@basemaps/landing 6.33.0 → 6.35.0
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/CHANGELOG.md +32 -0
- package/build/__tests__/map.config.test.js +20 -0
- package/build/__tests__/map.config.test.js.map +1 -1
- package/build/attribution.d.ts +3 -0
- package/build/attribution.d.ts.map +1 -1
- package/build/attribution.js +1 -1
- package/build/attribution.js.map +1 -1
- package/build/components/debug.d.ts +15 -19
- package/build/components/debug.d.ts.map +1 -1
- package/build/components/debug.js +65 -181
- package/build/components/debug.js.map +1 -1
- package/build/components/layout.header.js +1 -1
- package/build/components/layout.header.js.map +1 -1
- package/build/config.layer.d.ts +12 -0
- package/build/config.layer.d.ts.map +1 -0
- package/build/config.layer.js +40 -0
- package/build/config.layer.js.map +1 -0
- package/build/config.map.d.ts +2 -1
- package/build/config.map.d.ts.map +1 -1
- package/build/config.map.js +11 -7
- package/build/config.map.js.map +1 -1
- package/build/debug.map.d.ts +21 -0
- package/build/debug.map.d.ts.map +1 -0
- package/build/debug.map.js +179 -0
- package/build/debug.map.js.map +1 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/tile.matrix.d.ts +1 -1
- package/build/tile.matrix.d.ts.map +1 -1
- package/build/tile.matrix.js +3 -15
- package/build/tile.matrix.js.map +1 -1
- package/build/url.d.ts +7 -2
- package/build/url.d.ts.map +1 -1
- package/build/url.js +42 -11
- package/build/url.js.map +1 -1
- package/dist/examples/index.openlayers.attribution.wmts.3857.html +1 -1
- package/dist/{index-6.33.0-467e63869a31f2e1.css → index-6.35.0-467e63869a31f2e1.css} +0 -0
- package/dist/{index-6.33.0-32d4f61662fbd212.js → index-6.35.0-5eab7867ea4ef021.js} +7444 -6861
- package/dist/index-6.35.0-96a7f42b0fdac497.js +567 -0
- package/dist/index.html +2 -2
- package/dist/index.js +35 -35
- package/dist/lib/{attribution-6.33.0-a5dcb359f35150b9.js → attribution-6.35.0-b4a0b401b1a4cc45.js} +1 -1
- package/dist/lib/{attribution-6.33.0-431936fcac8e2647.js → attribution-6.35.0-fc88f809368e4547.js} +5 -1
- package/dist/lib/attribution.js +1 -1
- package/package.json +5 -5
- package/dist/index-6.33.0-58a76ef19edcbfcf.js +0 -567
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
"use strict";var g0=Object.create;var Ud=Object.defineProperty;var y0=Object.getOwnPropertyDescriptor;var _0=Object.getOwnPropertyNames;var x0=Object.getPrototypeOf,v0=Object.prototype.hasOwnProperty;var Vd=(n,o)=>()=>(n&&(o=n(n=0)),o);var is=(n,o)=>()=>(o||n((o={exports:{}}).exports,o),o.exports);var b0=(n,o,h,g)=>{if(o&&typeof o=="object"||typeof o=="function")for(let _ of _0(o))!v0.call(n,_)&&_!==h&&Ud(n,_,{get:()=>o[_],enumerable:!(g=y0(o,_))||g.enumerable});return n};var Ns=(n,o,h)=>(h=n!=null?g0(x0(n)):{},b0(o||!n||!n.__esModule?Ud(h,"default",{value:n,enumerable:!0}):h,n));function Us(n,o){for(var h in o)n[h]=o[h];return n}function Kd(n){var o=n.parentNode;o&&o.removeChild(n)}function vt(n,o,h){var g,_,a,M={};for(a in o)a=="key"?g=o[a]:a=="ref"?_=o[a]:M[a]=o[a];if(arguments.length>2&&(M.children=arguments.length>3?tc.call(arguments,2):h),typeof n=="function"&&n.defaultProps!=null)for(a in n.defaultProps)M[a]===void 0&&(M[a]=n.defaultProps[a]);return Kh(n,M,g,_,null)}function Kh(n,o,h,g,_){var a={type:n,props:o,key:h,ref:g,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_??++Zd};return _==null&&vi.vnode!=null&&vi.vnode(a),a}function yt(n){return n.children}function Ii(n,o){this.props=n,this.context=o}function po(n,o){if(o==null)return n.__?po(n.__,n.__.__k.indexOf(n)+1):null;for(var h;o<n.__k.length;o++)if((h=n.__k[o])!=null&&h.__e!=null)return h.__e;return typeof n.type=="function"?po(n):null}function Jd(n){var o,h;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,o=0;o<n.__k.length;o++)if((h=n.__k[o])!=null&&h.__e!=null){n.__e=n.__c.base=h.__e;break}return Jd(n)}}function qd(n){(!n.__d&&(n.__d=!0)&&Rl.push(n)&&!Yh.__r++||Gd!==vi.debounceRendering)&&((Gd=vi.debounceRendering)||Hd)(Yh)}function Yh(){for(var n;Yh.__r=Rl.length;)n=Rl.sort(function(o,h){return o.__v.__b-h.__v.__b}),Rl=[],n.some(function(o){var h,g,_,a,M,S;o.__d&&(M=(a=(h=o).__v).__e,(S=h.__P)&&(g=[],(_=Us({},a)).__v=a.__v+1,Gu(S,a,_,h.__n,S.ownerSVGElement!==void 0,a.__h!=null?[M]:null,g,M??po(a),a.__h),ef(g,a),a.__e!=M&&Jd(a)))})}function Yd(n,o,h,g,_,a,M,S,D,N){var L,Q,pt,ot,ft,Rt,Ct,Dt=g&&g.__k||Xd,ne=Dt.length;for(h.__k=[],L=0;L<o.length;L++)if((ot=h.__k[L]=(ot=o[L])==null||typeof ot=="boolean"?null:typeof ot=="string"||typeof ot=="number"||typeof ot=="bigint"?Kh(null,ot,null,null,ot):Array.isArray(ot)?Kh(yt,{children:ot},null,null,null):ot.__b>0?Kh(ot.type,ot.props,ot.key,null,ot.__v):ot)!=null){if(ot.__=h,ot.__b=h.__b+1,(pt=Dt[L])===null||pt&&ot.key==pt.key&&ot.type===pt.type)Dt[L]=void 0;else for(Q=0;Q<ne;Q++){if((pt=Dt[Q])&&ot.key==pt.key&&ot.type===pt.type){Dt[Q]=void 0;break}pt=null}Gu(n,ot,pt=pt||Jh,_,a,M,S,D,N),ft=ot.__e,(Q=ot.ref)&&pt.ref!=Q&&(Ct||(Ct=[]),pt.ref&&Ct.push(pt.ref,null,ot),Ct.push(Q,ot.__c||ft,ot)),ft!=null?(Rt==null&&(Rt=ft),typeof ot.type=="function"&&ot.__k===pt.__k?ot.__d=D=Qd(ot,D,n):D=tf(n,ot,pt,Dt,ft,D),typeof h.type=="function"&&(h.__d=D)):D&&pt.__e==D&&D.parentNode!=n&&(D=po(pt))}for(h.__e=Rt,L=ne;L--;)Dt[L]!=null&&(typeof h.type=="function"&&Dt[L].__e!=null&&Dt[L].__e==h.__d&&(h.__d=po(g,L+1)),nf(Dt[L],Dt[L]));if(Ct)for(L=0;L<Ct.length;L++)rf(Ct[L],Ct[++L],Ct[++L])}function Qd(n,o,h){for(var g,_=n.__k,a=0;_&&a<_.length;a++)(g=_[a])&&(g.__=n,o=typeof g.type=="function"?Qd(g,o,h):tf(h,g,g,_,g.__e,o));return o}function tf(n,o,h,g,_,a){var M,S,D;if(o.__d!==void 0)M=o.__d,o.__d=void 0;else if(h==null||_!=a||_.parentNode==null)t:if(a==null||a.parentNode!==n)n.appendChild(_),M=null;else{for(S=a,D=0;(S=S.nextSibling)&&D<g.length;D+=2)if(S==_)break t;n.insertBefore(_,a),M=a}return M!==void 0?M:_.nextSibling}function T0(n,o,h,g,_){var a;for(a in h)a==="children"||a==="key"||a in o||Qh(n,a,null,h[a],g);for(a in o)_&&typeof o[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||h[a]===o[a]||Qh(n,a,o[a],h[a],g)}function jd(n,o,h){o[0]==="-"?n.setProperty(o,h):n[o]=h==null?"":typeof h!="number"||S0.test(o)?h:h+"px"}function Qh(n,o,h,g,_){var a;t:if(o==="style")if(typeof h=="string")n.style.cssText=h;else{if(typeof g=="string"&&(n.style.cssText=g=""),g)for(o in g)h&&o in h||jd(n.style,o,"");if(h)for(o in h)g&&h[o]===g[o]||jd(n.style,o,h[o])}else if(o[0]==="o"&&o[1]==="n")a=o!==(o=o.replace(/Capture$/,"")),o=o.toLowerCase()in n?o.toLowerCase().slice(2):o.slice(2),n.l||(n.l={}),n.l[o+a]=h,h?g||n.addEventListener(o,a?Wd:$d,a):n.removeEventListener(o,a?Wd:$d,a);else if(o!=="dangerouslySetInnerHTML"){if(_)o=o.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(o!=="href"&&o!=="list"&&o!=="form"&&o!=="tabIndex"&&o!=="download"&&o in n)try{n[o]=h??"";break t}catch{}typeof h=="function"||(h!=null&&(h!==!1||o[0]==="a"&&o[1]==="r")?n.setAttribute(o,h):n.removeAttribute(o))}}function $d(n){this.l[n.type+!1](vi.event?vi.event(n):n)}function Wd(n){this.l[n.type+!0](vi.event?vi.event(n):n)}function Gu(n,o,h,g,_,a,M,S,D){var N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe=o.type;if(o.constructor!==void 0)return null;h.__h!=null&&(D=h.__h,S=o.__e=h.__e,o.__h=null,a=[S]),(N=vi.__b)&&N(o);try{t:if(typeof oe=="function"){if(Ct=o.props,Dt=(N=oe.contextType)&&g[N.__c],ne=N?Dt?Dt.props.value:N.__:g,h.__c?Rt=(L=o.__c=h.__c).__=L.__E:("prototype"in oe&&oe.prototype.render?o.__c=L=new oe(Ct,ne):(o.__c=L=new Ii(Ct,ne),L.constructor=oe,L.render=I0),Dt&&Dt.sub(L),L.props=Ct,L.state||(L.state={}),L.context=ne,L.__n=g,Q=L.__d=!0,L.__h=[]),L.__s==null&&(L.__s=L.state),oe.getDerivedStateFromProps!=null&&(L.__s==L.state&&(L.__s=Us({},L.__s)),Us(L.__s,oe.getDerivedStateFromProps(Ct,L.__s))),pt=L.props,ot=L.state,Q)oe.getDerivedStateFromProps==null&&L.componentWillMount!=null&&L.componentWillMount(),L.componentDidMount!=null&&L.__h.push(L.componentDidMount);else{if(oe.getDerivedStateFromProps==null&&Ct!==pt&&L.componentWillReceiveProps!=null&&L.componentWillReceiveProps(Ct,ne),!L.__e&&L.shouldComponentUpdate!=null&&L.shouldComponentUpdate(Ct,L.__s,ne)===!1||o.__v===h.__v){L.props=Ct,L.state=L.__s,o.__v!==h.__v&&(L.__d=!1),L.__v=o,o.__e=h.__e,o.__k=h.__k,o.__k.forEach(function(Ce){Ce&&(Ce.__=o)}),L.__h.length&&M.push(L);break t}L.componentWillUpdate!=null&&L.componentWillUpdate(Ct,L.__s,ne),L.componentDidUpdate!=null&&L.__h.push(function(){L.componentDidUpdate(pt,ot,ft)})}if(L.context=ne,L.props=Ct,L.__v=o,L.__P=n,Ht=vi.__r,fe=0,"prototype"in oe&&oe.prototype.render)L.state=L.__s,L.__d=!1,Ht&&Ht(o),N=L.render(L.props,L.state,L.context);else do L.__d=!1,Ht&&Ht(o),N=L.render(L.props,L.state,L.context),L.state=L.__s;while(L.__d&&++fe<25);L.state=L.__s,L.getChildContext!=null&&(g=Us(Us({},g),L.getChildContext())),Q||L.getSnapshotBeforeUpdate==null||(ft=L.getSnapshotBeforeUpdate(pt,ot)),me=N!=null&&N.type===yt&&N.key==null?N.props.children:N,Yd(n,Array.isArray(me)?me:[me],o,h,g,_,a,M,S,D),L.base=o.__e,o.__h=null,L.__h.length&&M.push(L),Rt&&(L.__E=L.__=null),L.__e=!1}else a==null&&o.__v===h.__v?(o.__k=h.__k,o.__e=h.__e):o.__e=E0(h.__e,o,h,g,_,a,M,D);(N=vi.diffed)&&N(o)}catch(Ce){o.__v=null,(D||a!=null)&&(o.__e=S,o.__h=!!D,a[a.indexOf(S)]=null),vi.__e(Ce,o,h)}}function ef(n,o){vi.__c&&vi.__c(o,n),n.some(function(h){try{n=h.__h,h.__h=[],n.some(function(g){g.call(h)})}catch(g){vi.__e(g,h.__v)}})}function E0(n,o,h,g,_,a,M,S){var D,N,L,Q=h.props,pt=o.props,ot=o.type,ft=0;if(ot==="svg"&&(_=!0),a!=null){for(;ft<a.length;ft++)if((D=a[ft])&&"setAttribute"in D==!!ot&&(ot?D.localName===ot:D.nodeType===3)){n=D,a[ft]=null;break}}if(n==null){if(ot===null)return document.createTextNode(pt);n=_?document.createElementNS("http://www.w3.org/2000/svg",ot):document.createElement(ot,pt.is&&pt),a=null,S=!1}if(ot===null)Q===pt||S&&n.data===pt||(n.data=pt);else{if(a=a&&tc.call(n.childNodes),N=(Q=h.props||Jh).dangerouslySetInnerHTML,L=pt.dangerouslySetInnerHTML,!S){if(a!=null)for(Q={},ft=0;ft<n.attributes.length;ft++)Q[n.attributes[ft].name]=n.attributes[ft].value;(L||N)&&(L&&(N&&L.__html==N.__html||L.__html===n.innerHTML)||(n.innerHTML=L&&L.__html||""))}if(T0(n,pt,Q,_,S),L)o.__k=[];else if(ft=o.props.children,Yd(n,Array.isArray(ft)?ft:[ft],o,h,g,_&&ot!=="foreignObject",a,M,a?a[0]:h.__k&&po(h,0),S),a!=null)for(ft=a.length;ft--;)a[ft]!=null&&Kd(a[ft]);S||("value"in pt&&(ft=pt.value)!==void 0&&(ft!==n.value||ot==="progress"&&!ft||ot==="option"&&ft!==Q.value)&&Qh(n,"value",ft,Q.value,!1),"checked"in pt&&(ft=pt.checked)!==void 0&&ft!==n.checked&&Qh(n,"checked",ft,Q.checked,!1))}return n}function rf(n,o,h){try{typeof n=="function"?n(o):n.current=o}catch(g){vi.__e(g,h)}}function nf(n,o,h){var g,_;if(vi.unmount&&vi.unmount(n),(g=n.ref)&&(g.current&&g.current!==n.__e||rf(g,null,o)),(g=n.__c)!=null){if(g.componentWillUnmount)try{g.componentWillUnmount()}catch(a){vi.__e(a,o)}g.base=g.__P=null}if(g=n.__k)for(_=0;_<g.length;_++)g[_]&&nf(g[_],o,typeof n.type!="function");h||n.__e==null||Kd(n.__e),n.__e=n.__d=void 0}function I0(n,o,h){return this.constructor(n,h)}function sf(n,o,h){var g,_,a;vi.__&&vi.__(n,o),_=(g=typeof h=="function")?null:h&&h.__k||o.__k,a=[],Gu(o,n=(!g&&h||o).__k=vt(yt,null,[n]),_||Jh,Jh,o.ownerSVGElement!==void 0,!g&&h?[h]:_?null:o.firstChild?tc.call(o.childNodes):null,a,!g&&h?h:_?_.__e:o.firstChild,g),ef(a,n)}var tc,vi,Zd,w0,Rl,Hd,Gd,M0,Jh,Xd,S0,Qr=Vd(()=>{W();Jh={},Xd=[],S0=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;tc=Xd.slice,vi={__e:function(n,o,h,g){for(var _,a,M;o=o.__;)if((_=o.__c)&&!_.__)try{if((a=_.constructor)&&a.getDerivedStateFromError!=null&&(_.setState(a.getDerivedStateFromError(n)),M=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(n,g||{}),M=_.__d),M)return _.__E=_}catch(S){n=S}throw n}},Zd=0,w0=function(n){return n!=null&&n.constructor===void 0},Ii.prototype.setState=function(n,o){var h;h=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Us({},this.state),typeof n=="function"&&(n=n(Us({},h),this.props)),n&&Us(h,n),n!=null&&this.__v&&(o&&this.__h.push(o),qd(this))},Ii.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),qd(this))},Ii.prototype.render=yt,Rl=[],Hd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yh.__r=0,M0=0});var W=Vd(()=>{"use strict";Qr()});var af=is(()=>{W()});var mf=is(ic=>{"use strict";W();Object.defineProperty(ic,"__esModule",{value:!0});ic.Nztm2000Quad=void 0;ic.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var gf=is(rc=>{"use strict";W();Object.defineProperty(rc,"__esModule",{value:!0});rc.Nztm2000=void 0;rc.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var yf=is(go=>{"use strict";W();Object.defineProperty(go,"__esModule",{value:!0});go.Nztm2000=go.Nztm2000Quad=void 0;var B0=mf();Object.defineProperty(go,"Nztm2000Quad",{enumerable:!0,get:function(){return B0.Nztm2000Quad}});var F0=gf();Object.defineProperty(go,"Nztm2000",{enumerable:!0,get:function(){return F0.Nztm2000}})});var xf=is(ss=>{"use strict";W();Object.defineProperty(ss,"__esModule",{value:!0});ss.once=ss.Emitter=ss.ALL_EVENTS=void 0;ss.ALL_EVENTS=Symbol("ALL_EVENTS");function O0(n,o){return n.add(o),function(){return n.delete(o)}}function _f(n,...o){if(n)for(let{fn:h}of n)h(...o)}var Zu=class{constructor(){this.$=Object.create(null)}on(o,h){let g=this.$[o]=this.$[o]||new Set;return O0(g,{fn:h})}emit(o,...h){_f(this.$[o],...h),_f(this.$[ss.ALL_EVENTS],{type:o,args:h})}};ss.Emitter=Zu;function N0(n,o,h){let g=n.on(o,function(...a){return g(),h(...a)});return g}ss.once=N0});var bf=is((Ub,vf)=>{"use strict";W();vf.exports=sc;sc.polyline=sc;sc.polygon=V0;function sc(n,o,h){var g=n.length,_=_o(n[0],o),a=[],M,S,D,N,L;for(h||(h=[]),M=1;M<g;M++){for(S=n[M-1],D=n[M],N=L=_o(D,o);;)if(_|N){if(_&N)break;_?(S=Xu(S,D,_,o),_=_o(S,o)):(D=Xu(S,D,N,o),N=_o(D,o))}else{a.push(S),N!==L?(a.push(D),M<g-1&&(h.push(a),a=[])):M===g-1&&a.push(D);break}_=L}return a.length&&h.push(a),h}function V0(n,o){var h,g,_,a,M,S,D;for(g=1;g<=8;g*=2){for(h=[],_=n[n.length-1],a=!(_o(_,o)&g),M=0;M<n.length;M++)S=n[M],D=!(_o(S,o)&g),D!==a&&h.push(Xu(_,S,g,o)),D&&h.push(S),_=S,a=D;if(n=h,!n.length)break}return h}function Xu(n,o,h,g){return h&8?[n[0]+(o[0]-n[0])*(g[3]-n[1])/(o[1]-n[1]),g[3]]:h&4?[n[0]+(o[0]-n[0])*(g[1]-n[1])/(o[1]-n[1]),g[1]]:h&2?[g[2],n[1]+(o[1]-n[1])*(g[2]-n[0])/(o[0]-n[0])]:h&1?[g[0],n[1]+(o[1]-n[1])*(g[0]-n[0])/(o[0]-n[0])]:null}function _o(n,o){var h=0;return n[0]<o[0]?h|=1:n[0]>o[2]&&(h|=2),n[1]<o[1]?h|=4:n[1]>o[3]&&(h|=8),h}});var wf=is((Ku,Ju)=>{W();(function(n,o){typeof Ku=="object"&&typeof Ju<"u"?Ju.exports=o():typeof define=="function"&&define.amd?define(o):(n=typeof globalThis<"u"?globalThis:n||self,n.polygonClipping=o())})(Ku,function(){"use strict";function n(mt,U){if(!(mt instanceof U))throw new TypeError("Cannot call a class as a function")}function o(mt,U){for(var B=0;B<U.length;B++){var V=U[B];V.enumerable=V.enumerable||!1,V.configurable=!0,"value"in V&&(V.writable=!0),Object.defineProperty(mt,V.key,V)}}function h(mt,U,B){return U&&o(mt.prototype,U),B&&o(mt,B),mt}var g=function(){function mt(U,B){this.next=null,this.key=U,this.data=B,this.left=null,this.right=null}return mt}();function _(mt,U){return mt>U?1:mt<U?-1:0}function a(mt,U,B){for(var V=new g(null,null),X=V,nt=V;;){var _t=B(mt,U.key);if(_t<0){if(U.left===null)break;if(B(mt,U.left.key)<0){var Ft=U.left;if(U.left=Ft.right,Ft.right=U,U=Ft,U.left===null)break}nt.left=U,nt=U,U=U.left}else if(_t>0){if(U.right===null)break;if(B(mt,U.right.key)>0){var Ft=U.right;if(U.right=Ft.left,Ft.left=U,U=Ft,U.right===null)break}X.right=U,X=U,U=U.right}else break}return X.right=U.left,nt.left=U.right,U.left=V.right,U.right=V.left,U}function M(mt,U,B,V){var X=new g(mt,U);if(B===null)return X.left=X.right=null,X;B=a(mt,B,V);var nt=V(mt,B.key);return nt<0?(X.left=B.left,X.right=B,B.left=null):nt>=0&&(X.right=B.right,X.left=B,B.right=null),X}function S(mt,U,B){var V=null,X=null;if(U){U=a(mt,U,B);var nt=B(U.key,mt);nt===0?(V=U.left,X=U.right):nt<0?(X=U.right,U.right=null,V=U):(V=U.left,U.left=null,X=U)}return{left:V,right:X}}function D(mt,U,B){return U===null?mt:(mt===null||(U=a(mt.key,U,B),U.left=mt),U)}function N(mt,U,B,V,X){if(mt){V(""+U+(B?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+X(mt)+`
|
|
2
|
+
`);var nt=U+(B?" ":"\u2502 ");mt.left&&N(mt.left,nt,!1,V,X),mt.right&&N(mt.right,nt,!0,V,X)}}var L=function(){function mt(U){U===void 0&&(U=_),this._root=null,this._size=0,this._comparator=U}return mt.prototype.insert=function(U,B){return this._size++,this._root=M(U,B,this._root,this._comparator)},mt.prototype.add=function(U,B){var V=new g(U,B);this._root===null&&(V.left=V.right=null,this._size++,this._root=V);var X=this._comparator,nt=a(U,this._root,X),_t=X(U,nt.key);return _t===0?this._root=nt:(_t<0?(V.left=nt.left,V.right=nt,nt.left=null):_t>0&&(V.right=nt.right,V.left=nt,nt.right=null),this._size++,this._root=V),this._root},mt.prototype.remove=function(U){this._root=this._remove(U,this._root,this._comparator)},mt.prototype._remove=function(U,B,V){var X;if(B===null)return null;B=a(U,B,V);var nt=V(U,B.key);return nt===0?(B.left===null?X=B.right:(X=a(U,B.left,V),X.right=B.right),this._size--,X):B},mt.prototype.pop=function(){var U=this._root;if(U){for(;U.left;)U=U.left;return this._root=a(U.key,this._root,this._comparator),this._root=this._remove(U.key,this._root,this._comparator),{key:U.key,data:U.data}}return null},mt.prototype.findStatic=function(U){for(var B=this._root,V=this._comparator;B;){var X=V(U,B.key);if(X===0)return B;X<0?B=B.left:B=B.right}return null},mt.prototype.find=function(U){return this._root&&(this._root=a(U,this._root,this._comparator),this._comparator(U,this._root.key)!==0)?null:this._root},mt.prototype.contains=function(U){for(var B=this._root,V=this._comparator;B;){var X=V(U,B.key);if(X===0)return!0;X<0?B=B.left:B=B.right}return!1},mt.prototype.forEach=function(U,B){for(var V=this._root,X=[],nt=!1;!nt;)V!==null?(X.push(V),V=V.left):X.length!==0?(V=X.pop(),U.call(B,V),V=V.right):nt=!0;return this},mt.prototype.range=function(U,B,V,X){for(var nt=[],_t=this._comparator,Ft=this._root,Vt;nt.length!==0||Ft;)if(Ft)nt.push(Ft),Ft=Ft.left;else{if(Ft=nt.pop(),Vt=_t(Ft.key,B),Vt>0)break;if(_t(Ft.key,U)>=0&&V.call(X,Ft))return this;Ft=Ft.right}return this},mt.prototype.keys=function(){var U=[];return this.forEach(function(B){var V=B.key;return U.push(V)}),U},mt.prototype.values=function(){var U=[];return this.forEach(function(B){var V=B.data;return U.push(V)}),U},mt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},mt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},mt.prototype.minNode=function(U){if(U===void 0&&(U=this._root),U)for(;U.left;)U=U.left;return U},mt.prototype.maxNode=function(U){if(U===void 0&&(U=this._root),U)for(;U.right;)U=U.right;return U},mt.prototype.at=function(U){for(var B=this._root,V=!1,X=0,nt=[];!V;)if(B)nt.push(B),B=B.left;else if(nt.length>0){if(B=nt.pop(),X===U)return B;X++,B=B.right}else V=!0;return null},mt.prototype.next=function(U){var B=this._root,V=null;if(U.right){for(V=U.right;V.left;)V=V.left;return V}for(var X=this._comparator;B;){var nt=X(U.key,B.key);if(nt===0)break;nt<0?(V=B,B=B.left):B=B.right}return V},mt.prototype.prev=function(U){var B=this._root,V=null;if(U.left!==null){for(V=U.left;V.right;)V=V.right;return V}for(var X=this._comparator;B;){var nt=X(U.key,B.key);if(nt===0)break;nt<0?B=B.left:(V=B,B=B.right)}return V},mt.prototype.clear=function(){return this._root=null,this._size=0,this},mt.prototype.toList=function(){return ot(this._root)},mt.prototype.load=function(U,B,V){B===void 0&&(B=[]),V===void 0&&(V=!1);var X=U.length,nt=this._comparator;if(V&&Ct(U,B,0,X-1,nt),this._root===null)this._root=Q(U,B,0,X),this._size=X;else{var _t=Rt(this.toList(),pt(U,B),nt);X=this._size+X,this._root=ft({head:_t},0,X)}return this},mt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(mt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(mt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),mt.prototype.toString=function(U){U===void 0&&(U=function(X){return String(X.key)});var B=[];return N(this._root,"",!0,function(V){return B.push(V)},U),B.join("")},mt.prototype.update=function(U,B,V){var X=this._comparator,nt=S(U,this._root,X),_t=nt.left,Ft=nt.right;X(U,B)<0?Ft=M(B,V,Ft,X):_t=M(B,V,_t,X),this._root=D(_t,Ft,X)},mt.prototype.split=function(U){return S(U,this._root,this._comparator)},mt}();function Q(mt,U,B,V){var X=V-B;if(X>0){var nt=B+Math.floor(X/2),_t=mt[nt],Ft=U[nt],Vt=new g(_t,Ft);return Vt.left=Q(mt,U,B,nt),Vt.right=Q(mt,U,nt+1,V),Vt}return null}function pt(mt,U){for(var B=new g(null,null),V=B,X=0;X<mt.length;X++)V=V.next=new g(mt[X],U[X]);return V.next=null,B.next}function ot(mt){for(var U=mt,B=[],V=!1,X=new g(null,null),nt=X;!V;)U?(B.push(U),U=U.left):B.length>0?(U=nt=nt.next=B.pop(),U=U.right):V=!0;return nt.next=null,X.next}function ft(mt,U,B){var V=B-U;if(V>0){var X=U+Math.floor(V/2),nt=ft(mt,U,X),_t=mt.head;return _t.left=nt,mt.head=mt.head.next,_t.right=ft(mt,X+1,B),_t}return null}function Rt(mt,U,B){for(var V=new g(null,null),X=V,nt=mt,_t=U;nt!==null&&_t!==null;)B(nt.key,_t.key)<0?(X.next=nt,nt=nt.next):(X.next=_t,_t=_t.next),X=X.next;return nt!==null?X.next=nt:_t!==null&&(X.next=_t),V.next}function Ct(mt,U,B,V,X){if(!(B>=V)){for(var nt=mt[B+V>>1],_t=B-1,Ft=V+1;;){do _t++;while(X(mt[_t],nt)<0);do Ft--;while(X(mt[Ft],nt)>0);if(_t>=Ft)break;var Vt=mt[_t];mt[_t]=mt[Ft],mt[Ft]=Vt,Vt=U[_t],U[_t]=U[Ft],U[Ft]=Vt}Ct(mt,U,B,Ft,X),Ct(mt,U,Ft+1,V,X)}}var Dt=function(U,B){return U.ll.x<=B.x&&B.x<=U.ur.x&&U.ll.y<=B.y&&B.y<=U.ur.y},ne=function(U,B){if(B.ur.x<U.ll.x||U.ur.x<B.ll.x||B.ur.y<U.ll.y||U.ur.y<B.ll.y)return null;var V=U.ll.x<B.ll.x?B.ll.x:U.ll.x,X=U.ur.x<B.ur.x?U.ur.x:B.ur.x,nt=U.ll.y<B.ll.y?B.ll.y:U.ll.y,_t=U.ur.y<B.ur.y?U.ur.y:B.ur.y;return{ll:{x:V,y:nt},ur:{x:X,y:_t}}},Ht=Number.EPSILON;Ht===void 0&&(Ht=Math.pow(2,-52));var fe=Ht*Ht,me=function(U,B){if(-Ht<U&&U<Ht&&-Ht<B&&B<Ht)return 0;var V=U-B;return V*V<fe*U*B?0:U<B?-1:1},oe=function(){function mt(){n(this,mt),this.reset()}return h(mt,[{key:"reset",value:function(){this.xRounder=new Ce,this.yRounder=new Ce}},{key:"round",value:function(B,V){return{x:this.xRounder.round(B),y:this.yRounder.round(V)}}}]),mt}(),Ce=function(){function mt(){n(this,mt),this.tree=new L,this.round(0)}return h(mt,[{key:"round",value:function(B){var V=this.tree.add(B),X=this.tree.prev(V);if(X!==null&&me(V.key,X.key)===0)return this.tree.remove(B),X.key;var nt=this.tree.next(V);return nt!==null&&me(V.key,nt.key)===0?(this.tree.remove(B),nt.key):B}}]),mt}(),Re=new oe,mi=function(U,B){return U.x*B.y-U.y*B.x},Fi=function(U,B){return U.x*B.x+U.y*B.y},Yi=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},nt={x:V.x-U.x,y:V.y-U.y},_t=mi(X,nt);return me(_t,0)},Oi=function(U){return Math.sqrt(Fi(U,U))},$r=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},nt={x:V.x-U.x,y:V.y-U.y};return mi(nt,X)/Oi(nt)/Oi(X)},ve=function(U,B,V){var X={x:B.x-U.x,y:B.y-U.y},nt={x:V.x-U.x,y:V.y-U.y};return Fi(nt,X)/Oi(nt)/Oi(X)},kr=function(U,B,V){return B.y===0?null:{x:U.x+B.x/B.y*(V-U.y),y:V}},Wr=function(U,B,V){return B.x===0?null:{x:V,y:U.y+B.y/B.x*(V-U.x)}},rn=function(U,B,V,X){if(B.x===0)return Wr(V,X,U.x);if(X.x===0)return Wr(U,B,V.x);if(B.y===0)return kr(V,X,U.y);if(X.y===0)return kr(U,B,V.y);var nt=mi(B,X);if(nt==0)return null;var _t={x:V.x-U.x,y:V.y-U.y},Ft=mi(_t,B)/nt,Vt=mi(_t,X)/nt,ct=U.x+Vt*B.x,zt=V.x+Ft*X.x,Ee=U.y+Vt*B.y,Ae=V.y+Ft*X.y,ce=(ct+zt)/2,Ve=(Ee+Ae)/2;return{x:ce,y:Ve}},bi=function(){h(mt,null,[{key:"compare",value:function(B,V){var X=mt.comparePoints(B.point,V.point);return X!==0?X:(B.point!==V.point&&B.link(V),B.isLeft!==V.isLeft?B.isLeft?1:-1:Lr.compare(B.segment,V.segment))}},{key:"comparePoints",value:function(B,V){return B.x<V.x?-1:B.x>V.x?1:B.y<V.y?-1:B.y>V.y?1:0}}]);function mt(U,B){n(this,mt),U.events===void 0?U.events=[this]:U.events.push(this),this.point=U,this.isLeft=B}return h(mt,[{key:"link",value:function(B){if(B.point===this.point)throw new Error("Tried to link already linked events");for(var V=B.point.events,X=0,nt=V.length;X<nt;X++){var _t=V[X];this.point.events.push(_t),_t.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var B=this.point.events.length,V=0;V<B;V++){var X=this.point.events[V];if(X.segment.consumedBy===void 0)for(var nt=V+1;nt<B;nt++){var _t=this.point.events[nt];_t.consumedBy===void 0&&X.otherSE.point.events===_t.otherSE.point.events&&X.segment.consume(_t.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var B=[],V=0,X=this.point.events.length;V<X;V++){var nt=this.point.events[V];nt!==this&&!nt.segment.ringOut&&nt.segment.isInResult()&&B.push(nt)}return B}},{key:"getLeftmostComparator",value:function(B){var V=this,X=new Map,nt=function(Ft){var Vt=Ft.otherSE;X.set(Ft,{sine:$r(V.point,B.point,Vt.point),cosine:ve(V.point,B.point,Vt.point)})};return function(_t,Ft){X.has(_t)||nt(_t),X.has(Ft)||nt(Ft);var Vt=X.get(_t),ct=Vt.sine,zt=Vt.cosine,Ee=X.get(Ft),Ae=Ee.sine,ce=Ee.cosine;return ct>=0&&Ae>=0?zt<ce?1:zt>ce?-1:0:ct<0&&Ae<0?zt<ce?-1:zt>ce?1:0:Ae<ct?-1:Ae>ct?1:0}}}]),mt}(),gn=0,Lr=function(){h(mt,null,[{key:"compare",value:function(B,V){var X=B.leftSE.point.x,nt=V.leftSE.point.x,_t=B.rightSE.point.x,Ft=V.rightSE.point.x;if(Ft<X)return 1;if(_t<nt)return-1;var Vt=B.leftSE.point.y,ct=V.leftSE.point.y,zt=B.rightSE.point.y,Ee=V.rightSE.point.y;if(X<nt){if(ct<Vt&&ct<zt)return 1;if(ct>Vt&&ct>zt)return-1;var Ae=B.comparePoint(V.leftSE.point);if(Ae<0)return 1;if(Ae>0)return-1;var ce=V.comparePoint(B.rightSE.point);return ce!==0?ce:-1}if(X>nt){if(Vt<ct&&Vt<Ee)return-1;if(Vt>ct&&Vt>Ee)return 1;var Ve=V.comparePoint(B.leftSE.point);if(Ve!==0)return Ve;var Pe=B.comparePoint(V.rightSE.point);return Pe<0?1:Pe>0?-1:1}if(Vt<ct)return-1;if(Vt>ct)return 1;if(_t<Ft){var ei=V.comparePoint(B.rightSE.point);if(ei!==0)return ei}if(_t>Ft){var ke=B.comparePoint(V.rightSE.point);if(ke<0)return 1;if(ke>0)return-1}if(_t!==Ft){var Gt=zt-Vt,xe=_t-X,pe=Ee-ct,oi=Ft-nt;if(Gt>xe&&pe<oi)return 1;if(Gt<xe&&pe>oi)return-1}return _t>Ft?1:_t<Ft||zt<Ee?-1:zt>Ee?1:B.id<V.id?-1:B.id>V.id?1:0}}]);function mt(U,B,V,X){n(this,mt),this.id=++gn,this.leftSE=U,U.segment=this,U.otherSE=B,this.rightSE=B,B.segment=this,B.otherSE=U,this.rings=V,this.windings=X}return h(mt,[{key:"replaceRightSE",value:function(B){this.rightSE=B,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var B=this.leftSE.point.y,V=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:B<V?B:V},ur:{x:this.rightSE.point.x,y:B>V?B:V}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(B){return B.x===this.leftSE.point.x&&B.y===this.leftSE.point.y||B.x===this.rightSE.point.x&&B.y===this.rightSE.point.y}},{key:"comparePoint",value:function(B){if(this.isAnEndpoint(B))return 0;var V=this.leftSE.point,X=this.rightSE.point,nt=this.vector();if(V.x===X.x)return B.x===V.x?0:B.x<V.x?1:-1;var _t=(B.y-V.y)/nt.y,Ft=V.x+_t*nt.x;if(B.x===Ft)return 0;var Vt=(B.x-V.x)/nt.x,ct=V.y+Vt*nt.y;return B.y===ct?0:B.y<ct?-1:1}},{key:"getIntersection",value:function(B){var V=this.bbox(),X=B.bbox(),nt=ne(V,X);if(nt===null)return null;var _t=this.leftSE.point,Ft=this.rightSE.point,Vt=B.leftSE.point,ct=B.rightSE.point,zt=Dt(V,Vt)&&this.comparePoint(Vt)===0,Ee=Dt(X,_t)&&B.comparePoint(_t)===0,Ae=Dt(V,ct)&&this.comparePoint(ct)===0,ce=Dt(X,Ft)&&B.comparePoint(Ft)===0;if(Ee&&zt)return ce&&!Ae?Ft:!ce&&Ae?ct:null;if(Ee)return Ae&&_t.x===ct.x&&_t.y===ct.y?null:_t;if(zt)return ce&&Ft.x===Vt.x&&Ft.y===Vt.y?null:Vt;if(ce&&Ae)return null;if(ce)return Ft;if(Ae)return ct;var Ve=rn(_t,this.vector(),Vt,B.vector());return Ve===null||!Dt(nt,Ve)?null:Re.round(Ve.x,Ve.y)}},{key:"split",value:function(B){var V=[],X=B.events!==void 0,nt=new bi(B,!0),_t=new bi(B,!1),Ft=this.rightSE;this.replaceRightSE(_t),V.push(_t),V.push(nt);var Vt=new mt(nt,Ft,this.rings.slice(),this.windings.slice());return bi.comparePoints(Vt.leftSE.point,Vt.rightSE.point)>0&&Vt.swapEvents(),bi.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),X&&(nt.checkForConsuming(),_t.checkForConsuming()),V}},{key:"swapEvents",value:function(){var B=this.rightSE;this.rightSE=this.leftSE,this.leftSE=B,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var V=0,X=this.windings.length;V<X;V++)this.windings[V]*=-1}},{key:"consume",value:function(B){for(var V=this,X=B;V.consumedBy;)V=V.consumedBy;for(;X.consumedBy;)X=X.consumedBy;var nt=mt.compare(V,X);if(nt!==0){if(nt>0){var _t=V;V=X,X=_t}if(V.prev===X){var Ft=V;V=X,X=Ft}for(var Vt=0,ct=X.rings.length;Vt<ct;Vt++){var zt=X.rings[Vt],Ee=X.windings[Vt],Ae=V.rings.indexOf(zt);Ae===-1?(V.rings.push(zt),V.windings.push(Ee)):V.windings[Ae]+=Ee}X.rings=null,X.windings=null,X.consumedBy=V,X.leftSE.consumedBy=V.leftSE,X.rightSE.consumedBy=V.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var B=this.prev.consumedBy||this.prev;this._beforeState=B.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var B=this.beforeState();this._afterState={rings:B.rings.slice(0),windings:B.windings.slice(0),multiPolys:[]};for(var V=this._afterState.rings,X=this._afterState.windings,nt=this._afterState.multiPolys,_t=0,Ft=this.rings.length;_t<Ft;_t++){var Vt=this.rings[_t],ct=this.windings[_t],zt=V.indexOf(Vt);zt===-1?(V.push(Vt),X.push(ct)):X[zt]+=ct}for(var Ee=[],Ae=[],ce=0,Ve=V.length;ce<Ve;ce++)if(X[ce]!==0){var Pe=V[ce],ei=Pe.poly;if(Ae.indexOf(ei)===-1)if(Pe.isExterior)Ee.push(ei);else{Ae.indexOf(ei)===-1&&Ae.push(ei);var ke=Ee.indexOf(Pe.poly);ke!==-1&&Ee.splice(ke,1)}}for(var Gt=0,xe=Ee.length;Gt<xe;Gt++){var pe=Ee[Gt].multiPoly;nt.indexOf(pe)===-1&&nt.push(pe)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var B=this.beforeState().multiPolys,V=this.afterState().multiPolys;switch(ti.type){case"union":{var X=B.length===0,nt=V.length===0;this._isInResult=X!==nt;break}case"intersection":{var _t,Ft;B.length<V.length?(_t=B.length,Ft=V.length):(_t=V.length,Ft=B.length),this._isInResult=Ft===ti.numMultiPolys&&_t<Ft;break}case"xor":{var Vt=Math.abs(B.length-V.length);this._isInResult=Vt%2===1;break}case"difference":{var ct=function(Ee){return Ee.length===1&&Ee[0].isSubject};this._isInResult=ct(B)!==ct(V);break}default:throw new Error("Unrecognized operation type found ".concat(ti.type))}return this._isInResult}}],[{key:"fromRing",value:function(B,V,X){var nt,_t,Ft,Vt=bi.comparePoints(B,V);if(Vt<0)nt=B,_t=V,Ft=1;else if(Vt>0)nt=V,_t=B,Ft=-1;else throw new Error("Tried to create degenerate segment at [".concat(B.x,", ").concat(B.y,"]"));var ct=new bi(nt,!0),zt=new bi(_t,!1);return new mt(ct,zt,[X],[Ft])}}]),mt}(),Dr=function(){function mt(U,B,V){if(n(this,mt),!Array.isArray(U)||U.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=B,this.isExterior=V,this.segments=[],typeof U[0][0]!="number"||typeof U[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var X=Re.round(U[0][0],U[0][1]);this.bbox={ll:{x:X.x,y:X.y},ur:{x:X.x,y:X.y}};for(var nt=X,_t=1,Ft=U.length;_t<Ft;_t++){if(typeof U[_t][0]!="number"||typeof U[_t][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var Vt=Re.round(U[_t][0],U[_t][1]);Vt.x===nt.x&&Vt.y===nt.y||(this.segments.push(Lr.fromRing(nt,Vt,this)),Vt.x<this.bbox.ll.x&&(this.bbox.ll.x=Vt.x),Vt.y<this.bbox.ll.y&&(this.bbox.ll.y=Vt.y),Vt.x>this.bbox.ur.x&&(this.bbox.ur.x=Vt.x),Vt.y>this.bbox.ur.y&&(this.bbox.ur.y=Vt.y),nt=Vt)}(X.x!==nt.x||X.y!==nt.y)&&this.segments.push(Lr.fromRing(nt,X,this))}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.segments.length;V<X;V++){var nt=this.segments[V];B.push(nt.leftSE),B.push(nt.rightSE)}return B}}]),mt}(),nn=function(){function mt(U,B){if(n(this,mt),!Array.isArray(U))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Dr(U[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var V=1,X=U.length;V<X;V++){var nt=new Dr(U[V],this,!1);nt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=nt.bbox.ll.x),nt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=nt.bbox.ll.y),nt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=nt.bbox.ur.x),nt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=nt.bbox.ur.y),this.interiorRings.push(nt)}this.multiPoly=B}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=this.exteriorRing.getSweepEvents(),V=0,X=this.interiorRings.length;V<X;V++)for(var nt=this.interiorRings[V].getSweepEvents(),_t=0,Ft=nt.length;_t<Ft;_t++)B.push(nt[_t]);return B}}]),mt}(),sn=function(){function mt(U,B){if(n(this,mt),!Array.isArray(U))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof U[0][0][0]=="number"&&(U=[U])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var V=0,X=U.length;V<X;V++){var nt=new nn(U[V],this);nt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=nt.bbox.ll.x),nt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=nt.bbox.ll.y),nt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=nt.bbox.ur.x),nt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=nt.bbox.ur.y),this.polys.push(nt)}this.isSubject=B}return h(mt,[{key:"getSweepEvents",value:function(){for(var B=[],V=0,X=this.polys.length;V<X;V++)for(var nt=this.polys[V].getSweepEvents(),_t=0,Ft=nt.length;_t<Ft;_t++)B.push(nt[_t]);return B}}]),mt}(),yr=function(){h(mt,null,[{key:"factory",value:function(B){for(var V=[],X=0,nt=B.length;X<nt;X++){var _t=B[X];if(!(!_t.isInResult()||_t.ringOut)){for(var Ft=null,Vt=_t.leftSE,ct=_t.rightSE,zt=[Vt],Ee=Vt.point,Ae=[];Ft=Vt,Vt=ct,zt.push(Vt),Vt.point!==Ee;)for(;;){var ce=Vt.getAvailableLinkedEvents();if(ce.length===0){var Ve=zt[0].point,Pe=zt[zt.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Ve.x,",")+" ".concat(Ve.y,"]. Last matching segment found ends at")+" [".concat(Pe.x,", ").concat(Pe.y,"]."))}if(ce.length===1){ct=ce[0].otherSE;break}for(var ei=null,ke=0,Gt=Ae.length;ke<Gt;ke++)if(Ae[ke].point===Vt.point){ei=ke;break}if(ei!==null){var xe=Ae.splice(ei)[0],pe=zt.splice(xe.index);pe.unshift(pe[0].otherSE),V.push(new mt(pe.reverse()));continue}Ae.push({index:zt.length,point:Vt.point});var oi=Vt.getLeftmostComparator(Ft);ct=ce.sort(oi)[0].otherSE;break}V.push(new mt(zt))}}return V}}]);function mt(U){n(this,mt),this.events=U;for(var B=0,V=U.length;B<V;B++)U[B].segment.ringOut=this;this.poly=null}return h(mt,[{key:"getGeom",value:function(){for(var B=this.events[0].point,V=[B],X=1,nt=this.events.length-1;X<nt;X++){var _t=this.events[X].point,Ft=this.events[X+1].point;Yi(_t,B,Ft)!==0&&(V.push(_t),B=_t)}if(V.length===1)return null;var Vt=V[0],ct=V[1];Yi(Vt,B,ct)===0&&V.shift(),V.push(V[0]);for(var zt=this.isExteriorRing()?1:-1,Ee=this.isExteriorRing()?0:V.length-1,Ae=this.isExteriorRing()?V.length:-1,ce=[],Ve=Ee;Ve!=Ae;Ve+=zt)ce.push([V[Ve].x,V[Ve].y]);return ce}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var B=this.enclosingRing();this._isExteriorRing=B?!B.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var B=this.events[0],V=1,X=this.events.length;V<X;V++){var nt=this.events[V];bi.compare(B,nt)>0&&(B=nt)}for(var _t=B.segment.prevInResult(),Ft=_t?_t.prevInResult():null;;){if(!_t)return null;if(!Ft)return _t.ringOut;if(Ft.ringOut!==_t.ringOut)return Ft.ringOut.enclosingRing()!==_t.ringOut?_t.ringOut:_t.ringOut.enclosingRing();_t=Ft.prevInResult(),Ft=_t?_t.prevInResult():null}}}]),mt}(),Rr=function(){function mt(U){n(this,mt),this.exteriorRing=U,U.poly=this,this.interiorRings=[]}return h(mt,[{key:"addInterior",value:function(B){this.interiorRings.push(B),B.poly=this}},{key:"getGeom",value:function(){var B=[this.exteriorRing.getGeom()];if(B[0]===null)return null;for(var V=0,X=this.interiorRings.length;V<X;V++){var nt=this.interiorRings[V].getGeom();nt!==null&&B.push(nt)}return B}}]),mt}(),Zr=function(){function mt(U){n(this,mt),this.rings=U,this.polys=this._composePolys(U)}return h(mt,[{key:"getGeom",value:function(){for(var B=[],V=0,X=this.polys.length;V<X;V++){var nt=this.polys[V].getGeom();nt!==null&&B.push(nt)}return B}},{key:"_composePolys",value:function(B){for(var V=[],X=0,nt=B.length;X<nt;X++){var _t=B[X];if(!_t.poly)if(_t.isExteriorRing())V.push(new Rr(_t));else{var Ft=_t.enclosingRing();Ft.poly||V.push(new Rr(Ft)),Ft.poly.addInterior(_t)}}return V}}]),mt}(),En=function(){function mt(U){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lr.compare;n(this,mt),this.queue=U,this.tree=new L(B),this.segments=[]}return h(mt,[{key:"process",value:function(B){var V=B.segment,X=[];if(B.consumedBy)return B.isLeft?this.queue.remove(B.otherSE):this.tree.remove(V),X;var nt=B.isLeft?this.tree.insert(V):this.tree.find(V);if(!nt)throw new Error("Unable to find segment #".concat(V.id," ")+"[".concat(V.leftSE.point.x,", ").concat(V.leftSE.point.y,"] -> ")+"[".concat(V.rightSE.point.x,", ").concat(V.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var _t=nt,Ft=nt,Vt=void 0,ct=void 0;Vt===void 0;)_t=this.tree.prev(_t),_t===null?Vt=null:_t.key.consumedBy===void 0&&(Vt=_t.key);for(;ct===void 0;)Ft=this.tree.next(Ft),Ft===null?ct=null:Ft.key.consumedBy===void 0&&(ct=Ft.key);if(B.isLeft){var zt=null;if(Vt){var Ee=Vt.getIntersection(V);if(Ee!==null&&(V.isAnEndpoint(Ee)||(zt=Ee),!Vt.isAnEndpoint(Ee)))for(var Ae=this._splitSafely(Vt,Ee),ce=0,Ve=Ae.length;ce<Ve;ce++)X.push(Ae[ce])}var Pe=null;if(ct){var ei=ct.getIntersection(V);if(ei!==null&&(V.isAnEndpoint(ei)||(Pe=ei),!ct.isAnEndpoint(ei)))for(var ke=this._splitSafely(ct,ei),Gt=0,xe=ke.length;Gt<xe;Gt++)X.push(ke[Gt])}if(zt!==null||Pe!==null){var pe=null;if(zt===null)pe=Pe;else if(Pe===null)pe=zt;else{var oi=bi.comparePoints(zt,Pe);pe=oi<=0?zt:Pe}this.queue.remove(V.rightSE),X.push(V.rightSE);for(var Wi=V.split(pe),be=0,rr=Wi.length;be<rr;be++)X.push(Wi[be])}X.length>0?(this.tree.remove(V),X.push(B)):(this.segments.push(V),V.prev=Vt)}else{if(Vt&&ct){var yi=Vt.getIntersection(ct);if(yi!==null){if(!Vt.isAnEndpoint(yi))for(var nr=this._splitSafely(Vt,yi),ni=0,Xe=nr.length;ni<Xe;ni++)X.push(nr[ni]);if(!ct.isAnEndpoint(yi))for(var Gi=this._splitSafely(ct,yi),_r=0,_i=Gi.length;_r<_i;_r++)X.push(Gi[_r])}}this.tree.remove(V)}return X}},{key:"_splitSafely",value:function(B,V){this.tree.remove(B);var X=B.rightSE;this.queue.remove(X);var nt=B.split(V);return nt.push(X),B.consumedBy===void 0&&this.tree.insert(B),nt}}]),mt}(),Bn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Fn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,gs=function(){function mt(){n(this,mt)}return h(mt,[{key:"run",value:function(B,V,X){ti.type=B,Re.reset();for(var nt=[new sn(V,!0)],_t=0,Ft=X.length;_t<Ft;_t++)nt.push(new sn(X[_t],!1));if(ti.numMultiPolys=nt.length,ti.type==="difference")for(var Vt=nt[0],ct=1;ct<nt.length;)ne(nt[ct].bbox,Vt.bbox)!==null?ct++:nt.splice(ct,1);if(ti.type==="intersection"){for(var zt=0,Ee=nt.length;zt<Ee;zt++)for(var Ae=nt[zt],ce=zt+1,Ve=nt.length;ce<Ve;ce++)if(ne(Ae.bbox,nt[ce].bbox)===null)return[]}for(var Pe=new L(bi.compare),ei=0,ke=nt.length;ei<ke;ei++)for(var Gt=nt[ei].getSweepEvents(),xe=0,pe=Gt.length;xe<pe;xe++)if(Pe.insert(Gt[xe]),Pe.size>Bn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var oi=new En(Pe),Wi=Pe.size,be=Pe.pop();be;){var rr=be.key;if(Pe.size===Wi){var yi=rr.segment;throw new Error("Unable to pop() ".concat(rr.isLeft?"left":"right"," SweepEvent ")+"[".concat(rr.point.x,", ").concat(rr.point.y,"] from segment #").concat(yi.id," ")+"[".concat(yi.leftSE.point.x,", ").concat(yi.leftSE.point.y,"] -> ")+"[".concat(yi.rightSE.point.x,", ").concat(yi.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Pe.size>Bn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(oi.segments.length>Fn)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var nr=oi.process(rr),ni=0,Xe=nr.length;ni<Xe;ni++){var Gi=nr[ni];Gi.consumedBy===void 0&&Pe.insert(Gi)}Wi=Pe.size,be=Pe.pop()}Re.reset();var _r=yr.factory(oi.segments),_i=new Zr(_r);return _i.getGeom()}}]),mt}(),ti=new gs,an=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return ti.run("union",U,V)},On=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return ti.run("intersection",U,V)},yn=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return ti.run("xor",U,V)},Br=function(U){for(var B=arguments.length,V=new Array(B>1?B-1:0),X=1;X<B;X++)V[X-1]=arguments[X];return ti.run("difference",U,V)},ys={union:an,intersection:On,xor:yn,difference:Br};return ys})});var cg=is((hI,hg)=>{"use strict";W();function P1(n){if(n.length>=255)throw new TypeError("Alphabet too long");for(var o=new Uint8Array(256),h=0;h<o.length;h++)o[h]=255;for(var g=0;g<n.length;g++){var _=n.charAt(g),a=_.charCodeAt(0);if(o[a]!==255)throw new TypeError(_+" is ambiguous");o[a]=g}var M=n.length,S=n.charAt(0),D=Math.log(M)/Math.log(256),N=Math.log(256)/Math.log(M);function L(ot){if(ot instanceof Uint8Array||(ArrayBuffer.isView(ot)?ot=new Uint8Array(ot.buffer,ot.byteOffset,ot.byteLength):Array.isArray(ot)&&(ot=Uint8Array.from(ot))),!(ot instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(ot.length===0)return"";for(var ft=0,Rt=0,Ct=0,Dt=ot.length;Ct!==Dt&&ot[Ct]===0;)Ct++,ft++;for(var ne=(Dt-Ct)*N+1>>>0,Ht=new Uint8Array(ne);Ct!==Dt;){for(var fe=ot[Ct],me=0,oe=ne-1;(fe!==0||me<Rt)&&oe!==-1;oe--,me++)fe+=256*Ht[oe]>>>0,Ht[oe]=fe%M>>>0,fe=fe/M>>>0;if(fe!==0)throw new Error("Non-zero carry");Rt=me,Ct++}for(var Ce=ne-Rt;Ce!==ne&&Ht[Ce]===0;)Ce++;for(var Re=S.repeat(ft);Ce<ne;++Ce)Re+=n.charAt(Ht[Ce]);return Re}function Q(ot){if(typeof ot!="string")throw new TypeError("Expected String");if(ot.length===0)return new Uint8Array;for(var ft=0,Rt=0,Ct=0;ot[ft]===S;)Rt++,ft++;for(var Dt=(ot.length-ft)*D+1>>>0,ne=new Uint8Array(Dt);ot[ft];){var Ht=o[ot.charCodeAt(ft)];if(Ht===255)return;for(var fe=0,me=Dt-1;(Ht!==0||fe<Ct)&&me!==-1;me--,fe++)Ht+=M*ne[me]>>>0,ne[me]=Ht%256>>>0,Ht=Ht/256>>>0;if(Ht!==0)throw new Error("Non-zero carry");Ct=fe,ft++}for(var oe=Dt-Ct;oe!==Dt&&ne[oe]===0;)oe++;for(var Ce=new Uint8Array(Rt+(Dt-oe)),Re=Rt;oe!==Dt;)Ce[Re++]=ne[oe++];return Ce}function pt(ot){var ft=Q(ot);if(ft)return ft;throw new Error("Non-base"+M+" character")}return{encode:L,decodeUnsafe:Q,decode:pt}}hg.exports=P1});var Ac=is((gp,yp)=>{W();(function(n,o){typeof gp=="object"&&typeof yp<"u"?yp.exports=o():typeof define=="function"&&define.amd?define(o):(n=typeof globalThis<"u"?globalThis:n||self,n.maplibregl=o())})(gp,function(){"use strict";var n,o,h;function g(a,M){if(!n)n=M;else if(!o)o=M;else{var S="var sharedChunk = {}; ("+n+")(sharedChunk); ("+o+")(sharedChunk);",D={};n(D),h=M(D),typeof window<"u"&&(h.workerUrl=window.URL.createObjectURL(new Blob([S],{type:"text/javascript"})))}}g(["exports"],function(a){"use strict";var M=S;function S(i,t,r,l){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=l}function D(i,t,r,l){let u=new M(i,t,r,l);return function(f){return u.solve(f)}}S.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,l=0;l<8;l++){var u=this.sampleCurveX(r)-i;if(Math.abs(u)<t)return r;var f=this.sampleCurveDerivativeX(r);if(Math.abs(f)<1e-6)break;r-=u/f}var m=0,x=1;for(r=i,l=0;l<20&&(u=this.sampleCurveX(r),!(Math.abs(u-i)<t));l++)i>u?m=r:x=r,r=.5*(x-m)+m;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};let N=D(.25,.1,.25,1);function L(i,t,r){return Math.min(r,Math.max(t,i))}function Q(i,t,r){let l=r-t,u=((i-t)%l+l)%l+t;return u===t?r:u}function pt(i,...t){for(let r of t)for(let l in r)i[l]=r[l];return i}let ot=1;function ft(i,t){i.forEach(r=>{t[r]&&(t[r]=t[r].bind(t))})}function Rt(i,t,r){let l={};for(let u in i)l[u]=t.call(r||this,i[u],u,i);return l}function Ct(i,t,r){let l={};for(let u in i)t.call(r||this,i[u],u,i)&&(l[u]=i[u]);return l}function Dt(i){return Array.isArray(i)?i.map(Dt):typeof i=="object"&&i?Rt(i,Dt):i}let ne={};function Ht(i){ne[i]||(typeof console<"u"&&console.warn(i),ne[i]=!0)}function fe(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function me(i){let t=0;for(let r,l,u=0,f=i.length,m=f-1;u<f;m=u++)r=i[u],l=i[m],t+=(l.x-r.x)*(r.y+l.y);return t}function oe(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ce(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,l,u,f)=>{let m=u||f;return t[l]=!m||m.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t}let Re,mi,Fi=null;function Yi(i){if(Fi==null){let t=i.navigator?i.navigator.userAgent:null;Fi=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Fi}function Oi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let $r={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){let t=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(i,t=0){let r=window.document.createElement("canvas"),l=r.getContext("2d");if(!l)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,l.drawImage(i,0,0,i.width,i.height),l.getImageData(-t,-t,i.width+2*t,i.height+2*t)},resolveURL:i=>(Re||(Re=document.createElement("a")),Re.href=i,Re.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(mi==null&&(mi=matchMedia("(prefers-reduced-motion: reduce)")),mi.matches)}};var ve=kr;function kr(i,t){this.x=i,this.y=t}kr.prototype={clone:function(){return new kr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),l=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=l,this},_rotateAround:function(i,t){var r=Math.cos(i),l=Math.sin(i),u=t.y+l*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-l*(this.y-t.y),this.y=u,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},kr.convert=function(i){return i instanceof kr?i:Array.isArray(i)?new kr(i[0],i[1]):i};let Wr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},rn="mapbox-tiles",bi,gn,Lr=500,Dr=50;function nn(){typeof caches>"u"||bi||(bi=caches.open(rn))}let sn=1/0,yr={supported:!1,testSupport:function(i){!En&&Zr&&(Bn?Fn(i):Rr=i)}},Rr,Zr,En=!1,Bn=!1;function Fn(i){let t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Zr),i.isContextLost())return;yr.supported=!0}catch{}i.deleteTexture(t),En=!0}typeof document<"u"&&(Zr=document.createElement("img"),Zr.onload=function(){Rr&&Fn(Rr),Rr=null,Bn=!0},Zr.onerror=function(){En=!0,Rr=null},Zr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let gs={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(gs);class ti extends Error{constructor(t,r,l,u){super(`AJAXError: ${r} (${t}): ${l}`),this.status=t,this.statusText=r,this.url=l,this.body=u}}let an=oe()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function On(i,t){let r=new AbortController,l=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:an(),signal:r.signal}),u=!1,f=!1;return i.type==="json"&&l.headers.set("Accept","application/json"),((m,x,b)=>{if(f)return;let E=Date.now();fetch(l).then(A=>A.ok?((z,R,O)=>{(i.type==="arrayBuffer"?z.arrayBuffer():i.type==="json"?z.json():z.text()).then(G=>{f||(R&&O&&function(tt,et,dt){if(nn(),!bi)return;let bt={status:et.status,statusText:et.statusText,headers:new Headers};et.headers.forEach((Et,Ot)=>bt.headers.set(Ot,Et));let xt=Ce(et.headers.get("Cache-Control")||"");xt["no-store"]||(xt["max-age"]&&bt.headers.set("Expires",new Date(dt+1e3*xt["max-age"]).toUTCString()),new Date(bt.headers.get("Expires")).getTime()-dt<42e4||function(Et,Ot){if(gn===void 0)try{new Response(new ReadableStream),gn=!0}catch{gn=!1}gn?Ot(Et.body):Et.blob().then(Ot)}(et,Et=>{let Ot=new Response(Et,bt);nn(),bi&&bi.then(Lt=>Lt.put(function(re){let ue=re.indexOf("?");return ue<0?re:re.slice(0,ue)}(tt.url),Ot)).catch(Lt=>Ht(Lt.message))}))}(l,R,O),u=!0,t(null,G,z.headers.get("Cache-Control"),z.headers.get("Expires")))}).catch(G=>{f||t(new Error(G.message))})})(A,null,E):A.blob().then(z=>t(new ti(A.status,A.statusText,i.url,z)))).catch(A=>{A.code!==20&&t(new Error(A.message))})})(),{cancel:()=>{f=!0,u||r.abort()}}}let yn=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t);if(!oe()){let l=i.url.substring(0,i.url.indexOf("://"));return(Wr.REGISTERED_PROTOCOLS[l]||On)(i,t)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(an())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return On(i,t);if(oe()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t,void 0,!0)}var r;return function(l,u){let f=new XMLHttpRequest;f.open(l.method||"GET",l.url,!0),l.type==="arrayBuffer"&&(f.responseType="arraybuffer");for(let m in l.headers)f.setRequestHeader(m,l.headers[m]);return l.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=l.credentials==="include",f.onerror=()=>{u(new Error(f.statusText))},f.onload=()=>{if((f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let m=f.response;if(l.type==="json")try{m=JSON.parse(f.response)}catch(x){return u(x)}u(null,m,f.getResponseHeader("Cache-Control"),f.getResponseHeader("Expires"))}else{let m=new Blob([f.response],{type:f.getResponseHeader("Content-Type")});u(new ti(f.status,f.statusText,l.url,m))}},f.send(l.body),{cancel:()=>f.abort()}}(i,t)},Br=function(i,t){return yn(pt(i,{type:"arrayBuffer"}),t)};function ys(i){let t=window.document.createElement("a");return t.href=i,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}let mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",U,B;U=[],B=0;let V=function(i,t){if(yr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),B>=Wr.MAX_PARALLEL_IMAGE_REQUESTS){let f={requestParameters:i,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return U.push(f),f}B++;let r=!1,l=()=>{if(!r)for(r=!0,B--;U.length&&B<Wr.MAX_PARALLEL_IMAGE_REQUESTS;){let f=U.shift(),{requestParameters:m,callback:x,cancelled:b}=f;b||(f.cancel=V(m,x).cancel)}},u=Br(i,(f,m,x,b)=>{l(),f?t(f):m&&function(E,A){typeof createImageBitmap=="function"?function(z,R){let O=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(O).then(G=>{R(null,G)}).catch(G=>{R(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(E,A):function(z,R){let O=new Image;O.onload=()=>{R(null,O),URL.revokeObjectURL(O.src),O.onload=null,window.requestAnimationFrame(()=>{O.src=mt})},O.onerror=()=>R(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 G=new Blob([new Uint8Array(z)],{type:"image/png"});O.src=z.byteLength?URL.createObjectURL(G):mt}(E,A)}(m,(E,A)=>{E!=null?t(E):A!=null&&t(null,A,{cacheControl:x,expires:b})})});return{cancel:()=>{u.cancel(),l()}}};function X(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function nt(i,t,r){if(r&&r[i]){let l=r[i].indexOf(t);l!==-1&&r[i].splice(l,1)}}class _t{constructor(t,r={}){pt(this,r),this.type=t}}class Ft extends _t{constructor(t,r={}){super("error",pt({error:t},r))}}class Vt{on(t,r){return this._listeners=this._listeners||{},X(t,r,this._listeners),this}off(t,r){return nt(t,r,this._listeners),nt(t,r,this._oneTimeListeners),this}once(t,r){return this._oneTimeListeners=this._oneTimeListeners||{},X(t,r,this._oneTimeListeners),this}fire(t,r){typeof t=="string"&&(t=new _t(t,r||{}));let l=t.type;if(this.listens(l)){t.target=this;let u=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(let x of u)x.call(this,t);let f=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(let x of f)nt(l,x,this._oneTimeListeners),x.call(this,t);let m=this._eventedParent;m&&(pt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(t))}else t instanceof Ft&&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 ct={$version:8,$root:{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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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"}},source_video:{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"}}},source_image:{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"}}},layer:{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"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"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"}},layout_circle:{"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"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"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"}},layout_symbol:{"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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-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"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"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"}},"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:{"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"}},paint_circle:{"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"}},paint_heatmap:{"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"}},paint_symbol:{"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"}},paint_raster:{"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"}},paint_hillshade:{"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"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}}};class zt{constructor(t,r,l,u){this.message=(t?`${t}: `:"")+l,u&&(this.identifier=u),r!=null&&r.__line__&&(this.line=r.__line__)}}function Ee(i){let t=i.value;return t?[new zt(i.key,t,"constants have been deprecated as of v8")]:[]}function Ae(i,...t){for(let r of t)for(let l in r)i[l]=r[l];return i}function ce(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ve(i){if(Array.isArray(i))return i.map(Ve);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=Ve(i[r]);return t}return ce(i)}class Pe extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class ei{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[l,u]of r)this.bindings[l]=u}concat(t){return new ei(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let ke={kind:"null"},Gt={kind:"number"},xe={kind:"string"},pe={kind:"boolean"},oi={kind:"color"},Wi={kind:"object"},be={kind:"value"},rr={kind:"collator"},yi={kind:"formatted"},nr={kind:"resolvedImage"};function ni(i,t){return{kind:"array",itemType:i,N:t}}function Xe(i){if(i.kind==="array"){let t=Xe(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let Gi=[ke,Gt,xe,pe,oi,yi,Wi,ni(be),nr];function _r(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!_r(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of Gi)if(!_r(r,t))return null}}return`Expected ${Xe(i)} but found ${Xe(t)} instead.`}function _i(i,t){return t.some(r=>r.kind===i.kind)}function Hr(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var Xr,Zs={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function _s(i){return(i=Math.round(i))<0?0:i>255?255:i}function xs(i){return _s(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function Z(i){return(t=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:t>1?1:t;var t}function I(i,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(t-i)*r*6:2*r<1?t:3*r<2?i+(t-i)*(2/3-r)*6:i}try{Xr={}.parseCSSColor=function(i){var t,r=i.replace(/ /g,"").toLowerCase();if(r in Zs)return Zs[r].slice();if(r[0]==="#")return r.length===4?(t=parseInt(r.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:r.length===7&&(t=parseInt(r.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var l=r.indexOf("("),u=r.indexOf(")");if(l!==-1&&u+1===r.length){var f=r.substr(0,l),m=r.substr(l+1,u-(l+1)).split(","),x=1;switch(f){case"rgba":if(m.length!==4)return null;x=Z(m.pop());case"rgb":return m.length!==3?null:[xs(m[0]),xs(m[1]),xs(m[2]),x];case"hsla":if(m.length!==4)return null;x=Z(m.pop());case"hsl":if(m.length!==3)return null;var b=(parseFloat(m[0])%360+360)%360/360,E=Z(m[1]),A=Z(m[2]),z=A<=.5?A*(E+1):A+E-A*E,R=2*A-z;return[_s(255*I(R,z,b+1/3)),_s(255*I(R,z,b)),_s(255*I(R,z,b-1/3)),x];default:return null}}return null}}catch{}class P{constructor(t,r,l,u=1){this.r=t,this.g=r,this.b=l,this.a=u}static parse(t){if(!t)return;if(t instanceof P)return t;if(typeof t!="string")return;let r=Xr(t);return r?new P(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[t,r,l,u]=this.toArray();return`rgba(${Math.round(t)},${Math.round(r)},${Math.round(l)},${u})`}toArray(){let{r:t,g:r,b:l,a:u}=this;return u===0?[0,0,0,0]:[255*t/u,255*r/u,255*l/u,u]}}P.black=new P(0,0,0,1),P.white=new P(1,1,1,1),P.transparent=new P(0,0,0,0),P.red=new P(1,0,0,1);class q{constructor(t,r,l){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=l,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}}class H{constructor(t,r,l,u,f){this.text=t,this.image=r,this.scale=l,this.fontStack=u,this.textColor=f}}class K{constructor(t){this.sections=t}static fromString(t){return new K([new H(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof K?t:K.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}serialize(){let t=["format"];for(let r of this.sections){if(r.image){t.push(["image",r.image.name]);continue}t.push(r.text);let l={};r.fontStack&&(l["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(l["font-scale"]=r.scale),r.textColor&&(l["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(l)}return t}}class st{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new st({name:t,available:!1}):null}serialize(){return["image",this.name]}}function it(i,t,r,l){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[i,t,r,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[i,t,r,l]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rt(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof P||i instanceof q||i instanceof K||i instanceof st)return!0;if(Array.isArray(i)){for(let t of i)if(!rt(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!rt(i[t]))return!1;return!0}return!1}function at(i){if(i===null)return ke;if(typeof i=="string")return xe;if(typeof i=="boolean")return pe;if(typeof i=="number")return Gt;if(i instanceof P)return oi;if(i instanceof q)return rr;if(i instanceof K)return yi;if(i instanceof st)return nr;if(Array.isArray(i)){let t=i.length,r;for(let l of i){let u=at(l);if(r){if(r===u)continue;r=be;break}r=u}return ni(r||be,t)}return Wi}function St(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof P||i instanceof K||i instanceof st?i.toString():JSON.stringify(i)}class Bt{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 ${t.length-1} instead.`);if(!rt(t[1]))return r.error("invalid value");let l=t[1],u=at(l),f=r.expectedType;return u.kind!=="array"||u.N!==0||!f||f.kind!=="array"||typeof f.N=="number"&&f.N!==0||(u=f),new Bt(u,l)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof P?["rgba"].concat(this.value.toArray()):this.value instanceof K?this.value.serialize():this.value}}class wt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let ae={string:xe,number:Gt,boolean:pe,object:Wi};class te{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 l,u=1,f=t[0];if(f==="array"){let x,b;if(t.length>2){let E=t[1];if(typeof E!="string"||!(E in ae)||E==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=ae[E],u++}else x=be;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);b=t[2],u++}l=ni(x,b)}else l=ae[f];let m=[];for(;u<t.length;u++){let x=r.parse(t[u],u,be);if(!x)return null;m.push(x)}return new te(l,m)}evaluate(t){for(let r=0;r<this.args.length;r++){let l=this.args[r].evaluate(t);if(!_r(this.type,at(l)))return l;if(r===this.args.length-1)throw new wt(`Expected value to be of type ${Xe(this.type)}, but found ${Xe(at(l))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=this.type,r=[t.kind];if(t.kind==="array"){let l=t.itemType;if(l.kind==="string"||l.kind==="number"||l.kind==="boolean"){r.push(l.kind);let u=t.N;(typeof u=="number"||this.args.length>1)&&r.push(u)}}return r.concat(this.args.map(l=>l.serialize()))}}class he{constructor(t){this.type=yi,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let l=t[1];if(!Array.isArray(l)&&typeof l=="object")return r.error("First argument must be an image or text section.");let u=[],f=!1;for(let m=1;m<=t.length-1;++m){let x=t[m];if(f&&typeof x=="object"&&!Array.isArray(x)){f=!1;let b=null;if(x["font-scale"]&&(b=r.parse(x["font-scale"],1,Gt),!b))return null;let E=null;if(x["text-font"]&&(E=r.parse(x["text-font"],1,ni(xe)),!E))return null;let A=null;if(x["text-color"]&&(A=r.parse(x["text-color"],1,oi),!A))return null;let z=u[u.length-1];z.scale=b,z.font=E,z.textColor=A}else{let b=r.parse(t[m],1,be);if(!b)return null;let E=b.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,u.push({content:b,scale:null,font:null,textColor:null})}}return new he(u)}evaluate(t){return new K(this.sections.map(r=>{let l=r.content.evaluate(t);return at(l)===nr?new H("",l,null,null,null):new H(St(l),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}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}serialize(){let t=["format"];for(let r of this.sections){t.push(r.content.serialize());let l={};r.scale&&(l["font-scale"]=r.scale.serialize()),r.font&&(l["text-font"]=r.font.serialize()),r.textColor&&(l["text-color"]=r.textColor.serialize()),t.push(l)}return t}}class ge{constructor(t){this.type=nr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let l=r.parse(t[1],1,xe);return l?new ge(l):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),l=st.fromString(r);return l&&t.availableImages&&(l.available=t.availableImages.indexOf(r)>-1),l}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let Ge={"to-boolean":pe,"to-color":oi,"to-number":Gt,"to-string":xe};class Fe{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 l=t[0];if((l==="to-boolean"||l==="to-string")&&t.length!==2)return r.error("Expected one argument.");let u=Ge[l],f=[];for(let m=1;m<t.length;m++){let x=r.parse(t[m],m,be);if(!x)return null;f.push(x)}return new Fe(u,f)}evaluate(t){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(t));if(this.type.kind==="color"){let r,l;for(let u of this.args){if(r=u.evaluate(t),l=null,r instanceof P)return r;if(typeof r=="string"){let f=t.parseColor(r);if(f)return f}else if(Array.isArray(r)&&(l=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:it(r[0],r[1],r[2],r[3]),!l))return new P(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(l||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(let l of this.args){if(r=l.evaluate(t),r===null)return 0;let u=Number(r);if(!isNaN(u))return u}throw new wt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?K.fromString(St(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?st.fromString(St(this.args[0].evaluate(t))):St(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if(this.type.kind==="formatted")return new he([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ge(this.args[0]).serialize();let t=[`to-${this.type.kind}`];return this.eachChild(r=>{t.push(r.serialize())}),t}}let Le=["Unknown","Point","LineString","Polygon"];class Ie{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"?Le[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]=P.parse(t)),r}}class Te{constructor(t,r,l,u){this.name=t,this.type=r,this._evaluate=l,this.args=u}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,r){let l=t[0],u=Te.definitions[l];if(!u)return r.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0);let f=Array.isArray(u)?u[0]:u.type,m=Array.isArray(u)?[[u[1],u[2]]]:u.overloads,x=m.filter(([E])=>!Array.isArray(E)||E.length===t.length-1),b=null;for(let[E,A]of x){b=new Ca(r.registry,r.path,null,r.scope);let z=[],R=!1;for(let O=1;O<t.length;O++){let G=t[O],tt=Array.isArray(E)?E[O-1]:E.type,et=b.parse(G,1+z.length,tt);if(!et){R=!0;break}z.push(et)}if(!R)if(Array.isArray(E)&&E.length!==z.length)b.error(`Expected ${E.length} arguments, but found ${z.length} instead.`);else{for(let O=0;O<z.length;O++){let G=Array.isArray(E)?E[O]:E.type,tt=z[O];b.concat(O+1).checkSubtype(G,tt.type)}if(b.errors.length===0)return new Te(l,f,A,z)}}if(x.length===1)r.errors.push(...b.errors);else{let E=(x.length?x:m).map(([z])=>{return R=z,Array.isArray(R)?`(${R.map(Xe).join(", ")})`:`(${Xe(R.type)}...)`;var R}).join(" | "),A=[];for(let z=1;z<t.length;z++){let R=r.parse(t[z],1+A.length);if(!R)return null;A.push(Xe(R.type))}r.error(`Expected arguments of type ${E}, but found (${A.join(", ")}) instead.`)}return null}static register(t,r){Te.definitions=r;for(let l in r)t[l]=Te}}class Ti{constructor(t,r,l){this.type=rr,this.locale=l,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let l=t[1];if(typeof l!="object"||Array.isArray(l))return r.error("Collator options argument must be an object.");let u=r.parse(l["case-sensitive"]!==void 0&&l["case-sensitive"],1,pe);if(!u)return null;let f=r.parse(l["diacritic-sensitive"]!==void 0&&l["diacritic-sensitive"],1,pe);if(!f)return null;let m=null;return l.locale&&(m=r.parse(l.locale,1,xe),!m)?null:new Ti(u,f,m)}evaluate(t){return new q(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}serialize(){let t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}let wi=8192;function qi(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Zi(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function Do(i,t){let r=(180+i[0])/360,l=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,u=Math.pow(2,t.z);return[Math.round(r*u*wi),Math.round(l*u*wi)]}function Ro(i,t,r){let l=i[0]-t[0],u=i[1]-t[1],f=i[0]-r[0],m=i[1]-r[1];return l*m-f*u==0&&l*f<=0&&u*m<=0}function si(i,t){let r=!1;for(let m=0,x=t.length;m<x;m++){let b=t[m];for(let E=0,A=b.length;E<A-1;E++){if(Ro(i,b[E],b[E+1]))return!1;(u=b[E])[1]>(l=i)[1]!=(f=b[E+1])[1]>l[1]&&l[0]<(f[0]-u[0])*(l[1]-u[1])/(f[1]-u[1])+u[0]&&(r=!r)}}var l,u,f;return r}function Fc(i,t){for(let r=0;r<t.length;r++)if(si(i,t[r]))return!0;return!1}function Bo(i,t,r,l){let u=l[0]-r[0],f=l[1]-r[1],m=(i[0]-r[0])*f-u*(i[1]-r[1]),x=(t[0]-r[0])*f-u*(t[1]-r[1]);return m>0&&x<0||m<0&&x>0}function Oc(i,t,r){for(let E of r)for(let A=0;A<E.length-1;++A)if((x=[(m=E[A+1])[0]-(f=E[A])[0],m[1]-f[1]])[0]*(b=[(u=t)[0]-(l=i)[0],u[1]-l[1]])[1]-x[1]*b[0]!=0&&Bo(l,u,f,m)&&Bo(f,m,l,u))return!0;var l,u,f,m,x,b;return!1}function Fo(i,t){for(let r=0;r<i.length;++r)if(!si(i[r],t))return!1;for(let r=0;r<i.length-1;++r)if(Oc(i[r],i[r+1],t))return!1;return!0}function Kl(i,t){for(let r=0;r<t.length;r++)if(Fo(i,t[r]))return!0;return!1}function Oo(i,t,r){let l=[];for(let u=0;u<i.length;u++){let f=[];for(let m=0;m<i[u].length;m++){let x=Do(i[u][m],r);qi(t,x),f.push(x)}l.push(f)}return l}function No(i,t,r){let l=[];for(let u=0;u<i.length;u++){let f=Oo(i[u],t,r);l.push(f)}return l}function Uo(i,t,r,l){if(i[0]<r[0]||i[0]>r[2]){let u=.5*l,f=i[0]-r[0]>u?-l:r[0]-i[0]>u?l:0;f===0&&(f=i[0]-r[2]>u?-l:r[2]-i[0]>u?l:0),i[0]+=f}qi(t,i)}function Jl(i,t,r,l){let u=Math.pow(2,l.z)*wi,f=[l.x*wi,l.y*wi],m=[];for(let x of i)for(let b of x){let E=[b.x+f[0],b.y+f[1]];Uo(E,t,r,u),m.push(E)}return m}function Yl(i,t,r,l){let u=Math.pow(2,l.z)*wi,f=[l.x*wi,l.y*wi],m=[];for(let b of i){let E=[];for(let A of b){let z=[A.x+f[0],A.y+f[1]];qi(t,z),E.push(z)}m.push(E)}if(t[2]-t[0]<=u/2){(x=t)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(let b of m)for(let E of b)Uo(E,t,r,u)}var x;return m}class Nn{constructor(t,r){this.type=pe,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 ${t.length-1} instead.`);if(rt(t[1])){let l=t[1];if(l.type==="FeatureCollection")for(let u=0;u<l.features.length;++u){let f=l.features[u].geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new Nn(l,l.features[u].geometry)}else if(l.type==="Feature"){let u=l.geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Nn(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new Nn(l,l)}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 function(r,l){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(l.type==="Polygon"){let x=Oo(l.coordinates,f,m),b=Jl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!si(E,x))return!1}if(l.type==="MultiPolygon"){let x=No(l.coordinates,f,m),b=Jl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Fc(E,x))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,l){let u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(l.type==="Polygon"){let x=Oo(l.coordinates,f,m),b=Yl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Fo(E,x))return!1}if(l.type==="MultiPolygon"){let x=No(l.coordinates,f,m),b=Yl(r.geometry(),u,f,m);if(!Zi(u,f))return!1;for(let E of b)if(!Kl(E,x))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Ea(i){if(i instanceof Te&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Nn)return!1;let t=!0;return i.eachChild(r=>{t&&!Ea(r)&&(t=!1)}),t}function vs(i){if(i instanceof Te&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!vs(r)&&(t=!1)}),t}function Hs(i,t){if(i instanceof Te&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(l=>{r&&!Hs(l,t)&&(r=!1)}),r}class Ia{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 l=t[1];return r.scope.has(l)?new Ia(l,r.scope.get(l)):r.error(`Unknown variable "${l}". Make sure "${l}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ca{constructor(t,r=[],l,u=new ei,f=[]){this.registry=t,this.path=r,this.key=r.map(m=>`[${m}]`).join(""),this.scope=u,this.errors=f,this.expectedType=l}parse(t,r,l,u,f={}){return r?this.concat(r,l,u)._parse(t,f):this._parse(t,f)}_parse(t,r){function l(u,f,m){return m==="assert"?new te(f,[u]):m==="coerce"?new Fe(f,[u]):u}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),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 u=t[0];if(typeof u!="string")return this.error(`Expression name must be a string, but found ${typeof u} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let f=this.registry[u];if(f){let m=f.parse(t,this);if(!m)return null;if(this.expectedType){let x=this.expectedType,b=m.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||b.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string"){if(this.checkSubtype(x,b))return null}else m=l(m,x,r.typeAnnotation||"coerce");else m=l(m,x,r.typeAnnotation||"assert")}if(!(m instanceof Bt)&&m.type.kind!=="resolvedImage"&&Xs(m)){let x=new Ie;try{m=new Bt(m.type,m.evaluate(x))}catch(b){return this.error(b.message),null}}return m}return this.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,l){let u=typeof t=="number"?this.path.concat(t):this.path,f=l?this.scope.concat(l):this.scope;return new Ca(this.registry,u,r||null,f,this.errors)}error(t,...r){let l=`${this.key}${r.map(u=>`[${u}]`).join("")}`;this.errors.push(new Pe(l,t))}checkSubtype(t,r){let l=_r(t,r);return l&&this.error(l),l}}function Xs(i){if(i instanceof Ia)return Xs(i.boundExpression);if(i instanceof Te&&i.name==="error"||i instanceof Ti||i instanceof Nn)return!1;let t=i instanceof Fe||i instanceof te,r=!0;return i.eachChild(l=>{r=t?r&&Xs(l):r&&l instanceof Bt}),!!r&&Ea(i)&&Hs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Aa(i,t){let r=i.length-1,l,u,f=0,m=r,x=0;for(;f<=m;)if(x=Math.floor((f+m)/2),l=i[x],u=i[x+1],l<=t){if(x===r||t<u)return x;f=x+1}else{if(!(l>t))throw new wt("Input is not a number.");m=x-1}return 0}class Ks{constructor(t,r,l){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[u,f]of l)this.labels.push(u),this.outputs.push(f)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let l=r.parse(t[1],1,Gt);if(!l)return null;let u=[],f=null;r.expectedType&&r.expectedType.kind!=="value"&&(f=r.expectedType);for(let m=1;m<t.length;m+=2){let x=m===1?-1/0:t[m],b=t[m+1],E=m,A=m+1;if(typeof x!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(u.length&&u[u.length-1][0]>=x)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);let z=r.parse(b,A,f);if(!z)return null;f=f||z.type,u.push([x,z])}return new Ks(f,l,u)}evaluate(t){let r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return l[0].evaluate(t);let f=r.length;return u>=r[f-1]?l[f-1].evaluate(t):l[Aa(r,u)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&t.push(this.labels[r]),t.push(this.outputs[r].serialize());return t}}function zi(i,t,r){return i*(1-r)+t*r}var Js=Object.freeze({__proto__:null,number:zi,color:function(i,t,r){return new P(zi(i.r,t.r,r),zi(i.g,t.g,r),zi(i.b,t.b,r),zi(i.a,t.a,r))},array:function(i,t,r){return i.map((l,u)=>zi(l,t[u],r))}});let Vo=.95047,Ql=1.08883,th=4/29,Pa=6/29,Go=3*Pa*Pa,Nc=Math.PI/180,Uc=180/Math.PI;function qo(i){return i>.008856451679035631?Math.pow(i,1/3):i/Go+th}function jo(i){return i>Pa?i*i*i:Go*(i-th)}function $o(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Wo(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function eh(i){let t=Wo(i.r),r=Wo(i.g),l=Wo(i.b),u=qo((.4124564*t+.3575761*r+.1804375*l)/Vo),f=qo((.2126729*t+.7151522*r+.072175*l)/1);return{l:116*f-16,a:500*(u-f),b:200*(f-qo((.0193339*t+.119192*r+.9503041*l)/Ql)),alpha:i.a}}function We(i){let t=(i.l+16)/116,r=isNaN(i.a)?t:t+i.a/500,l=isNaN(i.b)?t:t-i.b/200;return t=1*jo(t),r=Vo*jo(r),l=Ql*jo(l),new P($o(3.2404542*r-1.5371385*t-.4985314*l),$o(-.969266*r+1.8760108*t+.041556*l),$o(.0556434*r-.2040259*t+1.0572252*l),i.alpha)}function Vc(i,t,r){let l=t-i;return i+r*(l>180||l<-180?l-360*Math.round(l/360):l)}let Ys={forward:eh,reverse:We,interpolate:function(i,t,r){return{l:zi(i.l,t.l,r),a:zi(i.a,t.a,r),b:zi(i.b,t.b,r),alpha:zi(i.alpha,t.alpha,r)}}},Qs={forward:function(i){let{l:t,a:r,b:l}=eh(i),u=Math.atan2(l,r)*Uc;return{h:u<0?u+360:u,c:Math.sqrt(r*r+l*l),l:t,alpha:i.a}},reverse:function(i){let t=i.h*Nc,r=i.c;return We({l:i.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:i.alpha})},interpolate:function(i,t,r){return{h:Vc(i.h,t.h,r),c:zi(i.c,t.c,r),l:zi(i.l,t.l,r),alpha:zi(i.alpha,t.alpha,r)}}};var ih=Object.freeze({__proto__:null,lab:Ys,hcl:Qs});class xr{constructor(t,r,l,u,f){this.type=t,this.operator=r,this.interpolation=l,this.input=u,this.labels=[],this.outputs=[];for(let[m,x]of f)this.labels.push(m),this.outputs.push(x)}static interpolationFactor(t,r,l,u){let f=0;if(t.name==="exponential")f=Zo(r,t.base,l,u);else if(t.name==="linear")f=Zo(r,1,l,u);else if(t.name==="cubic-bezier"){let m=t.controlPoints;f=new M(m[0],m[1],m[2],m[3]).solve(Zo(r,1,l,u))}return f}static parse(t,r){let[l,u,f,...m]=t;if(!Array.isArray(u)||u.length===0)return r.error("Expected an interpolation type expression.",1);if(u[0]==="linear")u={name:"linear"};else if(u[0]==="exponential"){let E=u[1];if(typeof E!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);u={name:"exponential",base:E}}else{if(u[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(u[0])}`,1,0);{let E=u.slice(1);if(E.length!==4||E.some(A=>typeof A!="number"||A<0||A>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);u={name:"cubic-bezier",controlPoints:E}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(f=r.parse(f,2,Gt),!f)return null;let x=[],b=null;l==="interpolate-hcl"||l==="interpolate-lab"?b=oi:r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType);for(let E=0;E<m.length;E+=2){let A=m[E],z=m[E+1],R=E+3,O=E+4;if(typeof A!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',R);if(x.length&&x[x.length-1][0]>=A)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',R);let G=r.parse(z,O,b);if(!G)return null;b=b||G.type,x.push([A,G])}return b.kind==="number"||b.kind==="color"||b.kind==="array"&&b.itemType.kind==="number"&&typeof b.N=="number"?new xr(b,l,u,f,x):r.error(`Type ${Xe(b)} is not interpolatable.`)}evaluate(t){let r=this.labels,l=this.outputs;if(r.length===1)return l[0].evaluate(t);let u=this.input.evaluate(t);if(u<=r[0])return l[0].evaluate(t);let f=r.length;if(u>=r[f-1])return l[f-1].evaluate(t);let m=Aa(r,u),x=xr.interpolationFactor(this.interpolation,u,r[m],r[m+1]),b=l[m].evaluate(t),E=l[m+1].evaluate(t);return this.operator==="interpolate"?Js[this.type.kind.toLowerCase()](b,E,x):this.operator==="interpolate-hcl"?Qs.reverse(Qs.interpolate(Qs.forward(b),Qs.forward(E),x)):Ys.reverse(Ys.interpolate(Ys.forward(b),Ys.forward(E),x))}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t;t=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let r=[this.operator,t,this.input.serialize()];for(let l=0;l<this.labels.length;l++)r.push(this.labels[l],this.outputs[l].serialize());return r}}function Zo(i,t,r,l){let u=l-r,f=i-r;return u===0?0:t===1?f/u:(Math.pow(t,f)-1)/(Math.pow(t,u)-1)}class za{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 l=null,u=r.expectedType;u&&u.kind!=="value"&&(l=u);let f=[];for(let x of t.slice(1)){let b=r.parse(x,1+f.length,l,void 0,{typeAnnotation:"omit"});if(!b)return null;l=l||b.type,f.push(b)}let m=u&&f.some(x=>_r(u,x.type));return new za(m?be:l,f)}evaluate(t){let r,l=null,u=0;for(let f of this.args)if(u++,l=f.evaluate(t),l&&l instanceof st&&!l.available&&(r||(r=l.name),l=null,u===this.args.length&&(l=r)),l!==null)break;return l}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=["coalesce"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class ka{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 ${t.length-1} instead.`);let l=[];for(let f=1;f<t.length-1;f+=2){let m=t[f];if(typeof m!="string")return r.error(`Expected string, but found ${typeof m} instead.`,f);if(/[^a-zA-Z0-9_]/.test(m))return r.error("Variable names must contain only alphanumeric characters or '_'.",f);let x=r.parse(t[f+1],f+1);if(!x)return null;l.push([m,x])}let u=r.parse(t[t.length-1],t.length-1,r.expectedType,l);return u?new ka(l,u):null}outputDefined(){return this.result.outputDefined()}serialize(){let t=["let"];for(let[r,l]of this.bindings)t.push(r,l.serialize());return t.push(this.result.serialize()),t}}class Ho{constructor(t,r,l){this.type=t,this.index=r,this.input=l}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let l=r.parse(t[1],1,Gt),u=r.parse(t[2],2,ni(r.expectedType||be));return l&&u?new Ho(u.type.itemType,l,u):null}evaluate(t){let r=this.index.evaluate(t),l=this.input.evaluate(t);if(r<0)throw new wt(`Array index out of bounds: ${r} < 0.`);if(r>=l.length)throw new wt(`Array index out of bounds: ${r} > ${l.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return l[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Xo{constructor(t,r){this.type=pe,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let l=r.parse(t[1],1,be),u=r.parse(t[2],2,be);return l&&u?_i(l.type,[pe,xe,Gt,ke,be])?new Xo(l,u):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(l.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!l)return!1;if(!Hr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(at(r))} instead.`);if(!Hr(l,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Xe(at(l))} instead.`);return l.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class La{constructor(t,r,l){this.type=Gt,this.needle=t,this.haystack=r,this.fromIndex=l}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let l=r.parse(t[1],1,be),u=r.parse(t[2],2,be);if(!l||!u)return null;if(!_i(l.type,[pe,xe,Gt,ke,be]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(l.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Gt);return f?new La(l,u,f):null}return new La(l,u)}evaluate(t){let r=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!Hr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Xe(at(r))} instead.`);if(!Hr(l,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Xe(at(l))} instead.`);if(this.fromIndex){let u=this.fromIndex.evaluate(t);return l.indexOf(r,u)}return l.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ko{constructor(t,r,l,u,f,m){this.inputType=t,this.type=r,this.input=l,this.cases=u,this.outputs=f,this.otherwise=m}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let l,u;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);let f={},m=[];for(let E=2;E<t.length-1;E+=2){let A=t[E],z=t[E+1];Array.isArray(A)||(A=[A]);let R=r.concat(E);if(A.length===0)return R.error("Expected at least one branch label.");for(let G of A){if(typeof G!="number"&&typeof G!="string")return R.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return R.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return R.error("Numeric branch labels must be integer values.");if(l){if(R.checkSubtype(l,at(G)))return null}else l=at(G);if(f[String(G)]!==void 0)return R.error("Branch labels must be unique.");f[String(G)]=m.length}let O=r.parse(z,E,u);if(!O)return null;u=u||O.type,m.push(O)}let x=r.parse(t[1],1,be);if(!x)return null;let b=r.parse(t[t.length-1],t.length-1,u);return b?x.type.kind!=="value"&&r.concat(1).checkSubtype(l,x.type)?null:new Ko(l,u,x,f,m,b):null}evaluate(t){let r=this.input.evaluate(t);return(at(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()}serialize(){let t=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),l=[],u={};for(let m of r){let x=u[this.cases[m]];x===void 0?(u[this.cases[m]]=l.length,l.push([this.cases[m],[m]])):l[x][1].push(m)}let f=m=>this.inputType.kind==="number"?Number(m):m;for(let[m,x]of l)t.push(x.length===1?f(x[0]):x.map(f)),t.push(this.outputs[m].serialize());return t.push(this.otherwise.serialize()),t}}class Jo{constructor(t,r,l){this.type=t,this.branches=r,this.otherwise=l}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);let u=[];for(let m=1;m<t.length-1;m+=2){let x=r.parse(t[m],m,pe);if(!x)return null;let b=r.parse(t[m+1],m+1,l);if(!b)return null;u.push([x,b]),l=l||b.type}let f=r.parse(t[t.length-1],t.length-1,l);return f?new Jo(l,u,f):null}evaluate(t){for(let[r,l]of this.branches)if(r.evaluate(t))return l.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,l]of this.branches)t(r),t(l);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let t=["case"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class Da{constructor(t,r,l,u){this.type=t,this.input=r,this.beginIndex=l,this.endIndex=u}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let l=r.parse(t[1],1,be),u=r.parse(t[2],2,Gt);if(!l||!u)return null;if(!_i(l.type,[ni(be),xe,be]))return r.error(`Expected first argument to be of type array or string, but found ${Xe(l.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Gt);return f?new Da(l.type,l,u,f):null}return new Da(l.type,l,u)}evaluate(t){let r=this.input.evaluate(t),l=this.beginIndex.evaluate(t);if(!Hr(r,["string","array"]))throw new wt(`Expected first argument to be of type array or string, but found ${Xe(at(r))} instead.`);if(this.endIndex){let u=this.endIndex.evaluate(t);return r.slice(l,u)}return r.slice(l)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function rh(i,t){return i==="=="||i==="!="?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 nh(i,t,r,l){return l.compare(t,r)===0}function bs(i,t,r){let l=i!=="=="&&i!=="!=";return class wg{constructor(f,m,x){this.type=pe,this.lhs=f,this.rhs=m,this.collator=x,this.hasUntypedArgument=f.type.kind==="value"||m.type.kind==="value"}static parse(f,m){if(f.length!==3&&f.length!==4)return m.error("Expected two or three arguments.");let x=f[0],b=m.parse(f[1],1,be);if(!b)return null;if(!rh(x,b.type))return m.concat(1).error(`"${x}" comparisons are not supported for type '${Xe(b.type)}'.`);let E=m.parse(f[2],2,be);if(!E)return null;if(!rh(x,E.type))return m.concat(2).error(`"${x}" comparisons are not supported for type '${Xe(E.type)}'.`);if(b.type.kind!==E.type.kind&&b.type.kind!=="value"&&E.type.kind!=="value")return m.error(`Cannot compare types '${Xe(b.type)}' and '${Xe(E.type)}'.`);l&&(b.type.kind==="value"&&E.type.kind!=="value"?b=new te(E.type,[b]):b.type.kind!=="value"&&E.type.kind==="value"&&(E=new te(b.type,[E])));let A=null;if(f.length===4){if(b.type.kind!=="string"&&E.type.kind!=="string"&&b.type.kind!=="value"&&E.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(A=m.parse(f[3],3,rr),!A)return null}return new wg(b,E,A)}evaluate(f){let m=this.lhs.evaluate(f),x=this.rhs.evaluate(f);if(l&&this.hasUntypedArgument){let b=at(m),E=at(x);if(b.kind!==E.kind||b.kind!=="string"&&b.kind!=="number")throw new wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${b.kind}, ${E.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){let b=at(m),E=at(x);if(b.kind!=="string"||E.kind!=="string")return t(f,m,x)}return this.collator?r(f,m,x,this.collator.evaluate(f)):t(f,m,x)}eachChild(f){f(this.lhs),f(this.rhs),this.collator&&f(this.collator)}outputDefined(){return!0}serialize(){let f=[i];return this.eachChild(m=>{f.push(m.serialize())}),f}}}let Gc=bs("==",function(i,t,r){return t===r},nh),qc=bs("!=",function(i,t,r){return t!==r},function(i,t,r,l){return!nh(0,t,r,l)}),jc=bs("<",function(i,t,r){return t<r},function(i,t,r,l){return l.compare(t,r)<0}),$c=bs(">",function(i,t,r){return t>r},function(i,t,r,l){return l.compare(t,r)>0}),Wc=bs("<=",function(i,t,r){return t<=r},function(i,t,r,l){return l.compare(t,r)<=0}),Zc=bs(">=",function(i,t,r){return t>=r},function(i,t,r,l){return l.compare(t,r)>=0});class Yo{constructor(t,r,l,u,f){this.type=xe,this.number=t,this.locale=r,this.currency=l,this.minFractionDigits=u,this.maxFractionDigits=f}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let l=r.parse(t[1],1,Gt);if(!l)return null;let u=t[2];if(typeof u!="object"||Array.isArray(u))return r.error("NumberFormat options argument must be an object.");let f=null;if(u.locale&&(f=r.parse(u.locale,1,xe),!f))return null;let m=null;if(u.currency&&(m=r.parse(u.currency,1,xe),!m))return null;let x=null;if(u["min-fraction-digits"]&&(x=r.parse(u["min-fraction-digits"],1,Gt),!x))return null;let b=null;return u["max-fraction-digits"]&&(b=r.parse(u["max-fraction-digits"],1,Gt),!b)?null:new Yo(l,f,m,x,b)}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}serialize(){let t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class Qo{constructor(t){this.type=Gt,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let l=r.parse(t[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Xe(l.type)} instead.`):new Qo(l):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string"||Array.isArray(r))return r.length;throw new wt(`Expected value to be of type string or array, but found ${Xe(at(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){let t=["length"];return this.eachChild(r=>{t.push(r.serialize())}),t}}let ws={"==":Gc,"!=":qc,">":$c,"<":jc,">=":Zc,"<=":Wc,array:te,at:Ho,boolean:te,case:Jo,coalesce:za,collator:Ti,format:he,image:ge,in:Xo,"index-of":La,interpolate:xr,"interpolate-hcl":xr,"interpolate-lab":xr,length:Qo,let:ka,literal:Bt,match:Ko,number:te,"number-format":Yo,object:te,slice:Da,step:Ks,string:te,"to-boolean":Fe,"to-color":Fe,"to-number":Fe,"to-string":Fe,var:Ia,within:Nn};function sh(i,[t,r,l,u]){t=t.evaluate(i),r=r.evaluate(i),l=l.evaluate(i);let f=u?u.evaluate(i):1,m=it(t,r,l,f);if(m)throw new wt(m);return new P(t/255*f,r/255*f,l/255*f,f)}function ah(i,t){return i in t}function tl(i,t){let r=t[i];return r===void 0?null:r}function Un(i){return{type:i}}function oh(i){return{result:"success",value:i}}function Vn(i){return{result:"error",value:i}}function Ms(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function lh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function el(i){return!!i.expression&&i.expression.interpolated}function Se(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ra(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Qe(i){return i}function Ba(i,t){let r=t.type==="color",l=i.stops&&typeof i.stops[0][0]=="object",u=l||!(l||i.property!==void 0),f=i.type||(el(t)?"exponential":"interval");if(r&&((i=Ae({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],P.parse(E[1])])),i.default=P.parse(i.default?i.default:t.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!ih[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let m,x,b;if(f==="exponential")m=il;else if(f==="interval")m=Fa;else if(f==="categorical"){m=Mi,x=Object.create(null);for(let E of i.stops)x[E[0]]=E[1];b=typeof i.stops[0][0]}else{if(f!=="identity")throw new Error(`Unknown function type "${f}"`);m=Hc}if(l){let E={},A=[];for(let O=0;O<i.stops.length;O++){let G=i.stops[O],tt=G[0].zoom;E[tt]===void 0&&(E[tt]={zoom:tt,type:i.type,property:i.property,default:i.default,stops:[]},A.push(tt)),E[tt].stops.push([G[0].value,G[1]])}let z=[];for(let O of A)z.push([E[O].zoom,Ba(E[O],t)]);let R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:xr.interpolationFactor.bind(void 0,R),zoomStops:z.map(O=>O[0]),evaluate:({zoom:O},G)=>il({stops:z,base:i.base},t,O).evaluate(O,G)}}if(u){let E=f==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:xr.interpolationFactor.bind(void 0,E),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>m(i,t,A,x,b)}}return{kind:"source",evaluate(E,A){let z=A&&A.properties?A.properties[i.property]:void 0;return z===void 0?hi(i.default,t.default):m(i,t,z,x,b)}}}function hi(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function Mi(i,t,r,l,u){return hi(typeof r===u?l[r]:void 0,i.default,t.default)}function Fa(i,t,r){if(Se(r)!=="number")return hi(i.default,t.default);let l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];let u=Aa(i.stops.map(f=>f[0]),r);return i.stops[u][1]}function il(i,t,r){let l=i.base!==void 0?i.base:1;if(Se(r)!=="number")return hi(i.default,t.default);let u=i.stops.length;if(u===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[u-1][0])return i.stops[u-1][1];let f=Aa(i.stops.map(A=>A[0]),r),m=function(A,z,R,O){let G=O-R,tt=A-R;return G===0?0:z===1?tt/G:(Math.pow(z,tt)-1)/(Math.pow(z,G)-1)}(r,l,i.stops[f][0],i.stops[f+1][0]),x=i.stops[f][1],b=i.stops[f+1][1],E=Js[t.type]||Qe;if(i.colorSpace&&i.colorSpace!=="rgb"){let A=ih[i.colorSpace];E=(z,R)=>A.reverse(A.interpolate(A.forward(z),A.forward(R),m))}return typeof x.evaluate=="function"?{evaluate(...A){let z=x.evaluate.apply(void 0,A),R=b.evaluate.apply(void 0,A);if(z!==void 0&&R!==void 0)return E(z,R,m)}}:E(x,b,m)}function Hc(i,t,r){return t.type==="color"?r=P.parse(r):t.type==="formatted"?r=K.fromString(r.toString()):t.type==="resolvedImage"?r=st.fromString(r.toString()):Se(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0),hi(r,i.default,t.default)}Te.register(ws,{error:[{kind:"error"},[xe],(i,[t])=>{throw new wt(t.evaluate(i))}],typeof:[xe,[be],(i,[t])=>Xe(at(t.evaluate(i)))],"to-rgba":[ni(Gt,4),[oi],(i,[t])=>t.evaluate(i).toArray()],rgb:[oi,[Gt,Gt,Gt],sh],rgba:[oi,[Gt,Gt,Gt,Gt],sh],has:{type:pe,overloads:[[[xe],(i,[t])=>ah(t.evaluate(i),i.properties())],[[xe,Wi],(i,[t,r])=>ah(t.evaluate(i),r.evaluate(i))]]},get:{type:be,overloads:[[[xe],(i,[t])=>tl(t.evaluate(i),i.properties())],[[xe,Wi],(i,[t,r])=>tl(t.evaluate(i),r.evaluate(i))]]},"feature-state":[be,[xe],(i,[t])=>tl(t.evaluate(i),i.featureState||{})],properties:[Wi,[],i=>i.properties()],"geometry-type":[xe,[],i=>i.geometryType()],id:[be,[],i=>i.id()],zoom:[Gt,[],i=>i.globals.zoom],"heatmap-density":[Gt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Gt,[],i=>i.globals.lineProgress||0],accumulated:[be,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Gt,Un(Gt),(i,t)=>{let r=0;for(let l of t)r+=l.evaluate(i);return r}],"*":[Gt,Un(Gt),(i,t)=>{let r=1;for(let l of t)r*=l.evaluate(i);return r}],"-":{type:Gt,overloads:[[[Gt,Gt],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Gt],(i,[t])=>-t.evaluate(i)]]},"/":[Gt,[Gt,Gt],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Gt,[Gt,Gt],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Gt,[],()=>Math.LN2],pi:[Gt,[],()=>Math.PI],e:[Gt,[],()=>Math.E],"^":[Gt,[Gt,Gt],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Gt,[Gt],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))],log2:[Gt,[Gt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Gt,[Gt],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Gt,[Gt],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Gt,[Gt],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Gt,[Gt],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Gt,[Gt],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Gt,[Gt],(i,[t])=>Math.atan(t.evaluate(i))],min:[Gt,Un(Gt),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Gt,Un(Gt),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Gt,[Gt],(i,[t])=>Math.abs(t.evaluate(i))],round:[Gt,[Gt],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Gt,[Gt],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Gt,[Gt],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[pe,[xe,be],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[pe,[be],(i,[t])=>i.id()===t.value],"filter-type-==":[pe,[xe],(i,[t])=>i.geometryType()===t.value],"filter-<":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l<u}],"filter-id-<":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r<l}],"filter->":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l>u}],"filter-id->":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r>l}],"filter-<=":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l<=u}],"filter-id-<=":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r<=l}],"filter->=":[pe,[xe,be],(i,[t,r])=>{let l=i.properties()[t.value],u=r.value;return typeof l==typeof u&&l>=u}],"filter-id->=":[pe,[be],(i,[t])=>{let r=i.id(),l=t.value;return typeof r==typeof l&&r>=l}],"filter-has":[pe,[be],(i,[t])=>t.value in i.properties()],"filter-has-id":[pe,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[pe,[ni(xe)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[pe,[ni(be)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[pe,[xe,ni(be)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[pe,[xe,ni(be)],(i,[t,r])=>function(l,u,f,m){for(;f<=m;){let x=f+m>>1;if(u[x]===l)return!0;u[x]>l?m=x-1:f=x+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:pe,overloads:[[[pe,pe],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Un(pe),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:pe,overloads:[[[pe,pe],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Un(pe),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[pe,[pe],(i,[t])=>!t.evaluate(i)],"is-supported-script":[pe,[xe],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[xe,[xe],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[xe,[xe],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[xe,Un(be),(i,t)=>t.map(r=>St(r.evaluate(i))).join("")],"resolved-locale":[xe,[rr],(i,[t])=>t.evaluate(i).resolvedLocale()]});class rl{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Ie,this._defaultValue=r?function(l){return l.type==="color"&&Ra(l.default)?new P(0,0,0,0):l.type==="color"?P.parse(l.default)||null:l.default===void 0?null:l.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=l,this._evaluator.canonical=u,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(t,r,l,u,f,m){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=l||null,this._evaluator.canonical=u,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m||null;try{let x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new wt(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function Oa(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ws}function Na(i,t){let r=new Ca(ws,[],t?function(u){let f={color:oi,string:xe,number:Gt,enum:xe,boolean:pe,formatted:yi,resolvedImage:nr};return u.type==="array"?ni(f[u.value]||be,u.length):f[u.type]}(t):void 0),l=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?oh(new rl(l,t)):Vn(r.errors)}class Ua{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!vs(r.expression)}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,u,f,m)}evaluate(t,r,l,u,f,m){return this._styleExpression.evaluate(t,r,l,u,f,m)}}class Va{constructor(t,r,l,u){this.kind=t,this.zoomStops=l,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!vs(r.expression),this.interpolationType=u}evaluateWithoutErrorHandling(t,r,l,u,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,l,u,f,m)}evaluate(t,r,l,u,f,m){return this._styleExpression.evaluate(t,r,l,u,f,m)}interpolationFactor(t,r,l){return this.interpolationType?xr.interpolationFactor(this.interpolationType,t,r,l):0}}function nl(i,t){let r=Na(i,t);if(r.result==="error")return r;let l=r.value.expression,u=Ea(l);if(!u&&!Ms(t))return Vn([new Pe("","data expressions not supported")]);let f=Hs(l,["zoom"]);if(!f&&!lh(t))return Vn([new Pe("","zoom expressions not supported")]);let m=Ga(l);return m||f?m instanceof Pe?Vn([m]):m instanceof xr&&!el(t)?Vn([new Pe("",'"interpolate" expressions cannot be used with this property')]):oh(m?new Va(u?"camera":"composite",r.value,m.labels,m instanceof xr?m.interpolation:void 0):new Ua(u?"constant":"source",r.value)):Vn([new Pe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ss{constructor(t,r){this._parameters=t,this._specification=r,Ae(this,Ba(this._parameters,this._specification))}static deserialize(t){return new Ss(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Ga(i){let t=null;if(i instanceof ka)t=Ga(i.result);else if(i instanceof za){for(let r of i.args)if(t=Ga(r),t)break}else(i instanceof Ks||i instanceof xr)&&i.input instanceof Te&&i.input.name==="zoom"&&(t=i);return t instanceof Pe||i.eachChild(r=>{let l=Ga(r);l instanceof Pe?t=l:!t&&l?t=new Pe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&l&&t!==l&&(t=new Pe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Kr(i){let t=i.key,r=i.value,l=i.valueSpec||{},u=i.objectElementValidators||{},f=i.style,m=i.styleSpec,x=[],b=Se(r);if(b!=="object")return[new zt(t,r,`object expected, ${b} found`)];for(let E in r){let A=E.split(".")[0],z=l[A]||l["*"],R;if(u[A])R=u[A];else if(l[A])R=hr;else if(u["*"])R=u["*"];else{if(!l["*"]){x.push(new zt(t,r[E],`unknown property "${E}"`));continue}R=hr}x=x.concat(R({key:(t&&`${t}.`)+E,value:r[E],valueSpec:z,style:f,styleSpec:m,object:r,objectKey:E},r))}for(let E in l)u[E]||l[E].required&&l[E].default===void 0&&r[E]===void 0&&x.push(new zt(t,r,`missing required property "${E}"`));return x}function hh(i){let t=i.value,r=i.valueSpec,l=i.style,u=i.styleSpec,f=i.key,m=i.arrayElementValidator||hr;if(Se(t)!=="array")return[new zt(f,t,`array expected, ${Se(t)} found`)];if(r.length&&t.length!==r.length)return[new zt(f,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new zt(f,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let x={type:r.value,values:r.values};u.$version<7&&(x.function=r.function),Se(r.value)==="object"&&(x=r.value);let b=[];for(let E=0;E<t.length;E++)b=b.concat(m({array:t,arrayIndex:E,value:t[E],valueSpec:x,style:l,styleSpec:u,key:`${f}[${E}]`}));return b}function ch(i){let t=i.key,r=i.value,l=i.valueSpec,u=Se(r);return u==="number"&&r!=r&&(u="NaN"),u!=="number"?[new zt(t,r,`number expected, ${u} found`)]:"minimum"in l&&r<l.minimum?[new zt(t,r,`${r} is less than the minimum value ${l.minimum}`)]:"maximum"in l&&r>l.maximum?[new zt(t,r,`${r} is greater than the maximum value ${l.maximum}`)]:[]}function uh(i){let t=i.valueSpec,r=ce(i.value.type),l,u,f,m={},x=r!=="categorical"&&i.value.property===void 0,b=!x,E=Se(i.value.stops)==="array"&&Se(i.value.stops[0])==="array"&&Se(i.value.stops[0][0])==="object",A=Kr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new zt(O.key,O.value,'identity function may not have a "stops" property')];let G=[],tt=O.value;return G=G.concat(hh({key:O.key,value:tt,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:z})),Se(tt)==="array"&&tt.length===0&&G.push(new zt(O.key,tt,"array must have at least one stop")),G},default:function(O){return hr({key:O.key,value:O.value,valueSpec:t,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&x&&A.push(new zt(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||A.push(new zt(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!el(i.valueSpec)&&A.push(new zt(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!Ms(i.valueSpec)?A.push(new zt(i.key,i.value,"property functions not supported")):x&&!lh(i.valueSpec)&&A.push(new zt(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!E||i.value.property!==void 0||A.push(new zt(i.key,i.value,'"property" property is required')),A;function z(O){let G=[],tt=O.value,et=O.key;if(Se(tt)!=="array")return[new zt(et,tt,`array expected, ${Se(tt)} found`)];if(tt.length!==2)return[new zt(et,tt,`array length 2 expected, length ${tt.length} found`)];if(E){if(Se(tt[0])!=="object")return[new zt(et,tt,`object expected, ${Se(tt[0])} found`)];if(tt[0].zoom===void 0)return[new zt(et,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new zt(et,tt,"object stop key must have value")];if(f&&f>ce(tt[0].zoom))return[new zt(et,tt[0].zoom,"stop zoom values must appear in ascending order")];ce(tt[0].zoom)!==f&&(f=ce(tt[0].zoom),u=void 0,m={}),G=G.concat(Kr({key:`${et}[0]`,value:tt[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:ch,value:R}}))}else G=G.concat(R({key:`${et}[0]`,value:tt[0],valueSpec:{},style:O.style,styleSpec:O.styleSpec},tt));return Oa(Ve(tt[1]))?G.concat([new zt(`${et}[1]`,tt[1],"expressions are not allowed in function stops.")]):G.concat(hr({key:`${et}[1]`,value:tt[1],valueSpec:t,style:O.style,styleSpec:O.styleSpec}))}function R(O,G){let tt=Se(O.value),et=ce(O.value),dt=O.value!==null?O.value:G;if(l){if(tt!==l)return[new zt(O.key,dt,`${tt} stop domain type must match previous stop domain type ${l}`)]}else l=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new zt(O.key,dt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&r!=="categorical"){let bt=`number expected, ${tt} found`;return Ms(t)&&r===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zt(O.key,dt,bt)]}return r!=="categorical"||tt!=="number"||isFinite(et)&&Math.floor(et)===et?r!=="categorical"&&tt==="number"&&u!==void 0&&et<u?[new zt(O.key,dt,"stop domain values must appear in ascending order")]:(u=et,r==="categorical"&&et in m?[new zt(O.key,dt,"stop domain values must be unique")]:(m[et]=!0,[])):[new zt(O.key,dt,`integer expected, found ${et}`)]}}function Ts(i){let t=(i.expressionContext==="property"?nl:Na)(Ve(i.value),i.valueSpec);if(t.result==="error")return t.value.map(l=>new zt(`${i.key}${l.key}`,i.value,l.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new zt(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!vs(r))return[new zt(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!vs(r))return[new zt(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Hs(r,["zoom","feature-state"]))return[new zt(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ea(r))return[new zt(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qa(i){let t=i.key,r=i.value,l=i.valueSpec,u=[];return Array.isArray(l.values)?l.values.indexOf(ce(r))===-1&&u.push(new zt(t,r,`expected one of [${l.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(l.values).indexOf(ce(r))===-1&&u.push(new zt(t,r,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(r)} found`)),u}function sl(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!sl(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let ph={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ja(i){if(i==null)return{filter:()=>!0,needGeometry:!1};sl(i)||(i=ta(i));let t=Na(i,ph);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,l,u)=>t.value.evaluate(r,l,{},u),needGeometry:dh(i)}}function $a(i,t){return i<t?-1:i>t?1:0}function dh(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let t=1;t<i.length;t++)if(dh(i[t]))return!0;return!1}function ta(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?al(i[1],i[2],"=="):t==="!="?Es(al(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?al(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(ta))):t==="all"?["all"].concat(i.slice(1).map(ta)):t==="none"?["all"].concat(i.slice(1).map(ta).map(Es)):t==="in"?Wa(i[1],i.slice(2)):t==="!in"?Es(Wa(i[1],i.slice(2))):t==="has"?Za(i[1]):t==="!has"?Es(Za(i[1])):t!=="within"||i;var r}function al(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function Wa(i,t){if(t.length===0)return!1;switch(i){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",i,["literal",t.sort($a)]]:["filter-in-small",i,["literal",t]]}}function Za(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Es(i){return["!",i]}function ea(i){return sl(Ve(i.value))?Ts(Ae({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):fh(i)}function fh(i){let t=i.value,r=i.key;if(Se(t)!=="array")return[new zt(r,t,`array expected, ${Se(t)} found`)];let l=i.styleSpec,u,f=[];if(t.length<1)return[new zt(r,t,"filter array must have at least 1 element")];switch(f=f.concat(qa({key:`${r}[0]`,value:t[0],valueSpec:l.filter_operator,style:i.style,styleSpec:i.styleSpec})),ce(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ce(t[1])==="$type"&&f.push(new zt(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new zt(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(u=Se(t[1]),u!=="string"&&f.push(new zt(`${r}[1]`,t[1],`string expected, ${u} found`)));for(let m=2;m<t.length;m++)u=Se(t[m]),ce(t[1])==="$type"?f=f.concat(qa({key:`${r}[${m}]`,value:t[m],valueSpec:l.geometry_type,style:i.style,styleSpec:i.styleSpec})):u!=="string"&&u!=="number"&&u!=="boolean"&&f.push(new zt(`${r}[${m}]`,t[m],`string, number, or boolean expected, ${u} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)f=f.concat(fh({key:`${r}[${m}]`,value:t[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":u=Se(t[1]),t.length!==2?f.push(new zt(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="string"&&f.push(new zt(`${r}[1]`,t[1],`string expected, ${u} found`));break;case"within":u=Se(t[1]),t.length!==2?f.push(new zt(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):u!=="object"&&f.push(new zt(`${r}[1]`,t[1],`object expected, ${u} found`))}return f}function ia(i,t){let r=i.key,l=i.style,u=i.styleSpec,f=i.value,m=i.objectKey,x=u[`${t}_${i.layerType}`];if(!x)return[];let b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return hr({key:r,value:f,valueSpec:u.transition,style:l,styleSpec:u});let E=i.valueSpec||x[m];if(!E)return[new zt(r,f,`unknown property "${m}"`)];let A;if(Se(f)==="string"&&Ms(E)&&!E.tokens&&(A=/^{([^}]+)}$/.exec(f)))return[new zt(r,f,`"${m}" does not support interpolation syntax
|
|
3
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];let z=[];return i.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&z.push(new zt(r,f,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Ra(Ve(f))&&ce(f.type)==="identity"&&z.push(new zt(r,f,'"text-font" does not support identity functions'))),z.concat(hr({key:i.key,value:f,valueSpec:E,style:l,styleSpec:u,expressionContext:"property",propertyType:t,propertyKey:m}))}function mh(i){return ia(i,"paint")}function gh(i){return ia(i,"layout")}function yh(i){let t=[],r=i.value,l=i.key,u=i.style,f=i.styleSpec;r.type||r.ref||t.push(new zt(l,r,'either "type" or "ref" is required'));let m=ce(r.type),x=ce(r.ref);if(r.id){let b=ce(r.id);for(let E=0;E<i.arrayIndex;E++){let A=u.layers[E];ce(A.id)===b&&t.push(new zt(l,r.id,`duplicate layer id "${r.id}", previously used at line ${A.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(E=>{E in r&&t.push(new zt(l,r[E],`"${E}" is prohibited for ref layers`))}),u.layers.forEach(E=>{ce(E.id)===x&&(b=E)}),b?b.ref?t.push(new zt(l,r.ref,"ref cannot reference another ref layer")):m=ce(b.type):t.push(new zt(l,r.ref,`ref layer "${x}" not found`))}else if(m!=="background")if(r.source){let b=u.sources&&u.sources[r.source],E=b&&ce(b.type);b?E==="vector"&&m==="raster"?t.push(new zt(l,r.source,`layer "${r.id}" requires a raster source`)):E==="raster"&&m!=="raster"?t.push(new zt(l,r.source,`layer "${r.id}" requires a vector source`)):E!=="vector"||r["source-layer"]?E==="raster-dem"&&m!=="hillshade"?t.push(new zt(l,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):m!=="line"||!r.paint||!r.paint["line-gradient"]||E==="geojson"&&b.lineMetrics||t.push(new zt(l,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new zt(l,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new zt(l,r.source,`source "${r.source}" not found`))}else t.push(new zt(l,r,'missing required property "source"'));return t=t.concat(Kr({key:l,value:r,valueSpec:f.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>hr({key:`${l}.type`,value:r.type,valueSpec:f.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:ea,layout:b=>Kr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>gh(Ae({layerType:m},E))}}),paint:b=>Kr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>mh(Ae({layerType:m},E))}})}})),t}function Is(i){let t=i.value,r=i.key,l=Se(t);return l!=="string"?[new zt(r,t,`string expected, ${l} found`)]:[]}let _h={promoteId:function({key:i,value:t}){if(Se(t)==="string")return Is({key:i,value:t});{let r=[];for(let l in t)r.push(...Is({key:`${i}.${l}`,value:t[l]}));return r}}};function ra(i){let t=i.value,r=i.key,l=i.styleSpec,u=i.style;if(!t.type)return[new zt(r,t,'"type" is required')];let f=ce(t.type),m;switch(f){case"vector":case"raster":case"raster-dem":return m=Kr({key:r,value:t,valueSpec:l[`source_${f.replace("-","_")}`],style:i.style,styleSpec:l,objectElementValidators:_h}),m;case"geojson":if(m=Kr({key:r,value:t,valueSpec:l.source_geojson,style:u,styleSpec:l,objectElementValidators:_h}),t.cluster)for(let x in t.clusterProperties){let[b,E]=t.clusterProperties[x],A=typeof b=="string"?[b,["accumulated"],["get",x]]:b;m.push(...Ts({key:`${r}.${x}.map`,value:E,expressionContext:"cluster-map"})),m.push(...Ts({key:`${r}.${x}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return m;case"video":return Kr({key:r,value:t,valueSpec:l.source_video,style:u,styleSpec:l});case"image":return Kr({key:r,value:t,valueSpec:l.source_image,style:u,styleSpec:l});case"canvas":return[new zt(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qa({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:u,styleSpec:l})}}function na(i){let t=i.value,r=i.styleSpec,l=r.light,u=i.style,f=[],m=Se(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new zt("light",t,`object expected, ${m} found`)]),f;for(let x in t){let b=x.match(/^(.*)-transition$/);f=f.concat(b&&l[b[1]]&&l[b[1]].transition?hr({key:x,value:t[x],valueSpec:r.transition,style:u,styleSpec:r}):l[x]?hr({key:x,value:t[x],valueSpec:l[x],style:u,styleSpec:r}):[new zt(x,t[x],`unknown property "${x}"`)])}return f}let vr={"*":()=>[],array:hh,boolean:function(i){let t=i.value,r=i.key,l=Se(t);return l!=="boolean"?[new zt(r,t,`boolean expected, ${l} found`)]:[]},number:ch,color:function(i){let t=i.key,r=i.value,l=Se(r);return l!=="string"?[new zt(t,r,`color expected, ${l} found`)]:Xr(r)===null?[new zt(t,r,`color expected, "${r}" found`)]:[]},constants:Ee,enum:qa,filter:ea,function:uh,layer:yh,object:Kr,source:ra,light:na,string:Is,formatted:function(i){return Is(i).length===0?[]:Ts(i)},resolvedImage:function(i){return Is(i).length===0?[]:Ts(i)}};function hr(i){let t=i.value,r=i.valueSpec,l=i.styleSpec;return r.expression&&Ra(ce(t))?uh(i):r.expression&&Oa(Ve(t))?Ts(i):r.type&&vr[r.type]?vr[r.type](i):Kr(Ae({},i,{valueSpec:r.type?l[r.type]:r}))}function Xc(i){let t=i.value,r=i.key,l=Is(i);return l.length||(t.indexOf("{fontstack}")===-1&&l.push(new zt(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&l.push(new zt(r,t,'"glyphs" url must include a "{range}" token'))),l}function Gn(i,t=ct){let r=[];return r=r.concat(hr({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,objectElementValidators:{glyphs:Xc,"*":()=>[]}})),i.constants&&(r=r.concat(Ee({key:"constants",value:i.constants,style:i,styleSpec:t}))),xh(r)}function xh(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function Cs(i){return function(...t){return xh(i.apply(this,t))}}Gn.source=Cs(ra),Gn.light=Cs(na),Gn.layer=Cs(yh),Gn.filter=Cs(ea),Gn.paintProperty=Cs(mh),Gn.layoutProperty=Cs(gh);let qn=Gn,Kc=qn.light,ol=qn.paintProperty,Jc=qn.layoutProperty;function vh(i,t){let r=!1;if(t&&t.length)for(let l of t)i.fire(new Ft(new Error(l.message))),r=!0;return r}class jn{constructor(t,r,l){let u=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let m=new Int32Array(this.arrayBuffer);t=m[0],this.d=(r=m[1])+2*(l=m[2]);for(let b=0;b<this.d*this.d;b++){let E=m[3+b],A=m[3+b+1];u.push(E===A?null:m.subarray(E,A))}let x=m[3+u.length+1];this.keys=m.subarray(m[3+u.length],x),this.bboxes=m.subarray(x),this.insert=this._insertReadonly}else{this.d=r+2*l;for(let m=0;m<this.d*this.d;m++)u.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=l,this.scale=r/t,this.uid=0;let f=l/r*t;this.min=-f,this.max=t+f}insert(t,r,l,u,f){this._forEachCell(r,l,u,f,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(l),this.bboxes.push(u),this.bboxes.push(f)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,l,u,f,m){this.cells[f].push(m)}query(t,r,l,u,f){let m=this.min,x=this.max;if(t<=m&&r<=m&&x<=l&&x<=u&&!f)return Array.prototype.slice.call(this.keys);{let b=[];return this._forEachCell(t,r,l,u,this._queryCell,b,{},f),b}}_queryCell(t,r,l,u,f,m,x,b){let E=this.cells[f];if(E!==null){let A=this.keys,z=this.bboxes;for(let R=0;R<E.length;R++){let O=E[R];if(x[O]===void 0){let G=4*O;(b?b(z[G+0],z[G+1],z[G+2],z[G+3]):t<=z[G+2]&&r<=z[G+3]&&l>=z[G+0]&&u>=z[G+1])?(x[O]=!0,m.push(A[O])):x[O]=!1}}}}_forEachCell(t,r,l,u,f,m,x,b){let E=this._convertToCellCoord(t),A=this._convertToCellCoord(r),z=this._convertToCellCoord(l),R=this._convertToCellCoord(u);for(let O=E;O<=z;O++)for(let G=A;G<=R;G++){let tt=this.d*G+O;if((!b||b(this._convertFromCellCoord(O),this._convertFromCellCoord(G),this._convertFromCellCoord(O+1),this._convertFromCellCoord(G+1)))&&f.call(this,t,r,l,u,tt,m,x,b))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,l=0;for(let m=0;m<this.cells.length;m++)l+=this.cells[m].length;let u=new Int32Array(r+l+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;let f=r;for(let m=0;m<t.length;m++){let x=t[m];u[3+m]=f,u.set(x,f),f+=x.length}return u[3+t.length]=f,u.set(this.keys,f),f+=this.keys.length,u[3+t.length+1]=f,u.set(this.bboxes,f),f+=this.bboxes.length,u.buffer}static serialize(t,r){let l=t.toArrayBuffer();return r&&r.push(l),{buffer:l}}static deserialize(t){return new jn(t.buffer)}}let As={};function ie(i,t,r={}){Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),As[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}ie("Object",Object),ie("TransferableGridIndex",jn),ie("Color",P),ie("Error",Error),ie("AJAXError",ti),ie("ResolvedImage",st),ie("StylePropertyFunction",Ss),ie("StyleExpression",rl,{omit:["_evaluator"]}),ie("ZoomDependentExpression",Va),ie("ZoomConstantExpression",Ua),ie("CompoundExpression",Te,{omit:["_evaluate"]});for(let i in ws)ws[i]._classRegistryKey||ie(`Expression_${i}`,ws[i]);function ll(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function sa(i,t){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(ll(i)||Oi(i))return t&&t.push(i),i;if(ArrayBuffer.isView(i)){let r=i;return t&&t.push(r.buffer),r}if(i instanceof ImageData)return t&&t.push(i.data.buffer),i;if(Array.isArray(i)){let r=[];for(let l of i)r.push(sa(l,t));return r}if(typeof i=="object"){let r=i.constructor,l=r._classRegistryKey;if(!l)throw new Error("can't serialize object of unregistered class");let u=r.serialize?r.serialize(i,t):{};if(!r.serialize){for(let f in i){if(!i.hasOwnProperty(f)||As[l].omit.indexOf(f)>=0)continue;let m=i[f];u[f]=As[l].shallow.indexOf(f)>=0?m:sa(m,t)}i instanceof Error&&(u.message=i.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return l!=="Object"&&(u.$name=l),u}throw new Error("can't serialize object of type "+typeof i)}function $n(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||ll(i)||Oi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map($n);if(typeof i=="object"){let t=i.$name||"Object";if(!As[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=As[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let l=Object.create(r.prototype);for(let u of Object.keys(i)){if(u==="$name")continue;let f=i[u];l[u]=As[t].shallow.indexOf(u)>=0?f:$n(f)}return l}throw new Error("can't deserialize object of type "+typeof i)}class aa{constructor(){this.first=!0}update(t,r){let l=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<l&&(this.lastIntegerZoom=l,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=l,!0))}}let Xt={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function hl(i){for(let t of i)if(oa(t.charCodeAt(0)))return!0;return!1}function bh(i){for(let t of i)if(!Yc(t.charCodeAt(0)))return!1;return!0}function Yc(i){return!(Xt.Arabic(i)||Xt["Arabic Supplement"](i)||Xt["Arabic Extended-A"](i)||Xt["Arabic Presentation Forms-A"](i)||Xt["Arabic Presentation Forms-B"](i))}function oa(i){return!(i!==746&&i!==747&&(i<4352||!(Xt["Bopomofo Extended"](i)||Xt.Bopomofo(i)||Xt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Xt["CJK Compatibility Ideographs"](i)||Xt["CJK Compatibility"](i)||Xt["CJK Radicals Supplement"](i)||Xt["CJK Strokes"](i)||!(!Xt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Xt["CJK Unified Ideographs Extension A"](i)||Xt["CJK Unified Ideographs"](i)||Xt["Enclosed CJK Letters and Months"](i)||Xt["Hangul Compatibility Jamo"](i)||Xt["Hangul Jamo Extended-A"](i)||Xt["Hangul Jamo Extended-B"](i)||Xt["Hangul Jamo"](i)||Xt["Hangul Syllables"](i)||Xt.Hiragana(i)||Xt["Ideographic Description Characters"](i)||Xt.Kanbun(i)||Xt["Kangxi Radicals"](i)||Xt["Katakana Phonetic Extensions"](i)||Xt.Katakana(i)&&i!==12540||!(!Xt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Xt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Xt["Unified Canadian Aboriginal Syllabics"](i)||Xt["Unified Canadian Aboriginal Syllabics Extended"](i)||Xt["Vertical Forms"](i)||Xt["Yijing Hexagram Symbols"](i)||Xt["Yi Syllables"](i)||Xt["Yi Radicals"](i))))}function wh(i){return!(oa(i)||function(t){return!!(Xt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Xt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Xt["Letterlike Symbols"](t)||Xt["Number Forms"](t)||Xt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Xt["Control Pictures"](t)&&t!==9251||Xt["Optical Character Recognition"](t)||Xt["Enclosed Alphanumerics"](t)||Xt["Geometric Shapes"](t)||Xt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Xt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Xt["CJK Symbols and Punctuation"](t)||Xt.Katakana(t)||Xt["Private Use Area"](t)||Xt["CJK Compatibility Forms"](t)||Xt["Small Form Variants"](t)||Xt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}function Mh(i){return i>=1424&&i<=2303||Xt["Arabic Presentation Forms-A"](i)||Xt["Arabic Presentation Forms-B"](i)}function Qc(i,t){return!(!t&&Mh(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Xt.Khmer(i))}function tu(i){for(let t of i)if(Mh(t.charCodeAt(0)))return!0;return!1}let Ha="deferred",cl="loading",ul="loaded",pl=null,cr="unavailable",In=null,Sh=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(cr="error"),pl&&pl(i)};function dl(){Ps.fire(new _t("pluginStateChange",{pluginStatus:cr,pluginURL:In}))}let Ps=new Vt,fl=function(){return cr},Xa=function(){if(cr!==Ha||!In)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");cr=cl,dl(),In&&Br({url:In},i=>{i?Sh(i):(cr=ul,dl())})},Fr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>cr===ul||Fr.applyArabicShaping!=null,isLoading:()=>cr===cl,setState(i){cr=i.pluginStatus,In=i.pluginURL},isParsed:()=>Fr.applyArabicShaping!=null&&Fr.processBidirectionalText!=null&&Fr.processStyledBidirectionalText!=null,getPluginURL:()=>In};class ci{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 aa,this.transition={})}isSupportedScript(t){return function(r,l){for(let u of r)if(!Qc(u.charCodeAt(0),l))return!1;return!0}(t,Fr.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),l=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*r}}}class Ka{constructor(t,r){this.property=t,this.value=r,this.expression=function(l,u){if(Ra(l))return new Ss(l,u);if(Oa(l)){let f=nl(l,u);if(f.result==="error")throw new Error(f.value.map(m=>`${m.key}: ${m.message}`).join(", "));return f.value}{let f=l;return typeof l=="string"&&u.type==="color"&&(f=P.parse(l)),{kind:"constant",evaluate:()=>f}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,l){return this.property.possiblyEvaluate(this,t,r,l)}}class Ja{constructor(t){this.property=t,this.value=new Ka(t,void 0)}transitioned(t,r){return new Th(this.property,this.value,r,pt({},t.transition,this.transition),t.now)}untransitioned(){return new Th(this.property,this.value,null,{},0)}}class ml{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Dt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ja(this._values[t].property)),this._values[t].value=new Ka(this._values[t].property,r===null?void 0:Dt(r))}getTransition(t){return Dt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ja(this._values[t].property)),this._values[t].transition=Dt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let l=this.getValue(r);l!==void 0&&(t[r]=l);let u=this.getTransition(r);u!==void 0&&(t[`${r}-transition`]=u)}return t}transitioned(t,r){let l=new Eh(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].transitioned(t,r._values[u]);return l}untransitioned(){let t=new Eh(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class Th{constructor(t,r,l,u,f){this.property=t,this.value=r,this.begin=f+u.delay||0,this.end=this.begin+u.duration||0,t.specification.transition&&(u.delay||u.duration)&&(this.prior=l)}possiblyEvaluate(t,r,l){let u=t.now||0,f=this.value.possiblyEvaluate(t,r,l),m=this.prior;if(m){if(u>this.end)return this.prior=null,f;if(this.value.isDataDriven())return this.prior=null,f;if(u<this.begin)return m.possiblyEvaluate(t,r,l);{let x=(u-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(t,r,l),f,function(b){if(b<=0)return 0;if(b>=1)return 1;let E=b*b,A=E*b;return 4*(b<.5?A:3*(b-E)+A-.75)}(x))}}return f}}class Eh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,l){let u=new Ya(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,l);return u}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class eu{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Dt(this._values[t].value)}setValue(t,r){this._values[t]=new Ka(this._values[t].property,r===null?void 0:Dt(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let l=this.getValue(r);l!==void 0&&(t[r]=l)}return t}possiblyEvaluate(t,r,l){let u=new Ya(this._properties);for(let f of Object.keys(this._values))u._values[f]=this._values[f].possiblyEvaluate(t,r,l);return u}}class on{constructor(t,r,l){this.property=t,this.value=r,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,l,u){return this.property.evaluate(this.value,this.parameters,t,r,l,u)}}class Ya{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class le{constructor(t){this.specification=t}possiblyEvaluate(t,r){return t.expression.evaluate(r)}interpolate(t,r,l){let u=Js[this.specification.type];return u?u(t,r,l):t}}class ye{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,l,u){return new on(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},l,u)}:t.expression,r)}interpolate(t,r,l){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new on(this,{kind:"constant",value:void 0},t.parameters);let u=Js[this.specification.type];return u?new on(this,{kind:"constant",value:u(t.value.value,r.value.value,l)},t.parameters):t}evaluate(t,r,l,u,f,m){return t.kind==="constant"?t.value:t.evaluate(r,l,u,f,m)}}class la extends ye{possiblyEvaluate(t,r,l,u){if(t.value===void 0)return new on(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},l,u),m=t.property.specification.type==="resolvedImage"&&typeof f!="string"?f.name:f,x=this._calculate(m,m,m,r);return new on(this,{kind:"constant",value:x},r)}if(t.expression.kind==="camera"){let f=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 on(this,{kind:"constant",value:f},r)}return new on(this,t.expression,r)}evaluate(t,r,l,u,f,m){if(t.kind==="source"){let x=t.evaluate(r,l,u,f,m);return this._calculate(x,x,x,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},l,u),t.evaluate({zoom:Math.floor(r.zoom)},l,u),t.evaluate({zoom:Math.floor(r.zoom)+1},l,u),r):t.value}_calculate(t,r,l,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class ha{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,u){if(t.value!==void 0){if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},l,u);return this._calculate(f,f,f,r)}return this._calculate(t.expression.evaluate(new ci(Math.floor(r.zoom-1),r)),t.expression.evaluate(new ci(Math.floor(r.zoom),r)),t.expression.evaluate(new ci(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,l,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:l,to:r}}interpolate(t){return t}}class gl{constructor(t){this.specification=t}possiblyEvaluate(t,r,l,u){return!!t.expression.evaluate(r,null,{},l,u)}interpolate(){return!1}}class Ni{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let l=t[r];l.specification.overridable&&this.overridableProperties.push(r);let u=this.defaultPropertyValues[r]=new Ka(l,void 0),f=this.defaultTransitionablePropertyValues[r]=new Ja(l);this.defaultTransitioningPropertyValues[r]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=u.possiblyEvaluate({})}}}ie("DataDrivenProperty",ye),ie("DataConstantProperty",le),ie("CrossFadedDataDrivenProperty",la),ie("CrossFadedProperty",ha),ie("ColorRampProperty",gl);let Wn="-transition";class ur extends Vt{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new eu(r.layout)),r.paint)){this._transitionablePaint=new ml(r.paint);for(let l in t.paint)this.setPaintProperty(l,t.paint[l],{validate:!1});for(let l in t.layout)this.setLayoutProperty(l,t.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,l={}){r!=null&&this._validate(Jc,`layers.${this.id}.layout.${t}`,t,r,l)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(Wn)?this._transitionablePaint.getTransition(t.slice(0,-Wn.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,l={}){if(r!=null&&this._validate(ol,`layers.${this.id}.paint.${t}`,t,r,l))return!1;if(t.endsWith(Wn))return this._transitionablePaint.setTransition(t.slice(0,-Wn.length),r||void 0),!1;{let u=this._transitionablePaint._values[t],f=u.property.specification["property-type"]==="cross-faded-data-driven",m=u.value.isDataDriven(),x=u.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let b=this._transitionablePaint._values[t].value;return b.isDataDriven()||m||f||this._handleOverridablePaintPropertyUpdate(t,x,b)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,l){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Ct(t,(r,l)=>!(r===void 0||l==="layout"&&!Object.keys(r).length||l==="paint"&&!Object.keys(r).length))}_validate(t,r,l,u,f={}){return(!f||f.validate!==!1)&&vh(this,t.call(qn,{key:r,layerType:this.type,objectKey:l,value:u,styleSpec:ct,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof on&&Ms(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let iu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ca{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}}class li{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(5*this.capacity),128),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 Ui(i,t=1){let r=0,l=0;return{members:i.map(u=>{let f=iu[u.type].BYTES_PER_ELEMENT,m=r=Ih(r,Math.max(t,f)),x=u.components||1;return l=Math.max(l,f),r+=f*x,{name:u.name,type:u.type,components:x,offset:m}}),size:Ih(r,Math.max(l,t)),alignment:t}}function Ih(i,t){return Math.ceil(i/t)*t}class zs extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.int16[u+0]=r,this.int16[u+1]=l,t}}zs.prototype.bytesPerElement=4,ie("StructArrayLayout2i4",zs);class ua extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=4*t;return this.int16[m+0]=r,this.int16[m+1]=l,this.int16[m+2]=u,this.int16[m+3]=f,t}}ua.prototype.bytesPerElement=8,ie("StructArrayLayout4i8",ua);class p extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=l,this.int16[b+2]=u,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}p.prototype.bytesPerElement=12,ie("StructArrayLayout2i4i12",p);class e extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=4*t,E=8*t;return this.int16[b+0]=r,this.int16[b+1]=l,this.uint8[E+4]=u,this.uint8[E+5]=f,this.uint8[E+6]=m,this.uint8[E+7]=x,t}}e.prototype.bytesPerElement=8,ie("StructArrayLayout2i4ub8",e);class s extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.float32[u+0]=r,this.float32[u+1]=l,t}}s.prototype.bytesPerElement=8,ie("StructArrayLayout2f8",s);class c extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m,x,b,E,A){let z=this.length;return this.resize(z+1),this.emplace(z,t,r,l,u,f,m,x,b,E,A)}emplace(t,r,l,u,f,m,x,b,E,A,z){let R=10*t;return this.uint16[R+0]=r,this.uint16[R+1]=l,this.uint16[R+2]=u,this.uint16[R+3]=f,this.uint16[R+4]=m,this.uint16[R+5]=x,this.uint16[R+6]=b,this.uint16[R+7]=E,this.uint16[R+8]=A,this.uint16[R+9]=z,t}}c.prototype.bytesPerElement=20,ie("StructArrayLayout10ui20",c);class d extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m,x,b,E,A,z,R){let O=this.length;return this.resize(O+1),this.emplace(O,t,r,l,u,f,m,x,b,E,A,z,R)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O){let G=12*t;return this.int16[G+0]=r,this.int16[G+1]=l,this.int16[G+2]=u,this.int16[G+3]=f,this.uint16[G+4]=m,this.uint16[G+5]=x,this.uint16[G+6]=b,this.uint16[G+7]=E,this.int16[G+8]=A,this.int16[G+9]=z,this.int16[G+10]=R,this.int16[G+11]=O,t}}d.prototype.bytesPerElement=24,ie("StructArrayLayout4i4ui4i24",d);class y extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.float32[f+0]=r,this.float32[f+1]=l,this.float32[f+2]=u,t}}y.prototype.bytesPerElement=12,ie("StructArrayLayout3f12",y);class v extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}v.prototype.bytesPerElement=4,ie("StructArrayLayout1ul4",v);class w extends li{_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(t,r,l,u,f,m,x,b,E){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,l,u,f,m,x,b,E)}emplace(t,r,l,u,f,m,x,b,E,A){let z=10*t,R=5*t;return this.int16[z+0]=r,this.int16[z+1]=l,this.int16[z+2]=u,this.int16[z+3]=f,this.int16[z+4]=m,this.int16[z+5]=x,this.uint32[R+3]=b,this.uint16[z+8]=E,this.uint16[z+9]=A,t}}w.prototype.bytesPerElement=20,ie("StructArrayLayout6i1ul2ui20",w);class T extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,l,u,f,m)}emplace(t,r,l,u,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=l,this.int16[b+2]=u,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}T.prototype.bytesPerElement=12,ie("StructArrayLayout2i2i2i12",T);class C extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l,u,f){let m=this.length;return this.resize(m+1),this.emplace(m,t,r,l,u,f)}emplace(t,r,l,u,f,m){let x=4*t,b=8*t;return this.float32[x+0]=r,this.float32[x+1]=l,this.float32[x+2]=u,this.int16[b+6]=f,this.int16[b+7]=m,t}}C.prototype.bytesPerElement=16,ie("StructArrayLayout2f1f2i16",C);class k extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=12*t,x=3*t;return this.uint8[m+0]=r,this.uint8[m+1]=l,this.float32[x+1]=u,this.float32[x+2]=f,t}}k.prototype.bytesPerElement=12,ie("StructArrayLayout2ub2f12",k);class F extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.uint16[f+0]=r,this.uint16[f+1]=l,this.uint16[f+2]=u,t}}F.prototype.bytesPerElement=6,ie("StructArrayLayout3ui6",F);class j extends li{_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(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt){let bt=this.length;return this.resize(bt+1),this.emplace(bt,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt){let xt=24*t,Et=12*t,Ot=48*t;return this.int16[xt+0]=r,this.int16[xt+1]=l,this.uint16[xt+2]=u,this.uint16[xt+3]=f,this.uint32[Et+2]=m,this.uint32[Et+3]=x,this.uint32[Et+4]=b,this.uint16[xt+10]=E,this.uint16[xt+11]=A,this.uint16[xt+12]=z,this.float32[Et+7]=R,this.float32[Et+8]=O,this.uint8[Ot+36]=G,this.uint8[Ot+37]=tt,this.uint8[Ot+38]=et,this.uint32[Et+10]=dt,this.int16[xt+22]=bt,t}}j.prototype.bytesPerElement=48,ie("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",j);class Y extends li{_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(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee){let Qt=this.length;return this.resize(Qt+1),this.emplace(Qt,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee)}emplace(t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt,et,dt,bt,xt,Et,Ot,Lt,re,ue,Jt,Yt,Zt,ee,Qt){let qt=34*t,_e=17*t;return this.int16[qt+0]=r,this.int16[qt+1]=l,this.int16[qt+2]=u,this.int16[qt+3]=f,this.int16[qt+4]=m,this.int16[qt+5]=x,this.int16[qt+6]=b,this.int16[qt+7]=E,this.uint16[qt+8]=A,this.uint16[qt+9]=z,this.uint16[qt+10]=R,this.uint16[qt+11]=O,this.uint16[qt+12]=G,this.uint16[qt+13]=tt,this.uint16[qt+14]=et,this.uint16[qt+15]=dt,this.uint16[qt+16]=bt,this.uint16[qt+17]=xt,this.uint16[qt+18]=Et,this.uint16[qt+19]=Ot,this.uint16[qt+20]=Lt,this.uint16[qt+21]=re,this.uint16[qt+22]=ue,this.uint32[_e+12]=Jt,this.float32[_e+13]=Yt,this.float32[_e+14]=Zt,this.float32[_e+15]=ee,this.float32[_e+16]=Qt,t}}Y.prototype.bytesPerElement=68,ie("StructArrayLayout8i15ui1ul4f68",Y);class $ extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}$.prototype.bytesPerElement=4,ie("StructArrayLayout1f4",$);class J extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=3*t;return this.int16[f+0]=r,this.int16[f+1]=l,this.int16[f+2]=u,t}}J.prototype.bytesPerElement=6,ie("StructArrayLayout3i6",J);class lt extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,l)}emplace(t,r,l,u){let f=4*t;return this.uint32[2*t+0]=r,this.uint16[f+2]=l,this.uint16[f+3]=u,t}}lt.prototype.bytesPerElement=8,ie("StructArrayLayout1ul2ui8",lt);class ht extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let l=this.length;return this.resize(l+1),this.emplace(l,t,r)}emplace(t,r,l){let u=2*t;return this.uint16[u+0]=r,this.uint16[u+1]=l,t}}ht.prototype.bytesPerElement=4,ie("StructArrayLayout2ui4",ht);class gt extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}gt.prototype.bytesPerElement=2,ie("StructArrayLayout1ui2",gt);class ut extends li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,l,u){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,l,u)}emplace(t,r,l,u,f){let m=4*t;return this.float32[m+0]=r,this.float32[m+1]=l,this.float32[m+2]=u,this.float32[m+3]=f,t}}ut.prototype.bytesPerElement=16,ie("StructArrayLayout4f16",ut);class kt extends ca{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 ve(this.anchorPointX,this.anchorPointY)}}kt.prototype.size=20;class Mt extends w{get(t){return new kt(this,t)}}ie("CollisionBoxArray",Mt);class Tt extends ca{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Tt.prototype.size=48;class Ut extends j{get(t){return new Tt(this,t)}}ie("PlacedSymbolArray",Ut);class $t extends ca{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}$t.prototype.size=68;class Pt extends Y{get(t){return new $t(this,t)}}ie("SymbolInstanceArray",Pt);class se extends ${getoffsetX(t){return this.float32[1*t+0]}}ie("GlyphOffsetArray",se);class Kt extends J{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ie("SymbolLineVertexArray",Kt);class we extends ca{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]}}we.prototype.size=8;class Ue extends lt{get(t){return new we(this,t)}}ie("FeatureIndexArray",Ue);class De extends zs{}class Oe extends zs{}class xi extends p{}class Me extends e{}class je extends s{}class ii extends c{}class Hi extends d{}class br extends y{}class Or extends v{}class Nr extends T{}class Cn extends k{}class pr extends F{}class ln extends ht{}let Zn=Ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:wr}=Zn;class $e{constructor(t=[]){this.segments=t}prepareSegment(t,r,l,u){let f=this.segments[this.segments.length-1];return t>$e.MAX_VERTEX_ARRAY_LENGTH&&Ht(`Max vertices per segment is ${$e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!f||f.vertexLength+t>$e.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==u)&&(f={vertexOffset:r.length,primitiveOffset:l.length,vertexLength:0,primitiveLength:0},u!==void 0&&(f.sortKey=u),this.segments.push(f)),f}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,l,u){return new $e([{vertexOffset:t,primitiveOffset:r,vertexLength:l,primitiveLength:u,vaos:{},sortKey:0}])}}function Ke(i,t){return 256*(i=L(Math.floor(i),0,255))+L(Math.floor(t),0,255)}$e.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ie("SegmentVector",$e);let ki=Ui([{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 sr={exports:{}},ui={exports:{}};ui.exports=function(i,t){var r,l,u,f,m,x,b,E;for(l=i.length-(r=3&i.length),u=t,m=3432918353,x=461845907,E=0;E<l;)b=255&i.charCodeAt(E)|(255&i.charCodeAt(++E))<<8|(255&i.charCodeAt(++E))<<16|(255&i.charCodeAt(++E))<<24,++E,u=27492+(65535&(f=5*(65535&(u=(u^=b=(65535&(b=(b=(65535&b)*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(b=0,r){case 3:b^=(255&i.charCodeAt(E+2))<<16;case 2:b^=(255&i.charCodeAt(E+1))<<8;case 1:u^=b=(65535&(b=(b=(65535&(b^=255&i.charCodeAt(E)))*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0};var Hn={exports:{}};Hn.exports=function(i,t){for(var r,l=i.length,u=t^l,f=0;l>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(r>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),l-=4,++f;switch(l){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0};var hn=ui.exports,Qa=Hn.exports;sr.exports=hn,sr.exports.murmur3=hn,sr.exports.murmur2=Qa;var yl=sr.exports;class to{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,l,u){this.ids.push(Ch(t)),this.positions.push(r,l,u)}getPositions(t){let r=Ch(t),l=0,u=this.ids.length-1;for(;l<u;){let m=l+u>>1;this.ids[m]>=r?u=m:l=m+1}let f=[];for(;this.ids[l]===r;)f.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return f}static serialize(t,r){let l=new Float64Array(t.ids),u=new Uint32Array(t.positions);return Xn(l,u,0,l.length-1),r&&r.push(l.buffer,u.buffer),{ids:l,positions:u}}static deserialize(t){let r=new to;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Ch(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:yl(String(i))}function Xn(i,t,r,l){for(;r<l;){let u=i[r+l>>1],f=r-1,m=l+1;for(;;){do f++;while(i[f]<u);do m--;while(i[m]>u);if(f>=m)break;eo(i,f,m),eo(t,3*f,3*m),eo(t,3*f+1,3*m+1),eo(t,3*f+2,3*m+2)}m-r<l-m?(Xn(i,t,r,m),r=m+1):(Xn(i,t,m+1,l),l=m)}}function eo(i,t,r){let l=i[t];i[t]=i[r],i[r]=l}ie("FeaturePositionMap",to);class cn{constructor(t,r){this.gl=t.gl,this.location=r}}class ks extends cn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class vp extends cn{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]))}}class bp extends cn{constructor(t,r){super(t,r),this.current=P.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))}}let Ag=new Float32Array(16);function ru(i){return[Ke(255*i.r,255*i.g),Ke(255*i.b,255*i.a)]}class _l{constructor(t,r,l){this.value=t,this.uniformNames=r.map(u=>`u_${u}`),this.type=l}setUniform(t,r,l){t.set(l.constantOr(this.value))}getBinding(t,r,l){return this.type==="color"?new bp(t,r):new ks(t,r)}}class io{constructor(t,r){this.uniformNames=r.map(l=>`u_${l}`),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,l,u){let f=u==="u_pattern_to"?this.patternTo:u==="u_pattern_from"?this.patternFrom:u==="u_pixel_ratio_to"?this.pixelRatioTo:u==="u_pixel_ratio_from"?this.pixelRatioFrom:null;f&&t.set(f)}getBinding(t,r,l){return l.substr(0,9)==="u_pattern"?new vp(t,r):new ks(t,r)}}class Kn{constructor(t,r,l,u){this.expression=t,this.type=l,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new u}populatePaintArray(t,r,l,u,f){let m=this.paintVertexArray.length,x=this.expression.evaluate(new ci(0),r,{},u,[],f);this.paintVertexArray.resize(t),this._setPaintValue(m,t,x)}updatePaintArray(t,r,l,u){let f=this.expression.evaluate({zoom:0},l,u);this._setPaintValue(t,r,f)}_setPaintValue(t,r,l){if(this.type==="color"){let u=ru(l);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,u[0],u[1])}else{for(let u=t;u<r;u++)this.paintVertexArray.emplace(u,l);this.maxValue=Math.max(this.maxValue,Math.abs(l))}}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()}}class _n{constructor(t,r,l,u,f,m){this.expression=t,this.uniformNames=r.map(x=>`u_${x}_t`),this.type=l,this.useIntegerZoom=u,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=r.map(x=>({name:`a_${x}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(t,r,l,u,f){let m=this.expression.evaluate(new ci(this.zoom),r,{},u,[],f),x=this.expression.evaluate(new ci(this.zoom+1),r,{},u,[],f),b=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(b,t,m,x)}updatePaintArray(t,r,l,u){let f=this.expression.evaluate({zoom:this.zoom},l,u),m=this.expression.evaluate({zoom:this.zoom+1},l,u);this._setPaintValue(t,r,f,m)}_setPaintValue(t,r,l,u){if(this.type==="color"){let f=ru(l),m=ru(u);for(let x=t;x<r;x++)this.paintVertexArray.emplace(x,f[0],f[1],m[0],m[1])}else{for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,l,u);this.maxValue=Math.max(this.maxValue,Math.abs(l),Math.abs(u))}}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 l=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,u=L(this.expression.interpolationFactor(l,this.zoom,this.zoom+1),0,1);t.set(u)}getBinding(t,r,l){return new ks(t,r)}}class Ls{constructor(t,r,l,u,f,m){this.expression=t,this.type=r,this.useIntegerZoom=l,this.zoom=u,this.layerId=m,this.zoomInPaintVertexArray=new f,this.zoomOutPaintVertexArray=new f}populatePaintArray(t,r,l){let u=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(u,t,r.patterns&&r.patterns[this.layerId],l)}updatePaintArray(t,r,l,u,f){this._setPaintValues(t,r,l.patterns&&l.patterns[this.layerId],f)}_setPaintValues(t,r,l,u){if(!u||!l)return;let{min:f,mid:m,max:x}=l,b=u[f],E=u[m],A=u[x];if(b&&E&&A)for(let z=t;z<r;z++)this.zoomInPaintVertexArray.emplace(z,E.tl[0],E.tl[1],E.br[0],E.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],E.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(z,E.tl[0],E.tl[1],E.br[0],E.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],E.pixelRatio,A.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ki.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ki.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class wp{constructor(t,r,l){this.binders={},this._buffers=[];let u=[];for(let f in t.paint._values){if(!l(f))continue;let m=t.paint.get(f);if(!(m instanceof on&&Ms(m.property.specification)))continue;let x=Pg(f,t.type),b=m.value,E=m.property.specification.type,A=m.property.useIntegerZoom,z=m.property.specification["property-type"],R=z==="cross-faded"||z==="cross-faded-data-driven";if(b.kind==="constant")this.binders[f]=R?new io(b.value,x):new _l(b.value,x,E),u.push(`/u_${f}`);else if(b.kind==="source"||R){let O=Mp(f,E,"source");this.binders[f]=R?new Ls(b,E,A,r,O,t.id):new Kn(b,x,E,O),u.push(`/a_${f}`)}else{let O=Mp(f,E,"composite");this.binders[f]=new _n(b,x,E,A,r,O),u.push(`/z_${f}`)}}this.cacheKey=u.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Kn||r instanceof _n?r.maxValue:0}populatePaintArrays(t,r,l,u,f){for(let m in this.binders){let x=this.binders[m];(x instanceof Kn||x instanceof _n||x instanceof Ls)&&x.populatePaintArray(t,r,l,u,f)}}setConstantPatternPositions(t,r){for(let l in this.binders){let u=this.binders[l];u instanceof io&&u.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,l,u,f){let m=!1;for(let x in t){let b=r.getPositions(x);for(let E of b){let A=l.feature(E.index);for(let z in this.binders){let R=this.binders[z];if((R instanceof Kn||R instanceof _n||R instanceof Ls)&&R.expression.isStateDependent===!0){let O=u.paint.get(z);R.expression=O.value,R.updatePaintArray(E.start,E.end,A,t[x],f),m=!0}}}}return m}defines(){let t=[];for(let r in this.binders){let l=this.binders[r];(l instanceof _l||l instanceof io)&&t.push(...l.uniformNames.map(u=>`#define HAS_UNIFORM_${u}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let l=this.binders[r];if(l instanceof Kn||l instanceof _n)for(let u=0;u<l.paintVertexAttributes.length;u++)t.push(l.paintVertexAttributes[u].name);else if(l instanceof Ls)for(let u=0;u<ki.members.length;u++)t.push(ki.members[u].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let l=this.binders[r];if(l instanceof _l||l instanceof io||l instanceof _n)for(let u of l.uniformNames)t.push(u)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let l=[];for(let u in this.binders){let f=this.binders[u];if(f instanceof _l||f instanceof io||f instanceof _n){for(let m of f.uniformNames)if(r[m]){let x=f.getBinding(t,r[m],m);l.push({name:m,property:u,binding:x})}}}return l}setUniforms(t,r,l,u){for(let{name:f,property:m,binding:x}of r)this.binders[m].setUniform(x,u,l.get(m),f)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let l=this.binders[r];if(t&&l instanceof Ls){let u=t.fromScale===2?l.zoomInPaintVertexBuffer:l.zoomOutPaintVertexBuffer;u&&this._buffers.push(u)}else(l instanceof Kn||l instanceof _n)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer)}}upload(t){for(let r in this.binders){let l=this.binders[r];(l instanceof Kn||l instanceof _n||l instanceof Ls)&&l.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Kn||r instanceof _n||r instanceof Ls)&&r.destroy()}}}class pa{constructor(t,r,l=()=>!0){this.programConfigurations={};for(let u of t)this.programConfigurations[u.id]=new wp(u,r,l);this.needsUpload=!1,this._featureMap=new to,this._bufferOffset=0}populatePaintArrays(t,r,l,u,f,m){for(let x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(t,r,u,f,m);r.id!==void 0&&this._featureMap.add(r.id,l,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,l,u){for(let f of l)this.needsUpload=this.programConfigurations[f.id].updatePaintArrays(t,this._featureMap,r,f,u)||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 Pg(i,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"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function Mp(i,t,r){let l={color:{source:s,composite:ut},number:{source:$,composite:s}},u=function(f){return{"line-pattern":{source:ii,composite:ii},"fill-pattern":{source:ii,composite:ii},"fill-extrusion-pattern":{source:ii,composite:ii}}[f]}(i);return u&&u[r]||l[t][r]}ie("ConstantBinder",_l),ie("CrossFadedConstantBinder",io),ie("SourceExpressionBinder",Kn),ie("CrossFadedCompositeBinder",Ls),ie("CompositeExpressionBinder",_n),ie("ProgramConfiguration",wp,{omit:["_buffers"]}),ie("ProgramConfigurationSet",pa);var Vi=8192;let nu=Math.pow(2,14)-1,Sp=-nu-1;function da(i){let t=Vi/i.extent,r=i.loadGeometry();for(let l=0;l<r.length;l++){let u=r[l];for(let f=0;f<u.length;f++){let m=u[f],x=Math.round(m.x*t),b=Math.round(m.y*t);m.x=L(x,Sp,nu),m.y=L(b,Sp,nu),(x<m.x||x>m.x+1||b<m.y||b>m.y+1)&&Ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function fa(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?da(i):[]}}function Ah(i,t,r,l,u){i.emplaceBack(2*t+(l+1)/2,2*r+(u+1)/2)}class su{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 De,this.indexArray=new pr,this.segments=new $e,this.programConfigurations=new pa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){let u=this.layers[0],f=[],m=null,x=!1;u.type==="circle"&&(m=u.layout.get("circle-sort-key"),x=!m.isConstant());for(let{feature:b,id:E,index:A,sourceLayerIndex:z}of t){let R=this.layers[0]._featureFilter.needGeometry,O=fa(b,R);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),O,l))continue;let G=x?m.evaluate(O,{},l):void 0,tt={id:E,properties:b.properties,type:b.type,sourceLayerIndex:z,index:A,geometry:R?O.geometry:da(b),patterns:{},sortKey:G};f.push(tt)}x&&f.sort((b,E)=>b.sortKey-E.sortKey);for(let b of f){let{geometry:E,index:A,sourceLayerIndex:z}=b,R=t[A].feature;this.addFeature(b,E,A,l),r.featureIndex.insert(R,E,A,z,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wr),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,l,u){for(let f of r)for(let m of f){let x=m.x,b=m.y;if(x<0||x>=Vi||b<0||b>=Vi)continue;let E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),A=E.vertexLength;Ah(this.layoutVertexArray,x,b,-1,-1),Ah(this.layoutVertexArray,x,b,1,-1),Ah(this.layoutVertexArray,x,b,1,1),Ah(this.layoutVertexArray,x,b,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),E.vertexLength+=4,E.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,{},u)}}function Tp(i,t){for(let r=0;r<i.length;r++)if(ro(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(ro(i,t[r]))return!0;return!!au(i,t)}function zg(i,t,r){return!!ro(i,t)||!!ou(t,i,r)}function Ep(i,t){if(i.length===1)return Cp(t,i[0]);for(let r=0;r<t.length;r++){let l=t[r];for(let u=0;u<l.length;u++)if(ro(i,l[u]))return!0}for(let r=0;r<i.length;r++)if(Cp(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(au(i,t[r]))return!0;return!1}function kg(i,t,r){if(i.length>1){if(au(i,t))return!0;for(let l=0;l<t.length;l++)if(ou(t[l],i,r))return!0}for(let l=0;l<i.length;l++)if(ou(i[l],t,r))return!0;return!1}function au(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let l=i[r],u=i[r+1];for(let f=0;f<t.length-1;f++)if(Lg(l,u,t[f],t[f+1]))return!0}return!1}function Lg(i,t,r,l){return fe(i,r,l)!==fe(t,r,l)&&fe(i,t,r)!==fe(i,t,l)}function ou(i,t,r){let l=r*r;if(t.length===1)return i.distSqr(t[0])<l;for(let u=1;u<t.length;u++)if(Ip(i,t[u-1],t[u])<l)return!0;return!1}function Ip(i,t,r){let l=t.distSqr(r);if(l===0)return i.distSqr(t);let u=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/l;return i.distSqr(u<0?t:u>1?r:r.sub(t)._mult(u)._add(t))}function Cp(i,t){let r,l,u,f=!1;for(let m=0;m<i.length;m++){r=i[m];for(let x=0,b=r.length-1;x<r.length;b=x++)l=r[x],u=r[b],l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(f=!f)}return f}function ro(i,t){let r=!1;for(let l=0,u=i.length-1;l<i.length;u=l++){let f=i[l],m=i[u];f.y>t.y!=m.y>t.y&&t.x<(m.x-f.x)*(t.y-f.y)/(m.y-f.y)+f.x&&(r=!r)}return r}function Dg(i,t,r){let l=r[0],u=r[2];if(i.x<l.x&&t.x<l.x||i.x>u.x&&t.x>u.x||i.y<l.y&&t.y<l.y||i.y>u.y&&t.y>u.y)return!1;let f=fe(i,t,r[0]);return f!==fe(i,t,r[1])||f!==fe(i,t,r[2])||f!==fe(i,t,r[3])}function xl(i,t,r){let l=t.paint.get(i).value;return l.kind==="constant"?l.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Ph(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function zh(i,t,r,l,u){if(!t[0]&&!t[1])return i;let f=ve.convert(t)._mult(u);r==="viewport"&&f._rotate(-l);let m=[];for(let x=0;x<i.length;x++)m.push(i[x].sub(f));return m}ie("CircleBucket",su,{omit:["layers"]});let Rg=new Ni({"circle-sort-key":new ye(ct.layout_circle["circle-sort-key"])});var Bg={paint:new Ni({"circle-radius":new ye(ct.paint_circle["circle-radius"]),"circle-color":new ye(ct.paint_circle["circle-color"]),"circle-blur":new ye(ct.paint_circle["circle-blur"]),"circle-opacity":new ye(ct.paint_circle["circle-opacity"]),"circle-translate":new le(ct.paint_circle["circle-translate"]),"circle-translate-anchor":new le(ct.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new le(ct.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new le(ct.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ye(ct.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ye(ct.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ye(ct.paint_circle["circle-stroke-opacity"])}),layout:Rg},no=typeof Float32Array<"u"?Float32Array:Array;function lu(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Ap(i,t,r){var l=t[0],u=t[1],f=t[2],m=t[3],x=t[4],b=t[5],E=t[6],A=t[7],z=t[8],R=t[9],O=t[10],G=t[11],tt=t[12],et=t[13],dt=t[14],bt=t[15],xt=r[0],Et=r[1],Ot=r[2],Lt=r[3];return i[0]=xt*l+Et*x+Ot*z+Lt*tt,i[1]=xt*u+Et*b+Ot*R+Lt*et,i[2]=xt*f+Et*E+Ot*O+Lt*dt,i[3]=xt*m+Et*A+Ot*G+Lt*bt,i[4]=(xt=r[4])*l+(Et=r[5])*x+(Ot=r[6])*z+(Lt=r[7])*tt,i[5]=xt*u+Et*b+Ot*R+Lt*et,i[6]=xt*f+Et*E+Ot*O+Lt*dt,i[7]=xt*m+Et*A+Ot*G+Lt*bt,i[8]=(xt=r[8])*l+(Et=r[9])*x+(Ot=r[10])*z+(Lt=r[11])*tt,i[9]=xt*u+Et*b+Ot*R+Lt*et,i[10]=xt*f+Et*E+Ot*O+Lt*dt,i[11]=xt*m+Et*A+Ot*G+Lt*bt,i[12]=(xt=r[12])*l+(Et=r[13])*x+(Ot=r[14])*z+(Lt=r[15])*tt,i[13]=xt*u+Et*b+Ot*R+Lt*et,i[14]=xt*f+Et*E+Ot*O+Lt*dt,i[15]=xt*m+Et*A+Ot*G+Lt*bt,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var vl,Fg=Ap;function kh(i,t,r){var l=t[0],u=t[1],f=t[2],m=t[3];return i[0]=r[0]*l+r[4]*u+r[8]*f+r[12]*m,i[1]=r[1]*l+r[5]*u+r[9]*f+r[13]*m,i[2]=r[2]*l+r[6]*u+r[10]*f+r[14]*m,i[3]=r[3]*l+r[7]*u+r[11]*f+r[15]*m,i}function Pp(i,t){let r=kh([],[i.x,i.y,0,1],t);return new ve(r[0]/r[3],r[1]/r[3])}vl=new no(4),no!=Float32Array&&(vl[0]=0,vl[1]=0,vl[2]=0,vl[3]=0);class zp extends su{}ie("HeatmapBucket",zp,{omit:["layers"]});var Og={paint:new Ni({"heatmap-radius":new ye(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ye(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new le(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new gl(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new le(ct.paint_heatmap["heatmap-opacity"])})};function hu(i,{width:t,height:r},l,u){if(u){if(u instanceof Uint8ClampedArray)u=new Uint8Array(u.buffer);else if(u.length!==t*r*l)throw new RangeError(`mismatched image size. expected: ${u.length} but got: ${t*r*l}`)}else u=new Uint8Array(t*r*l);return i.width=t,i.height=r,i.data=u,i}function kp(i,{width:t,height:r},l){if(t===i.width&&r===i.height)return;let u=hu({},{width:t,height:r},l);cu(i,u,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},l),i.width=t,i.height=r,i.data=u.data}function cu(i,t,r,l,u,f){if(u.width===0||u.height===0)return t;if(u.width>i.width||u.height>i.height||r.x>i.width-u.width||r.y>i.height-u.height)throw new RangeError("out of range source coordinates for image copy");if(u.width>t.width||u.height>t.height||l.x>t.width-u.width||l.y>t.height-u.height)throw new RangeError("out of range destination coordinates for image copy");let m=i.data,x=t.data;for(let b=0;b<u.height;b++){let E=((r.y+b)*i.width+r.x)*f,A=((l.y+b)*t.width+l.x)*f;for(let z=0;z<u.width*f;z++)x[A+z]=m[E+z]}return t}class bl{constructor(t,r){hu(this,t,1,r)}resize(t){kp(this,t,1)}clone(){return new bl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,l,u,f){cu(t,r,l,u,f,1)}}class Jr{constructor(t,r){hu(this,t,4,r)}resize(t){kp(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Jr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,l,u,f){cu(t,r,l,u,f,4)}}function Lp(i){let t={},r=i.resolution||256,l=i.clips?i.clips.length:1,u=i.image||new Jr({width:r,height:l}),f=(m,x,b)=>{t[i.evaluationKey]=b;let E=i.expression.evaluate(t);u.data[m+x+0]=Math.floor(255*E.r/E.a),u.data[m+x+1]=Math.floor(255*E.g/E.a),u.data[m+x+2]=Math.floor(255*E.b/E.a),u.data[m+x+3]=Math.floor(255*E.a)};if(i.clips)for(let m=0,x=0;m<l;++m,x+=4*r)for(let b=0,E=0;b<r;b++,E+=4){let A=b/(r-1),{start:z,end:R}=i.clips[m];f(x,E,z*(1-A)+R*A)}else for(let m=0,x=0;m<r;m++,x+=4)f(0,x,m/(r-1));return u}ie("AlphaImage",bl),ie("RGBAImage",Jr);var Ng={paint:new Ni({"hillshade-illumination-direction":new le(ct.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new le(ct.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new le(ct.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new le(ct.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new le(ct.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new le(ct.paint_hillshade["hillshade-accent-color"])})};let Ug=Ui([{name:"a_pos",components:2,type:"Int16"}],4),{members:Vg}=Ug;var uu={exports:{}};function Lh(i,t,r){r=r||2;var l,u,f,m,x,b,E,A=t&&t.length,z=A?t[0]*r:i.length,R=Dp(i,0,z,r,!0),O=[];if(!R||R.next===R.prev)return O;if(A&&(R=function(tt,et,dt,bt){var xt,Et,Ot,Lt=[];for(xt=0,Et=et.length;xt<Et;xt++)(Ot=Dp(tt,et[xt]*bt,xt<Et-1?et[xt+1]*bt:tt.length,bt,!1))===Ot.next&&(Ot.steiner=!0),Lt.push(Xg(Ot));for(Lt.sort(Wg),xt=0;xt<Lt.length;xt++)dt=Ds(dt=Zg(Lt[xt],dt),dt.next);return dt}(i,t,R,r)),i.length>80*r){l=f=i[0],u=m=i[1];for(var G=r;G<z;G+=r)(x=i[G])<l&&(l=x),(b=i[G+1])<u&&(u=b),x>f&&(f=x),b>m&&(m=b);E=(E=Math.max(f-l,m-u))!==0?1/E:0}return wl(R,O,r,l,u,E),O}function Dp(i,t,r,l,u){var f,m;if(u===fu(i,t,r,l)>0)for(f=t;f<r;f+=l)m=Fp(f,i[f],i[f+1],m);else for(f=r-l;f>=t;f-=l)m=Fp(f,i[f],i[f+1],m);return m&&Dh(m,m.next)&&(Sl(m),m=m.next),m}function Ds(i,t){if(!i)return i;t||(t=i);var r,l=i;do if(r=!1,l.steiner||!Dh(l,l.next)&&Ei(l.prev,l,l.next)!==0)l=l.next;else{if(Sl(l),(l=t=l.prev)===l.next)break;r=!0}while(r||l!==t);return t}function wl(i,t,r,l,u,f,m){if(i){!m&&f&&function(A,z,R,O){var G=A;do G.z===null&&(G.z=pu(G.x,G.y,z,R,O)),G.prevZ=G.prev,G.nextZ=G.next,G=G.next;while(G!==A);G.prevZ.nextZ=null,G.prevZ=null,function(tt){var et,dt,bt,xt,Et,Ot,Lt,re,ue=1;do{for(dt=tt,tt=null,Et=null,Ot=0;dt;){for(Ot++,bt=dt,Lt=0,et=0;et<ue&&(Lt++,bt=bt.nextZ);et++);for(re=ue;Lt>0||re>0&&bt;)Lt!==0&&(re===0||!bt||dt.z<=bt.z)?(xt=dt,dt=dt.nextZ,Lt--):(xt=bt,bt=bt.nextZ,re--),Et?Et.nextZ=xt:tt=xt,xt.prevZ=Et,Et=xt;dt=bt}Et.nextZ=null,ue*=2}while(Ot>1)}(G)}(i,l,u,f);for(var x,b,E=i;i.prev!==i.next;)if(x=i.prev,b=i.next,f?qg(i,l,u,f):Gg(i))t.push(x.i/r),t.push(i.i/r),t.push(b.i/r),Sl(i),i=b.next,E=b.next;else if((i=b)===E){m?m===1?wl(i=jg(Ds(i),t,r),t,r,l,u,f,2):m===2&&$g(i,t,r,l,u,f):wl(Ds(i),t,r,l,u,f,1);break}}}function Gg(i){var t=i.prev,r=i,l=i.next;if(Ei(t,r,l)>=0)return!1;for(var u=i.next.next;u!==i.prev;){if(so(t.x,t.y,r.x,r.y,l.x,l.y,u.x,u.y)&&Ei(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function qg(i,t,r,l){var u=i.prev,f=i,m=i.next;if(Ei(u,f,m)>=0)return!1;for(var x=u.x>f.x?u.x>m.x?u.x:m.x:f.x>m.x?f.x:m.x,b=u.y>f.y?u.y>m.y?u.y:m.y:f.y>m.y?f.y:m.y,E=pu(u.x<f.x?u.x<m.x?u.x:m.x:f.x<m.x?f.x:m.x,u.y<f.y?u.y<m.y?u.y:m.y:f.y<m.y?f.y:m.y,t,r,l),A=pu(x,b,t,r,l),z=i.prevZ,R=i.nextZ;z&&z.z>=E&&R&&R.z<=A;){if(z!==i.prev&&z!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Ei(z.prev,z,z.next)>=0||(z=z.prevZ,R!==i.prev&&R!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Ei(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;z&&z.z>=E;){if(z!==i.prev&&z!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Ei(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;R&&R.z<=A;){if(R!==i.prev&&R!==i.next&&so(u.x,u.y,f.x,f.y,m.x,m.y,R.x,R.y)&&Ei(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function jg(i,t,r){var l=i;do{var u=l.prev,f=l.next.next;!Dh(u,f)&&Rp(u,l,l.next,f)&&Ml(u,f)&&Ml(f,u)&&(t.push(u.i/r),t.push(l.i/r),t.push(f.i/r),Sl(l),Sl(l.next),l=i=f),l=l.next}while(l!==i);return Ds(l)}function $g(i,t,r,l,u,f){var m=i;do{for(var x=m.next.next;x!==m.prev;){if(m.i!==x.i&&Kg(m,x)){var b=Bp(m,x);return m=Ds(m,m.next),b=Ds(b,b.next),wl(m,t,r,l,u,f),void wl(b,t,r,l,u,f)}x=x.next}m=m.next}while(m!==i)}function Wg(i,t){return i.x-t.x}function Zg(i,t){var r=function(f,m){var x,b=m,E=f.x,A=f.y,z=-1/0;do{if(A<=b.y&&A>=b.next.y&&b.next.y!==b.y){var R=b.x+(A-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(R<=E&&R>z){if(z=R,R===E){if(A===b.y)return b;if(A===b.next.y)return b.next}x=b.x<b.next.x?b:b.next}}b=b.next}while(b!==m);if(!x)return null;if(E===z)return x;var O,G=x,tt=x.x,et=x.y,dt=1/0;b=x;do E>=b.x&&b.x>=tt&&E!==b.x&&so(A<et?E:z,A,tt,et,A<et?z:E,A,b.x,b.y)&&(O=Math.abs(A-b.y)/(E-b.x),Ml(b,f)&&(O<dt||O===dt&&(b.x>x.x||b.x===x.x&&Hg(x,b)))&&(x=b,dt=O)),b=b.next;while(b!==G);return x}(i,t);if(!r)return t;var l=Bp(r,i),u=Ds(r,r.next);return Ds(l,l.next),t===r?u:t}function Hg(i,t){return Ei(i.prev,i,t.prev)<0&&Ei(t.next,i,i.next)<0}function pu(i,t,r,l,u){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*u)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-l)*u)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Xg(i){var t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function so(i,t,r,l,u,f,m,x){return(u-m)*(t-x)-(i-m)*(f-x)>=0&&(i-m)*(l-x)-(r-m)*(t-x)>=0&&(r-m)*(f-x)-(u-m)*(l-x)>=0}function Kg(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,l){var u=r;do{if(u.i!==r.i&&u.next.i!==r.i&&u.i!==l.i&&u.next.i!==l.i&&Rp(u,u.next,r,l))return!0;u=u.next}while(u!==r);return!1}(i,t)&&(Ml(i,t)&&Ml(t,i)&&function(r,l){var u=r,f=!1,m=(r.x+l.x)/2,x=(r.y+l.y)/2;do u.y>x!=u.next.y>x&&u.next.y!==u.y&&m<(u.next.x-u.x)*(x-u.y)/(u.next.y-u.y)+u.x&&(f=!f),u=u.next;while(u!==r);return f}(i,t)&&(Ei(i.prev,i,t.prev)||Ei(i,t.prev,t))||Dh(i,t)&&Ei(i.prev,i,i.next)>0&&Ei(t.prev,t,t.next)>0)}function Ei(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Dh(i,t){return i.x===t.x&&i.y===t.y}function Rp(i,t,r,l){var u=Bh(Ei(i,t,r)),f=Bh(Ei(i,t,l)),m=Bh(Ei(r,l,i)),x=Bh(Ei(r,l,t));return u!==f&&m!==x||!(u!==0||!Rh(i,r,t))||!(f!==0||!Rh(i,l,t))||!(m!==0||!Rh(r,i,l))||!(x!==0||!Rh(r,t,l))}function Rh(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Bh(i){return i>0?1:i<0?-1:0}function Ml(i,t){return Ei(i.prev,i,i.next)<0?Ei(i,t,i.next)>=0&&Ei(i,i.prev,t)>=0:Ei(i,t,i.prev)<0||Ei(i,i.next,t)<0}function Bp(i,t){var r=new du(i.i,i.x,i.y),l=new du(t.i,t.x,t.y),u=i.next,f=t.prev;return i.next=t,t.prev=i,r.next=u,u.prev=r,l.next=r,r.prev=l,f.next=l,l.prev=f,l}function Fp(i,t,r,l){var u=new du(i,t,r);return l?(u.next=l.next,u.prev=l,l.next.prev=u,l.next=u):(u.prev=u,u.next=u),u}function Sl(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function du(i,t,r){this.i=i,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function fu(i,t,r,l){for(var u=0,f=t,m=r-l;f<r;f+=l)u+=(i[m]-i[f])*(i[f+1]+i[m+1]),m=f;return u}uu.exports=Lh,uu.exports.default=Lh,Lh.deviation=function(i,t,r,l){var u=t&&t.length,f=Math.abs(fu(i,0,u?t[0]*r:i.length,r));if(u)for(var m=0,x=t.length;m<x;m++)f-=Math.abs(fu(i,t[m]*r,m<x-1?t[m+1]*r:i.length,r));var b=0;for(m=0;m<l.length;m+=3){var E=l[m]*r,A=l[m+1]*r,z=l[m+2]*r;b+=Math.abs((i[E]-i[z])*(i[A+1]-i[E+1])-(i[E]-i[A])*(i[z+1]-i[E+1]))}return f===0&&b===0?0:Math.abs((b-f)/f)},Lh.flatten=function(i){for(var t=i[0][0].length,r={vertices:[],holes:[],dimensions:t},l=0,u=0;u<i.length;u++){for(var f=0;f<i[u].length;f++)for(var m=0;m<t;m++)r.vertices.push(i[u][f][m]);u>0&&r.holes.push(l+=i[u-1].length)}return r};var Op=uu.exports;function Jg(i,t,r,l,u){Np(i,t,r||0,l||i.length-1,u||Yg)}function Np(i,t,r,l,u){for(;l>r;){if(l-r>600){var f=l-r+1,m=t-r+1,x=Math.log(f),b=.5*Math.exp(2*x/3),E=.5*Math.sqrt(x*b*(f-b)/f)*(m-f/2<0?-1:1);Np(i,t,Math.max(r,Math.floor(t-m*b/f+E)),Math.min(l,Math.floor(t+(f-m)*b/f+E)),u)}var A=i[t],z=r,R=l;for(Tl(i,r,t),u(i[l],A)>0&&Tl(i,r,l);z<R;){for(Tl(i,z,R),z++,R--;u(i[z],A)<0;)z++;for(;u(i[R],A)>0;)R--}u(i[r],A)===0?Tl(i,r,R):Tl(i,++R,l),R<=t&&(r=R+1),t<=R&&(l=R-1)}}function Tl(i,t,r){var l=i[t];i[t]=i[r],i[r]=l}function Yg(i,t){return i<t?-1:i>t?1:0}function mu(i,t){let r=i.length;if(r<=1)return[i];let l=[],u,f;for(let m=0;m<r;m++){let x=me(i[m]);x!==0&&(i[m].area=Math.abs(x),f===void 0&&(f=x<0),f===x<0?(u&&l.push(u),u=[i[m]]):u.push(i[m]))}if(u&&l.push(u),t>1)for(let m=0;m<l.length;m++)l[m].length<=t||(Jg(l[m],t,1,l[m].length-1,Qg),l[m]=l[m].slice(0,t));return l}function Qg(i,t){return t.area-i.area}function gu(i,t,r){let l=r.patternDependencies,u=!1;for(let f of t){let m=f.paint.get(`${i}-pattern`);m.isConstant()||(u=!0);let x=m.constantOr(null);x&&(u=!0,l[x.to]=!0,l[x.from]=!0)}return u}function yu(i,t,r,l,u){let f=u.patternDependencies;for(let m of t){let x=m.paint.get(`${i}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:l-1},r,{},u.availableImages),E=x.evaluate({zoom:l},r,{},u.availableImages),A=x.evaluate({zoom:l+1},r,{},u.availableImages);b=b&&b.name?b.name:b,E=E&&E.name?E.name:E,A=A&&A.name?A.name:A,f[b]=!0,f[E]=!0,f[A]=!0,r.patterns[m.id]={min:b,mid:E,max:A}}}return r}class _u{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 Oe,this.indexArray=new pr,this.indexArray2=new ln,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.segments2=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=gu("fill",this.layers,r);let u=this.layers[0].layout.get("fill-sort-key"),f=!u.isConstant(),m=[];for(let{feature:x,id:b,index:E,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,R=fa(x,z);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),R,l))continue;let O=f?u.evaluate(R,{},l,r.availableImages):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:da(x),patterns:{},sortKey:O};m.push(G)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:E,sourceLayerIndex:A}=x;if(this.hasPattern){let z=yu("fill",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,l,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vg),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,l,u,f){for(let m of mu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray),E=b.vertexLength,A=[],z=[];for(let O of m){if(O.length===0)continue;O!==m[0]&&z.push(A.length/2);let G=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),tt=G.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(tt+O.length-1,tt),A.push(O[0].x),A.push(O[0].y);for(let et=1;et<O.length;et++)this.layoutVertexArray.emplaceBack(O[et].x,O[et].y),this.indexArray2.emplaceBack(tt+et-1,tt+et),A.push(O[et].x),A.push(O[et].y);G.vertexLength+=O.length,G.primitiveLength+=O.length}let R=Op(A,z);for(let O=0;O<R.length;O+=3)this.indexArray.emplaceBack(E+R[O],E+R[O+1],E+R[O+2]);b.vertexLength+=x,b.primitiveLength+=R.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,f,u)}}ie("FillBucket",_u,{omit:["layers","patternFeatures"]});let ty=new Ni({"fill-sort-key":new ye(ct.layout_fill["fill-sort-key"])});var ey={paint:new Ni({"fill-antialias":new le(ct.paint_fill["fill-antialias"]),"fill-opacity":new ye(ct.paint_fill["fill-opacity"]),"fill-color":new ye(ct.paint_fill["fill-color"]),"fill-outline-color":new ye(ct.paint_fill["fill-outline-color"]),"fill-translate":new le(ct.paint_fill["fill-translate"]),"fill-translate-anchor":new le(ct.paint_fill["fill-translate-anchor"]),"fill-pattern":new la(ct.paint_fill["fill-pattern"])}),layout:ty};let iy=Ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:ry}=iy;var Rs={},ny=ve,Up=ao;function ao(i,t,r,l,u){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=l,this._values=u,i.readFields(sy,this,t)}function sy(i,t,r){i==1?t.id=r.readVarint():i==2?function(l,u){for(var f=l.readVarint()+l.pos;l.pos<f;){var m=u._keys[l.readVarint()],x=u._values[l.readVarint()];u.properties[m]=x}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function ay(i){for(var t,r,l=0,u=0,f=i.length,m=f-1;u<f;m=u++)l+=((r=i[m]).x-(t=i[u]).x)*(t.y+r.y);return l}ao.types=["Unknown","Point","LineString","Polygon"],ao.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,l=1,u=0,f=0,m=0,x=[];i.pos<r;){if(u<=0){var b=i.readVarint();l=7&b,u=b>>3}if(u--,l===1||l===2)f+=i.readSVarint(),m+=i.readSVarint(),l===1&&(t&&x.push(t),t=[]),t.push(new ny(f,m));else{if(l!==7)throw new Error("unknown command "+l);t&&t.push(t[0].clone())}}return t&&x.push(t),x},ao.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,l=0,u=0,f=0,m=1/0,x=-1/0,b=1/0,E=-1/0;i.pos<t;){if(l<=0){var A=i.readVarint();r=7&A,l=A>>3}if(l--,r===1||r===2)(u+=i.readSVarint())<m&&(m=u),u>x&&(x=u),(f+=i.readSVarint())<b&&(b=f),f>E&&(E=f);else if(r!==7)throw new Error("unknown command "+r)}return[m,b,x,E]},ao.prototype.toGeoJSON=function(i,t,r){var l,u,f=this.extent*Math.pow(2,r),m=this.extent*i,x=this.extent*t,b=this.loadGeometry(),E=ao.types[this.type];function A(O){for(var G=0;G<O.length;G++){var tt=O[G];O[G]=[360*(tt.x+m)/f-180,360/Math.PI*Math.atan(Math.exp((180-360*(tt.y+x)/f)*Math.PI/180))-90]}}switch(this.type){case 1:var z=[];for(l=0;l<b.length;l++)z[l]=b[l][0];A(b=z);break;case 2:for(l=0;l<b.length;l++)A(b[l]);break;case 3:for(b=function(O){var G=O.length;if(G<=1)return[O];for(var tt,et,dt=[],bt=0;bt<G;bt++){var xt=ay(O[bt]);xt!==0&&(et===void 0&&(et=xt<0),et===xt<0?(tt&&dt.push(tt),tt=[O[bt]]):tt.push(O[bt]))}return tt&&dt.push(tt),dt}(b),l=0;l<b.length;l++)for(u=0;u<b[l].length;u++)A(b[l][u])}b.length===1?b=b[0]:E="Multi"+E;var R={type:"Feature",geometry:{type:E,coordinates:b},properties:this.properties};return"id"in this&&(R.id=this.id),R};var oy=Up,Vp=Gp;function Gp(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(ly,this,t),this.length=this._features.length}function ly(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push(function(l){for(var u=null,f=l.readVarint()+l.pos;l.pos<f;){var m=l.readVarint()>>3;u=m===1?l.readString():m===2?l.readFloat():m===3?l.readDouble():m===4?l.readVarint64():m===5?l.readVarint():m===6?l.readSVarint():m===7?l.readBoolean():null}return u}(r))}Gp.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new oy(this._pbf,t,this.extent,this._keys,this._values)};var hy=Vp;function cy(i,t,r){if(i===3){var l=new hy(r,r.readVarint()+r.pos);l.length&&(t[l.name]=l)}}Rs.VectorTile=function(i,t){this.layers=i.readFields(cy,{},t)},Rs.VectorTileFeature=Up,Rs.VectorTileLayer=Vp;let uy=Rs.VectorTileFeature.types,xu=Math.pow(2,13);function El(i,t,r,l,u,f,m,x){i.emplaceBack(t,r,2*Math.floor(l*xu)+m,u*xu*2,f*xu*2,Math.round(x))}class vu{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 xi,this.indexArray=new pr,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.features=[],this.hasPattern=gu("fill-extrusion",this.layers,r);for(let{feature:u,id:f,index:m,sourceLayerIndex:x}of t){let b=this.layers[0]._featureFilter.needGeometry,E=fa(u,b);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),E,l))continue;let A={id:f,sourceLayerIndex:x,index:m,geometry:b?E.geometry:da(u),properties:u.properties,type:u.type,patterns:{}};this.hasPattern?this.features.push(yu("fill-extrusion",this.layers,A,this.zoom,r)):this.addFeature(A,A.geometry,m,l,{}),r.featureIndex.insert(u,A.geometry,m,x,this.index,!0)}}addFeatures(t,r,l){for(let u of this.features){let{geometry:f}=u;this.addFeature(u,f,u.index,r,l)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ry),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,l,u,f){for(let m of mu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let O of m){if(O.length===0||dy(O))continue;let G=0;for(let tt=0;tt<O.length;tt++){let et=O[tt];if(tt>=1){let dt=O[tt-1];if(!py(et,dt)){b.vertexLength+4>$e.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let bt=et.sub(dt)._perp()._unit(),xt=dt.dist(et);G+xt>32768&&(G=0),El(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,0,G),El(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,1,G),G+=xt,El(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,0,G),El(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,1,G);let Et=b.vertexLength;this.indexArray.emplaceBack(Et,Et+2,Et+1),this.indexArray.emplaceBack(Et+1,Et+2,Et+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+x>$e.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),uy[t.type]!=="Polygon")continue;let E=[],A=[],z=b.vertexLength;for(let O of m)if(O.length!==0){O!==m[0]&&A.push(E.length/2);for(let G=0;G<O.length;G++){let tt=O[G];El(this.layoutVertexArray,tt.x,tt.y,0,0,1,1,0),E.push(tt.x),E.push(tt.y)}}let R=Op(E,A);for(let O=0;O<R.length;O+=3)this.indexArray.emplaceBack(z+R[O],z+R[O+2],z+R[O+1]);b.primitiveLength+=R.length/3,b.vertexLength+=x}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,f,u)}}function py(i,t){return i.x===t.x&&(i.x<0||i.x>Vi)||i.y===t.y&&(i.y<0||i.y>Vi)}function dy(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Vi)||i.every(t=>t.y<0)||i.every(t=>t.y>Vi)}ie("FillExtrusionBucket",vu,{omit:["layers","features"]});var fy={paint:new Ni({"fill-extrusion-opacity":new le(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ye(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new le(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new le(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new la(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ye(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ye(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new le(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Il(i,t){return i.x*t.x+i.y*t.y}function qp(i,t){if(i.length===1){let r=0,l=t[r++],u;for(;!u||l.equals(u);)if(u=t[r++],!u)return 1/0;for(;r<t.length;r++){let f=t[r],m=i[0],x=u.sub(l),b=f.sub(l),E=m.sub(l),A=Il(x,x),z=Il(x,b),R=Il(b,b),O=Il(E,x),G=Il(E,b),tt=A*R-z*z,et=(R*O-z*G)/tt,dt=(A*G-z*O)/tt,bt=l.z*(1-et-dt)+u.z*et+f.z*dt;if(isFinite(bt))return bt}return 1/0}{let r=1/0;for(let l of t)r=Math.min(r,l.z);return r}}let my=Ui([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:gy}=my,yy=Ui([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:_y}=yy,xy=Rs.VectorTileFeature.types,vy=Math.cos(Math.PI/180*37.5),jp=Math.pow(2,14)/.5;class bu{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 Me,this.layoutVertexArray2=new je,this.indexArray=new pr,this.programConfigurations=new pa(t.layers,t.zoom),this.segments=new $e,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,l){this.hasPattern=gu("line",this.layers,r);let u=this.layers[0].layout.get("line-sort-key"),f=!u.isConstant(),m=[];for(let{feature:x,id:b,index:E,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,R=fa(x,z);if(!this.layers[0]._featureFilter.filter(new ci(this.zoom),R,l))continue;let O=f?u.evaluate(R,{},l):void 0,G={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:E,geometry:z?R.geometry:da(x),patterns:{},sortKey:O};m.push(G)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:E,sourceLayerIndex:A}=x;if(this.hasPattern){let z=yu("line",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,E,l,{});r.featureIndex.insert(t[E].feature,b,E,A,this.index)}}update(t,r,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,l)}addFeatures(t,r,l){for(let u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,l)}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,_y)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gy),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"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,l,u,f){let m=this.layers[0].layout,x=m.get("line-join").evaluate(t,{}),b=m.get("line-cap"),E=m.get("line-miter-limit"),A=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let z of r)this.addLine(z,t,x,b,E,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,f,u)}addLine(t,r,l,u,f,m){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let dt=0;dt<t.length-1;dt++)this.totalDistance+=t[dt].dist(t[dt+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let x=xy[r.type]==="Polygon",b=t.length;for(;b>=2&&t[b-1].equals(t[b-2]);)b--;let E=0;for(;E<b-1&&t[E].equals(t[E+1]);)E++;if(b<(x?3:2))return;l==="bevel"&&(f=1.05);let A=this.overscaling<=16?122880/(512*this.overscaling):0,z=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray),R,O,G,tt,et;this.e1=this.e2=-1,x&&(R=t[b-2],et=t[E].sub(R)._unit()._perp());for(let dt=E;dt<b;dt++){if(G=dt===b-1?x?t[E+1]:void 0:t[dt+1],G&&t[dt].equals(G))continue;et&&(tt=et),R&&(O=R),R=t[dt],et=G?G.sub(R)._unit()._perp():tt,tt=tt||et;let bt=tt.add(et);bt.x===0&&bt.y===0||bt._unit();let xt=tt.x*et.x+tt.y*et.y,Et=bt.x*et.x+bt.y*et.y,Ot=Et!==0?1/Et:1/0,Lt=2*Math.sqrt(2-2*Et),re=Et<vy&&O&&G,ue=tt.x*et.y-tt.y*et.x>0;if(re&&dt>E){let Zt=R.dist(O);if(Zt>2*A){let ee=R.sub(R.sub(O)._mult(A/Zt)._round());this.updateDistance(O,ee),this.addCurrentVertex(ee,tt,0,0,z),O=ee}}let Jt=O&&G,Yt=Jt?l:x?"butt":u;if(Jt&&Yt==="round"&&(Ot<m?Yt="miter":Ot<=2&&(Yt="fakeround")),Yt==="miter"&&Ot>f&&(Yt="bevel"),Yt==="bevel"&&(Ot>2&&(Yt="flipbevel"),Ot<f&&(Yt="miter")),O&&this.updateDistance(O,R),Yt==="miter")bt._mult(Ot),this.addCurrentVertex(R,bt,0,0,z);else if(Yt==="flipbevel"){if(Ot>100)bt=et.mult(-1);else{let Zt=Ot*tt.add(et).mag()/tt.sub(et).mag();bt._perp()._mult(Zt*(ue?-1:1))}this.addCurrentVertex(R,bt,0,0,z),this.addCurrentVertex(R,bt.mult(-1),0,0,z)}else if(Yt==="bevel"||Yt==="fakeround"){let Zt=-Math.sqrt(Ot*Ot-1),ee=ue?Zt:0,Qt=ue?0:Zt;if(O&&this.addCurrentVertex(R,tt,ee,Qt,z),Yt==="fakeround"){let qt=Math.round(180*Lt/Math.PI/20);for(let _e=1;_e<qt;_e++){let de=_e/qt;if(de!==.5){let Je=de-.5;de+=de*Je*(de-1)*((1.0904+xt*(xt*(3.55645-1.43519*xt)-3.2452))*Je*Je+(.848013+xt*(.215638*xt-1.06021)))}let Ne=et.sub(tt)._mult(de)._add(tt)._unit()._mult(ue?-1:1);this.addHalfVertex(R,Ne.x,Ne.y,!1,ue,0,z)}}G&&this.addCurrentVertex(R,et,-ee,-Qt,z)}else if(Yt==="butt")this.addCurrentVertex(R,bt,0,0,z);else if(Yt==="square"){let Zt=O?1:-1;this.addCurrentVertex(R,bt,Zt,Zt,z)}else Yt==="round"&&(O&&(this.addCurrentVertex(R,tt,0,0,z),this.addCurrentVertex(R,tt,1,1,z,!0)),G&&(this.addCurrentVertex(R,et,-1,-1,z,!0),this.addCurrentVertex(R,et,0,0,z)));if(re&&dt<b-1){let Zt=R.dist(G);if(Zt>2*A){let ee=R.add(G.sub(R)._mult(A/Zt)._round());this.updateDistance(R,ee),this.addCurrentVertex(ee,et,0,0,z),R=ee}}}}addCurrentVertex(t,r,l,u,f,m=!1){let x=r.y*u-r.x,b=-r.y-r.x*u;this.addHalfVertex(t,r.x+r.y*l,r.y-r.x*l,m,!1,l,f),this.addHalfVertex(t,x,b,m,!0,-u,f),this.distance>jp/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(t,r,l,u,f,m))}addHalfVertex({x:t,y:r},l,u,f,m,x,b){let E=.5*(this.lineClips?this.scaledDistance*(jp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(f?1:0),(r<<1)+(m?1:0),Math.round(63*l)+128,Math.round(63*u)+128,1+(x===0?0:x<0?-1:1)|(63&E)<<2,E>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let A=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),b.primitiveLength++),m?this.e2=A:this.e1=A}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()}}ie("LineBucket",bu,{omit:["layers","patternFeatures"]});let by=new Ni({"line-cap":new le(ct.layout_line["line-cap"]),"line-join":new ye(ct.layout_line["line-join"]),"line-miter-limit":new le(ct.layout_line["line-miter-limit"]),"line-round-limit":new le(ct.layout_line["line-round-limit"]),"line-sort-key":new ye(ct.layout_line["line-sort-key"])});var $p={paint:new Ni({"line-opacity":new ye(ct.paint_line["line-opacity"]),"line-color":new ye(ct.paint_line["line-color"]),"line-translate":new le(ct.paint_line["line-translate"]),"line-translate-anchor":new le(ct.paint_line["line-translate-anchor"]),"line-width":new ye(ct.paint_line["line-width"]),"line-gap-width":new ye(ct.paint_line["line-gap-width"]),"line-offset":new ye(ct.paint_line["line-offset"]),"line-blur":new ye(ct.paint_line["line-blur"]),"line-dasharray":new ha(ct.paint_line["line-dasharray"]),"line-pattern":new la(ct.paint_line["line-pattern"]),"line-gradient":new gl(ct.paint_line["line-gradient"])}),layout:by};let Wp=new class extends ye{possiblyEvaluate(i,t){return t=new ci(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(i,t)}evaluate(i,t,r,l){return t=pt({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(i,t,r,l)}}($p.paint.properties["line-width"].specification);function Zp(i,t){return t>0?t+2*i:i}Wp.useIntegerZoom=!0;let wy=Ui([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),My=Ui([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ui([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Sy=Ui([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ui([{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"}]);let Hp=Ui([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ty=Ui([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ey(i,t,r){return i.sections.forEach(l=>{l.text=function(u,f,m){let x=f.layout.get("text-transform").evaluate(m,{});return x==="uppercase"?u=u.toLocaleUpperCase():x==="lowercase"&&(u=u.toLocaleLowerCase()),Fr.applyArabicShaping&&(u=Fr.applyArabicShaping(u)),u}(l.text,t,r)}),i}Ui([{name:"triangle",components:3,type:"Uint16"}]),Ui([{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"}]),Ui([{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"}]),Ui([{type:"Float32",name:"offsetX"}]),Ui([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);let Cl={"!":"\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"};var Xi=24,wu=ri,Xp=function(i,t,r,l,u){var f,m,x=8*u-l-1,b=(1<<x)-1,E=b>>1,A=-7,z=r?u-1:0,R=r?-1:1,O=i[t+z];for(z+=R,f=O&(1<<-A)-1,O>>=-A,A+=x;A>0;f=256*f+i[t+z],z+=R,A-=8);for(m=f&(1<<-A)-1,f>>=-A,A+=l;A>0;m=256*m+i[t+z],z+=R,A-=8);if(f===0)f=1-E;else{if(f===b)return m?NaN:1/0*(O?-1:1);m+=Math.pow(2,l),f-=E}return(O?-1:1)*m*Math.pow(2,f-l)},Kp=function(i,t,r,l,u,f){var m,x,b,E=8*f-u-1,A=(1<<E)-1,z=A>>1,R=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=l?0:f-1,G=l?1:-1,tt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,m=A):(m=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-m))<1&&(m--,b*=2),(t+=m+z>=1?R/b:R*Math.pow(2,1-z))*b>=2&&(m++,b/=2),m+z>=A?(x=0,m=A):m+z>=1?(x=(t*b-1)*Math.pow(2,u),m+=z):(x=t*Math.pow(2,z-1)*Math.pow(2,u),m=0));u>=8;i[r+O]=255&x,O+=G,x/=256,u-=8);for(m=m<<u|x,E+=u;E>0;i[r+O]=255&m,O+=G,m/=256,E-=8);i[r+O-G]|=128*tt};function ri(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ri.Varint=0,ri.Fixed64=1,ri.Bytes=2,ri.Fixed32=5;var Bs,Mu=4294967296,Jp=1/Mu,Yp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Jn(i){return i.type===ri.Bytes?i.readVarint()+i.pos:i.pos+1}function oo(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Qp(i,t,r){var l=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(l);for(var u=r.pos-1;u>=i;u--)r.buf[u+l]=r.buf[u]}function Iy(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function Cy(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function Ay(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function Py(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function zy(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function ky(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function Ly(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function Dy(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function Ry(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function Fh(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function lo(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function td(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}function By(i,t,r){i===1&&r.readMessage(Fy,t)}function Fy(i,t,r){if(i===3){let{id:l,bitmap:u,width:f,height:m,left:x,top:b,advance:E}=r.readMessage(Oy,{});t.push({id:l,bitmap:new bl({width:f+6,height:m+6},u),metrics:{width:f,height:m,left:x,top:b,advance:E}})}}function Oy(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}function ed(i){let t=0,r=0;for(let m of i)t+=m.w*m.h,r=Math.max(r,m.w);i.sort((m,x)=>x.h-m.h);let l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],u=0,f=0;for(let m of i)for(let x=l.length-1;x>=0;x--){let b=l[x];if(!(m.w>b.w||m.h>b.h)){if(m.x=b.x,m.y=b.y,f=Math.max(f,m.y+m.h),u=Math.max(u,m.x+m.w),m.w===b.w&&m.h===b.h){let E=l.pop();x<l.length&&(l[x]=E)}else m.h===b.h?(b.x+=m.w,b.w-=m.w):m.w===b.w?(b.y+=m.h,b.h-=m.h):(l.push({x:b.x+m.w,y:b.y,w:b.w-m.w,h:m.h}),b.y+=m.h,b.h-=m.h);break}}return{w:u,h:f,fill:t/(u*f)||0}}ri.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var l=this.readVarint(),u=l>>3,f=this.pos;this.type=7&l,i(u,t,this),this.pos===f&&this.skip(l)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Fh(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=td(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Fh(this.buf,this.pos)+Fh(this.buf,this.pos+4)*Mu;return this.pos+=8,i},readSFixed64:function(){var i=Fh(this.buf,this.pos)+td(this.buf,this.pos+4)*Mu;return this.pos+=8,i},readFloat:function(){var i=Xp(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Xp(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,l=this.buf;return t=127&(r=l[this.pos++]),r<128?t:(t|=(127&(r=l[this.pos++]))<<7,r<128?t:(t|=(127&(r=l[this.pos++]))<<14,r<128?t:(t|=(127&(r=l[this.pos++]))<<21,r<128?t:function(u,f,m){var x,b,E=m.buf;if(x=(112&(b=E[m.pos++]))>>4,b<128||(x|=(127&(b=E[m.pos++]))<<3,b<128)||(x|=(127&(b=E[m.pos++]))<<10,b<128)||(x|=(127&(b=E[m.pos++]))<<17,b<128)||(x|=(127&(b=E[m.pos++]))<<24,b<128)||(x|=(1&(b=E[m.pos++]))<<31,b<128))return oo(u,x,f);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=l[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Yp?function(r,l,u){return Yp.decode(r.subarray(l,u))}(this.buf,t,i):function(r,l,u){for(var f="",m=l;m<u;){var x,b,E,A=r[m],z=null,R=A>239?4:A>223?3:A>191?2:1;if(m+R>u)break;R===1?A<128&&(z=A):R===2?(192&(x=r[m+1]))==128&&(z=(31&A)<<6|63&x)<=127&&(z=null):R===3?(b=r[m+2],(192&(x=r[m+1]))==128&&(192&b)==128&&((z=(15&A)<<12|(63&x)<<6|63&b)<=2047||z>=55296&&z<=57343)&&(z=null)):R===4&&(b=r[m+2],E=r[m+3],(192&(x=r[m+1]))==128&&(192&b)==128&&(192&E)==128&&((z=(15&A)<<18|(63&x)<<12|(63&b)<<6|63&E)<=65535||z>=1114112)&&(z=null)),z===null?(z=65533,R=1):z>65535&&(z-=65536,f+=String.fromCharCode(z>>>10&1023|55296),z=56320|1023&z),f+=String.fromCharCode(z),m+=R}return f}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==ri.Bytes)return i.push(this.readVarint(t));var r=Jn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ri.Bytes)return i.push(this.readSVarint());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ri.Bytes)return i.push(this.readBoolean());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ri.Bytes)return i.push(this.readFloat());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ri.Bytes)return i.push(this.readDouble());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ri.Bytes)return i.push(this.readFixed32());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ri.Bytes)return i.push(this.readSFixed32());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ri.Bytes)return i.push(this.readFixed64());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ri.Bytes)return i.push(this.readSFixed64());var t=Jn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ri.Varint)for(;this.buf[this.pos++]>127;);else if(t===ri.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ri.Fixed32)this.pos+=4;else{if(t!==ri.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)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(i){this.realloc(4),lo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),lo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),lo(this.buf,-1&i,this.pos),lo(this.buf,Math.floor(i*Jp),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),lo(this.buf,-1&i,this.pos),lo(this.buf,Math.floor(i*Jp),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var l,u;if(t>=0?(l=t%4294967296|0,u=t/4294967296|0):(u=~(-t/4294967296),4294967295^(l=~(-t%4294967296))?l=l+1|0:(l=0,u=u+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(f,m,x){x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,x.buf[x.pos]=127&(f>>>=7)}(l,0,r),function(f,m){var x=(7&f)<<4;m.buf[m.pos++]|=x|((f>>>=3)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f)))))}(u,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(l,u,f){for(var m,x,b=0;b<u.length;b++){if((m=u.charCodeAt(b))>55295&&m<57344){if(!x){m>56319||b+1===u.length?(l[f++]=239,l[f++]=191,l[f++]=189):x=m;continue}if(m<56320){l[f++]=239,l[f++]=191,l[f++]=189,x=m;continue}m=x-55296<<10|m-56320|65536,x=null}else x&&(l[f++]=239,l[f++]=191,l[f++]=189,x=null);m<128?l[f++]=m:(m<2048?l[f++]=m>>6|192:(m<65536?l[f++]=m>>12|224:(l[f++]=m>>18|240,l[f++]=m>>12&63|128),l[f++]=m>>6&63|128),l[f++]=63&m|128)}return f}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Qp(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Kp(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Kp(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var l=this.pos-r;l>=128&&Qp(r,l,this),this.pos=r-1,this.writeVarint(l),this.pos+=l},writeMessage:function(i,t,r){this.writeTag(i,ri.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,Iy,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,Cy,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,zy,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,Ay,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,Py,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,ky,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,Ly,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,Dy,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,Ry,t)},writeBytesField:function(i,t){this.writeTag(i,ri.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ri.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ri.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ri.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ri.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ri.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ri.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ri.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ri.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ri.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,Boolean(t))}};class Su{constructor(t,{pixelRatio:r,version:l,stretchX:u,stretchY:f,content:m}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=u,this.stretchY=f,this.content=m,this.version=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class id{constructor(t,r){let l={},u={};this.haveRenderCallbacks=[];let f=[];this.addImages(t,l,f),this.addImages(r,u,f);let{w:m,h:x}=ed(f),b=new Jr({width:m||1,height:x||1});for(let E in t){let A=t[E],z=l[E].paddedRect;Jr.copy(A.data,b,{x:0,y:0},{x:z.x+1,y:z.y+1},A.data)}for(let E in r){let A=r[E],z=u[E].paddedRect,R=z.x+1,O=z.y+1,G=A.data.width,tt=A.data.height;Jr.copy(A.data,b,{x:0,y:0},{x:R,y:O},A.data),Jr.copy(A.data,b,{x:0,y:tt-1},{x:R,y:O-1},{width:G,height:1}),Jr.copy(A.data,b,{x:0,y:0},{x:R,y:O+tt},{width:G,height:1}),Jr.copy(A.data,b,{x:G-1,y:0},{x:R-1,y:O},{width:1,height:tt}),Jr.copy(A.data,b,{x:0,y:0},{x:R+G,y:O},{width:1,height:tt})}this.image=b,this.iconPositions=l,this.patternPositions=u}addImages(t,r,l){for(let u in t){let f=t[u],m={x:0,y:0,w:f.data.width+2,h:f.data.height+2};l.push(m),r[u]=new Su(m,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(u)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let l in t.updatedImages)this.patchUpdatedImage(this.iconPositions[l],t.getImage(l),r),this.patchUpdatedImage(this.patternPositions[l],t.getImage(l),r)}patchUpdatedImage(t,r,l){if(!t||!r||t.version===r.version)return;t.version=r.version;let[u,f]=t.tl;l.update(r.data,void 0,{x:u,y:f})}}ie("ImagePosition",Su),ie("ImageAtlas",id),a.WritingMode=void 0,(Bs=a.WritingMode||(a.WritingMode={}))[Bs.none=0]="none",Bs[Bs.horizontal=1]="horizontal",Bs[Bs.vertical=2]="vertical",Bs[Bs.horizontalOnly=3]="horizontalOnly";let Oh=-17;class Al{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let l=new Al;return l.scale=t||1,l.fontStack=r,l}static forImage(t){let r=new Al;return r.imageName=t,r}}class ho{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let l=new ho;for(let u=0;u<t.sections.length;u++){let f=t.sections[u];f.image?l.addImageSection(f):l.addTextSection(f,r)}return l}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=function(t){let r="";for(let l=0;l<t.length;l++){let u=t.charCodeAt(l+1)||null,f=t.charCodeAt(l-1)||null;r+=u&&wh(u)&&!Cl[t[l+1]]||f&&wh(f)&&!Cl[t[l-1]]||!Cl[t[l]]?t[l]:Cl[t[l]]}return r}(this.text)}trim(){let t=0;for(let l=0;l<this.text.length&&Uh[this.text.charCodeAt(l)];l++)t++;let r=this.text.length;for(let l=this.text.length-1;l>=0&&l>=t&&Uh[this.text.charCodeAt(l)];l--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let l=new ho;return l.text=this.text.substring(t,r),l.sectionIndex=this.sectionIndex.slice(t,r),l.sections=this.sections,l}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(Al.forText(t.scale,t.fontStack||r));let l=this.sections.length-1;for(let u=0;u<t.text.length;++u)this.sectionIndex.push(l)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void Ht("Can't add FormattedSection with an empty image.");let l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCharCode(l),this.sections.push(Al.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Nh(i,t,r,l,u,f,m,x,b,E,A,z,R,O,G,tt){let et=ho.fromFeature(i,u),dt;z===a.WritingMode.vertical&&et.verticalizePunctuation();let{processBidirectionalText:bt,processStyledBidirectionalText:xt}=Fr;if(bt&&et.sections.length===1){dt=[];let Lt=bt(et.toString(),Tu(et,E,f,t,l,O,G));for(let re of Lt){let ue=new ho;ue.text=re,ue.sections=et.sections;for(let Jt=0;Jt<re.length;Jt++)ue.sectionIndex.push(0);dt.push(ue)}}else if(xt){dt=[];let Lt=xt(et.text,et.sectionIndex,Tu(et,E,f,t,l,O,G));for(let re of Lt){let ue=new ho;ue.text=re[0],ue.sectionIndex=re[1],ue.sections=et.sections,dt.push(ue)}}else dt=function(Lt,re){let ue=[],Jt=Lt.text,Yt=0;for(let Zt of re)ue.push(Lt.substring(Yt,Zt)),Yt=Zt;return Yt<Jt.length&&ue.push(Lt.substring(Yt,Jt.length)),ue}(et,Tu(et,E,f,t,l,O,G));let Et=[],Ot={positionedLines:Et,text:et.toString(),top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:z,iconsInText:!1,verticalizable:!1};return function(Lt,re,ue,Jt,Yt,Zt,ee,Qt,qt,_e,de,Ne){let Je=0,pi=Oh,di=0,Qi=0,Li=Qt==="right"?1:Qt==="left"?0:.5,Di=0;for(let Ri of Yt){Ri.trim();let er=Ri.getMaxScale(),or=(er-1)*Xi,dr={positionedGlyphs:[],lineOffset:0};Lt.positionedLines[Di]=dr;let Sr=dr.positionedGlyphs,Tr=0;if(!Ri.length()){pi+=Zt,++Di;continue}for(let $i=0;$i<Ri.length();$i++){let Be=Ri.getSection($i),Ur=Ri.getSectionIndex($i),ir=Ri.getCharCode($i),lr=0,pn=null,xn=null,vn=null,Qn=Xi,dn=!(qt===a.WritingMode.horizontal||!de&&!oa(ir)||de&&(Uh[ir]||(ji=ir,Xt.Arabic(ji)||Xt["Arabic Supplement"](ji)||Xt["Arabic Extended-A"](ji)||Xt["Arabic Presentation Forms-A"](ji)||Xt["Arabic Presentation Forms-B"](ji))));if(Be.imageName){let Yr=Jt[Be.imageName];if(!Yr)continue;vn=Be.imageName,Lt.iconsInText=Lt.iconsInText||!0,xn=Yr.paddedRect;let Er=Yr.displaySize;Be.scale=Be.scale*Xi/Ne,pn={width:Er[0],height:Er[1],left:1,top:-3,advance:dn?Er[1]:Er[0]},lr=or+(Xi-Er[1]*Be.scale),Qn=pn.advance;let ts=dn?Er[0]*Be.scale-Xi*er:Er[1]*Be.scale-Xi*er;ts>0&&ts>Tr&&(Tr=ts)}else{let Yr=ue[Be.fontStack],Er=Yr&&Yr[ir];if(Er&&Er.rect)xn=Er.rect,pn=Er.metrics;else{let ts=re[Be.fontStack],kl=ts&&ts[ir];if(!kl)continue;pn=kl.metrics}lr=(er-Be.scale)*Xi}dn?(Lt.verticalizable=!0,Sr.push({glyph:ir,imageName:vn,x:Je,y:pi+lr,vertical:dn,scale:Be.scale,fontStack:Be.fontStack,sectionIndex:Ur,metrics:pn,rect:xn}),Je+=Qn*Be.scale+_e):(Sr.push({glyph:ir,imageName:vn,x:Je,y:pi+lr,vertical:dn,scale:Be.scale,fontStack:Be.fontStack,sectionIndex:Ur,metrics:pn,rect:xn}),Je+=pn.advance*Be.scale+_e)}Sr.length!==0&&(di=Math.max(Je-_e,di),Vy(Sr,0,Sr.length-1,Li,Tr)),Je=0;let gi=Zt*er+Tr;dr.lineOffset=Math.max(Tr,or),pi+=gi,Qi=Math.max(gi,Qi),++Di}var ji;let tr=pi-Oh,{horizontalAlign:ar,verticalAlign:Mr}=Eu(ee);(function(Ri,er,or,dr,Sr,Tr,gi,$i,Be){let Ur=(er-or)*Sr,ir=0;ir=Tr!==gi?-$i*dr-Oh:(-dr*Be+.5)*gi;for(let lr of Ri)for(let pn of lr.positionedGlyphs)pn.x+=Ur,pn.y+=ir})(Lt.positionedLines,Li,ar,Mr,di,Qi,Zt,tr,Yt.length),Lt.top+=-Mr*tr,Lt.bottom=Lt.top+tr,Lt.left+=-ar*di,Lt.right=Lt.left+di}(Ot,t,r,l,dt,m,x,b,z,E,R,tt),!function(Lt){for(let re of Lt)if(re.positionedGlyphs.length!==0)return!1;return!0}(Et)&&Ot}let Uh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ny={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 rd(i,t,r,l,u,f){if(t.imageName){let m=l[t.imageName];return m?m.displaySize[0]*t.scale*Xi/f+u:0}{let m=r[t.fontStack],x=m&&m[i];return x?x.metrics.advance*t.scale+u:0}}function nd(i,t,r,l){let u=Math.pow(i-t,2);return l?i<t?u/2:2*u:u+Math.abs(r)*r}function Uy(i,t,r){let l=0;return i===10&&(l-=1e4),r&&(l+=150),i!==40&&i!==65288||(l+=50),t!==41&&t!==65289||(l+=50),l}function sd(i,t,r,l,u,f){let m=null,x=nd(t,r,u,f);for(let b of l){let E=nd(t-b.x,r,u,f)+b.badness;E<=x&&(m=b,x=E)}return{index:i,x:t,priorBreak:m,badness:x}}function ad(i){return i?ad(i.priorBreak).concat(i.index):[]}function Tu(i,t,r,l,u,f,m){if(f!=="point")return[];if(!i)return[];let x=[],b=function(R,O,G,tt,et,dt){let bt=0;for(let xt=0;xt<R.length();xt++){let Et=R.getSection(xt);bt+=rd(R.getCharCode(xt),Et,tt,et,O,dt)}return bt/Math.max(1,Math.ceil(bt/G))}(i,t,r,l,u,m),E=i.text.indexOf("\u200B")>=0,A=0;for(let R=0;R<i.length();R++){let O=i.getSection(R),G=i.getCharCode(R);if(Uh[G]||(A+=rd(G,O,l,u,t,m)),R<i.length()-1){let tt=!((z=G)<11904||!(Xt["Bopomofo Extended"](z)||Xt.Bopomofo(z)||Xt["CJK Compatibility Forms"](z)||Xt["CJK Compatibility Ideographs"](z)||Xt["CJK Compatibility"](z)||Xt["CJK Radicals Supplement"](z)||Xt["CJK Strokes"](z)||Xt["CJK Symbols and Punctuation"](z)||Xt["CJK Unified Ideographs Extension A"](z)||Xt["CJK Unified Ideographs"](z)||Xt["Enclosed CJK Letters and Months"](z)||Xt["Halfwidth and Fullwidth Forms"](z)||Xt.Hiragana(z)||Xt["Ideographic Description Characters"](z)||Xt["Kangxi Radicals"](z)||Xt["Katakana Phonetic Extensions"](z)||Xt.Katakana(z)||Xt["Vertical Forms"](z)||Xt["Yi Radicals"](z)||Xt["Yi Syllables"](z)));(Ny[G]||tt||O.imageName)&&x.push(sd(R+1,A,b,x,Uy(G,i.getCharCode(R+1),tt&&E),!1))}}var z;return ad(sd(i.length(),A,b,x,0,!0))}function Eu(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Vy(i,t,r,l,u){if(!l&&!u)return;let f=i[r],m=(i[r].x+f.metrics.advance*f.scale)*l;for(let x=t;x<=r;x++)i[x].x-=m,i[x].y+=u}function Gy(i,t,r){let{horizontalAlign:l,verticalAlign:u}=Eu(r),f=t[0]-i.displaySize[0]*l,m=t[1]-i.displaySize[1]*u;return{image:i,top:m,bottom:m+i.displaySize[1],left:f,right:f+i.displaySize[0]}}function od(i,t,r,l,u,f){let m=i.image,x;if(m.content){let et=m.content,dt=m.pixelRatio||1;x=[et[0]/dt,et[1]/dt,m.displaySize[0]-et[2]/dt,m.displaySize[1]-et[3]/dt]}let b=t.left*f,E=t.right*f,A,z,R,O;r==="width"||r==="both"?(O=u[0]+b-l[3],z=u[0]+E+l[1]):(O=u[0]+(b+E-m.displaySize[0])/2,z=O+m.displaySize[0]);let G=t.top*f,tt=t.bottom*f;return r==="height"||r==="both"?(A=u[1]+G-l[0],R=u[1]+tt+l[2]):(A=u[1]+(G+tt-m.displaySize[1])/2,R=A+m.displaySize[1]),{image:m,top:A,right:z,bottom:R,left:O,collisionPadding:x}}let Yn=128;function ld(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new ci(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:l,interpolationType:u}=r,f=0;for(;f<l.length&&l[f]<=i;)f++;f=Math.max(0,f-1);let m=f;for(;m<l.length&&l[m]<i+1;)m++;m=Math.min(l.length-1,m);let x=l[f],b=l[m];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:u}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new ci(x)),maxSize:r.evaluate(new ci(b)),interpolationType:u}}}class Fs extends ve{constructor(t,r,l,u){super(t,r),this.angle=l,u!==void 0&&(this.segment=u)}clone(){return new Fs(this.x,this.y,this.angle,this.segment)}}function hd(i,t,r,l,u){if(t.segment===void 0)return!0;let f=t,m=t.segment+1,x=0;for(;x>-r/2;){if(m--,m<0)return!1;x-=i[m].dist(f),f=i[m]}x+=i[m].dist(i[m+1]),m++;let b=[],E=0;for(;x<r/2;){let A=i[m],z=i[m+1];if(!z)return!1;let R=i[m-1].angleTo(A)-A.angleTo(z);for(R=Math.abs((R+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:x,angleDelta:R}),E+=R;x-b[0].distance>l;)E-=b.shift().angleDelta;if(E>u)return!1;m++,x+=A.dist(z)}return!0}function cd(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function ud(i,t,r){return i?.6*t*r:0}function pd(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function qy(i,t,r,l,u,f){let m=ud(r,u,f),x=pd(r,l)*f,b=0,E=cd(i)/2;for(let A=0;A<i.length-1;A++){let z=i[A],R=i[A+1],O=z.dist(R);if(b+O>E){let G=(E-b)/O,tt=zi(z.x,R.x,G),et=zi(z.y,R.y,G),dt=new Fs(tt,et,R.angleTo(z),A);return dt._round(),!m||hd(i,dt,x,m,t)?dt:void 0}b+=O}}function jy(i,t,r,l,u,f,m,x,b){let E=ud(l,f,m),A=pd(l,u),z=A*m,R=i[0].x===0||i[0].x===b||i[0].y===0||i[0].y===b;return t-z<t/4&&(t=z+t/4),dd(i,R?t/2*x%t:(A/2+2*f)*m*x%t,t,E,r,z,R,!1,b)}function dd(i,t,r,l,u,f,m,x,b){let E=f/2,A=cd(i),z=0,R=t-r,O=[];for(let G=0;G<i.length-1;G++){let tt=i[G],et=i[G+1],dt=tt.dist(et),bt=et.angleTo(tt);for(;R+r<z+dt;){R+=r;let xt=(R-z)/dt,Et=zi(tt.x,et.x,xt),Ot=zi(tt.y,et.y,xt);if(Et>=0&&Et<b&&Ot>=0&&Ot<b&&R-E>=0&&R+E<=A){let Lt=new Fs(Et,Ot,bt,G);Lt._round(),l&&!hd(i,Lt,f,l,u)||O.push(Lt)}}z+=dt}return x||O.length||m||(O=dd(i,z/2,r,l,u,f,m,!0,b)),O}function fd(i,t,r,l,u){let f=[];for(let m=0;m<i.length;m++){let x=i[m],b;for(let E=0;E<x.length-1;E++){let A=x[E],z=x[E+1];A.x<t&&z.x<t||(A.x<t?A=new ve(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x<t&&(z=new ve(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y<r&&z.y<r||(A.y<r?A=new ve(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round():z.y<r&&(z=new ve(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round()),A.x>=l&&z.x>=l||(A.x>=l?A=new ve(l,A.y+(l-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x>=l&&(z=new ve(l,A.y+(l-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y>=u&&z.y>=u||(A.y>=u?A=new ve(A.x+(u-A.y)/(z.y-A.y)*(z.x-A.x),u)._round():z.y>=u&&(z=new ve(A.x+(u-A.y)/(z.y-A.y)*(z.x-A.x),u)._round()),b&&A.equals(b[b.length-1])||(b=[A],f.push(b)),b.push(z)))))}}return f}function md(i,t,r,l){let u=[],f=i.image,m=f.pixelRatio,x=f.paddedRect.w-2,b=f.paddedRect.h-2,E=i.right-i.left,A=i.bottom-i.top,z=f.stretchX||[[0,x]],R=f.stretchY||[[0,b]],O=(Zt,ee)=>Zt+ee[1]-ee[0],G=z.reduce(O,0),tt=R.reduce(O,0),et=x-G,dt=b-tt,bt=0,xt=G,Et=0,Ot=tt,Lt=0,re=et,ue=0,Jt=dt;if(f.content&&l){let Zt=f.content;bt=Vh(z,0,Zt[0]),Et=Vh(R,0,Zt[1]),xt=Vh(z,Zt[0],Zt[2]),Ot=Vh(R,Zt[1],Zt[3]),Lt=Zt[0]-bt,ue=Zt[1]-Et,re=Zt[2]-Zt[0]-xt,Jt=Zt[3]-Zt[1]-Ot}let Yt=(Zt,ee,Qt,qt)=>{let _e=Gh(Zt.stretch-bt,xt,E,i.left),de=qh(Zt.fixed-Lt,re,Zt.stretch,G),Ne=Gh(ee.stretch-Et,Ot,A,i.top),Je=qh(ee.fixed-ue,Jt,ee.stretch,tt),pi=Gh(Qt.stretch-bt,xt,E,i.left),di=qh(Qt.fixed-Lt,re,Qt.stretch,G),Qi=Gh(qt.stretch-Et,Ot,A,i.top),Li=qh(qt.fixed-ue,Jt,qt.stretch,tt),Di=new ve(_e,Ne),ji=new ve(pi,Ne),tr=new ve(pi,Qi),ar=new ve(_e,Qi),Mr=new ve(de/m,Je/m),Ri=new ve(di/m,Li/m),er=t*Math.PI/180;if(er){let Sr=Math.sin(er),Tr=Math.cos(er),gi=[Tr,-Sr,Sr,Tr];Di._matMult(gi),ji._matMult(gi),ar._matMult(gi),tr._matMult(gi)}let or=Zt.stretch+Zt.fixed,dr=ee.stretch+ee.fixed;return{tl:Di,tr:ji,bl:ar,br:tr,tex:{x:f.paddedRect.x+1+or,y:f.paddedRect.y+1+dr,w:Qt.stretch+Qt.fixed-or,h:qt.stretch+qt.fixed-dr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Mr,pixelOffsetBR:Ri,minFontScaleX:re/m/E,minFontScaleY:Jt/m/A,isSDF:r}};if(l&&(f.stretchX||f.stretchY)){let Zt=gd(z,et,G),ee=gd(R,dt,tt);for(let Qt=0;Qt<Zt.length-1;Qt++){let qt=Zt[Qt],_e=Zt[Qt+1];for(let de=0;de<ee.length-1;de++)u.push(Yt(qt,ee[de],_e,ee[de+1]))}}else u.push(Yt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return u}function Vh(i,t,r){let l=0;for(let u of i)l+=Math.max(t,Math.min(r,u[1]))-Math.max(t,Math.min(r,u[0]));return l}function gd(i,t,r){let l=[{fixed:-1,stretch:0}];for(let[u,f]of i){let m=l[l.length-1];l.push({fixed:u-m.stretch,stretch:m.stretch}),l.push({fixed:u-m.stretch,stretch:m.stretch+(f-u)})}return l.push({fixed:t+1,stretch:r}),l}function Gh(i,t,r,l){return i/t*r+l}function qh(i,t,r,l){return i-t*r/l}ie("Anchor",Fs);class jh{constructor(t,r,l,u,f,m,x,b,E,A){if(this.boxStartIndex=t.length,E){let z=m.top,R=m.bottom,O=m.collisionPadding;O&&(z-=O[1],R+=O[3]);let G=R-z;G>0&&(G=Math.max(10,G),this.circleDiameter=G)}else{let z=m.top*x-b,R=m.bottom*x+b,O=m.left*x-b,G=m.right*x+b,tt=m.collisionPadding;if(tt&&(O-=tt[0]*x,z-=tt[1]*x,G+=tt[2]*x,R+=tt[3]*x),A){let et=new ve(O,z),dt=new ve(G,z),bt=new ve(O,R),xt=new ve(G,R),Et=A*Math.PI/180;et._rotate(Et),dt._rotate(Et),bt._rotate(Et),xt._rotate(Et),O=Math.min(et.x,dt.x,bt.x,xt.x),G=Math.max(et.x,dt.x,bt.x,xt.x),z=Math.min(et.y,dt.y,bt.y,xt.y),R=Math.max(et.y,dt.y,bt.y,xt.y)}t.emplaceBack(r.x,r.y,O,z,G,R,l,u,f)}this.boxEndIndex=t.length}}class $y{constructor(t=[],r=Wy){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}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:l}=this,u=r[t];for(;t>0;){let f=t-1>>1,m=r[f];if(l(u,m)>=0)break;r[t]=m,t=f}r[t]=u}_down(t){let{data:r,compare:l}=this,u=this.length>>1,f=r[t];for(;t<u;){let m=1+(t<<1),x=r[m],b=m+1;if(b<this.length&&l(r[b],x)<0&&(m=b,x=r[b]),l(x,f)>=0)break;r[t]=x,t=m}r[t]=f}}function Wy(i,t){return i<t?-1:i>t?1:0}function Zy(i,t=1,r=!1){let l=1/0,u=1/0,f=-1/0,m=-1/0,x=i[0];for(let O=0;O<x.length;O++){let G=x[O];(!O||G.x<l)&&(l=G.x),(!O||G.y<u)&&(u=G.y),(!O||G.x>f)&&(f=G.x),(!O||G.y>m)&&(m=G.y)}let b=Math.min(f-l,m-u),E=b/2,A=new $y([],Hy);if(b===0)return new ve(l,u);for(let O=l;O<f;O+=b)for(let G=u;G<m;G+=b)A.push(new co(O+E,G+E,E,i));let z=function(O){let G=0,tt=0,et=0,dt=O[0];for(let bt=0,xt=dt.length,Et=xt-1;bt<xt;Et=bt++){let Ot=dt[bt],Lt=dt[Et],re=Ot.x*Lt.y-Lt.x*Ot.y;tt+=(Ot.x+Lt.x)*re,et+=(Ot.y+Lt.y)*re,G+=3*re}return new co(tt/G,et/G,0,O)}(i),R=A.length;for(;A.length;){let O=A.pop();(O.d>z.d||!z.d)&&(z=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,R)),O.max-z.d<=t||(E=O.h/2,A.push(new co(O.p.x-E,O.p.y-E,E,i)),A.push(new co(O.p.x+E,O.p.y-E,E,i)),A.push(new co(O.p.x-E,O.p.y+E,E,i)),A.push(new co(O.p.x+E,O.p.y+E,E,i)),R+=4)}return r&&(console.log(`num probes: ${R}`),console.log(`best distance: ${z.d}`)),z.p}function Hy(i,t){return t.max-i.max}function co(i,t,r,l){this.p=new ve(i,t),this.h=r,this.d=function(u,f){let m=!1,x=1/0;for(let b=0;b<f.length;b++){let E=f[b];for(let A=0,z=E.length,R=z-1;A<z;R=A++){let O=E[A],G=E[R];O.y>u.y!=G.y>u.y&&u.x<(G.x-O.x)*(u.y-O.y)/(G.y-O.y)+O.x&&(m=!m),x=Math.min(x,Ip(u,O,G))}}return(m?1:-1)*Math.sqrt(x)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}let Iu=Number.POSITIVE_INFINITY;function yd(i,t){return t[1]!==Iu?function(r,l,u){let f=0,m=0;switch(l=Math.abs(l),u=Math.abs(u),r){case"top-right":case"top-left":case"top":m=u-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-u}switch(r){case"top-right":case"bottom-right":case"right":f=-l;break;case"top-left":case"bottom-left":case"left":f=l}return[f,m]}(i,t[0],t[1]):function(r,l){let u=0,f=0;l<0&&(l=0);let m=l/Math.sqrt(2);switch(r){case"top-right":case"top-left":f=m-7;break;case"bottom-right":case"bottom-left":f=7-m;break;case"bottom":f=7-l;break;case"top":f=l-7}switch(r){case"top-right":case"bottom-right":u=-m;break;case"top-left":case"bottom-left":u=m;break;case"left":u=l;break;case"right":u=-l}return[u,f]}(i,t[0])}function Cu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Xy(i,t,r,l,u,f,m,x,b,E,A){let z=f.textMaxSize.evaluate(t,{});z===void 0&&(z=m);let R=i.layers[0].layout,O=R.get("icon-offset").evaluate(t,{},A),G=xd(r.horizontal),tt=m/24,et=i.tilePixelRatio*tt,dt=i.tilePixelRatio*z/24,bt=i.tilePixelRatio*x,xt=i.tilePixelRatio*R.get("symbol-spacing"),Et=R.get("text-padding")*i.tilePixelRatio,Ot=R.get("icon-padding")*i.tilePixelRatio,Lt=R.get("text-max-angle")/180*Math.PI,re=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",ue=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",Jt=R.get("symbol-placement"),Yt=xt/2,Zt=R.get("icon-text-fit"),ee;l&&Zt!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ee=od(l,r.vertical,Zt,R.get("icon-text-fit-padding"),O,tt)),G&&(l=od(l,G,Zt,R.get("icon-text-fit-padding"),O,tt)));let Qt=(qt,_e)=>{_e.x<0||_e.x>=Vi||_e.y<0||_e.y>=Vi||function(de,Ne,Je,pi,di,Qi,Li,Di,ji,tr,ar,Mr,Ri,er,or,dr,Sr,Tr,gi,$i,Be,Ur,ir,lr,pn){let xn=de.addToLineVertexArray(Ne,Je),vn,Qn,dn,Yr,Er=0,ts=0,kl=0,Rd=0,Ou=-1,Nu=-1,es={},Bd=yl(""),Uu=0,Vu=0;if(Di._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Uu,Vu]=Di.layout.get("text-offset").evaluate(Be,{},lr).map(Ir=>Ir*Xi):(Uu=Di.layout.get("text-radial-offset").evaluate(Be,{},lr)*Xi,Vu=Iu),de.allowVerticalPlacement&&pi.vertical){let Ir=Di.layout.get("text-rotate").evaluate(Be,{},lr)+90;dn=new jh(ji,Ne,tr,ar,Mr,pi.vertical,Ri,er,or,Ir),Li&&(Yr=new jh(ji,Ne,tr,ar,Mr,Li,Sr,Tr,or,Ir))}if(di){let Ir=Di.layout.get("icon-rotate").evaluate(Be,{}),An=Di.layout.get("icon-text-fit")!=="none",Ll=md(di,Ir,ir,An),Dl=Li?md(Li,Ir,ir,An):void 0;Qn=new jh(ji,Ne,tr,ar,Mr,di,Sr,Tr,!1,Ir),Er=4*Ll.length;let Nd=de.iconSizeData,ga=null;Nd.kind==="source"?(ga=[Yn*Di.layout.get("icon-size").evaluate(Be,{})],ga[0]>Os&&Ht(`${de.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Nd.kind==="composite"&&(ga=[Yn*Ur.compositeIconSizes[0].evaluate(Be,{},lr),Yn*Ur.compositeIconSizes[1].evaluate(Be,{},lr)],(ga[0]>Os||ga[1]>Os)&&Ht(`${de.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),de.addSymbols(de.icon,Ll,ga,$i,gi,Be,a.WritingMode.none,Ne,xn.lineStartIndex,xn.lineLength,-1,lr),Ou=de.icon.placedSymbolArray.length-1,Dl&&(ts=4*Dl.length,de.addSymbols(de.icon,Dl,ga,$i,gi,Be,a.WritingMode.vertical,Ne,xn.lineStartIndex,xn.lineLength,-1,lr),Nu=de.icon.placedSymbolArray.length-1)}let Fd=Object.keys(pi.horizontal);for(let Ir of Fd){let An=pi.horizontal[Ir];if(!vn){Bd=yl(An.text);let Dl=Di.layout.get("text-rotate").evaluate(Be,{},lr);vn=new jh(ji,Ne,tr,ar,Mr,An,Ri,er,or,Dl)}let Ll=An.positionedLines.length===1;if(kl+=_d(de,Ne,An,Qi,Di,or,Be,dr,xn,pi.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,Ll?Fd:[Ir],es,Ou,Ur,lr),Ll)break}pi.vertical&&(Rd+=_d(de,Ne,pi.vertical,Qi,Di,or,Be,dr,xn,a.WritingMode.vertical,["vertical"],es,Nu,Ur,lr));let l0=vn?vn.boxStartIndex:de.collisionBoxArray.length,h0=vn?vn.boxEndIndex:de.collisionBoxArray.length,c0=dn?dn.boxStartIndex:de.collisionBoxArray.length,u0=dn?dn.boxEndIndex:de.collisionBoxArray.length,p0=Qn?Qn.boxStartIndex:de.collisionBoxArray.length,d0=Qn?Qn.boxEndIndex:de.collisionBoxArray.length,f0=Yr?Yr.boxStartIndex:de.collisionBoxArray.length,m0=Yr?Yr.boxEndIndex:de.collisionBoxArray.length,bn=-1,Xh=(Ir,An)=>Ir&&Ir.circleDiameter?Math.max(Ir.circleDiameter,An):An;bn=Xh(vn,bn),bn=Xh(dn,bn),bn=Xh(Qn,bn),bn=Xh(Yr,bn);let Od=bn>-1?1:0;Od&&(bn*=pn/Xi),de.glyphOffsetArray.length>=uo.MAX_GLYPHS&&Ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Be.sortKey!==void 0&&de.addToSortKeyRanges(de.symbolInstances.length,Be.sortKey),de.symbolInstances.emplaceBack(Ne.x,Ne.y,es.right>=0?es.right:-1,es.center>=0?es.center:-1,es.left>=0?es.left:-1,es.vertical||-1,Ou,Nu,Bd,l0,h0,c0,u0,p0,d0,f0,m0,tr,kl,Rd,Er,ts,Od,0,Ri,Uu,Vu,bn)}(i,_e,qt,r,l,u,ee,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,et,Et,re,b,bt,Ot,ue,O,t,f,E,A,m)};if(Jt==="line")for(let qt of fd(t.geometry,0,0,Vi,Vi)){let _e=jy(qt,xt,Lt,r.vertical||G,l,24,dt,i.overscaling,Vi);for(let de of _e){let Ne=G;Ne&&Ky(i,Ne.text,Yt,de)||Qt(qt,de)}}else if(Jt==="line-center"){for(let qt of t.geometry)if(qt.length>1){let _e=qy(qt,Lt,r.vertical||G,l,24,dt);_e&&Qt(qt,_e)}}else if(t.type==="Polygon")for(let qt of mu(t.geometry,0)){let _e=Zy(qt,16);Qt(qt[0],new Fs(_e.x,_e.y,0))}else if(t.type==="LineString")for(let qt of t.geometry)Qt(qt,new Fs(qt[0].x,qt[0].y,0));else if(t.type==="Point")for(let qt of t.geometry)for(let _e of qt)Qt([_e],new Fs(_e.x,_e.y,0))}let Os=32640;function _d(i,t,r,l,u,f,m,x,b,E,A,z,R,O,G){let tt=function(bt,xt,Et,Ot,Lt,re,ue,Jt){let Yt=Ot.layout.get("text-rotate").evaluate(re,{})*Math.PI/180,Zt=[];for(let ee of xt.positionedLines)for(let Qt of ee.positionedGlyphs){if(!Qt.rect)continue;let qt=Qt.rect||{},_e=4,de=!0,Ne=1,Je=0,pi=(Lt||Jt)&&Qt.vertical,di=Qt.metrics.advance*Qt.scale/2;if(Jt&&xt.verticalizable){let gi=(Qt.scale-1)*Xi,$i=(Xi-Qt.metrics.width*Qt.scale)/2;Je=ee.lineOffset/2-(Qt.imageName?-$i:gi)}if(Qt.imageName){let gi=ue[Qt.imageName];de=gi.sdf,Ne=gi.pixelRatio,_e=1/Ne}let Qi=Lt?[Qt.x+di,Qt.y]:[0,0],Li=Lt?[0,0]:[Qt.x+di+Et[0],Qt.y+Et[1]-Je],Di=[0,0];pi&&(Di=Li,Li=[0,0]);let ji=(Qt.metrics.left-_e)*Qt.scale-di+Li[0],tr=(-Qt.metrics.top-_e)*Qt.scale+Li[1],ar=ji+qt.w*Qt.scale/Ne,Mr=tr+qt.h*Qt.scale/Ne,Ri=new ve(ji,tr),er=new ve(ar,tr),or=new ve(ji,Mr),dr=new ve(ar,Mr);if(pi){let gi=new ve(-di,di-Oh),$i=-Math.PI/2,Be=12-di,Ur=new ve(22-Be,-(Qt.imageName?Be:0)),ir=new ve(...Di);Ri._rotateAround($i,gi)._add(Ur)._add(ir),er._rotateAround($i,gi)._add(Ur)._add(ir),or._rotateAround($i,gi)._add(Ur)._add(ir),dr._rotateAround($i,gi)._add(Ur)._add(ir)}if(Yt){let gi=Math.sin(Yt),$i=Math.cos(Yt),Be=[$i,-gi,gi,$i];Ri._matMult(Be),er._matMult(Be),or._matMult(Be),dr._matMult(Be)}let Sr=new ve(0,0),Tr=new ve(0,0);Zt.push({tl:Ri,tr:er,bl:or,br:dr,tex:qt,writingMode:xt.writingMode,glyphOffset:Qi,sectionIndex:Qt.sectionIndex,isSDF:de,pixelOffsetTL:Sr,pixelOffsetBR:Tr,minFontScaleX:0,minFontScaleY:0})}return Zt}(0,r,x,u,f,m,l,i.allowVerticalPlacement),et=i.textSizeData,dt=null;et.kind==="source"?(dt=[Yn*u.layout.get("text-size").evaluate(m,{})],dt[0]>Os&&Ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):et.kind==="composite"&&(dt=[Yn*O.compositeTextSizes[0].evaluate(m,{},G),Yn*O.compositeTextSizes[1].evaluate(m,{},G)],(dt[0]>Os||dt[1]>Os)&&Ht(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,tt,dt,x,f,m,E,t,b.lineStartIndex,b.lineLength,R,G);for(let bt of A)z[bt]=i.text.placedSymbolArray.length-1;return 4*tt.length}function xd(i){for(let t in i)return i[t];return null}function Ky(i,t,r,l){let u=i.compareText;if(t in u){let f=u[t];for(let m=f.length-1;m>=0;m--)if(l.dist(f[m])<r)return!0}else u[t]=[];return u[t].push(l),!1}let Jy=Rs.VectorTileFeature.types,Yy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $h(i,t,r,l,u,f,m,x,b,E,A,z,R){let O=x?Math.min(Os,Math.round(x[0])):0,G=x?Math.min(Os,Math.round(x[1])):0;i.emplaceBack(t,r,Math.round(32*l),Math.round(32*u),f,m,(O<<1)+(b?1:0),G,16*E,16*A,256*z,256*R)}function Au(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function Qy(i){for(let t of i.sections)if(tu(t.text))return!0;return!1}class Pu{constructor(t){this.layoutVertexArray=new Hi,this.indexArray=new pr,this.programConfigurations=t,this.segments=new $e,this.dynamicLayoutVertexArray=new br,this.opacityVertexArray=new Or,this.placedSymbolArray=new Ut}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,l,u){this.isEmpty()||(l&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,My.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Yy,!0),this.opacityVertexBuffer.itemSize=1),(l||u)&&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())}}ie("SymbolBuffers",Pu);class zu{constructor(t,r,l){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new l,this.segments=new $e,this.collisionVertexArray=new Cn}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Sy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ie("CollisionBuffers",zu);class uo{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(m=>m.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=lu([]),this.placementViewportMatrix=lu([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ld(this.zoom,r["text-size"]),this.iconSizeData=ld(this.zoom,r["icon-size"]);let l=this.layers[0].layout,u=l.get("symbol-sort-key"),f=l.get("symbol-z-order");this.canOverlap=Lu(l,"text-overlap","text-allow-overlap")!=="never"||Lu(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=f!=="viewport-y"&&!u.isConstant(),this.sortFeaturesByY=(f==="viewport-y"||f==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.get("text-writing-mode").map(m=>a.WritingMode[m])),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=t.sourceID}createArrays(){this.text=new Pu(new pa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Pu(new pa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new se,this.lineVertexArray=new Kt,this.symbolInstances=new Pt}calculateGlyphDependencies(t,r,l,u,f){for(let m=0;m<t.length;m++)if(r[t.charCodeAt(m)]=!0,(l||u)&&f){let x=Cl[t.charAt(m)];x&&(r[x.charCodeAt(0)]=!0)}}populate(t,r,l){let u=this.layers[0],f=u.layout,m=f.get("text-font"),x=f.get("text-field"),b=f.get("icon-image"),E=(x.value.kind!=="constant"||x.value.value instanceof K&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),A=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,z=f.get("symbol-sort-key");if(this.features=[],!E&&!A)return;let R=r.iconDependencies,O=r.glyphDependencies,G=r.availableImages,tt=new ci(this.zoom);for(let{feature:et,id:dt,index:bt,sourceLayerIndex:xt}of t){let Et=u._featureFilter.needGeometry,Ot=fa(et,Et);if(!u._featureFilter.filter(tt,Ot,l))continue;let Lt,re;if(Et||(Ot.geometry=da(et)),E){let Jt=u.getValueAndResolveTokens("text-field",Ot,l,G),Yt=K.factory(Jt);Qy(Yt)&&(this.hasRTLText=!0),(!this.hasRTLText||fl()==="unavailable"||this.hasRTLText&&Fr.isParsed())&&(Lt=Ey(Yt,u,Ot))}if(A){let Jt=u.getValueAndResolveTokens("icon-image",Ot,l,G);re=Jt instanceof st?Jt:st.fromString(Jt)}if(!Lt&&!re)continue;let ue=this.sortFeaturesByKey?z.evaluate(Ot,{},l):void 0;if(this.features.push({id:dt,text:Lt,icon:re,index:bt,sourceLayerIndex:xt,geometry:Ot.geometry,properties:et.properties,type:Jy[et.type],sortKey:ue}),re&&(R[re.name]=!0),Lt){let Jt=m.evaluate(Ot,{},l).join(","),Yt=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(let Zt of Lt.sections)if(Zt.image)R[Zt.image.name]=!0;else{let ee=hl(Lt.toString()),Qt=Zt.fontStack||Jt,qt=O[Qt]=O[Qt]||{};this.calculateGlyphDependencies(Zt.text,qt,Yt,this.allowVerticalPlacement,ee)}}}f.get("symbol-placement")==="line"&&(this.features=function(et){let dt={},bt={},xt=[],Et=0;function Ot(Jt){xt.push(et[Jt]),Et++}function Lt(Jt,Yt,Zt){let ee=bt[Jt];return delete bt[Jt],bt[Yt]=ee,xt[ee].geometry[0].pop(),xt[ee].geometry[0]=xt[ee].geometry[0].concat(Zt[0]),ee}function re(Jt,Yt,Zt){let ee=dt[Yt];return delete dt[Yt],dt[Jt]=ee,xt[ee].geometry[0].shift(),xt[ee].geometry[0]=Zt[0].concat(xt[ee].geometry[0]),ee}function ue(Jt,Yt,Zt){let ee=Zt?Yt[0][Yt[0].length-1]:Yt[0][0];return`${Jt}:${ee.x}:${ee.y}`}for(let Jt=0;Jt<et.length;Jt++){let Yt=et[Jt],Zt=Yt.geometry,ee=Yt.text?Yt.text.toString():null;if(!ee){Ot(Jt);continue}let Qt=ue(ee,Zt),qt=ue(ee,Zt,!0);if(Qt in bt&&qt in dt&&bt[Qt]!==dt[qt]){let _e=re(Qt,qt,Zt),de=Lt(Qt,qt,xt[_e].geometry);delete dt[Qt],delete bt[qt],bt[ue(ee,xt[de].geometry,!0)]=de,xt[_e].geometry=null}else Qt in bt?Lt(Qt,qt,Zt):qt in dt?re(Qt,qt,Zt):(Ot(Jt),dt[Qt]=Et-1,bt[qt]=Et-1)}return xt.filter(Jt=>Jt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((et,dt)=>et.sortKey-dt.sortKey)}update(t,r,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,l),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,l))}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 l=this.lineVertexArray.length;if(t.segment!==void 0){let u=t.dist(r[t.segment+1]),f=t.dist(r[t.segment]),m={};for(let x=t.segment+1;x<r.length;x++)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:u},x<r.length-1&&(u+=r[x+1].dist(r[x]));for(let x=t.segment||0;x>=0;x--)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:f},x>0&&(f+=r[x-1].dist(r[x]));for(let x=0;x<r.length;x++){let b=m[x];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:l,lineLength:this.lineVertexArray.length-l}}addSymbols(t,r,l,u,f,m,x,b,E,A,z,R){let O=t.indexArray,G=t.layoutVertexArray,tt=t.segments.prepareSegment(4*r.length,G,O,this.canOverlap?m.sortKey:void 0),et=this.glyphOffsetArray.length,dt=tt.vertexLength,bt=this.allowVerticalPlacement&&x===a.WritingMode.vertical?Math.PI/2:0,xt=m.text&&m.text.sections;for(let Et=0;Et<r.length;Et++){let{tl:Ot,tr:Lt,bl:re,br:ue,tex:Jt,pixelOffsetTL:Yt,pixelOffsetBR:Zt,minFontScaleX:ee,minFontScaleY:Qt,glyphOffset:qt,isSDF:_e,sectionIndex:de}=r[Et],Ne=tt.vertexLength,Je=qt[1];$h(G,b.x,b.y,Ot.x,Je+Ot.y,Jt.x,Jt.y,l,_e,Yt.x,Yt.y,ee,Qt),$h(G,b.x,b.y,Lt.x,Je+Lt.y,Jt.x+Jt.w,Jt.y,l,_e,Zt.x,Yt.y,ee,Qt),$h(G,b.x,b.y,re.x,Je+re.y,Jt.x,Jt.y+Jt.h,l,_e,Yt.x,Zt.y,ee,Qt),$h(G,b.x,b.y,ue.x,Je+ue.y,Jt.x+Jt.w,Jt.y+Jt.h,l,_e,Zt.x,Zt.y,ee,Qt),Au(t.dynamicLayoutVertexArray,b,bt),O.emplaceBack(Ne,Ne+1,Ne+2),O.emplaceBack(Ne+1,Ne+2,Ne+3),tt.vertexLength+=4,tt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(qt[0]),Et!==r.length-1&&de===r[Et+1].sectionIndex||t.programConfigurations.populatePaintArrays(G.length,m,m.index,{},R,xt&&xt[de])}t.placedSymbolArray.emplaceBack(b.x,b.y,et,this.glyphOffsetArray.length-et,dt,E,A,b.segment,l?l[0]:0,l?l[1]:0,u[0],u[1],x,0,!1,0,z)}_addCollisionDebugVertex(t,r,l,u,f,m){return r.emplaceBack(0,0),t.emplaceBack(l.x,l.y,u,f,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(t,r,l,u,f,m,x){let b=f.segments.prepareSegment(4,f.layoutVertexArray,f.indexArray),E=b.vertexLength,A=f.layoutVertexArray,z=f.collisionVertexArray,R=x.anchorX,O=x.anchorY;this._addCollisionDebugVertex(A,z,m,R,O,new ve(t,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(l,r)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(l,u)),this._addCollisionDebugVertex(A,z,m,R,O,new ve(t,u)),b.vertexLength+=4;let G=f.indexArray;G.emplaceBack(E,E+1),G.emplaceBack(E+1,E+2),G.emplaceBack(E+2,E+3),G.emplaceBack(E+3,E),b.primitiveLength+=4}addDebugCollisionBoxes(t,r,l,u){for(let f=t;f<r;f++){let m=this.collisionBoxArray.get(f);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,u?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,l)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new zu(Nr,Hp.members,ln),this.iconCollisionBox=new zu(Nr,Hp.members,ln);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,l,u,f,m,x,b,E){let A={};for(let z=r;z<l;z++){let R=t.get(z);A.textBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.textFeatureIndex=R.featureIndex;break}for(let z=u;z<f;z++){let R=t.get(z);A.verticalTextBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.verticalTextFeatureIndex=R.featureIndex;break}for(let z=m;z<x;z++){let R=t.get(z);A.iconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.iconFeatureIndex=R.featureIndex;break}for(let z=b;z<E;z++){let R=t.get(z);A.verticalIconBox={x1:R.x1,y1:R.y1,x2:R.x2,y2:R.y2,anchorPointX:R.anchorPointX,anchorPointY:R.anchorPointY},A.verticalIconFeatureIndex=R.featureIndex;break}return A}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let l=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,l.textBoxStartIndex,l.textBoxEndIndex,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l.iconBoxStartIndex,l.iconBoxEndIndex,l.verticalIconBoxStartIndex,l.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 l=t.placedSymbolArray.get(r),u=l.vertexStartIndex+4*l.numGlyphs;for(let f=l.vertexStartIndex;f<u;f+=4)t.indexArray.emplaceBack(f,f+1,f+2),t.indexArray.emplaceBack(f+1,f+2,f+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),l=Math.cos(t),u=[],f=[],m=[];for(let x=0;x<this.symbolInstances.length;++x){m.push(x);let b=this.symbolInstances.get(x);u.push(0|Math.round(r*b.anchorX+l*b.anchorY)),f.push(b.featureIndex)}return m.sort((x,b)=>u[x]-u[b]||f[b]-f[x]),m}addToSortKeyRanges(t,r){let l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===r?l.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 l=this.symbolInstances.get(r);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((u,f,m)=>{u>=0&&m.indexOf(u)===f&&this.addIndicesForPlacedSymbol(this.text,u)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ie("SymbolBucket",uo,{omit:["layers","collisionBoxArray","features","compareText"]}),uo.MAX_GLYPHS=65535,uo.addDynamicAttributes=Au;let t0=new Ni({"symbol-placement":new le(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new le(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new le(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ye(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new le(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new le(ct.layout_symbol["icon-allow-overlap"]),"icon-overlap":new le(ct.layout_symbol["icon-overlap"]),"icon-ignore-placement":new le(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new le(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new le(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new ye(ct.layout_symbol["icon-size"]),"icon-text-fit":new le(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new le(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new ye(ct.layout_symbol["icon-image"]),"icon-rotate":new ye(ct.layout_symbol["icon-rotate"]),"icon-padding":new le(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new le(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new ye(ct.layout_symbol["icon-offset"]),"icon-anchor":new ye(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new le(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new le(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new le(ct.layout_symbol["text-rotation-alignment"]),"text-field":new ye(ct.layout_symbol["text-field"]),"text-font":new ye(ct.layout_symbol["text-font"]),"text-size":new ye(ct.layout_symbol["text-size"]),"text-max-width":new ye(ct.layout_symbol["text-max-width"]),"text-line-height":new le(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new ye(ct.layout_symbol["text-letter-spacing"]),"text-justify":new ye(ct.layout_symbol["text-justify"]),"text-radial-offset":new ye(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new le(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new ye(ct.layout_symbol["text-anchor"]),"text-max-angle":new le(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new le(ct.layout_symbol["text-writing-mode"]),"text-rotate":new ye(ct.layout_symbol["text-rotate"]),"text-padding":new le(ct.layout_symbol["text-padding"]),"text-keep-upright":new le(ct.layout_symbol["text-keep-upright"]),"text-transform":new ye(ct.layout_symbol["text-transform"]),"text-offset":new ye(ct.layout_symbol["text-offset"]),"text-allow-overlap":new le(ct.layout_symbol["text-allow-overlap"]),"text-overlap":new le(ct.layout_symbol["text-overlap"]),"text-ignore-placement":new le(ct.layout_symbol["text-ignore-placement"]),"text-optional":new le(ct.layout_symbol["text-optional"])});var ku={paint:new Ni({"icon-opacity":new ye(ct.paint_symbol["icon-opacity"]),"icon-color":new ye(ct.paint_symbol["icon-color"]),"icon-halo-color":new ye(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new ye(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ye(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new le(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new le(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new ye(ct.paint_symbol["text-opacity"]),"text-color":new ye(ct.paint_symbol["text-color"],{runtimeType:oi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new ye(ct.paint_symbol["text-halo-color"]),"text-halo-width":new ye(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new ye(ct.paint_symbol["text-halo-blur"]),"text-translate":new le(ct.paint_symbol["text-translate"]),"text-translate-anchor":new le(ct.paint_symbol["text-translate-anchor"])}),layout:t0};class vd{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ke,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){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ie("FormatSectionOverride",vd,{omit:["defaultValue"]});class Wh extends ur{constructor(t){super(t,ku)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="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 l=this.layout.get("text-writing-mode");if(l){let u=[];for(let f of l)u.indexOf(f)<0&&u.push(f);this.layout._values["text-writing-mode"]=u}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,l,u){let f=this.layout.get(t).evaluate(r,{},l,u),m=this._unevaluatedLayout._values[t];return m.isDataDriven()||Oa(m.value)||!f?f:function(x,b){return b.replace(/{([^{}]+)}/g,(E,A)=>A in x?String(x[A]):"")}(r.properties,f)}createBucket(t){return new uo(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let t of ku.paint.overridableProperties){if(!Wh.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),l=new vd(r),u=new rl(l,r.property.specification),f=null;f=r.value.kind==="constant"||r.value.kind==="source"?new Ua("source",u):new Va("composite",u,r.value.zoomStops,r.value._interpolationType),this.paint._values[t]=new on(r.property,f,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,l){return!(!this.layout||r.isDataDriven()||l.isDataDriven())&&Wh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let l=t.get("text-field"),u=ku.paint.properties[r],f=!1,m=x=>{for(let b of x)if(u.overrides&&u.overrides.hasOverride(b))return void(f=!0)};if(l.value.kind==="constant"&&l.value.value instanceof K)m(l.value.value.sections);else if(l.value.kind==="source"){let x=E=>{f||(E instanceof Bt&&at(E.value)===yi?m(E.value.sections):E instanceof he?m(E.sections):E.eachChild(x))},b=l.value;b._styleExpression&&x(b._styleExpression.expression)}return f}}function Lu(i,t,r){let l="never",u=i.get(t);return u?l=u:i.get(r)&&(l="always"),l}var e0={paint:new Ni({"background-color":new le(ct.paint_background["background-color"]),"background-pattern":new ha(ct.paint_background["background-pattern"]),"background-opacity":new le(ct.paint_background["background-opacity"])})},i0={paint:new Ni({"raster-opacity":new le(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new le(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new le(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new le(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new le(ct.paint_raster["raster-saturation"]),"raster-contrast":new le(ct.paint_raster["raster-contrast"]),"raster-resampling":new le(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new le(ct.paint_raster["raster-fade-duration"])})};class r0 extends ur{constructor(t){super(t,{}),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=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}let n0={circle:class extends ur{constructor(i){super(i,Bg)}createBucket(i){return new su(i)}queryRadius(i){let t=i;return xl("circle-radius",this,t)+xl("circle-stroke-width",this,t)+Ph(this.paint.get("circle-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m,x){let b=zh(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),f.angle,m),E=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),A=this.paint.get("circle-pitch-alignment")==="map",z=A?b:function(O,G){return O.map(tt=>Pp(tt,G))}(b,x),R=A?E*m:E;for(let O of l)for(let G of O){let tt=A?G:Pp(G,x),et=R,dt=kh([],[G.x,G.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?et*=dt[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(et*=f.cameraToCenterDistance/dt[3]),zg(z,tt,et))return!0}return!1}},heatmap:class extends ur{constructor(i){super(i,Og),this._updateColorRamp()}createBucket(i){return new zp(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Lp({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends ur{constructor(i){super(i,Ng)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends ur{constructor(i){super(i,ey)}recalculate(i,t){super.recalculate(i,t);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new _u(i)}queryRadius(){return Ph(this.paint.get("fill-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m){return Ep(zh(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),f.angle,m),l)}isTileClipped(){return!0}},"fill-extrusion":class extends ur{constructor(i){super(i,fy)}createBucket(i){return new vu(i)}queryRadius(){return Ph(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,t,r,l,u,f,m,x){let b=zh(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),f.angle,m),E=this.paint.get("fill-extrusion-height").evaluate(t,r),A=this.paint.get("fill-extrusion-base").evaluate(t,r),z=function(O,G,tt,et){let dt=[];for(let bt of O){let xt=[bt.x,bt.y,0,1];kh(xt,xt,G),dt.push(new ve(xt[0]/xt[3],xt[1]/xt[3]))}return dt}(b,x),R=function(O,G,tt,et){let dt=[],bt=[],xt=et[8]*G,Et=et[9]*G,Ot=et[10]*G,Lt=et[11]*G,re=et[8]*tt,ue=et[9]*tt,Jt=et[10]*tt,Yt=et[11]*tt;for(let Zt of O){let ee=[],Qt=[];for(let qt of Zt){let _e=qt.x,de=qt.y,Ne=et[0]*_e+et[4]*de+et[12],Je=et[1]*_e+et[5]*de+et[13],pi=et[2]*_e+et[6]*de+et[14],di=et[3]*_e+et[7]*de+et[15],Qi=pi+Ot,Li=di+Lt,Di=Ne+re,ji=Je+ue,tr=pi+Jt,ar=di+Yt,Mr=new ve((Ne+xt)/Li,(Je+Et)/Li);Mr.z=Qi/Li,ee.push(Mr);let Ri=new ve(Di/ar,ji/ar);Ri.z=tr/ar,Qt.push(Ri)}dt.push(ee),bt.push(Qt)}return[dt,bt]}(l,A,E,x);return function(O,G,tt){let et=1/0;Ep(tt,G)&&(et=qp(tt,G[0]));for(let dt=0;dt<G.length;dt++){let bt=G[dt],xt=O[dt];for(let Et=0;Et<bt.length-1;Et++){let Ot=bt[Et],Lt=[Ot,bt[Et+1],xt[Et+1],xt[Et],Ot];Tp(tt,Lt)&&(et=Math.min(et,qp(tt,Lt)))}}return et!==1/0&&et}(R[0],R[1],z)}},line:class extends ur{constructor(i){super(i,$p),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ks,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,t){super.recalculate(i,t),this.paint._values["line-floorwidth"]=Wp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new bu(i)}queryRadius(i){let t=i,r=Zp(xl("line-width",this,t),xl("line-gap-width",this,t)),l=xl("line-offset",this,t);return r/2+Math.abs(l)+Ph(this.paint.get("line-translate"))}queryIntersectsFeature(i,t,r,l,u,f,m){let x=zh(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,m),b=m/2*Zp(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),E=this.paint.get("line-offset").evaluate(t,r);return E&&(l=function(A,z){let R=[];for(let O=0;O<A.length;O++){let G=A[O],tt=[];for(let et=0;et<G.length;et++){let dt=G[et-1],bt=G[et],xt=G[et+1],Et=et===0?new ve(0,0):bt.sub(dt)._unit()._perp(),Ot=et===G.length-1?new ve(0,0):xt.sub(bt)._unit()._perp(),Lt=Et._add(Ot)._unit(),re=Lt.x*Ot.x+Lt.y*Ot.y;re!==0&&Lt._mult(1/re),tt.push(Lt._mult(z)._add(bt))}R.push(tt)}return R}(l,E*m)),function(A,z,R){for(let O=0;O<z.length;O++){let G=z[O];if(A.length>=3){for(let tt=0;tt<G.length;tt++)if(ro(A,G[tt]))return!0}if(kg(A,G,R))return!0}return!1}(x,l,b)}isTileClipped(){return!0}},symbol:Wh,background:class extends ur{constructor(i){super(i,e0)}},raster:class extends ur{constructor(i){super(i,i0)}}};class s0{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=()=>{}}}let bd=63710088e-1;class Si{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${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 Si(Q(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,l=this.lat*r,u=t.lat*r,f=Math.sin(l)*Math.sin(u)+Math.cos(l)*Math.cos(u)*Math.cos((t.lng-this.lng)*r);return bd*Math.acos(Math.min(f,1))}toBounds(t=0){let r=360*t/40075017,l=r/Math.cos(Math.PI/180*this.lat);return new ma(new Si(this.lng-l,this.lat-r),new Si(this.lng+l,this.lat+r))}static convert(t){if(t instanceof Si)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Si(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Si(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>]")}}class ma{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):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 Si?new Si(t.lng,t.lat):Si.convert(t),this}setSouthWest(t){return this._sw=t instanceof Si?new Si(t.lng,t.lat):Si.convert(t),this}extend(t){let r=this._sw,l=this._ne,u,f;if(t instanceof Si)u=t,f=t;else{if(!(t instanceof ma))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ma.convert(t)):this.extend(Si.convert(t)):this;if(u=t._sw,f=t._ne,!u||!f)return this}return r||l?(r.lng=Math.min(u.lng,r.lng),r.lat=Math.min(u.lat,r.lat),l.lng=Math.max(f.lng,l.lng),l.lat=Math.max(f.lat,l.lat)):(this._sw=new Si(u.lng,u.lat),this._ne=new Si(f.lng,f.lat)),this}getCenter(){return new Si((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 Si(this.getWest(),this.getNorth())}getSouthEast(){return new Si(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:l}=Si.convert(t),u=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=l&&l<=this._ne.lat&&u}static convert(t){return t instanceof ma?t:t&&new ma(t)}}let wd=2*Math.PI*bd;function Md(i){return wd*Math.cos(i*Math.PI/180)}function Sd(i){return(180+i)/360}function Td(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Ed(i,t){return i/Md(t)}function Du(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Zh{constructor(t,r,l=0){this.x=+t,this.y=+r,this.z=+l}static fromLngLat(t,r=0){let l=Si.convert(t);return new Zh(Sd(l.lng),Td(l.lat),Ed(r,l.lat))}toLngLat(){return new Si(360*this.x-180,Du(this.y))}toAltitude(){return this.z*Md(Du(this.y))}meterInMercatorCoordinateUnits(){return 1/wd*(t=Du(this.y),1/Math.cos(t*Math.PI/180));var t}}function Id(i,t,r){var l=2*Math.PI*6378137/256/Math.pow(2,r);return[i*l-2*Math.PI*6378137/2,t*l-2*Math.PI*6378137/2]}class Ru{constructor(t,r,l){this.z=t,this.x=r,this.y=l,this.key=Pl(0,t,t,r,l)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,l){let u=(m=this.y,x=this.z,b=Id(256*(f=this.x),256*(m=Math.pow(2,x)-m-1),x),E=Id(256*(f+1),256*(m+1),x),b[0]+","+b[1]+","+E[0]+","+E[1]);var f,m,x,b,E;let A=function(z,R,O){let G,tt="";for(let et=z;et>0;et--)G=1<<et-1,tt+=(R&G?1:0)+(O&G?2:0);return tt}(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(l==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,u)}getTilePoint(t){let r=Math.pow(2,this.z);return new ve((t.x*r-this.x)*Vi,(t.y*r-this.y)*Vi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Cd{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Pl(t,r.z,r.z,r.x,r.y)}}class un{constructor(t,r,l,u,f){this.overscaledZ=t,this.wrap=r,this.canonical=new Ru(l,+u,+f),this.key=Pl(r,t,l,u,f)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){let r=this.canonical.z-t;return t>this.canonical.z?new un(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new un(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){let l=this.canonical.z-t;return t>this.canonical.z?Pl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Pl(this.wrap*+r,t,t,this.canonical.x>>l,this.canonical.y>>l)}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 un(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,l=2*this.canonical.x,u=2*this.canonical.y;return[new un(r,this.wrap,r,l,u),new un(r,this.wrap,r,l+1,u),new un(r,this.wrap,r,l,u+1),new un(r,this.wrap,r,l+1,u+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new un(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new un(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 Cd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Zh(t.x-this.wrap,t.y))}}function Pl(i,t,r,l,u){(i*=2)<0&&(i=-1*i-1);let f=1<<r;return(f*f*i+f*u+l).toString(36)+r.toString(36)+t.toString(36)}ie("CanonicalTileID",Ru),ie("OverscaledTileID",un,{omit:["posMatrix"]});class Ad{constructor(t,r,l){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(l&&l!=="mapbox"&&l!=="terrarium")return void Ht(`"${l}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let u=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=l||"mapbox";for(let f=0;f<u;f++)this.data[this._idx(-1,f)]=this.data[this._idx(0,f)],this.data[this._idx(u,f)]=this.data[this._idx(u-1,f)],this.data[this._idx(f,-1)]=this.data[this._idx(f,0)],this.data[this._idx(f,u)]=this.data[this._idx(f,u-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(u,-1)]=this.data[this._idx(u-1,0)],this.data[this._idx(-1,u)]=this.data[this._idx(0,u-1)],this.data[this._idx(u,u)]=this.data[this._idx(u-1,u-1)]}get(t,r){let l=new Uint8Array(this.data.buffer),u=4*this._idx(t,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(l[u],l[u+1],l[u+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,l){return(256*t*256+256*r+l)/10-1e4}_unpackTerrarium(t,r,l){return 256*t+r+l/256-32768}getPixels(){return new Jr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,l){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let u=r*this.dim,f=r*this.dim+this.dim,m=l*this.dim,x=l*this.dim+this.dim;switch(r){case-1:u=f-1;break;case 1:f=u+1}switch(l){case-1:m=x-1;break;case 1:x=m+1}let b=-r*this.dim,E=-l*this.dim;for(let A=m;A<x;A++)for(let z=u;z<f;z++)this.data[this._idx(z,A)]=t.data[this._idx(z+b,A+E)]}}ie("DEMData",Ad);class Pd{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let l=t[r];this._stringToNumber[l]=r,this._numberToString[r]=l}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class zd{constructor(t,r,l,u,f){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=l,t._y=u,this.properties=t.properties,this.id=f}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}}class kd{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new jn(Vi,16,0),this.grid3D=new jn(Vi,16,0),this.featureIndexArray=new Ue,this.promoteId=r}insert(t,r,l,u,f,m){let x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,u,f);let b=m?this.grid3D:this.grid;for(let E=0;E<r.length;E++){let A=r[E],z=[1/0,1/0,-1/0,-1/0];for(let R=0;R<A.length;R++){let O=A[R];z[0]=Math.min(z[0],O.x),z[1]=Math.min(z[1],O.y),z[2]=Math.max(z[2],O.x),z[3]=Math.max(z[3],O.y)}z[0]<Vi&&z[1]<Vi&&z[2]>=0&&z[3]>=0&&b.insert(x,z[0],z[1],z[2],z[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rs.VectorTile(new wu(this.rawTileData)).layers,this.sourceLayerCoder=new Pd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,l,u){this.loadVTLayers();let f=t.params||{},m=Vi/t.tileSize/t.scale,x=ja(f.filter),b=t.queryGeometry,E=t.queryPadding*m,A=Dd(b),z=this.grid.query(A.minX-E,A.minY-E,A.maxX+E,A.maxY+E),R=Dd(t.cameraQueryGeometry),O=this.grid3D.query(R.minX-E,R.minY-E,R.maxX+E,R.maxY+E,(et,dt,bt,xt)=>function(Et,Ot,Lt,re,ue){for(let Yt of Et)if(Ot<=Yt.x&&Lt<=Yt.y&&re>=Yt.x&&ue>=Yt.y)return!0;let Jt=[new ve(Ot,Lt),new ve(Ot,ue),new ve(re,ue),new ve(re,Lt)];if(Et.length>2){for(let Yt of Jt)if(ro(Et,Yt))return!0}for(let Yt=0;Yt<Et.length-1;Yt++)if(Dg(Et[Yt],Et[Yt+1],Jt))return!0;return!1}(t.cameraQueryGeometry,et-E,dt-E,bt+E,xt+E));for(let et of O)z.push(et);z.sort(a0);let G={},tt;for(let et=0;et<z.length;et++){let dt=z[et];if(dt===tt)continue;tt=dt;let bt=this.featureIndexArray.get(dt),xt=null;this.loadMatchingFeature(G,bt.bucketIndex,bt.sourceLayerIndex,bt.featureIndex,x,f.layers,f.availableImages,r,l,u,(Et,Ot,Lt)=>(xt||(xt=da(Et)),Ot.queryIntersectsFeature(b,Et,Lt,xt,this.z,t.transform,m,t.pixelPosMatrix)))}return G}loadMatchingFeature(t,r,l,u,f,m,x,b,E,A,z){let R=this.bucketLayerIDs[r];if(m&&!function(et,dt){for(let bt=0;bt<et.length;bt++)if(dt.indexOf(et[bt])>=0)return!0;return!1}(m,R))return;let O=this.sourceLayerCoder.decode(l),G=this.vtLayers[O].feature(u);if(f.needGeometry){let et=fa(G,!0);if(!f.filter(new ci(this.tileID.overscaledZ),et,this.tileID.canonical))return}else if(!f.filter(new ci(this.tileID.overscaledZ),G))return;let tt=this.getId(G,O);for(let et=0;et<R.length;et++){let dt=R[et];if(m&&m.indexOf(dt)<0)continue;let bt=b[dt];if(!bt)continue;let xt={};tt&&A&&(xt=A.getState(bt.sourceLayer||"_geojsonTileLayer",tt));let Et=pt({},E[dt]);Et.paint=Ld(Et.paint,bt.paint,G,xt,x),Et.layout=Ld(Et.layout,bt.layout,G,xt,x);let Ot=!z||z(G,bt,xt);if(!Ot)continue;let Lt=new zd(G,this.z,this.x,this.y,tt);Lt.layer=Et;let re=t[dt];re===void 0&&(re=t[dt]=[]),re.push({featureIndex:u,feature:Lt,intersectionZ:Ot})}}lookupSymbolFeatures(t,r,l,u,f,m,x,b){let E={};this.loadVTLayers();let A=ja(f);for(let z of t)this.loadMatchingFeature(E,l,u,z,A,m,x,b,r);return E}hasLayer(t){for(let r of this.bucketLayerIDs)for(let l of r)if(t===l)return!0;return!1}getId(t,r){let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof l=="boolean"&&(l=Number(l))),l}}function Ld(i,t,r,l,u){return Rt(i,(f,m)=>{let x=t instanceof Ya?t.get(m):null;return x&&x.evaluate?x.evaluate(r,l,u):x})}function Dd(i){let t=1/0,r=1/0,l=-1/0,u=-1/0;for(let f of i)t=Math.min(t,f.x),r=Math.min(r,f.y),l=Math.max(l,f.x),u=Math.max(u,f.y);return{minX:t,minY:r,maxX:l,maxY:u}}function a0(i,t){return t-i}var Bu;ie("FeatureIndex",kd,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Bu=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Bu.load="load",Bu.fullLoad="fullLoad";let Hh=null,zl=[],Fu=1e3/30,o0={mark(i){performance.mark(i)},frame(i){let t=i;Hh!=null&&zl.push(t-Hh),Hh=t},clearMetrics(){Hh=null,zl=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(let i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);let i=performance.getEntriesByName("loadTime")[0].duration,t=performance.getEntriesByName("fullLoadTime")[0].duration,r=zl.length,l=1/(zl.reduce((f,m)=>f+m,0)/r/1e3),u=zl.filter(f=>f>Fu).reduce((f,m)=>f+(m-Fu)/Fu,0);return{loadTime:i,fullLoadTime:t,fps:l,percentDroppedFrames:u/(r+u)*100}}};a.AJAXError=ti,a.ARRAY_TYPE=no,a.Actor=class{constructor(i,t,r){this.target=i,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},ft(["receive","process"],this),this.invoker=new s0(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=oe()?i:window}send(i,t,r,l,u=!1){let f=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[f]=r);let m=Yi(this.globalScope)?void 0:[];return this.target.postMessage({id:f,type:i,hasCallback:!!r,targetMapId:l,mustQueue:u,sourceMapId:this.mapId,data:sa(t,m)},m),{cancel:()=>{r&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:l,sourceMapId:this.mapId})}}}receive(i){let t=i.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if(t.type==="<cancel>"){delete this.tasks[r];let l=this.cancelCallbacks[r];delete this.cancelCallbacks[r],l&&l()}else oe()||t.mustQueue?(this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,t)}process(){if(!this.taskQueue.length)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){if(t.type==="<response>"){let r=this.callbacks[i];delete this.callbacks[i],r&&(t.error?r($n(t.error)):r(null,$n(t.data)))}else{let r=!1,l=Yi(this.globalScope)?void 0:[],u=t.hasCallback?(x,b)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:x?sa(x):null,data:sa(b,l)},l)}:x=>{r=!0},f=null,m=$n(t.data);if(this.parent[t.type])f=this.parent[t.type](t.sourceMapId,m,u);else if(this.parent.getWorkerSource){let x=t.type.split(".");f=this.parent.getWorkerSource(t.sourceMapId,x[0],m.source)[x[1]](m,u)}else u(new Error(`Could not find function ${t.type}`));!r&&f&&f.cancel&&(this.cancelCallbacks[i]=f.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=bl,a.CanonicalTileID=Ru,a.CollisionBoxArray=Mt,a.CollisionCircleLayoutArray=class extends C{},a.Color=P,a.DEMData=Ad,a.DataConstantProperty=le,a.DictionaryCoder=Pd,a.EXTENT=Vi,a.ErrorEvent=Ft,a.EvaluationParameters=ci,a.Event=_t,a.Evented=Vt,a.FeatureIndex=kd,a.FillBucket=_u,a.FillExtrusionBucket=vu,a.GeoJSONFeature=zd,a.ImageAtlas=id,a.ImagePosition=Su,a.LineBucket=bu,a.LineStripIndexArray=class extends gt{},a.LngLat=Si,a.LngLatBounds=ma,a.MercatorCoordinate=Zh,a.ONE_EM=Xi,a.OverscaledTileID=un,a.PerformanceUtils=o0,a.PosArray=class extends zs{},a.Properties=Ni,a.QuadTriangleArray=class extends F{},a.RGBAImage=Jr,a.RasterBoundsArray=class extends ua{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=gs,a.SegmentVector=$e,a.SymbolBucket=uo,a.Transitionable=ml,a.TriangleIndexArray=pr,a.Uniform1f=ks,a.Uniform1i=class extends cn{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends cn{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends cn{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=vp,a.UniformColor=bp,a.UniformMatrix4f=class extends cn{constructor(i,t){super(i,t),this.current=Ag}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=Cd,a.ValidationError=zt,a.ZoomHistory=aa,a.addDynamicAttributes=Au,a.asyncAll=function(i,t,r){if(!i.length)return r(null,[]);let l=i.length,u=new Array(i.length),f=null;i.forEach((m,x)=>{t(m,(b,E)=>{b&&(f=b),u[x]=E,--l==0&&r(f,u)})})},a.bezier=D,a.bindAll=ft,a.cacheEntryPossiblyAdded=function(i){sn++,sn>Dr&&(i.getActor().send("enforceCacheSizeLimit",Lr),sn=0)},a.clamp=L,a.clearTileCache=function(i){let t=caches.delete(rn);i&&t.catch(i).then(()=>i())},a.clipLine=fd,a.clone=function(i){var t=new no(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},a.clone$1=Dt,a.collisionCircleLayout=Ty,a.config=Wr,a.create=function(){var i=new no(16);return no!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.createExpression=Na,a.createFilter=ja,a.createLayout=Ui,a.createStyleLayer=function(i){return i.type==="custom"?new r0(i):new n0[i.type](i)},a.dot=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},a.ease=N,a.emitValidationErrors=vh,a.enforceCacheSizeLimit=function(i){nn(),bi&&bi.then(t=>{t.keys().then(r=>{for(let l=0;l<r.length-i;l++)t.delete(r[l])})})},a.evaluateSizeForFeature=function(i,{uSize:t,uSizeT:r},{lowerSize:l,upperSize:u}){return i.kind==="source"?l/Yn:i.kind==="composite"?zi(l/Yn,u/Yn,r):t},a.evaluateSizeForZoom=function(i,t){let r=0,l=0;if(i.kind==="constant")l=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:u,minZoom:f,maxZoom:m}=i,x=u?L(xr.interpolationFactor(u,t,f,m),0,1):0;i.kind==="camera"?l=zi(i.minSize,i.maxSize,x):r=x}return{uSizeT:r,uSize:l}},a.evaluateVariableOffset=yd,a.evented=Ps,a.exported=$r,a.exported$1=yr,a.extend=pt,a.filterObject=Ct,a.getAnchorAlignment=Eu,a.getAnchorJustification=Cu,a.getArrayBuffer=Br,a.getImage=V,a.getJSON=function(i,t){return yn(pt(i,{type:"json"}),t)},a.getOverlapMode=Lu,a.getRTLTextPluginStatus=fl,a.getReferrer=an,a.getVideo=function(i,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let l=0;l<i.length;l++){let u=window.document.createElement("source");ys(i[l])||(r.crossOrigin="Anonymous"),u.src=i[l],r.appendChild(u)}return{cancel:()=>{}}},a.identity=lu,a.invert=function(i,t){var r=t[0],l=t[1],u=t[2],f=t[3],m=t[4],x=t[5],b=t[6],E=t[7],A=t[8],z=t[9],R=t[10],O=t[11],G=t[12],tt=t[13],et=t[14],dt=t[15],bt=r*x-l*m,xt=r*b-u*m,Et=r*E-f*m,Ot=l*b-u*x,Lt=l*E-f*x,re=u*E-f*b,ue=A*tt-z*G,Jt=A*et-R*G,Yt=A*dt-O*G,Zt=z*et-R*tt,ee=z*dt-O*tt,Qt=R*dt-O*et,qt=bt*Qt-xt*ee+Et*Zt+Ot*Yt-Lt*Jt+re*ue;return qt?(i[0]=(x*Qt-b*ee+E*Zt)*(qt=1/qt),i[1]=(u*ee-l*Qt-f*Zt)*qt,i[2]=(tt*re-et*Lt+dt*Ot)*qt,i[3]=(R*Lt-z*re-O*Ot)*qt,i[4]=(b*Yt-m*Qt-E*Jt)*qt,i[5]=(r*Qt-u*Yt+f*Jt)*qt,i[6]=(et*Et-G*re-dt*xt)*qt,i[7]=(A*re-R*Et+O*xt)*qt,i[8]=(m*ee-x*Yt+E*ue)*qt,i[9]=(l*Yt-r*ee-f*ue)*qt,i[10]=(G*Lt-tt*Et+dt*bt)*qt,i[11]=(z*Et-A*Lt-O*bt)*qt,i[12]=(x*Jt-m*Zt-b*ue)*qt,i[13]=(r*Zt-l*Jt+u*ue)*qt,i[14]=(tt*xt-G*Ot-et*bt)*qt,i[15]=(A*Ot-z*xt+R*bt)*qt,i):null},a.isImageBitmap=Oi,a.isSafari=Yi,a.keysDifference=function(i,t){let r=[];for(let l in i)l in t||r.push(l);return r},a.lazyLoadRTLTextPlugin=function(){Fr.isLoading()||Fr.isLoaded()||fl()!=="deferred"||Xa()},a.makeRequest=yn,a.mapObject=Rt,a.mercatorXfromLng=Sd,a.mercatorYfromLat=Td,a.mercatorZfromAltitude=Ed,a.mul=Fg,a.multiply=Ap,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.number=zi,a.ortho=function(i,t,r,l,u,f,m){var x=1/(t-r),b=1/(l-u),E=1/(f-m);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*b,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*E,i[11]=0,i[12]=(t+r)*x,i[13]=(u+l)*b,i[14]=(m+f)*E,i[15]=1,i},a.parseCacheControl=Ce,a.parseGlyphPBF=function(i){return new wu(i).readFields(By,[])},a.pbf=wu,a.performSymbolLayout=function(i,t,r,l,u,f,m){i.createArrays(),i.tilePixelRatio=Vi/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let x=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,E={layoutIconSize:b["icon-size"].possiblyEvaluate(new ci(i.zoom+1),m),layoutTextSize:b["text-size"].possiblyEvaluate(new ci(i.zoom+1),m),textMaxSize:b["text-size"].possiblyEvaluate(new ci(18))};if(i.textSizeData.kind==="composite"){let{minZoom:G,maxZoom:tt}=i.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new ci(G),m),b["text-size"].possiblyEvaluate(new ci(tt),m)]}if(i.iconSizeData.kind==="composite"){let{minZoom:G,maxZoom:tt}=i.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new ci(G),m),b["icon-size"].possiblyEvaluate(new ci(tt),m)]}let A=x.get("text-line-height")*Xi,z=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point",R=x.get("text-keep-upright"),O=x.get("text-size");for(let G of i.features){let tt=x.get("text-font").evaluate(G,{},m).join(","),et=O.evaluate(G,{},m),dt=E.layoutTextSize.evaluate(G,{},m),bt=E.layoutIconSize.evaluate(G,{},m),xt={horizontal:{},vertical:void 0},Et=G.text,Ot,Lt=[0,0];if(Et){let Jt=Et.toString(),Yt=x.get("text-letter-spacing").evaluate(G,{},m)*Xi,Zt=bh(Jt)?Yt:0,ee=x.get("text-anchor").evaluate(G,{},m),Qt=x.get("text-variable-anchor");if(!Qt){let Je=x.get("text-radial-offset").evaluate(G,{},m);Lt=Je?yd(ee,[Je*Xi,Iu]):x.get("text-offset").evaluate(G,{},m).map(pi=>pi*Xi)}let qt=z?"center":x.get("text-justify").evaluate(G,{},m),_e=x.get("symbol-placement"),de=_e==="point"?x.get("text-max-width").evaluate(G,{},m)*Xi:0,Ne=()=>{i.allowVerticalPlacement&&hl(Jt)&&(xt.vertical=Nh(Et,t,r,u,tt,de,A,ee,"left",Zt,Lt,a.WritingMode.vertical,!0,_e,dt,et))};if(!z&&Qt){let Je=qt==="auto"?Qt.map(di=>Cu(di)):[qt],pi=!1;for(let di=0;di<Je.length;di++){let Qi=Je[di];if(!xt.horizontal[Qi])if(pi)xt.horizontal[Qi]=xt.horizontal[0];else{let Li=Nh(Et,t,r,u,tt,de,A,"center",Qi,Zt,Lt,a.WritingMode.horizontal,!1,_e,dt,et);Li&&(xt.horizontal[Qi]=Li,pi=Li.positionedLines.length===1)}}Ne()}else{qt==="auto"&&(qt=Cu(ee));let Je=Nh(Et,t,r,u,tt,de,A,ee,qt,Zt,Lt,a.WritingMode.horizontal,!1,_e,dt,et);Je&&(xt.horizontal[qt]=Je),Ne(),hl(Jt)&&z&&R&&(xt.vertical=Nh(Et,t,r,u,tt,de,A,ee,qt,Zt,Lt,a.WritingMode.vertical,!1,_e,dt,et))}}let re=!1;if(G.icon&&G.icon.name){let Jt=l[G.icon.name];Jt&&(Ot=Gy(u[G.icon.name],x.get("icon-offset").evaluate(G,{},m),x.get("icon-anchor").evaluate(G,{},m)),re=!!Jt.sdf,i.sdfIcons===void 0?i.sdfIcons=re:i.sdfIcons!==re&&Ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Jt.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}let ue=xd(xt.horizontal)||xt.vertical;i.iconsInText=!!ue&&ue.iconsInText,(ue||Ot)&&Xy(i,G,xt,Ot,l,E,dt,bt,Lt,re,m)}f&&i.generateCollisionDebugBuffers()},a.perspective=function(i,t,r,l,u){var f,m=1/Math.tan(t/2);return i[0]=m/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,u!=null&&u!==1/0?(i[10]=(u+l)*(f=1/(l-u)),i[14]=2*u*l*f):(i[10]=-1,i[14]=-2*l),i},a.pick=function(i,t){let r={};for(let l=0;l<t.length;l++){let u=t[l];u in i&&(r[u]=i[u])}return r},a.plugin=Fr,a.pointGeometry=ve,a.polygonIntersectsPolygon=Tp,a.potpack=ed,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=ie,a.registerForPluginStateChange=function(i){return i({pluginStatus:cr,pluginURL:In}),Ps.on("pluginStateChange",i),i},a.renderColorRamp=Lp,a.rotateX=function(i,t,r){var l=Math.sin(r),u=Math.cos(r),f=t[4],m=t[5],x=t[6],b=t[7],E=t[8],A=t[9],z=t[10],R=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=f*u+E*l,i[5]=m*u+A*l,i[6]=x*u+z*l,i[7]=b*u+R*l,i[8]=E*u-f*l,i[9]=A*u-m*l,i[10]=z*u-x*l,i[11]=R*u-b*l,i},a.rotateZ=function(i,t,r){var l=Math.sin(r),u=Math.cos(r),f=t[0],m=t[1],x=t[2],b=t[3],E=t[4],A=t[5],z=t[6],R=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=f*u+E*l,i[1]=m*u+A*l,i[2]=x*u+z*l,i[3]=b*u+R*l,i[4]=E*u-f*l,i[5]=A*u-m*l,i[6]=z*u-x*l,i[7]=R*u-b*l,i},a.scale=function(i,t,r){var l=r[0],u=r[1],f=r[2];return i[0]=t[0]*l,i[1]=t[1]*l,i[2]=t[2]*l,i[3]=t[3]*l,i[4]=t[4]*u,i[5]=t[5]*u,i[6]=t[6]*u,i[7]=t[7]*u,i[8]=t[8]*f,i[9]=t[9]*f,i[10]=t[10]*f,i[11]=t[11]*f,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},a.scale$1=function(i,t,r){return i[0]=t[0]*r,i[1]=t[1]*r,i[2]=t[2]*r,i[3]=t[3]*r,i},a.setCacheLimits=function(i,t){Lr=i,Dr=t},a.setRTLTextPlugin=function(i,t,r=!1){if(cr===Ha||cr===cl||cr===ul)throw new Error("setRTLTextPlugin cannot be called multiple times.");In=$r.resolveURL(i),cr=Ha,pl=t,dl(),r||Xa()},a.spec=ct,a.sphericalToCartesian=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},a.toEvaluationFeature=fa,a.transformMat4=kh,a.translate=function(i,t,r){var l,u,f,m,x,b,E,A,z,R,O,G,tt=r[0],et=r[1],dt=r[2];return t===i?(i[12]=t[0]*tt+t[4]*et+t[8]*dt+t[12],i[13]=t[1]*tt+t[5]*et+t[9]*dt+t[13],i[14]=t[2]*tt+t[6]*et+t[10]*dt+t[14],i[15]=t[3]*tt+t[7]*et+t[11]*dt+t[15]):(u=t[1],f=t[2],m=t[3],x=t[4],b=t[5],E=t[6],A=t[7],z=t[8],R=t[9],O=t[10],G=t[11],i[0]=l=t[0],i[1]=u,i[2]=f,i[3]=m,i[4]=x,i[5]=b,i[6]=E,i[7]=A,i[8]=z,i[9]=R,i[10]=O,i[11]=G,i[12]=l*tt+x*et+z*dt+t[12],i[13]=u*tt+b*et+R*dt+t[13],i[14]=f*tt+E*et+O*dt+t[14],i[15]=m*tt+A*et+G*dt+t[15]),i},a.triggerPluginCompletionEvent=Sh,a.unicodeBlockLookup=Xt,a.uniqueId=function(){return ot++},a.validateCustomStyleLayer=function(i){let t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},a.validateLight=Kc,a.validateStyle=qn,a.vectorTile=Rs,a.warnOnce=Ht,a.wrap=Q}),g(["./shared"],function(a){"use strict";function M(Z){let I=typeof Z;if(I==="number"||I==="boolean"||I==="string"||Z==null)return JSON.stringify(Z);if(Array.isArray(Z)){let H="[";for(let K of Z)H+=`${M(K)},`;return`${H}]`}let P=Object.keys(Z).sort(),q="{";for(let H=0;H<P.length;H++)q+=`${JSON.stringify(P[H])}:${M(Z[P[H]])},`;return`${q}}`}function S(Z){let I="";for(let P of a.refProperties)I+=`/${M(Z[P])}`;return I}class D{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,P){for(let H of I){this._layerConfigs[H.id]=H;let K=this._layers[H.id]=a.createStyleLayer(H);K._featureFilter=a.createFilter(K.filter),this.keyCache[H.id]&&delete this.keyCache[H.id]}for(let H of P)delete this.keyCache[H],delete this._layerConfigs[H],delete this._layers[H];this.familiesBySource={};let q=function(H,K){let st={};for(let rt=0;rt<H.length;rt++){let at=K&&K[H[rt].id]||S(H[rt]);K&&(K[H[rt].id]=at);let St=st[at];St||(St=st[at]=[]),St.push(H[rt])}let it=[];for(let rt in st)it.push(st[rt]);return it}(Object.values(this._layerConfigs),this.keyCache);for(let H of q){let K=H.map(Bt=>this._layers[Bt.id]),st=K[0];if(st.visibility==="none")continue;let it=st.source||"",rt=this.familiesBySource[it];rt||(rt=this.familiesBySource[it]={});let at=st.sourceLayer||"_geojsonTileLayer",St=rt[at];St||(St=rt[at]=[]),St.push(K)}}}class N{constructor(I){let P={},q=[];for(let it in I){let rt=I[it],at=P[it]={};for(let St in rt){let Bt=rt[+St];if(!Bt||Bt.bitmap.width===0||Bt.bitmap.height===0)continue;let wt={x:0,y:0,w:Bt.bitmap.width+2,h:Bt.bitmap.height+2};q.push(wt),at[St]={rect:wt,metrics:Bt.metrics}}}let{w:H,h:K}=a.potpack(q),st=new a.AlphaImage({width:H||1,height:K||1});for(let it in I){let rt=I[it];for(let at in rt){let St=rt[+at];if(!St||St.bitmap.width===0||St.bitmap.height===0)continue;let Bt=P[it][at].rect;a.AlphaImage.copy(St.bitmap,st,{x:0,y:0},{x:Bt.x+1,y:Bt.y+1},St.bitmap)}}this.image=st,this.positions=P}}a.register("GlyphAtlas",N);class L{constructor(I){this.tileID=new a.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,P,q,H,K){this.status="parsing",this.data=I,this.collisionBoxArray=new a.CollisionBoxArray;let st=new a.DictionaryCoder(Object.keys(I.layers).sort()),it=new a.FeatureIndex(this.tileID,this.promoteId);it.bucketLayerIDs=[];let rt={},at={featureIndex:it,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},St=P.familiesBySource[this.source];for(let Le in St){let Ie=I.layers[Le];if(!Ie)continue;Ie.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${Le}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Te=st.encode(Le),Ti=[];for(let wi=0;wi<Ie.length;wi++){let qi=Ie.feature(wi),Zi=it.getId(qi,Le);Ti.push({feature:qi,id:Zi,index:wi,sourceLayerIndex:Te})}for(let wi of St[Le]){let qi=wi[0];qi.minzoom&&this.zoom<Math.floor(qi.minzoom)||qi.maxzoom&&this.zoom>=qi.maxzoom||qi.visibility!=="none"&&(Q(wi,this.zoom,q),(rt[qi.id]=qi.createBucket({index:it.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Te,sourceID:this.source})).populate(Ti,at,this.tileID.canonical),it.bucketLayerIDs.push(wi.map(Zi=>Zi.id)))}}let Bt,wt,ae,te,he=a.mapObject(at.glyphDependencies,Le=>Object.keys(Le).map(Number));Object.keys(he).length?H.send("getGlyphs",{uid:this.uid,stacks:he},(Le,Ie)=>{Bt||(Bt=Le,wt=Ie,Fe.call(this))}):wt={};let ge=Object.keys(at.iconDependencies);ge.length?H.send("getImages",{icons:ge,source:this.source,tileID:this.tileID,type:"icons"},(Le,Ie)=>{Bt||(Bt=Le,ae=Ie,Fe.call(this))}):ae={};let Ge=Object.keys(at.patternDependencies);function Fe(){if(Bt)return K(Bt);if(wt&&ae&&te){let Le=new N(wt),Ie=new a.ImageAtlas(ae,te);for(let Te in rt){let Ti=rt[Te];Ti instanceof a.SymbolBucket?(Q(Ti.layers,this.zoom,q),a.performSymbolLayout(Ti,wt,Le.positions,ae,Ie.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):Ti.hasPattern&&(Ti instanceof a.LineBucket||Ti instanceof a.FillBucket||Ti instanceof a.FillExtrusionBucket)&&(Q(Ti.layers,this.zoom,q),Ti.addFeatures(at,this.tileID.canonical,Ie.patternPositions))}this.status="done",K(null,{buckets:Object.values(rt).filter(Te=>!Te.isEmpty()),featureIndex:it,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Le.image,imageAtlas:Ie,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?ae:null,glyphPositions:this.returnDependencies?Le.positions:null})}}Ge.length?H.send("getImages",{icons:Ge,source:this.source,tileID:this.tileID,type:"patterns"},(Le,Ie)=>{Bt||(Bt=Le,te=Ie,Fe.call(this))}):te={},Fe.call(this)}}function Q(Z,I,P){let q=new a.EvaluationParameters(I);for(let H of Z)H.recalculate(q,P)}function pt(Z,I){let P=a.getArrayBuffer(Z.request,(q,H,K,st)=>{q?I(q):H&&I(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(H)),rawData:H,cacheControl:K,expires:st})});return()=>{P.cancel(),I()}}class ot{constructor(I,P,q,H){this.actor=I,this.layerIndex=P,this.availableImages=q,this.loadVectorData=H||pt,this.loading={},this.loaded={}}loadTile(I,P){let q=I.uid;this.loading||(this.loading={});let H=!!(I&&I.request&&I.request.collectResourceTiming)&&new a.RequestPerformance(I.request),K=this.loading[q]=new L(I);K.abort=this.loadVectorData(I,(st,it)=>{if(delete this.loading[q],st||!it)return K.status="done",this.loaded[q]=K,P(st);let rt=it.rawData,at={};it.expires&&(at.expires=it.expires),it.cacheControl&&(at.cacheControl=it.cacheControl);let St={};if(H){let Bt=H.finish();Bt&&(St.resourceTiming=JSON.parse(JSON.stringify(Bt)))}K.vectorTile=it.vectorTile,K.parse(it.vectorTile,this.layerIndex,this.availableImages,this.actor,(Bt,wt)=>{if(Bt||!wt)return P(Bt);P(null,a.extend({rawTileData:rt.slice(0)},wt,at,St))}),this.loaded=this.loaded||{},this.loaded[q]=K})}reloadTile(I,P){let q=this.loaded,H=I.uid,K=this;if(q&&q[H]){let st=q[H];st.showCollisionBoxes=I.showCollisionBoxes;let it=(rt,at)=>{let St=st.reloadCallback;St&&(delete st.reloadCallback,st.parse(st.vectorTile,K.layerIndex,this.availableImages,K.actor,St)),P(rt,at)};st.status==="parsing"?st.reloadCallback=it:st.status==="done"&&(st.vectorTile?st.parse(st.vectorTile,this.layerIndex,this.availableImages,this.actor,it):it())}}abortTile(I,P){let q=this.loading,H=I.uid;q&&q[H]&&q[H].abort&&(q[H].abort(),delete q[H]),P()}removeTile(I,P){let q=this.loaded,H=I.uid;q&&q[H]&&delete q[H],P()}}class ft{constructor(){this.loaded={}}loadTile(I,P){let{uid:q,encoding:H,rawImageData:K}=I,st=a.isImageBitmap(K)?this.getImageData(K):K,it=new a.DEMData(q,st,H);this.loaded=this.loaded||{},this.loaded[q]=it,P(null,it)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);let P=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(I){let P=this.loaded,q=I.uid;P&&P[q]&&delete P[q]}}var Rt=function Z(I,P){var q,H=I&&I.type;if(H==="FeatureCollection")for(q=0;q<I.features.length;q++)Z(I.features[q],P);else if(H==="GeometryCollection")for(q=0;q<I.geometries.length;q++)Z(I.geometries[q],P);else if(H==="Feature")Z(I.geometry,P);else if(H==="Polygon")Ct(I.coordinates,P);else if(H==="MultiPolygon")for(q=0;q<I.coordinates.length;q++)Ct(I.coordinates[q],P);return I};function Ct(Z,I){if(Z.length!==0){Dt(Z[0],I);for(var P=1;P<Z.length;P++)Dt(Z[P],!I)}}function Dt(Z,I){for(var P=0,q=0,H=0,K=Z.length,st=K-1;H<K;st=H++){var it=(Z[H][0]-Z[st][0])*(Z[st][1]+Z[H][1]),rt=P+it;q+=Math.abs(P)>=Math.abs(it)?P-rt+it:it-rt+P,P=rt}P+q>=0!=!!I&&Z.reverse()}let ne=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Ht{constructor(I){this._feature=I,this.extent=a.EXTENT,this.type=I.type,this.properties=I.tags,"id"in I&&!isNaN(I.id)&&(this.id=parseInt(I.id,10))}loadGeometry(){if(this._feature.type===1){let I=[];for(let P of this._feature.geometry)I.push([new a.pointGeometry(P[0],P[1])]);return I}{let I=[];for(let P of this._feature.geometry){let q=[];for(let H of P)q.push(new a.pointGeometry(H[0],H[1]));I.push(q)}return I}}toGeoJSON(I,P,q){return ne.call(this,I,P,q)}}class fe{constructor(I){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=I.length,this._features=I}feature(I){return new Ht(this._features[I])}}var me={exports:{}},oe=a.pointGeometry,Ce=a.vectorTile.VectorTileFeature,Re=mi;function mi(Z,I){this.options=I||{},this.features=Z,this.length=Z.length}function Fi(Z,I){this.id=typeof Z.id=="number"?Z.id:void 0,this.type=Z.type,this.rawGeometry=Z.type===1?[Z.geometry]:Z.geometry,this.properties=Z.tags,this.extent=I||4096}mi.prototype.feature=function(Z){return new Fi(this.features[Z],this.options.extent)},Fi.prototype.loadGeometry=function(){var Z=this.rawGeometry;this.geometry=[];for(var I=0;I<Z.length;I++){for(var P=Z[I],q=[],H=0;H<P.length;H++)q.push(new oe(P[H][0],P[H][1]));this.geometry.push(q)}return this.geometry},Fi.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Z=this.geometry,I=1/0,P=-1/0,q=1/0,H=-1/0,K=0;K<Z.length;K++)for(var st=Z[K],it=0;it<st.length;it++){var rt=st[it];I=Math.min(I,rt.x),P=Math.max(P,rt.x),q=Math.min(q,rt.y),H=Math.max(H,rt.y)}return[I,q,P,H]},Fi.prototype.toGeoJSON=Ce.prototype.toGeoJSON;var Yi=a.pbf,Oi=Re;function $r(Z){var I=new Yi;return function(P,q){for(var H in P.layers)q.writeMessage(3,ve,P.layers[H])}(Z,I),I.finish()}function ve(Z,I){var P;I.writeVarintField(15,Z.version||1),I.writeStringField(1,Z.name||""),I.writeVarintField(5,Z.extent||4096);var q={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<Z.length;P++)q.feature=Z.feature(P),I.writeMessage(2,kr,q);var H=q.keys;for(P=0;P<H.length;P++)I.writeStringField(3,H[P]);var K=q.values;for(P=0;P<K.length;P++)I.writeMessage(4,Lr,K[P])}function kr(Z,I){var P=Z.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,Wr,Z),I.writeVarintField(3,P.type),I.writeMessage(4,gn,P)}function Wr(Z,I){var P=Z.feature,q=Z.keys,H=Z.values,K=Z.keycache,st=Z.valuecache;for(var it in P.properties){var rt=P.properties[it],at=K[it];if(rt!==null){at===void 0&&(q.push(it),K[it]=at=q.length-1),I.writeVarint(at);var St=typeof rt;St!=="string"&&St!=="boolean"&&St!=="number"&&(rt=JSON.stringify(rt));var Bt=St+":"+rt,wt=st[Bt];wt===void 0&&(H.push(rt),st[Bt]=wt=H.length-1),I.writeVarint(wt)}}}function rn(Z,I){return(I<<3)+(7&Z)}function bi(Z){return Z<<1^Z>>31}function gn(Z,I){for(var P=Z.loadGeometry(),q=Z.type,H=0,K=0,st=P.length,it=0;it<st;it++){var rt=P[it],at=1;q===1&&(at=rt.length),I.writeVarint(rn(1,at));for(var St=q===3?rt.length-1:rt.length,Bt=0;Bt<St;Bt++){Bt===1&&q!==1&&I.writeVarint(rn(2,St-1));var wt=rt[Bt].x-H,ae=rt[Bt].y-K;I.writeVarint(bi(wt)),I.writeVarint(bi(ae)),H+=wt,K+=ae}q===3&&I.writeVarint(rn(7,1))}}function Lr(Z,I){var P=typeof Z;P==="string"?I.writeStringField(1,Z):P==="boolean"?I.writeBooleanField(7,Z):P==="number"&&(Z%1!=0?I.writeDoubleField(3,Z):Z<0?I.writeSVarintField(6,Z):I.writeVarintField(5,Z))}me.exports=$r,me.exports.fromVectorTileJs=$r,me.exports.fromGeojsonVt=function(Z,I){I=I||{};var P={};for(var q in Z)P[q]=new Oi(Z[q].features,I),P[q].name=q,P[q].version=I.version,P[q].extent=I.extent;return $r({layers:P})},me.exports.GeoJSONWrapper=Oi;var Dr=me.exports;function nn(Z,I,P,q,H,K){if(H-q<=P)return;let st=q+H>>1;sn(Z,I,st,q,H,K%2),nn(Z,I,P,q,st-1,K+1),nn(Z,I,P,st+1,H,K+1)}function sn(Z,I,P,q,H,K){for(;H>q;){if(H-q>600){let at=H-q+1,St=P-q+1,Bt=Math.log(at),wt=.5*Math.exp(2*Bt/3),ae=.5*Math.sqrt(Bt*wt*(at-wt)/at)*(St-at/2<0?-1:1);sn(Z,I,P,Math.max(q,Math.floor(P-St*wt/at+ae)),Math.min(H,Math.floor(P+(at-St)*wt/at+ae)),K)}let st=I[2*P+K],it=q,rt=H;for(yr(Z,I,q,P),I[2*H+K]>st&&yr(Z,I,q,H);it<rt;){for(yr(Z,I,it,rt),it++,rt--;I[2*it+K]<st;)it++;for(;I[2*rt+K]>st;)rt--}I[2*q+K]===st?yr(Z,I,q,rt):(rt++,yr(Z,I,rt,H)),rt<=P&&(q=rt+1),P<=rt&&(H=rt-1)}}function yr(Z,I,P,q){Rr(Z,P,q),Rr(I,2*P,2*q),Rr(I,2*P+1,2*q+1)}function Rr(Z,I,P){let q=Z[I];Z[I]=Z[P],Z[P]=q}function Zr(Z,I,P,q){let H=Z-P,K=I-q;return H*H+K*K}let En=Z=>Z[0],Bn=Z=>Z[1];class Fn{constructor(I,P=En,q=Bn,H=64,K=Float64Array){this.nodeSize=H,this.points=I;let st=I.length<65536?Uint16Array:Uint32Array,it=this.ids=new st(I.length),rt=this.coords=new K(2*I.length);for(let at=0;at<I.length;at++)it[at]=at,rt[2*at]=P(I[at]),rt[2*at+1]=q(I[at]);nn(it,rt,H,0,it.length-1,0)}range(I,P,q,H){return function(K,st,it,rt,at,St,Bt){let wt=[0,K.length-1,0],ae=[],te,he;for(;wt.length;){let ge=wt.pop(),Ge=wt.pop(),Fe=wt.pop();if(Ge-Fe<=Bt){for(let Te=Fe;Te<=Ge;Te++)te=st[2*Te],he=st[2*Te+1],te>=it&&te<=at&&he>=rt&&he<=St&&ae.push(K[Te]);continue}let Le=Math.floor((Fe+Ge)/2);te=st[2*Le],he=st[2*Le+1],te>=it&&te<=at&&he>=rt&&he<=St&&ae.push(K[Le]);let Ie=(ge+1)%2;(ge===0?it<=te:rt<=he)&&(wt.push(Fe),wt.push(Le-1),wt.push(Ie)),(ge===0?at>=te:St>=he)&&(wt.push(Le+1),wt.push(Ge),wt.push(Ie))}return ae}(this.ids,this.coords,I,P,q,H,this.nodeSize)}within(I,P,q){return function(H,K,st,it,rt,at){let St=[0,H.length-1,0],Bt=[],wt=rt*rt;for(;St.length;){let ae=St.pop(),te=St.pop(),he=St.pop();if(te-he<=at){for(let Ie=he;Ie<=te;Ie++)Zr(K[2*Ie],K[2*Ie+1],st,it)<=wt&&Bt.push(H[Ie]);continue}let ge=Math.floor((he+te)/2),Ge=K[2*ge],Fe=K[2*ge+1];Zr(Ge,Fe,st,it)<=wt&&Bt.push(H[ge]);let Le=(ae+1)%2;(ae===0?st-rt<=Ge:it-rt<=Fe)&&(St.push(he),St.push(ge-1),St.push(Le)),(ae===0?st+rt>=Ge:it+rt>=Fe)&&(St.push(ge+1),St.push(te),St.push(Le))}return Bt}(this.ids,this.coords,I,P,q,this.nodeSize)}}let gs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Z=>Z},ti=Math.fround||(an=new Float32Array(1),Z=>(an[0]=+Z,an[0]));var an;class On{constructor(I){this.options=X(Object.create(gs),I),this.trees=new Array(this.options.maxZoom+1)}load(I){let{log:P,minZoom:q,maxZoom:H,nodeSize:K}=this.options;P&&console.time("total time");let st=`prepare ${I.length} points`;P&&console.time(st),this.points=I;let it=[];for(let rt=0;rt<I.length;rt++)I[rt].geometry&&it.push(Br(I[rt],rt));this.trees[H+1]=new Fn(it,nt,_t,K,Float32Array),P&&console.timeEnd(st);for(let rt=H;rt>=q;rt--){let at=+Date.now();it=this._cluster(it,rt),this.trees[rt]=new Fn(it,nt,_t,K,Float32Array),P&&console.log("z%d: %d clusters in %dms",rt,it.length,+Date.now()-at)}return P&&console.timeEnd("total time"),this}getClusters(I,P){let q=((I[0]+180)%360+360)%360-180,H=Math.max(-90,Math.min(90,I[1])),K=I[2]===180?180:((I[2]+180)%360+360)%360-180,st=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)q=-180,K=180;else if(q>K){let St=this.getClusters([q,H,180,st],P),Bt=this.getClusters([-180,H,K,st],P);return St.concat(Bt)}let it=this.trees[this._limitZoom(P)],rt=it.range(U(q),B(st),U(K),B(H)),at=[];for(let St of rt){let Bt=it.points[St];at.push(Bt.numPoints?ys(Bt):this.points[Bt.index])}return at}getChildren(I){let P=this._getOriginId(I),q=this._getOriginZoom(I),H="No cluster with the specified id.",K=this.trees[q];if(!K)throw new Error(H);let st=K.points[P];if(!st)throw new Error(H);let it=this.options.radius/(this.options.extent*Math.pow(2,q-1)),rt=K.within(st.x,st.y,it),at=[];for(let St of rt){let Bt=K.points[St];Bt.parentId===I&&at.push(Bt.numPoints?ys(Bt):this.points[Bt.index])}if(at.length===0)throw new Error(H);return at}getLeaves(I,P,q){let H=[];return this._appendLeaves(H,I,P=P||10,q=q||0,0),H}getTile(I,P,q){let H=this.trees[this._limitZoom(I)],K=Math.pow(2,I),{extent:st,radius:it}=this.options,rt=it/st,at=(q-rt)/K,St=(q+1+rt)/K,Bt={features:[]};return this._addTileFeatures(H.range((P-rt)/K,at,(P+1+rt)/K,St),H.points,P,q,K,Bt),P===0&&this._addTileFeatures(H.range(1-rt/K,at,1,St),H.points,K,q,K,Bt),P===K-1&&this._addTileFeatures(H.range(0,at,rt/K,St),H.points,-1,q,K,Bt),Bt.features.length?Bt:null}getClusterExpansionZoom(I){let P=this._getOriginZoom(I)-1;for(;P<=this.options.maxZoom;){let q=this.getChildren(I);if(P++,q.length!==1)break;I=q[0].properties.cluster_id}return P}_appendLeaves(I,P,q,H,K){let st=this.getChildren(P);for(let it of st){let rt=it.properties;if(rt&&rt.cluster?K+rt.point_count<=H?K+=rt.point_count:K=this._appendLeaves(I,rt.cluster_id,q,H,K):K<H?K++:I.push(it),I.length===q)break}return K}_addTileFeatures(I,P,q,H,K,st){for(let it of I){let rt=P[it],at=rt.numPoints,St,Bt,wt;if(at)St=mt(rt),Bt=rt.x,wt=rt.y;else{let he=this.points[rt.index];St=he.properties,Bt=U(he.geometry.coordinates[0]),wt=B(he.geometry.coordinates[1])}let ae={type:1,geometry:[[Math.round(this.options.extent*(Bt*K-q)),Math.round(this.options.extent*(wt*K-H))]],tags:St},te;at?te=rt.id:this.options.generateId?te=rt.index:this.points[rt.index].id&&(te=this.points[rt.index].id),te!==void 0&&(ae.id=te),st.features.push(ae)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(+I,this.options.maxZoom+1))}_cluster(I,P){let q=[],{radius:H,extent:K,reduce:st,minPoints:it}=this.options,rt=H/(K*Math.pow(2,P));for(let at=0;at<I.length;at++){let St=I[at];if(St.zoom<=P)continue;St.zoom=P;let Bt=this.trees[P+1],wt=Bt.within(St.x,St.y,rt),ae=St.numPoints||1,te=ae;for(let he of wt){let ge=Bt.points[he];ge.zoom>P&&(te+=ge.numPoints||1)}if(te>ae&&te>=it){let he=St.x*ae,ge=St.y*ae,Ge=st&&ae>1?this._map(St,!0):null,Fe=(at<<5)+(P+1)+this.points.length;for(let Le of wt){let Ie=Bt.points[Le];if(Ie.zoom<=P)continue;Ie.zoom=P;let Te=Ie.numPoints||1;he+=Ie.x*Te,ge+=Ie.y*Te,Ie.parentId=Fe,st&&(Ge||(Ge=this._map(St,!0)),st(Ge,this._map(Ie)))}St.parentId=Fe,q.push(yn(he/te,ge/te,Fe,te,Ge))}else if(q.push(St),te>1)for(let he of wt){let ge=Bt.points[he];ge.zoom<=P||(ge.zoom=P,q.push(ge))}}return q}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,P){if(I.numPoints)return P?X({},I.properties):I.properties;let q=this.points[I.index].properties,H=this.options.map(q);return P&&H===q?X({},H):H}}function yn(Z,I,P,q,H){return{x:ti(Z),y:ti(I),zoom:1/0,id:P,parentId:-1,numPoints:q,properties:H}}function Br(Z,I){let[P,q]=Z.geometry.coordinates;return{x:ti(U(P)),y:ti(B(q)),zoom:1/0,index:I,parentId:-1}}function ys(Z){return{type:"Feature",id:Z.id,properties:mt(Z),geometry:{type:"Point",coordinates:[(I=Z.x,360*(I-.5)),V(Z.y)]}};var I}function mt(Z){let I=Z.numPoints,P=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?Math.round(I/100)/10+"k":I;return X(X({},Z.properties),{cluster:!0,cluster_id:Z.id,point_count:I,point_count_abbreviated:P})}function U(Z){return Z/360+.5}function B(Z){let I=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function V(Z){let I=(180-360*Z)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function X(Z,I){for(let P in I)Z[P]=I[P];return Z}function nt(Z){return Z.x}function _t(Z){return Z.y}function Ft(Z,I,P,q){for(var H,K=q,st=P-I>>1,it=P-I,rt=Z[I],at=Z[I+1],St=Z[P],Bt=Z[P+1],wt=I+3;wt<P;wt+=3){var ae=Vt(Z[wt],Z[wt+1],rt,at,St,Bt);if(ae>K)H=wt,K=ae;else if(ae===K){var te=Math.abs(wt-st);te<it&&(H=wt,it=te)}}K>q&&(H-I>3&&Ft(Z,I,H,q),Z[H+2]=K,P-H>3&&Ft(Z,H,P,q))}function Vt(Z,I,P,q,H,K){var st=H-P,it=K-q;if(st!==0||it!==0){var rt=((Z-P)*st+(I-q)*it)/(st*st+it*it);rt>1?(P=H,q=K):rt>0&&(P+=st*rt,q+=it*rt)}return(st=Z-P)*st+(it=I-q)*it}function ct(Z,I,P,q){var H={id:Z===void 0?null:Z,type:I,geometry:P,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(K){var st=K.geometry,it=K.type;if(it==="Point"||it==="MultiPoint"||it==="LineString")zt(K,st);else if(it==="Polygon"||it==="MultiLineString")for(var rt=0;rt<st.length;rt++)zt(K,st[rt]);else if(it==="MultiPolygon")for(rt=0;rt<st.length;rt++)for(var at=0;at<st[rt].length;at++)zt(K,st[rt][at])}(H),H}function zt(Z,I){for(var P=0;P<I.length;P+=3)Z.minX=Math.min(Z.minX,I[P]),Z.minY=Math.min(Z.minY,I[P+1]),Z.maxX=Math.max(Z.maxX,I[P]),Z.maxY=Math.max(Z.maxY,I[P+1])}function Ee(Z,I,P,q){if(I.geometry){var H=I.geometry.coordinates,K=I.geometry.type,st=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),it=[],rt=I.id;if(P.promoteId?rt=I.properties[P.promoteId]:P.generateId&&(rt=q||0),K==="Point")Ae(H,it);else if(K==="MultiPoint")for(var at=0;at<H.length;at++)Ae(H[at],it);else if(K==="LineString")ce(H,it,st,!1);else if(K==="MultiLineString"){if(P.lineMetrics){for(at=0;at<H.length;at++)ce(H[at],it=[],st,!1),Z.push(ct(rt,"LineString",it,I.properties));return}Ve(H,it,st,!1)}else if(K==="Polygon")Ve(H,it,st,!0);else{if(K!=="MultiPolygon"){if(K==="GeometryCollection"){for(at=0;at<I.geometry.geometries.length;at++)Ee(Z,{id:rt,geometry:I.geometry.geometries[at],properties:I.properties},P,q);return}throw new Error("Input data is not a valid GeoJSON object.")}for(at=0;at<H.length;at++){var St=[];Ve(H[at],St,st,!0),it.push(St)}}Z.push(ct(rt,K,it,I.properties))}}function Ae(Z,I){I.push(Pe(Z[0])),I.push(ei(Z[1])),I.push(0)}function ce(Z,I,P,q){for(var H,K,st=0,it=0;it<Z.length;it++){var rt=Pe(Z[it][0]),at=ei(Z[it][1]);I.push(rt),I.push(at),I.push(0),it>0&&(st+=q?(H*at-rt*K)/2:Math.sqrt(Math.pow(rt-H,2)+Math.pow(at-K,2))),H=rt,K=at}var St=I.length-3;I[2]=1,Ft(I,0,St,P),I[St+2]=1,I.size=Math.abs(st),I.start=0,I.end=I.size}function Ve(Z,I,P,q){for(var H=0;H<Z.length;H++){var K=[];ce(Z[H],K,P,q),I.push(K)}}function Pe(Z){return Z/360+.5}function ei(Z){var I=Math.sin(Z*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function ke(Z,I,P,q,H,K,st,it){if(q/=I,K>=(P/=I)&&st<q)return Z;if(st<P||K>=q)return null;for(var rt=[],at=0;at<Z.length;at++){var St=Z[at],Bt=St.geometry,wt=St.type,ae=H===0?St.minX:St.minY,te=H===0?St.maxX:St.maxY;if(ae>=P&&te<q)rt.push(St);else if(!(te<P||ae>=q)){var he=[];if(wt==="Point"||wt==="MultiPoint")Gt(Bt,he,P,q,H);else if(wt==="LineString")xe(Bt,he,P,q,H,!1,it.lineMetrics);else if(wt==="MultiLineString")oi(Bt,he,P,q,H,!1);else if(wt==="Polygon")oi(Bt,he,P,q,H,!0);else if(wt==="MultiPolygon")for(var ge=0;ge<Bt.length;ge++){var Ge=[];oi(Bt[ge],Ge,P,q,H,!0),Ge.length&&he.push(Ge)}if(he.length){if(it.lineMetrics&&wt==="LineString"){for(ge=0;ge<he.length;ge++)rt.push(ct(St.id,wt,he[ge],St.tags));continue}wt!=="LineString"&&wt!=="MultiLineString"||(he.length===1?(wt="LineString",he=he[0]):wt="MultiLineString"),wt!=="Point"&&wt!=="MultiPoint"||(wt=he.length===3?"Point":"MultiPoint"),rt.push(ct(St.id,wt,he,St.tags))}}}return rt.length?rt:null}function Gt(Z,I,P,q,H){for(var K=0;K<Z.length;K+=3){var st=Z[K+H];st>=P&&st<=q&&(I.push(Z[K]),I.push(Z[K+1]),I.push(Z[K+2]))}}function xe(Z,I,P,q,H,K,st){for(var it,rt,at=pe(Z),St=H===0?be:rr,Bt=Z.start,wt=0;wt<Z.length-3;wt+=3){var ae=Z[wt],te=Z[wt+1],he=Z[wt+2],ge=Z[wt+3],Ge=Z[wt+4],Fe=H===0?ae:te,Le=H===0?ge:Ge,Ie=!1;st&&(it=Math.sqrt(Math.pow(ae-ge,2)+Math.pow(te-Ge,2))),Fe<P?Le>P&&(rt=St(at,ae,te,ge,Ge,P),st&&(at.start=Bt+it*rt)):Fe>q?Le<q&&(rt=St(at,ae,te,ge,Ge,q),st&&(at.start=Bt+it*rt)):Wi(at,ae,te,he),Le<P&&Fe>=P&&(rt=St(at,ae,te,ge,Ge,P),Ie=!0),Le>q&&Fe<=q&&(rt=St(at,ae,te,ge,Ge,q),Ie=!0),!K&&Ie&&(st&&(at.end=Bt+it*rt),I.push(at),at=pe(Z)),st&&(Bt+=it)}var Te=Z.length-3;ae=Z[Te],te=Z[Te+1],he=Z[Te+2],(Fe=H===0?ae:te)>=P&&Fe<=q&&Wi(at,ae,te,he),Te=at.length-3,K&&Te>=3&&(at[Te]!==at[0]||at[Te+1]!==at[1])&&Wi(at,at[0],at[1],at[2]),at.length&&I.push(at)}function pe(Z){var I=[];return I.size=Z.size,I.start=Z.start,I.end=Z.end,I}function oi(Z,I,P,q,H,K){for(var st=0;st<Z.length;st++)xe(Z[st],I,P,q,H,K,!1)}function Wi(Z,I,P,q){Z.push(I),Z.push(P),Z.push(q)}function be(Z,I,P,q,H,K){var st=(K-I)/(q-I);return Z.push(K),Z.push(P+(H-P)*st),Z.push(1),st}function rr(Z,I,P,q,H,K){var st=(K-P)/(H-P);return Z.push(I+(q-I)*st),Z.push(K),Z.push(1),st}function yi(Z,I){for(var P=[],q=0;q<Z.length;q++){var H,K=Z[q],st=K.type;if(st==="Point"||st==="MultiPoint"||st==="LineString")H=nr(K.geometry,I);else if(st==="MultiLineString"||st==="Polygon"){H=[];for(var it=0;it<K.geometry.length;it++)H.push(nr(K.geometry[it],I))}else if(st==="MultiPolygon")for(H=[],it=0;it<K.geometry.length;it++){for(var rt=[],at=0;at<K.geometry[it].length;at++)rt.push(nr(K.geometry[it][at],I));H.push(rt)}P.push(ct(K.id,st,H,K.tags))}return P}function nr(Z,I){var P=[];P.size=Z.size,Z.start!==void 0&&(P.start=Z.start,P.end=Z.end);for(var q=0;q<Z.length;q+=3)P.push(Z[q]+I,Z[q+1],Z[q+2]);return P}function ni(Z,I){if(Z.transformed)return Z;var P,q,H,K=1<<Z.z,st=Z.x,it=Z.y;for(P=0;P<Z.features.length;P++){var rt=Z.features[P],at=rt.geometry,St=rt.type;if(rt.geometry=[],St===1)for(q=0;q<at.length;q+=2)rt.geometry.push(Xe(at[q],at[q+1],I,K,st,it));else for(q=0;q<at.length;q++){var Bt=[];for(H=0;H<at[q].length;H+=2)Bt.push(Xe(at[q][H],at[q][H+1],I,K,st,it));rt.geometry.push(Bt)}}return Z.transformed=!0,Z}function Xe(Z,I,P,q,H,K){return[Math.round(P*(Z*q-H)),Math.round(P*(I*q-K))]}function Gi(Z,I,P,q,H){for(var K=I===H.maxZoom?0:H.tolerance/((1<<I)*H.extent),st={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:P,y:q,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},it=0;it<Z.length;it++){st.numFeatures++,_r(st,Z[it],K,H);var rt=Z[it].minX,at=Z[it].minY,St=Z[it].maxX,Bt=Z[it].maxY;rt<st.minX&&(st.minX=rt),at<st.minY&&(st.minY=at),St>st.maxX&&(st.maxX=St),Bt>st.maxY&&(st.maxY=Bt)}return st}function _r(Z,I,P,q){var H=I.geometry,K=I.type,st=[];if(K==="Point"||K==="MultiPoint")for(var it=0;it<H.length;it+=3)st.push(H[it]),st.push(H[it+1]),Z.numPoints++,Z.numSimplified++;else if(K==="LineString")_i(st,H,Z,P,!1,!1);else if(K==="MultiLineString"||K==="Polygon")for(it=0;it<H.length;it++)_i(st,H[it],Z,P,K==="Polygon",it===0);else if(K==="MultiPolygon")for(var rt=0;rt<H.length;rt++){var at=H[rt];for(it=0;it<at.length;it++)_i(st,at[it],Z,P,!0,it===0)}if(st.length){var St=I.tags||null;if(K==="LineString"&&q.lineMetrics){for(var Bt in St={},I.tags)St[Bt]=I.tags[Bt];St.mapbox_clip_start=H.start/H.size,St.mapbox_clip_end=H.end/H.size}var wt={geometry:st,type:K==="Polygon"||K==="MultiPolygon"?3:K==="LineString"||K==="MultiLineString"?2:1,tags:St};I.id!==null&&(wt.id=I.id),Z.features.push(wt)}}function _i(Z,I,P,q,H,K){var st=q*q;if(q>0&&I.size<(H?st:q))P.numPoints+=I.length/3;else{for(var it=[],rt=0;rt<I.length;rt+=3)(q===0||I[rt+2]>st)&&(P.numSimplified++,it.push(I[rt]),it.push(I[rt+1])),P.numPoints++;H&&function(at,St){for(var Bt=0,wt=0,ae=at.length,te=ae-2;wt<ae;te=wt,wt+=2)Bt+=(at[wt]-at[te])*(at[wt+1]+at[te+1]);if(Bt>0===St)for(wt=0,ae=at.length;wt<ae/2;wt+=2){var he=at[wt],ge=at[wt+1];at[wt]=at[ae-2-wt],at[wt+1]=at[ae-1-wt],at[ae-2-wt]=he,at[ae-1-wt]=ge}}(it,K),Z.push(it)}}function Hr(Z,I){var P=(I=this.options=function(H,K){for(var st in K)H[st]=K[st];return H}(Object.create(this.options),I)).debug;if(P&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var q=function(H,K){var st=[];if(H.type==="FeatureCollection")for(var it=0;it<H.features.length;it++)Ee(st,H.features[it],K,it);else Ee(st,H.type==="Feature"?H:{geometry:H},K);return st}(Z,I);this.tiles={},this.tileCoords=[],P&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),q=function(H,K){var st=K.buffer/K.extent,it=H,rt=ke(H,1,-1-st,st,0,-1,2,K),at=ke(H,1,1-st,2+st,0,-1,2,K);return(rt||at)&&(it=ke(H,1,-st,1+st,0,-1,2,K)||[],rt&&(it=yi(rt,1).concat(it)),at&&(it=it.concat(yi(at,-1)))),it}(q,I),q.length&&this.splitTile(q,0,0,0),P&&(q.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)))}function Xr(Z,I,P){return 32*((1<<Z)*P+I)+Z}function Zs(Z,I){let P=Z.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);let q=this._geoJSONIndex.getTile(P.z,P.x,P.y);if(!q)return I(null,null);let H=new fe(q.features),K=Dr(H);K.byteOffset===0&&K.byteLength===K.buffer.byteLength||(K=new Uint8Array(K)),I(null,{vectorTile:H,rawData:K.buffer})}Hr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Hr.prototype.splitTile=function(Z,I,P,q,H,K,st){for(var it=[Z,I,P,q],rt=this.options,at=rt.debug;it.length;){q=it.pop(),P=it.pop(),I=it.pop(),Z=it.pop();var St=1<<I,Bt=Xr(I,P,q),wt=this.tiles[Bt];if(!wt&&(at>1&&console.time("creation"),wt=this.tiles[Bt]=Gi(Z,I,P,q,rt),this.tileCoords.push({z:I,x:P,y:q}),at)){at>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,P,q,wt.numFeatures,wt.numPoints,wt.numSimplified),console.timeEnd("creation"));var ae="z"+I;this.stats[ae]=(this.stats[ae]||0)+1,this.total++}if(wt.source=Z,H){if(I===rt.maxZoom||I===H)continue;var te=1<<H-I;if(P!==Math.floor(K/te)||q!==Math.floor(st/te))continue}else if(I===rt.indexMaxZoom||wt.numPoints<=rt.indexMaxPoints)continue;if(wt.source=null,Z.length!==0){at>1&&console.time("clipping");var he,ge,Ge,Fe,Le,Ie,Te=.5*rt.buffer/rt.extent,Ti=.5-Te,wi=.5+Te,qi=1+Te;he=ge=Ge=Fe=null,Le=ke(Z,St,P-Te,P+wi,0,wt.minX,wt.maxX,rt),Ie=ke(Z,St,P+Ti,P+qi,0,wt.minX,wt.maxX,rt),Z=null,Le&&(he=ke(Le,St,q-Te,q+wi,1,wt.minY,wt.maxY,rt),ge=ke(Le,St,q+Ti,q+qi,1,wt.minY,wt.maxY,rt),Le=null),Ie&&(Ge=ke(Ie,St,q-Te,q+wi,1,wt.minY,wt.maxY,rt),Fe=ke(Ie,St,q+Ti,q+qi,1,wt.minY,wt.maxY,rt),Ie=null),at>1&&console.timeEnd("clipping"),it.push(he||[],I+1,2*P,2*q),it.push(ge||[],I+1,2*P,2*q+1),it.push(Ge||[],I+1,2*P+1,2*q),it.push(Fe||[],I+1,2*P+1,2*q+1)}}},Hr.prototype.getTile=function(Z,I,P){var q=this.options,H=q.extent,K=q.debug;if(Z<0||Z>24)return null;var st=1<<Z,it=Xr(Z,I=(I%st+st)%st,P);if(this.tiles[it])return ni(this.tiles[it],H);K>1&&console.log("drilling down to z%d-%d-%d",Z,I,P);for(var rt,at=Z,St=I,Bt=P;!rt&&at>0;)at--,St=Math.floor(St/2),Bt=Math.floor(Bt/2),rt=this.tiles[Xr(at,St,Bt)];return rt&&rt.source?(K>1&&console.log("found parent tile z%d-%d-%d",at,St,Bt),K>1&&console.time("drilling down"),this.splitTile(rt.source,at,St,Bt,Z,I,P),K>1&&console.timeEnd("drilling down"),this.tiles[it]?ni(this.tiles[it],H):null):null};class _s extends ot{constructor(I,P,q,H){super(I,P,q,Zs),H&&(this.loadGeoJSON=H)}loadData(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=P,this._pendingLoadDataParams=I,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;let I=this._pendingCallback,P=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;let q=!!(P&&P.request&&P.request.collectResourceTiming)&&new a.RequestPerformance(P.request);this.loadGeoJSON(P,(H,K)=>{if(H||!K)return I(H);if(typeof K!="object")return I(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{Rt(K,!0);try{if(P.filter){let it=a.createExpression(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(it.result==="error")throw new Error(it.value.map(at=>`${at.key}: ${at.message}`).join(", "));let rt=K.features.filter(at=>it.value.evaluate({zoom:0},at));K={type:"FeatureCollection",features:rt}}this._geoJSONIndex=P.cluster?new On(function({superclusterOptions:it,clusterProperties:rt}){if(!rt||!it)return it;let at={},St={},Bt={accumulated:null,zoom:0},wt={properties:null},ae=Object.keys(rt);for(let te of ae){let[he,ge]=rt[te],Ge=a.createExpression(ge),Fe=a.createExpression(typeof he=="string"?[he,["accumulated"],["get",te]]:he);at[te]=Ge.value,St[te]=Fe.value}return it.map=te=>{wt.properties=te;let he={};for(let ge of ae)he[ge]=at[ge].evaluate(Bt,wt);return he},it.reduce=(te,he)=>{wt.properties=he;for(let ge of ae)Bt.accumulated=te[ge],te[ge]=St[ge].evaluate(Bt,wt)},it}(P)).load(K.features):function(it,rt){return new Hr(it,rt)}(K,P.geojsonVtOptions)}catch(it){return I(it)}this.loaded={};let st={};if(q){let it=q.finish();it&&(st.resourceTiming={},st.resourceTiming[P.source]=JSON.parse(JSON.stringify(it)))}I(null,st)}})}coalesce(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())}reloadTile(I,P){let q=this.loaded;return q&&q[I.uid]?super.reloadTile(I,P):this.loadTile(I,P)}loadGeoJSON(I,P){if(I.request)a.getJSON(I.request,P);else{if(typeof I.data!="string")return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));try{return P(null,JSON.parse(I.data))}catch{return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`))}}}removeSource(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(I,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(q){P(q)}}getClusterChildren(I,P){try{P(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(q){P(q)}}getClusterLeaves(I,P){try{P(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(q){P(q)}}}class xs{constructor(I){this.self=I,this.actor=new a.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ot,geojson:_s},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,q)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=q},this.self.registerRTLTextPlugin=P=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=P.applyArabicShaping,a.plugin.processBidirectionalText=P.processBidirectionalText,a.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(I,P){this.referrer=P}setImages(I,P,q){this.availableImages[I]=P;for(let H in this.workerSources[I]){let K=this.workerSources[I][H];for(let st in K)K[st].availableImages=P}q()}setLayers(I,P,q){this.getLayerIndex(I).replace(P),q()}updateLayers(I,P,q){this.getLayerIndex(I).update(P.layers,P.removedIds),q()}loadTile(I,P,q){this.getWorkerSource(I,P.type,P.source).loadTile(P,q)}loadDEMTile(I,P,q){this.getDEMWorkerSource(I,P.source).loadTile(P,q)}reloadTile(I,P,q){this.getWorkerSource(I,P.type,P.source).reloadTile(P,q)}abortTile(I,P,q){this.getWorkerSource(I,P.type,P.source).abortTile(P,q)}removeTile(I,P,q){this.getWorkerSource(I,P.type,P.source).removeTile(P,q)}removeDEMTile(I,P){this.getDEMWorkerSource(I,P.source).removeTile(P)}removeSource(I,P,q){if(!this.workerSources[I]||!this.workerSources[I][P.type]||!this.workerSources[I][P.type][P.source])return;let H=this.workerSources[I][P.type][P.source];delete this.workerSources[I][P.type][P.source],H.removeSource!==void 0?H.removeSource(P,q):q()}loadWorkerSource(I,P,q){try{this.self.importScripts(P.url),q()}catch(H){q(H.toString())}}syncRTLPluginState(I,P,q){try{a.plugin.setState(P);let H=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&H!=null){this.self.importScripts(H);let K=a.plugin.isParsed();q(K?void 0:new Error(`RTL Text Plugin failed to import scripts from ${H}`),K)}}catch(H){q(H.toString())}}getAvailableImages(I){let P=this.availableImages[I];return P||(P=[]),P}getLayerIndex(I){let P=this.layerIndexes[I];return P||(P=this.layerIndexes[I]=new D),P}getWorkerSource(I,P,q){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][P]||(this.workerSources[I][P]={}),!this.workerSources[I][P][q]){let H={send:(K,st,it)=>{this.actor.send(K,st,it,I)}};this.workerSources[I][P][q]=new this.workerSourceTypes[P](H,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][P][q]}getDEMWorkerSource(I,P){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][P]||(this.demWorkerSources[I][P]=new ft),this.demWorkerSources[I][P]}enforceCacheSizeLimit(I,P){a.enforceCacheSizeLimit(P)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new xs(self)),xs}),g(["./shared"],function(a){"use strict";var M=S;function S(p){return!function(e){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var c,d,y=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(y);try{d=new Worker(v),c=!0}catch{c=!1}return d&&d.terminate(),URL.revokeObjectURL(v),c}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var c=document.createElement("canvas");c.width=c.height=1;var d=c.getContext("2d");if(!d)return!1;var y=d.getImageData(0,0,1,1);return y&&y.width===c.width}()?(D[s=e&&e.failIfMajorPerformanceCaveat]===void 0&&(D[s]=function(c){var d,y=function(v){var w=document.createElement("canvas"),T=Object.create(S.webGLContextAttributes);return T.failIfMajorPerformanceCaveat=v,w.getContext("webgl",T)||w.getContext("experimental-webgl",T)}(c);if(!y)return!1;try{d=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!d||y.isContextLost())&&(y.shaderSource(d,"void main() {}"),y.compileShader(d),y.getShaderParameter(d,y.COMPILE_STATUS)===!0)}(s)),D[s]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var s}(p)}var D={};function N(p,e){if(Array.isArray(p)){if(!Array.isArray(e)||p.length!==e.length)return!1;for(let s=0;s<p.length;s++)if(!N(p[s],e[s]))return!1;return!0}if(typeof p=="object"&&p!==null&&e!==null){if(typeof e!="object"||Object.keys(p).length!==Object.keys(e).length)return!1;for(let s in p)if(!N(p[s],e[s]))return!1;return!0}return p===e}S.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class L{static testProp(e){if(!L.docStyle)return e[0];for(let s=0;s<e.length;s++)if(e[s]in L.docStyle)return e[s];return e[0]}static create(e,s,c){let d=window.document.createElement(e);return s!==void 0&&(d.className=s),c&&c.appendChild(d),d}static createNS(e,s){return window.document.createElementNS(e,s)}static disableDrag(){L.docStyle&&L.selectProp&&(L.userSelect=L.docStyle[L.selectProp],L.docStyle[L.selectProp]="none")}static enableDrag(){L.docStyle&&L.selectProp&&(L.docStyle[L.selectProp]=L.userSelect)}static setTransform(e,s){e.style[L.transformProp]=s}static addEventListener(e,s,c,d={}){e.addEventListener(s,c,"passive"in d?d:d.capture)}static removeEventListener(e,s,c,d={}){e.removeEventListener(s,c,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",L.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",L.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",L.suppressClickInternal,!0)},0)}static mousePos(e,s){let c=e.getBoundingClientRect();return new a.pointGeometry(s.clientX-c.left-e.clientLeft,s.clientY-c.top-e.clientTop)}static touchPos(e,s){let c=e.getBoundingClientRect(),d=[];for(let y=0;y<s.length;y++)d.push(new a.pointGeometry(s[y].clientX-c.left-e.clientLeft,s[y].clientY-c.top-e.clientTop));return d}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}L.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,L.selectProp=L.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),L.transformProp=L.testProp(["transform","WebkitTransform"]);class Q{constructor(e){this._transformRequestFn=e}transformRequest(e,s){return this._transformRequestFn&&this._transformRequestFn(e,s)||{url:e}}normalizeSpriteURL(e,s,c){let d=function(y){let v=y.match(pt);if(!v)throw new Error(`Unable to parse URL "${y}"`);return{protocol:v[1],authority:v[2],path:v[3]||"/",params:v[4]?v[4].split("&"):[]}}(e);return d.path+=`${s}${c}`,function(y){let v=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${v}`}(d)}setTransformRequest(e){this._transformRequestFn=e}}let pt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ot(p){var e=new a.ARRAY_TYPE(3);return e[0]=p[0],e[1]=p[1],e[2]=p[2],e}var ft,Rt=function(p,e,s){return p[0]=e[0]-s[0],p[1]=e[1]-s[1],p[2]=e[2]-s[2],p};ft=new a.ARRAY_TYPE(3),a.ARRAY_TYPE!=Float32Array&&(ft[0]=0,ft[1]=0,ft[2]=0);var Ct=function(p){var e=p[0],s=p[1];return e*e+s*s};(function(){var p=new a.ARRAY_TYPE(2);a.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0)})();class Dt{constructor(e,s,c,d){this.context=e,this.format=c,this.texture=e.gl.createTexture(),this.update(s,d)}update(e,s,c){let{width:d,height:y}=e,v=!(this.size&&this.size[0]===d&&this.size[1]===y||c),{context:w}=this,{gl:T}=w;if(this.useMipmap=Boolean(s&&s.useMipmap),T.bindTexture(T.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1),w.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA&&(!s||s.premultiply!==!1)),v)this.size=[d,y],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?T.texImage2D(T.TEXTURE_2D,0,this.format,this.format,T.UNSIGNED_BYTE,e):T.texImage2D(T.TEXTURE_2D,0,this.format,d,y,0,this.format,T.UNSIGNED_BYTE,e.data);else{let{x:C,y:k}=c||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?T.texSubImage2D(T.TEXTURE_2D,0,C,k,T.RGBA,T.UNSIGNED_BYTE,e):T.texSubImage2D(T.TEXTURE_2D,0,C,k,d,y,T.RGBA,T.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&T.generateMipmap(T.TEXTURE_2D)}bind(e,s,c){let{context:d}=this,{gl:y}=d;y.bindTexture(y.TEXTURE_2D,this.texture),c!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(c=y.LINEAR),e!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,e),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,c||e),this.filter=e),s!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,s),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,s),this.wrap=s)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function ne(p){let{userImage:e}=p;return!!(e&&e.render&&e.render())&&(p.data.replace(new Uint8Array(e.data.buffer)),!0)}class Ht extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:s,callback:c}of this.requestors)this._notify(s,c);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,s){this._validate(e,s)&&(this.images[e]=s)}_validate(e,s){let c=!0;return this._validateStretch(s.stretchX,s.data&&s.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),c=!1),this._validateStretch(s.stretchY,s.data&&s.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),c=!1),this._validateContent(s.content,s)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),c=!1),c}_validateStretch(e,s){if(!e)return!0;let c=0;for(let d of e){if(d[0]<c||d[1]<d[0]||s<d[1])return!1;c=d[1]}return!0}_validateContent(e,s){return!(e&&(e.length!==4||e[0]<0||s.data.width<e[0]||e[1]<0||s.data.height<e[1]||e[2]<0||s.data.width<e[2]||e[3]<0||s.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,s){s.version=this.images[e].version+1,this.images[e]=s,this.updatedImages[e]=!0}removeImage(e){let s=this.images[e];delete this.images[e],delete this.patterns[e],s.userImage&&s.userImage.onRemove&&s.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,s){let c=!0;if(!this.isLoaded())for(let d of e)this.images[d]||(c=!1);this.isLoaded()||c?this._notify(e,s):this.requestors.push({ids:e,callback:s})}_notify(e,s){let c={};for(let d of e){this.images[d]||this.fire(new a.Event("styleimagemissing",{id:d}));let y=this.images[d];y?c[d]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:Boolean(y.userImage&&y.userImage.render)}:a.warnOnce(`Image "${d}" 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.`)}s(null,c)}getPixelSize(){let{width:e,height:s}=this.atlasImage;return{width:e,height:s}}getPattern(e){let s=this.patterns[e],c=this.getImage(e);if(!c)return null;if(s&&s.position.version===c.version)return s.position;if(s)s.position.version=c.version;else{let d={w:c.data.width+2,h:c.data.height+2,x:0,y:0},y=new a.ImagePosition(d,c);this.patterns[e]={bin:d,position:y}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let s=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Dt(e,this.atlasImage,s.RGBA),this.atlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let y in this.patterns)e.push(this.patterns[y].bin);let{w:s,h:c}=a.potpack(e),d=this.atlasImage;d.resize({width:s||1,height:c||1});for(let y in this.patterns){let{bin:v}=this.patterns[y],w=v.x+1,T=v.y+1,C=this.images[y].data,k=C.width,F=C.height;a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:T},{width:k,height:F}),a.RGBAImage.copy(C,d,{x:0,y:F-1},{x:w,y:T-1},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:T+F},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:k-1,y:0},{x:w-1,y:T},{width:1,height:F}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w+k,y:T},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let s of e){if(this.callbackDispatchedThisFrame[s])continue;this.callbackDispatchedThisFrame[s]=!0;let c=this.images[s];ne(c)&&this.updateImage(s,c)}}}let fe=1e20;function me(p,e,s,c,d,y,v,w,T){for(let C=e;C<e+c;C++)oe(p,s*y+C,y,d,v,w,T);for(let C=s;C<s+d;C++)oe(p,C*y+e,1,c,v,w,T)}function oe(p,e,s,c,d,y,v){y[0]=0,v[0]=-fe,v[1]=fe,d[0]=p[e];for(let w=1,T=0,C=0;w<c;w++){d[w]=p[e+w*s];let k=w*w;do{let F=y[T];C=(d[w]-d[F]+k-F*F)/(w-F)/2}while(C<=v[T]&&--T>-1);T++,y[T]=w,v[T]=C,v[T+1]=fe}for(let w=0,T=0;w<c;w++){for(;v[T+1]<w;)T++;let C=y[T],k=w-C;p[e+w*s]=d[C]+k*k}}class Ce{constructor(e,s){this.requestManager=e,this.localIdeographFontFamily=s,this.entries={}}setURL(e){this.url=e}getGlyphs(e,s){let c=[];for(let d in e)for(let y of e[d])c.push({stack:d,id:y});a.asyncAll(c,({stack:d,id:y},v)=>{let w=this.entries[d];w||(w=this.entries[d]={glyphs:{},requests:{},ranges:{}});let T=w.glyphs[y];if(T!==void 0)return void v(null,{stack:d,id:y,glyph:T});if(T=this._tinySDF(w,d,y),T)return w.glyphs[y]=T,void v(null,{stack:d,id:y,glyph:T});let C=Math.floor(y/256);if(256*C>65535)return void v(new Error("glyphs > 65535 not supported"));if(w.ranges[C])return void v(null,{stack:d,id:y,glyph:T});let k=w.requests[C];k||(k=w.requests[C]=[],Ce.loadGlyphRange(d,C,this.url,this.requestManager,(F,j)=>{if(j){for(let Y in j)this._doesCharSupportLocalGlyph(+Y)||(w.glyphs[+Y]=j[+Y]);w.ranges[C]=!0}for(let Y of k)Y(F,j);delete w.requests[C]})),k.push((F,j)=>{F?v(F):j&&v(null,{stack:d,id:y,glyph:j[y]||null})})},(d,y)=>{if(d)s(d);else if(y){let v={};for(let{stack:w,id:T,glyph:C}of y)(v[w]||(v[w]={}))[T]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};s(null,v)}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](e)||a.unicodeBlockLookup["Hangul Syllables"](e)||a.unicodeBlockLookup.Hiragana(e)||a.unicodeBlockLookup.Katakana(e))}_tinySDF(e,s,c){let d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let y=e.tinySDF;if(!y){let w="400";/bold/i.test(s)?w="900":/medium/i.test(s)?w="500":/light/i.test(s)&&(w="200"),y=e.tinySDF=new Ce.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:d,fontWeight:w})}let v=y.draw(String.fromCharCode(c));return{id:c,bitmap:new a.AlphaImage({width:v.width||30,height:v.height||30},v.data),metrics:{width:v.glyphWidth||24,height:v.glyphHeight||24,left:v.glyphLeft||0,top:v.glyphTop-27||-8,advance:v.glyphAdvance||24}}}}Ce.loadGlyphRange=function(p,e,s,c,d){let y=256*e,v=y+255,w=c.transformRequest(s.replace("{fontstack}",p).replace("{range}",`${y}-${v}`),a.ResourceType.Glyphs);a.getArrayBuffer(w,(T,C)=>{if(T)d(T);else if(C){let k={};for(let F of a.parseGlyphPBF(C))k[F.id]=F;d(null,k)}})},Ce.TinySDF=class{constructor({fontSize:p=24,buffer:e=3,radius:s=8,cutoff:c=.25,fontFamily:d="sans-serif",fontWeight:y="normal",fontStyle:v="normal"}={}){this.buffer=e,this.cutoff=c,this.radius=s;let w=this.size=p+4*e,T=this._createCanvas(w),C=this.ctx=T.getContext("2d",{willReadFrequently:!0});C.font=`${v} ${y} ${p}px ${d}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(p){let e=document.createElement("canvas");return e.width=e.height=p,e}draw(p){let{width:e,actualBoundingBoxAscent:s,actualBoundingBoxDescent:c,actualBoundingBoxLeft:d,actualBoundingBoxRight:y}=this.ctx.measureText(p),v=Math.ceil(s),w=Math.min(this.size-this.buffer,Math.ceil(y-d)),T=Math.min(this.size-this.buffer,v+Math.ceil(c)),C=w+2*this.buffer,k=T+2*this.buffer,F=Math.max(C*k,0),j=new Uint8ClampedArray(F),Y={data:j,width:C,height:k,glyphWidth:w,glyphHeight:T,glyphTop:v,glyphLeft:0,glyphAdvance:e};if(w===0||T===0)return Y;let{ctx:$,buffer:J,gridInner:lt,gridOuter:ht}=this;$.clearRect(J,J,w,T),$.fillText(p,J,J+v);let gt=$.getImageData(J,J,w,T);ht.fill(fe,0,F),lt.fill(0,0,F);for(let ut=0;ut<T;ut++)for(let kt=0;kt<w;kt++){let Mt=gt.data[4*(ut*w+kt)+3]/255;if(Mt===0)continue;let Tt=(ut+J)*C+kt+J;if(Mt===1)ht[Tt]=0,lt[Tt]=fe;else{let Ut=.5-Mt;ht[Tt]=Ut>0?Ut*Ut:0,lt[Tt]=Ut<0?Ut*Ut:0}}me(ht,0,0,C,k,C,this.f,this.v,this.z),me(lt,J,J,w,T,C,this.f,this.v,this.z);for(let ut=0;ut<F;ut++){let kt=Math.sqrt(ht[ut])-Math.sqrt(lt[ut]);j[ut]=Math.round(255-255*(kt/this.radius+this.cutoff))}return Y}};let Re=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(p,e){return a.sphericalToCartesian(p.expression.evaluate(e))}interpolate(p,e,s){return{x:a.number(p.x,e.x,s),y:a.number(p.y,e.y,s),z:a.number(p.z,e.z,s)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),mi="-transition";class Fi extends a.Evented{constructor(e){super(),this._transitionable=new a.Transitionable(Re),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,s={}){if(!this._validate(a.validateLight,e,s))for(let c in e){let d=e[c];c.endsWith(mi)?this._transitionable.setTransition(c.slice(0,-mi.length),d):this._transitionable.setValue(c,d)}}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,s,c){return(!c||c.validate!==!1)&&a.emitValidationErrors(this,e.call(a.validateStyle,a.extend({value:s,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class Yi{constructor(e,s){this.width=e,this.height=s,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,s){let c=e.join(",")+String(s);return this.dashEntry[c]||(this.dashEntry[c]=this.addDash(e,s)),this.dashEntry[c]}getDashRanges(e,s,c){let d=[],y=e.length%2==1?-e[e.length-1]*c:0,v=e[0]*c,w=!0;d.push({left:y,right:v,isDash:w,zeroLength:e[0]===0});let T=e[0];for(let C=1;C<e.length;C++){w=!w;let k=e[C];y=T*c,T+=k,v=T*c,d.push({left:y,right:v,isDash:w,zeroLength:k===0})}return d}addRoundDash(e,s,c){let d=s/2;for(let y=-c;y<=c;y++){let v=this.width*(this.nextRow+c+y),w=0,T=e[w];for(let C=0;C<this.width;C++){C/T.right>1&&(T=e[++w]);let k=Math.abs(C-T.left),F=Math.abs(C-T.right),j=Math.min(k,F),Y,$=y/c*(d+1);if(T.isDash){let J=d-Math.abs($);Y=Math.sqrt(j*j+J*J)}else Y=d-Math.sqrt(j*j+$*$);this.data[v+C]=Math.max(0,Math.min(255,Y+128))}}}addRegularDash(e){for(let w=e.length-1;w>=0;--w){let T=e[w],C=e[w+1];T.zeroLength?e.splice(w,1):C&&C.isDash===T.isDash&&(C.left=T.left,e.splice(w,1))}let s=e[0],c=e[e.length-1];s.isDash===c.isDash&&(s.left=c.left-this.width,c.right=s.right+this.width);let d=this.width*this.nextRow,y=0,v=e[y];for(let w=0;w<this.width;w++){w/v.right>1&&(v=e[++y]);let T=Math.abs(w-v.left),C=Math.abs(w-v.right),k=Math.min(T,C);this.data[d+w]=Math.max(0,Math.min(255,(v.isDash?k:-k)+128))}}addDash(e,s){let c=s?7:0,d=2*c+1;if(this.nextRow+d>this.height)return a.warnOnce("LineAtlas out of space"),null;let y=0;for(let w=0;w<e.length;w++)y+=e[w];if(y!==0){let w=this.width/y,T=this.getDashRanges(e,this.width,w);s?this.addRoundDash(T,w,c):this.addRegularDash(T)}let v={y:(this.nextRow+c+.5)/this.height,height:2*c/this.height,width:y};return this.nextRow+=d,this.dirty=!0,v}bind(e){let s=e.gl;this.texture?(s.bindTexture(s.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,s.texSubImage2D(s.TEXTURE_2D,0,0,0,this.width,this.height,s.ALPHA,s.UNSIGNED_BYTE,this.data))):(this.texture=s.createTexture(),s.bindTexture(s.TEXTURE_2D,this.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.ALPHA,this.width,this.height,0,s.ALPHA,s.UNSIGNED_BYTE,this.data))}}class Oi{constructor(e,s){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a.uniqueId();let c=this.workerPool.acquire(this.id);for(let d=0;d<c.length;d++){let y=new Oi.Actor(c[d],s,this.id);y.name=`Worker ${d}`,this.actors.push(y)}}broadcast(e,s,c){a.asyncAll(this.actors,(d,y)=>{d.send(e,s,y)},c=c||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function $r(p,e,s){let c=function(d,y){if(d)return s(d);if(y){let v=a.pick(a.extend(y,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(v.vectorLayers=y.vector_layers,v.vectorLayerIds=v.vectorLayers.map(w=>w.id)),s(null,v)}};return p.url?a.getJSON(e.transformRequest(p.url,a.ResourceType.Source),c):a.exported.frame(()=>c(null,p))}Oi.Actor=a.Actor;class ve{constructor(e,s,c){this.bounds=a.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=s||0,this.maxzoom=c||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let s=Math.pow(2,e.z),c=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*s),d=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*s),y=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*s),v=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*s);return e.x>=c&&e.x<y&&e.y>=d&&e.y<v}}class kr extends a.Evented{constructor(e,s,c,d){if(super(),this.id=e,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(s,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},s),this._collectResourceTiming=s.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=$r(this._options,this.map._requestManager,(e,s)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new a.ErrorEvent(e)):s&&(a.extend(this,s),s.bounds&&(this.tileBounds=new ve(s.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}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)}serialize(){return a.extend({},this._options)}loadTile(e,s){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(c,a.ResourceType.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};function y(v,w){return delete e.request,e.aborted?s(null):v&&v.status!==404?s(v):(w&&w.resourceTiming&&(e.resourceTiming=w.resourceTiming),this.map._refreshExpiredTiles&&w&&e.setExpiryData(w),e.loadVectorData(w,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),s(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}d.request.collectResourceTiming=this._collectResourceTiming,e.actor&&e.state!=="expired"?e.state==="loading"?e.reloadCallback=s:e.request=e.actor.send("reloadTile",d,y.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",d,y.bind(this)))}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}}class Wr extends a.Evented{constructor(e,s,c,d){super(),this.id=e,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},s),a.extend(this,a.pick(s,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=$r(this._options,this.map._requestManager,(e,s)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new a.ErrorEvent(e)):s&&(a.extend(this,s),s.bounds&&(this.tileBounds=new ve(s.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("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 a.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,s){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),(d,y,v)=>{if(delete e.request,e.aborted)e.state="unloaded",s(null);else if(d)e.state="errored",s(d);else if(y){this.map._refreshExpiredTiles&&e.setExpiryData(v);let w=this.map.painter.context,T=w.gl;e.texture=this.map.painter.getTileTexture(y.width),e.texture?e.texture.update(y,{useMipmap:!0}):(e.texture=new Dt(w,y,T.RGBA,{useMipmap:!0}),e.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE,T.LINEAR_MIPMAP_NEAREST),w.extTextureFilterAnisotropic&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax)),e.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),s(null)}})}abortTile(e,s){e.request&&(e.request.cancel(),delete e.request),s()}unloadTile(e,s){e.texture&&this.map.painter.saveTileTexture(e.texture),s()}hasTransition(){return!1}}let rn;class bi extends Wr{constructor(e,s,c,d){super(e,s,c,d),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,s){let c=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function d(y,v){y&&(e.state="errored",s(y)),v&&(e.dem=v,e.needsHillshadePrepare=!0,e.state="loaded",s(null))}e.request=a.getImage(this.map._requestManager.transformRequest(c,a.ResourceType.Tile),function(y,v){if(delete e.request,e.aborted)e.state="unloaded",s(null);else if(y)e.state="errored",s(y);else if(v){this.map._refreshExpiredTiles&&e.setExpiryData(v),delete v.cacheControl,delete v.expires;let w=a.isImageBitmap(v)&&(rn==null&&(rn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),rn)?v:a.exported.getImageData(v,1),T={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:w,encoding:this.encoding};e.actor&&e.state!=="expired"||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",T,d.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){let s=e.canonical,c=Math.pow(2,s.z),d=(s.x-1+c)%c,y=s.x===0?e.wrap-1:e.wrap,v=(s.x+1+c)%c,w=s.x+1===c?e.wrap+1:e.wrap,T={};return T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y).key]={backfilled:!1},s.y>0&&(T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y-1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,e.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y-1).key]={backfilled:!1}),s.y+1<c&&(T[new a.OverscaledTileID(e.overscaledZ,y,s.z,d,s.y+1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,e.wrap,s.z,s.x,s.y+1).key]={backfilled:!1},T[new a.OverscaledTileID(e.overscaledZ,w,s.z,v,s.y+1).key]={backfilled:!1}),T}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})}}class gn extends a.Evented{constructor(e,s,c,d){super(),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=c.getActor(),this.setEventedParent(d),this._data=s.data,this._options=a.extend({},s),this._collectResourceTiming=s.collectResourceTiming,s.maxzoom!==void 0&&(this.maxzoom=s.maxzoom),s.type&&(this.type=s.type),s.attribution&&(this.attribution=s.attribution),this.promoteId=s.promoteId;let y=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:s.cluster||!1,geojsonVtOptions:{buffer:(s.buffer!==void 0?s.buffer:128)*y,tolerance:(s.tolerance!==void 0?s.tolerance:.375)*y,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:s.lineMetrics||!1,generateId:s.generateId||!1},superclusterOptions:{maxZoom:s.clusterMaxZoom!==void 0?s.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,s.clusterMinPoints||2),extent:a.EXTENT,radius:(s.clusterRadius||50)*y,log:!1,generateId:s.generateId||!1},clusterProperties:s.clusterProperties,filter:s.filter},s.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,s){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},s),this}getClusterChildren(e,s){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},s),this}getClusterLeaves(e,s,c,d){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:s,offset:c},d),this}_updateWorkerData(e){let s=a.extend({},this.workerOptions),c=this._data;typeof c=="string"?(s.request=this.map._requestManager.transformRequest(a.exported.resolveURL(c),a.ResourceType.Source),s.request.collectResourceTiming=this._collectResourceTiming):s.data=JSON.stringify(c),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,s,(d,y)=>{if(this._pendingLoads--,this._removed||y&&y.abandoned)return;let v=null;if(y&&y.resourceTiming&&y.resourceTiming[this.id]&&(v=y.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:s.source},null),d)return void this.fire(new a.ErrorEvent(d));let w={dataType:"source",sourceDataType:e};this._collectResourceTiming&&v&&v.length>0&&a.extend(w,{resourceTiming:v}),this.fire(new a.Event("data",w))})}loaded(){return this._pendingLoads===0}loadTile(e,s){let c=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let d={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(c,d,(y,v)=>(delete e.request,e.unloadVectorData(),e.aborted?s(null):y?s(y):(e.loadVectorData(v,this.map.painter,c==="reloadTile"),s(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})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Lr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Dr extends a.Evented{constructor(e,s,c,d){super(),this.id=e,this.dispatcher=c,this.coordinates=s.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=s}load(e,s){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(c,d)=>{this._loaded=!0,c?this.fire(new a.ErrorEvent(c)):d&&(this.image=d,e&&(this.coordinates=e),s&&s(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}setCoordinates(e){this.coordinates=e;let s=e.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(d){let y=1/0,v=1/0,w=-1/0,T=-1/0;for(let j of d)y=Math.min(y,j.x),v=Math.min(v,j.y),w=Math.max(w,j.x),T=Math.max(T,j.y);let C=Math.max(w-y,T-v),k=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),F=Math.pow(2,k);return new a.CanonicalTileID(k,Math.floor((y+w)/2*F),Math.floor((v+T)/2*F))}(s),this.minzoom=this.maxzoom=this.tileID.z;let c=s.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(c[0].x,c[0].y,0,0),this._boundsArray.emplaceBack(c[1].x,c[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(c[3].x,c[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(c[2].x,c[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Dt(e,this.image,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));for(let c in this.tiles){let d=this.tiles[c];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}loadTile(e,s){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},s(null)):(e.state="errored",s(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class nn extends Dr{constructor(e,s,c,d){super(e,s,c,d),this.roundZoom=!0,this.type="video",this.options=s}load(){this._loaded=!1;let e=this.options;this.urls=[];for(let s of e.urls)this.urls.push(this.map._requestManager.transformRequest(s,a.ResourceType.Source).url);a.getVideo(this.urls,(s,c)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):c&&(this.video=c,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let s=this.video.seekable;e<s.start(0)||e>s.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,s=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new Dt(e,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));for(let c in this.tiles){let d=this.tiles[c];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class sn extends Dr{constructor(e,s,c,d){super(e,s,c,d),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(v=>typeof v!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${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 a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){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 s=this.map.painter.context,c=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,Lr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Dt(s,this.canvas,c.RGBA,{premultiply:!0});for(let d in this.tiles){let y=this.tiles[d];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let yr={vector:kr,raster:Wr,"raster-dem":bi,geojson:gn,video:nn,image:Dr,canvas:sn};function Rr(p,e){let s=a.create();return a.translate(s,s,[1,1,0]),a.scale(s,s,[.5*p.width,.5*p.height,1]),a.multiply(s,s,p.calculatePosMatrix(e.toUnwrapped()))}function Zr(p,e,s,c,d,y){let v=function(F,j,Y){if(F)for(let $ of F){let J=j[$];if(J&&J.source===Y&&J.type==="fill-extrusion")return!0}else for(let $ in j){let J=j[$];if(J.source===Y&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,p.id),w=y.maxPitchScaleFactor(),T=p.tilesIn(c,w,v);T.sort(En);let C=[];for(let F of T)C.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(e,s,p._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,d,y,w,Rr(p.transform,F.tileID))});let k=function(F){let j={},Y={};for(let $ of F){let J=$.queryResults,lt=$.wrappedTileID,ht=Y[lt]=Y[lt]||{};for(let gt in J){let ut=J[gt],kt=ht[gt]=ht[gt]||{},Mt=j[gt]=j[gt]||[];for(let Tt of ut)kt[Tt.featureIndex]||(kt[Tt.featureIndex]=!0,Mt.push(Tt))}}return j}(C);for(let F in k)k[F].forEach(j=>{let Y=j.feature,$=p.getFeatureState(Y.layer["source-layer"],Y.id);Y.source=Y.layer.source,Y.layer["source-layer"]&&(Y.sourceLayer=Y.layer["source-layer"]),Y.state=$});return k}function En(p,e){let s=p.tileID,c=e.tileID;return s.overscaledZ-c.overscaledZ||s.canonical.y-c.canonical.y||s.wrap-c.wrap||s.canonical.x-c.canonical.x}class Bn{constructor(e,s){this.tileID=e,this.uid=a.uniqueId(),this.uses=0,this.tileSize=s,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let s=e+this.timeAdded;s<a.exported.now()||this.fadeEndTime&&s<this.fadeEndTime||(this.fadeEndTime=s)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(e,s,c){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(d,y){let v={};if(!y)return v;for(let w of d){let T=w.layerIds.map(C=>y.getLayer(C)).filter(Boolean);if(T.length!==0){w.layers=T,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(C=>T.filter(k=>k.id===C)[0]));for(let C of T)v[C.id]=w}}return v}(e.buckets,s.style),this.hasSymbolBuckets=!1;for(let d in this.buckets){let y=this.buckets[d];if(y instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!c)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let d in this.buckets){let y=this.buckets[d];if(y instanceof a.SymbolBucket&&y.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(let d in this.buckets){let y=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,s.style.getLayer(d).queryRadius(y))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(let e in this.buckets)this.buckets[e].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(e){return this.buckets[e.id]}upload(e){for(let c in this.buckets){let d=this.buckets[c];d.uploadPending()&&d.upload(e)}let s=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Dt(e,this.imageAtlas.image,s.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dt(e,this.glyphAtlasImage,s.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,s,c,d,y,v,w,T,C,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:y,scale:v,tileSize:this.tileSize,pixelPosMatrix:k,transform:T,params:w,queryPadding:this.queryPadding*C},e,s,c):{}}querySourceFeatures(e,s){let c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;let d=c.loadVTLayers(),y=s?s.sourceLayer:"",v=d._geojsonTileLayer||d[y];if(!v)return;let w=a.createFilter(s&&s.filter),{z:T,x:C,y:k}=this.tileID.canonical,F={z:T,x:C,y:k};for(let j=0;j<v.length;j++){let Y=v.feature(j);if(w.needGeometry){let lt=a.toEvaluationFeature(Y,!0);if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),lt,this.tileID.canonical))continue}else if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),Y))continue;let $=c.getId(Y,y),J=new a.GeoJSONFeature(Y,T,C,k,$);J.tile=F,e.push(J)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let s=this.expirationTime;if(e.cacheControl){let c=a.parseCacheControl(e.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let c=Date.now(),d=!1;if(this.expirationTime>c)d=!1;else if(s)if(this.expirationTime<s)d=!0;else{let y=this.expirationTime-s;y?this.expirationTime=c+Math.max(y,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,s){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let c=this.latestFeatureIndex.loadVTLayers();for(let d in this.buckets){if(!s.style.hasLayer(d))continue;let y=this.buckets[d],v=y.layers[0].sourceLayer||"_geojsonTileLayer",w=c[v],T=e[v];if(!w||!T||Object.keys(T).length===0)continue;y.update(T,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});let C=s&&s.style&&s.style.getLayer(d);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.exported.now()+e}setDependencies(e,s){let c={};for(let d of s)c[d]=!0;this.dependencies[e]=c}hasDependency(e,s){for(let c of e){let d=this.dependencies[c];if(d){for(let y of s)if(d[y])return!0}}return!1}}class Fn{constructor(e,s){this.max=e,this.onRemove=s,this.reset()}reset(){for(let e in this.data)for(let s of this.data[e])s.timeout&&clearTimeout(s.timeout),this.onRemove(s.value);return this.data={},this.order=[],this}add(e,s,c){let d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);let y={value:s,timeout:void 0};if(c!==void 0&&(y.timeout=setTimeout(()=>{this.remove(e,y)},c)),this.data[d].push(y),this.order.push(d),this.order.length>this.max){let v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let s=this.data[e].shift();return s.timeout&&clearTimeout(s.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),s.value}getByKey(e){let s=this.data[e];return s?s[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,s){if(!this.has(e))return this;let c=e.wrapped().key,d=s===void 0?0:this.data[c].indexOf(s),y=this.data[c][d];return this.data[c].splice(d,1),y.timeout&&clearTimeout(y.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(y.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}filter(e){let s=[];for(let c in this.data)for(let d of this.data[c])e(d.value)||s.push(d);for(let c of s)this.remove(c.value.tileID,c)}}class gs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,s,c){let d=String(s);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},a.extend(this.stateChanges[e][d],c),this.deletedStates[e]===null){this.deletedStates[e]={};for(let y in this.state[e])y!==d&&(this.deletedStates[e][y]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(let y in this.state[e][d])c[y]||(this.deletedStates[e][d][y]=null)}else for(let y in c)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][y]===null&&delete this.deletedStates[e][d][y]}removeFeatureState(e,s,c){if(this.deletedStates[e]===null)return;let d=String(s);if(this.deletedStates[e]=this.deletedStates[e]||{},c&&s!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][c]=null);else if(s!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(c in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][c]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,s){let c=String(s),d=a.extend({},(this.state[e]||{})[c],(this.stateChanges[e]||{})[c]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let y=this.deletedStates[e][s];if(y===null)return{};for(let v in y)delete d[v]}return d}initializeTileState(e,s){e.setFeatureState(this.state,s)}coalesceChanges(e,s){let c={};for(let d in this.stateChanges){this.state[d]=this.state[d]||{};let y={};for(let v in this.stateChanges[d])this.state[d][v]||(this.state[d][v]={}),a.extend(this.state[d][v],this.stateChanges[d][v]),y[v]=this.state[d][v];c[d]=y}for(let d in this.deletedStates){this.state[d]=this.state[d]||{};let y={};if(this.deletedStates[d]===null)for(let v in this.state[d])y[v]={},this.state[d][v]={};else for(let v in this.deletedStates[d]){if(this.deletedStates[d][v]===null)this.state[d][v]={};else for(let w of Object.keys(this.deletedStates[d][v]))delete this.state[d][v][w];y[v]=this.state[d][v]}c[d]=c[d]||{},a.extend(c[d],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(let d in e)e[d].setFeatureState(c,s)}}class ti extends a.Evented{constructor(e,s,c){super(),this.id=e,this.dispatcher=c,this.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(d,y,v,w){let T=new yr[y.type](d,y,v,w);if(T.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${T.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],T),T}(e,s,c,this),this._tiles={},this._cache=new Fn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new gs}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize: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;for(let e in this._tiles){let s=this._tiles[e];if(s.state!=="loaded"&&s.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)}_loadTile(e,s){return this._source.loadTile(e,s)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new a.Event("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 s in this._tiles){let c=this._tiles[s];c.upload(e),c.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(an).map(e=>e.key)}getRenderableIds(e){let s=[];for(let c in this._tiles)this._isIdRenderable(c,e)&&s.push(this._tiles[c]);return e?s.sort((c,d)=>{let y=c.tileID,v=d.tileID,w=new a.pointGeometry(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),T=new a.pointGeometry(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-v.overscaledZ||T.y-w.y||T.x-w.x}).map(c=>c.tileID.key):s.map(c=>c.tileID).sort(an).map(c=>c.key)}hasRenderableParent(e){let s=this.findLoadedParent(e,0);return!!s&&this._isIdRenderable(s.tileID.key)}_isIdRenderable(e,s){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(s||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,s){let c=this._tiles[e];c&&(c.state!=="loading"&&(c.state=s),this._loadTile(c,this._tileLoaded.bind(this,c,e,s)))}_tileLoaded(e,s,c,d){if(d)return e.state="errored",void(d.status!==404?this._source.fire(new a.ErrorEvent(d,{tile:e})):this.update(this.transform));e.timeAdded=a.exported.now(),c==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(s,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 a.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let s=this.getRenderableIds();for(let d=0;d<s.length;d++){let y=s[d];if(e.neighboringTiles&&e.neighboringTiles[y]){let v=this.getTileByID(y);c(e,v),c(v,e)}}function c(d,y){d.needsHillshadePrepare=!0;let v=y.tileID.canonical.x-d.tileID.canonical.x,w=y.tileID.canonical.y-d.tileID.canonical.y,T=Math.pow(2,d.tileID.canonical.z),C=y.tileID.key;v===0&&w===0||Math.abs(w)>1||(Math.abs(v)>1&&(Math.abs(v+T)===1?v+=T:Math.abs(v-T)===1&&(v-=T)),y.dem&&d.dem&&(d.dem.backfillBorder(y.dem,v,w),d.neighboringTiles&&d.neighboringTiles[C]&&(d.neighboringTiles[C].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,s,c,d){for(let y in this._tiles){let v=this._tiles[y];if(d[y]||!v.hasData()||v.tileID.overscaledZ<=s||v.tileID.overscaledZ>c)continue;let w=v.tileID;for(;v&&v.tileID.overscaledZ>s+1;){let C=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[C.key],v&&v.hasData()&&(w=C)}let T=w;for(;T.overscaledZ>s;)if(T=T.scaledTo(T.overscaledZ-1),e[T.key]){d[w.key]=w;break}}}findLoadedParent(e,s){if(e.key in this._loadedParentTiles){let c=this._loadedParentTiles[e.key];return c&&c.tileID.overscaledZ>=s?c:null}for(let c=e.overscaledZ-1;c>=s;c--){let d=e.scaledTo(c),y=this._getLoadedTile(d);if(y)return y}}_getLoadedTile(e){let s=this._tiles[e.key];return s&&s.hasData()?s:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let s=Math.ceil(e.width/this._source.tileSize)+1,c=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(s*c*5),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(y)}handleWrapJump(e){let s=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,s){let c={};for(let d in this._tiles){let y=this._tiles[d];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+s),c[y.tileID.key]=y}this._tiles=c;for(let d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(let d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new a.OverscaledTileID(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(s=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(s=s.filter(T=>this._source.hasTile(T)))):s=[];let c=e.coveringZoomLevel(this._source),d=Math.max(c-ti.maxOverzooming,this._source.minzoom),y=Math.max(c+ti.maxUnderzooming,this._source.minzoom),v=this._updateRetainedTiles(s,c);if(On(this._source.type)){let T={},C={},k=Object.keys(v);for(let F of k){let j=v[F],Y=this._tiles[F];if(!Y||Y.fadeEndTime&&Y.fadeEndTime<=a.exported.now())continue;let $=this.findLoadedParent(j,d);$&&(this._addTile($.tileID),T[$.tileID.key]=$.tileID),C[F]=j}this._retainLoadedChildren(C,c,y,v);for(let F in T)v[F]||(this._coveredTiles[F]=!0,v[F]=T[F])}for(let T in v)this._tiles[T].clearFadeHold();let w=a.keysDifference(this._tiles,v);for(let T of w){let C=this._tiles[T];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,s){let c={},d={},y=Math.max(s-ti.maxOverzooming,this._source.minzoom),v=Math.max(s+ti.maxUnderzooming,this._source.minzoom),w={};for(let T of e){let C=this._addTile(T);c[T.key]=T,C.hasData()||s<this._source.maxzoom&&(w[T.key]=T)}this._retainLoadedChildren(w,s,v,c);for(let T of e){let C=this._tiles[T.key];if(C.hasData())continue;if(s+1>this._source.maxzoom){let F=T.children(this._source.maxzoom)[0],j=this.getTile(F);if(j&&j.hasData()){c[F.key]=F;continue}}else{let F=T.children(this._source.maxzoom);if(c[F[0].key]&&c[F[1].key]&&c[F[2].key]&&c[F[3].key])continue}let k=C.wasRequested();for(let F=T.overscaledZ-1;F>=y;--F){let j=T.scaledTo(F);if(d[j.key]||(d[j.key]=!0,C=this.getTile(j),!C&&k&&(C=this._addTile(j)),C&&(c[j.key]=j,k=C.wasRequested(),C.hasData())))break}}return c}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let s=[],c,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}s.push(d.key);let y=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(y),c)break;d=y}for(let y of s)this._loadedParentTiles[y]=c}}_addTile(e){let s=this._tiles[e.key];if(s)return s;s=this._cache.getAndRemove(e),s&&(this._setTileReloadTimer(e.key,s),s.tileID=e,this._state.initializeTileState(s,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,s)));let c=s;return s||(s=new Bn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(s,this._tileLoaded.bind(this,s,e.key,s.state))),s.uses++,this._tiles[e.key]=s,c||this._source.fire(new a.Event("dataloading",{tile:s,coord:s.tileID,dataType:"source"})),s}_setTileReloadTimer(e,s){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let c=s.getExpiryTimeout();c&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},c))}_removeTile(e){let s=this._tiles[e];s&&(s.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),s.uses>0||(s.hasData()&&s.state!=="reloading"?this._cache.add(s.tileID,s,s.getExpiryTimeout()):(s.aborted=!0,this._abortTile(s),this._unloadTile(s))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,s,c){let d=[],y=this.transform;if(!y)return d;let v=c?y.getCameraQueryGeometry(e):e,w=e.map($=>y.pointCoordinate($)),T=v.map($=>y.pointCoordinate($)),C=this.getIds(),k=1/0,F=1/0,j=-1/0,Y=-1/0;for(let $ of T)k=Math.min(k,$.x),F=Math.min(F,$.y),j=Math.max(j,$.x),Y=Math.max(Y,$.y);for(let $=0;$<C.length;$++){let J=this._tiles[C[$]];if(J.holdingForFade())continue;let lt=J.tileID,ht=Math.pow(2,y.zoom-J.tileID.overscaledZ),gt=s*J.queryPadding*a.EXTENT/J.tileSize/ht,ut=[lt.getTilePoint(new a.MercatorCoordinate(k,F)),lt.getTilePoint(new a.MercatorCoordinate(j,Y))];if(ut[0].x-gt<a.EXTENT&&ut[0].y-gt<a.EXTENT&&ut[1].x+gt>=0&&ut[1].y+gt>=0){let kt=w.map(Tt=>lt.getTilePoint(Tt)),Mt=T.map(Tt=>lt.getTilePoint(Tt));d.push({tile:J,tileID:lt,queryGeometry:kt,cameraQueryGeometry:Mt,scale:ht})}}return d}getVisibleCoordinates(e){let s=this.getRenderableIds(e).map(c=>this._tiles[c].tileID);for(let c of s)c.posMatrix=this.transform.calculatePosMatrix(c.toUnwrapped());return s}hasTransition(){if(this._source.hasTransition())return!0;if(On(this._source.type))for(let e in this._tiles){let s=this._tiles[e];if(s.fadeEndTime!==void 0&&s.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(e,s,c){this._state.updateState(e=e||"_geojsonTileLayer",s,c)}removeFeatureState(e,s,c){this._state.removeFeatureState(e=e||"_geojsonTileLayer",s,c)}getFeatureState(e,s){return this._state.getState(e=e||"_geojsonTileLayer",s)}setDependencies(e,s,c){let d=this._tiles[e];d&&d.setDependencies(s,c)}reloadTilesForDependencies(e,s){for(let c in this._tiles)this._tiles[c].hasDependency(e,s)&&this._reloadTile(c,"reloading");this._cache.filter(c=>!c.hasDependency(e,s))}}function an(p,e){let s=Math.abs(2*p.wrap)-+(p.wrap<0),c=Math.abs(2*e.wrap)-+(e.wrap<0);return p.overscaledZ-e.overscaledZ||c-s||e.canonical.y-p.canonical.y||e.canonical.x-p.canonical.x}function On(p){return p==="raster"||p==="image"||p==="video"}ti.maxOverzooming=10,ti.maxUnderzooming=3;let yn="mapboxgl_preloaded_worker_pool";class Br{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Br.workerCount;)this.workers.push(new Worker(ua.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(s=>{s.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[yn]}numActive(){return Object.keys(this.active).length}}let ys=Math.floor(a.exported.hardwareConcurrency/2),mt;function U(){return mt||(mt=new Br),mt}function B(p,e){let s={};for(let c in p)c!=="ref"&&(s[c]=p[c]);return a.refProperties.forEach(c=>{c in e&&(s[c]=e[c])}),s}function V(p){p=p.slice();let e=Object.create(null);for(let s=0;s<p.length;s++)e[p[s].id]=p[s];for(let s=0;s<p.length;s++)"ref"in p[s]&&(p[s]=B(p[s],e[p[s].ref]));return p}Br.workerCount=Math.max(Math.min(ys,6),1);let X={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function nt(p,e,s){s.push({command:X.addSource,args:[p,e[p]]})}function _t(p,e,s){e.push({command:X.removeSource,args:[p]}),s[p]=!0}function Ft(p,e,s,c){_t(p,s,c),nt(p,e,s)}function Vt(p,e,s){let c;for(c in p[s])if(Object.prototype.hasOwnProperty.call(p[s],c)&&c!=="data"&&!N(p[s][c],e[s][c]))return!1;for(c in e[s])if(Object.prototype.hasOwnProperty.call(e[s],c)&&c!=="data"&&!N(p[s][c],e[s][c]))return!1;return!0}function ct(p,e,s,c,d,y){let v;for(v in e=e||{},p=p||{})Object.prototype.hasOwnProperty.call(p,v)&&(N(p[v],e[v])||s.push({command:y,args:[c,v,e[v],d]}));for(v in e)Object.prototype.hasOwnProperty.call(e,v)&&!Object.prototype.hasOwnProperty.call(p,v)&&(N(p[v],e[v])||s.push({command:y,args:[c,v,e[v],d]}))}function zt(p){return p.id}function Ee(p,e){return p[e.id]=e,p}class Ae{constructor(e,s){this.reset(e,s)}reset(e,s){this.points=e||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(s||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=a.clamp(e,0,1);let s=1,c=this._distances[s],d=e*this.paddedLength+this.padding;for(;c<d&&s<this._distances.length;)c=this._distances[++s];let y=s-1,v=this._distances[y],w=c-v,T=w>0?(d-v)/w:0;return this.points[y].mult(1-T).add(this.points[s].mult(T))}}function ce(p,e){let s=!0;return p==="always"||p!=="never"&&e!=="never"||(s=!1),s}class Ve{constructor(e,s,c){let d=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(e/c),this.yCellCount=Math.ceil(s/c);for(let v=0;v<this.xCellCount*this.yCellCount;v++)d.push([]),y.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=s,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/s,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,s,c,d,y){this._forEachCell(s,c,d,y,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(y)}insertCircle(e,s,c,d){this._forEachCell(s-d,c-d,s+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(s),this.circles.push(c),this.circles.push(d)}_insertBoxCell(e,s,c,d,y,v){this.boxCells[y].push(v)}_insertCircleCell(e,s,c,d,y,v){this.circleCells[y].push(v)}_query(e,s,c,d,y,v,w){if(c<0||e>this.width||d<0||s>this.height)return[];let T=[];if(e<=0&&s<=0&&this.width<=c&&this.height<=d){if(y)return[{key:null,x1:e,y1:s,x2:c,y2:d}];for(let C=0;C<this.boxKeys.length;C++)T.push({key:this.boxKeys[C],x1:this.bboxes[4*C],y1:this.bboxes[4*C+1],x2:this.bboxes[4*C+2],y2:this.bboxes[4*C+3]});for(let C=0;C<this.circleKeys.length;C++){let k=this.circles[3*C],F=this.circles[3*C+1],j=this.circles[3*C+2];T.push({key:this.circleKeys[C],x1:k-j,y1:F-j,x2:k+j,y2:F+j})}}else this._forEachCell(e,s,c,d,this._queryCell,T,{hitTest:y,overlapMode:v,seenUids:{box:{},circle:{}}},w);return T}query(e,s,c,d){return this._query(e,s,c,d,!1,null)}hitTest(e,s,c,d,y,v){return this._query(e,s,c,d,!0,y,v).length>0}hitTestCircle(e,s,c,d,y){let v=e-c,w=e+c,T=s-c,C=s+c;if(w<0||v>this.width||C<0||T>this.height)return!1;let k=[];return this._forEachCell(v,T,w,C,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:e,y:s,radius:c},seenUids:{box:{},circle:{}}},y),k.length>0}_queryCell(e,s,c,d,y,v,w,T){let{seenUids:C,hitTest:k,overlapMode:F}=w,j=this.boxCells[y];if(j!==null){let $=this.bboxes;for(let J of j)if(!C.box[J]){C.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(e<=$[lt+2]&&s<=$[lt+3]&&c>=$[lt+0]&&d>=$[lt+1]&&(!T||T(ht))&&(!k||!ce(F,ht.overlapMode))&&(v.push({key:ht,x1:$[lt],y1:$[lt+1],x2:$[lt+2],y2:$[lt+3]}),k))return!0}}let Y=this.circleCells[y];if(Y!==null){let $=this.circles;for(let J of Y)if(!C.circle[J]){C.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circleAndRectCollide($[lt],$[lt+1],$[lt+2],e,s,c,d)&&(!T||T(ht))&&(!k||!ce(F,ht.overlapMode))){let gt=$[lt],ut=$[lt+1],kt=$[lt+2];if(v.push({key:ht,x1:gt-kt,y1:ut-kt,x2:gt+kt,y2:ut+kt}),k)return!0}}}return!1}_queryCellCircle(e,s,c,d,y,v,w,T){let{circle:C,seenUids:k,overlapMode:F}=w,j=this.boxCells[y];if(j!==null){let $=this.bboxes;for(let J of j)if(!k.box[J]){k.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(this._circleAndRectCollide(C.x,C.y,C.radius,$[lt+0],$[lt+1],$[lt+2],$[lt+3])&&(!T||T(ht))&&!ce(F,ht.overlapMode))return v.push(!0),!0}}let Y=this.circleCells[y];if(Y!==null){let $=this.circles;for(let J of Y)if(!k.circle[J]){k.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circlesCollide($[lt],$[lt+1],$[lt+2],C.x,C.y,C.radius)&&(!T||T(ht))&&!ce(F,ht.overlapMode))return v.push(!0),!0}}}_forEachCell(e,s,c,d,y,v,w,T){let C=this._convertToXCellCoord(e),k=this._convertToYCellCoord(s),F=this._convertToXCellCoord(c),j=this._convertToYCellCoord(d);for(let Y=C;Y<=F;Y++)for(let $=k;$<=j;$++)if(y.call(this,e,s,c,d,this.xCellCount*$+Y,v,w,T))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,s,c,d,y,v){let w=d-e,T=y-s,C=c+v;return C*C>w*w+T*T}_circleAndRectCollide(e,s,c,d,y,v,w){let T=(v-d)/2,C=Math.abs(e-(d+T));if(C>T+c)return!1;let k=(w-y)/2,F=Math.abs(s-(y+k));if(F>k+c)return!1;if(C<=T||F<=k)return!0;let j=C-T,Y=F-k;return j*j+Y*Y<=c*c}}function Pe(p,e,s,c,d){let y=a.create();return e?(a.scale(y,y,[1/d,1/d,1]),s||a.rotateZ(y,y,c.angle)):a.multiply(y,c.labelPlaneMatrix,p),y}function ei(p,e,s,c,d){if(e){let y=a.clone(p);return a.scale(y,y,[d,d,1]),s||a.rotateZ(y,y,-c.angle),y}return c.glCoordMatrix}function ke(p,e){let s=[p.x,p.y,0,1];Xe(s,s,e);let c=s[3];return{point:new a.pointGeometry(s[0]/c,s[1]/c),signedDistanceFromCamera:c}}function Gt(p,e){return .5+p/e*.5}function xe(p,e){let s=p[0]/p[3],c=p[1]/p[3];return s>=-e[0]&&s<=e[0]&&c>=-e[1]&&c<=e[1]}function pe(p,e,s,c,d,y,v,w,T){let C=c?p.textSizeData:p.iconSizeData,k=a.evaluateSizeForZoom(C,s.transform.zoom),F=[256/s.width*2+1,256/s.height*2+1],j=c?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;j.clear();let Y=p.lineVertexArray,$=c?p.text.placedSymbolArray:p.icon.placedSymbolArray,J=s.transform.width/s.transform.height,lt=!1;for(let ht=0;ht<$.length;ht++){let gt=$.get(ht);if(gt.hidden||gt.writingMode===a.WritingMode.vertical&&!lt){ni(gt.numGlyphs,j);continue}lt=!1;let ut=[gt.anchorX,gt.anchorY,0,1];if(a.transformMat4(ut,ut,e),!xe(ut,F)){ni(gt.numGlyphs,j);continue}let kt=Gt(s.transform.cameraToCenterDistance,ut[3]),Mt=a.evaluateSizeForFeature(C,k,gt),Tt=v?Mt/kt:Mt*kt,Ut=new a.pointGeometry(gt.anchorX,gt.anchorY),$t=ke(Ut,d).point,Pt={},se=be(gt,Tt,!1,w,e,d,y,p.glyphOffsetArray,Y,j,$t,Ut,Pt,J,T);lt=se.useVertical,(se.notEnoughRoom||lt||se.needsFlipping&&be(gt,Tt,!0,w,e,d,y,p.glyphOffsetArray,Y,j,$t,Ut,Pt,J,T).notEnoughRoom)&&ni(gt.numGlyphs,j)}c?p.text.dynamicLayoutVertexBuffer.updateData(j):p.icon.dynamicLayoutVertexBuffer.updateData(j)}function oi(p,e,s,c,d,y,v,w,T,C,k,F){let j=w.glyphStartIndex+w.numGlyphs,Y=w.lineStartIndex,$=w.lineStartIndex+w.lineLength,J=e.getoffsetX(w.glyphStartIndex),lt=e.getoffsetX(j-1),ht=yi(p*J,s,c,d,y,v,w.segment,Y,$,T,C,k,F);if(!ht)return null;let gt=yi(p*lt,s,c,d,y,v,w.segment,Y,$,T,C,k,F);return gt?{first:ht,last:gt}:null}function Wi(p,e,s,c){return p===a.WritingMode.horizontal&&Math.abs(s.y-e.y)>Math.abs(s.x-e.x)*c?{useVertical:!0}:(p===a.WritingMode.vertical?e.y<s.y:e.x>s.x)?{needsFlipping:!0}:null}function be(p,e,s,c,d,y,v,w,T,C,k,F,j,Y,$){let J=e/24,lt=p.lineOffsetX*J,ht=p.lineOffsetY*J,gt;if(p.numGlyphs>1){let ut=p.glyphStartIndex+p.numGlyphs,kt=p.lineStartIndex,Mt=p.lineStartIndex+p.lineLength,Tt=oi(J,w,lt,ht,s,k,F,p,T,y,j,$);if(!Tt)return{notEnoughRoom:!0};let Ut=ke(Tt.first.point,v).point,$t=ke(Tt.last.point,v).point;if(c&&!s){let Pt=Wi(p.writingMode,Ut,$t,Y);if(Pt)return Pt}gt=[Tt.first];for(let Pt=p.glyphStartIndex+1;Pt<ut-1;Pt++)gt.push(yi(J*w.getoffsetX(Pt),lt,ht,s,k,F,p.segment,kt,Mt,T,y,j,$));gt.push(Tt.last)}else{if(c&&!s){let kt=ke(F,d).point,Mt=p.lineStartIndex+p.segment+1,Tt=new a.pointGeometry(T.getx(Mt),T.gety(Mt)),Ut=ke(Tt,d),$t=Ut.signedDistanceFromCamera>0?Ut.point:rr(F,Tt,kt,1,d),Pt=Wi(p.writingMode,kt,$t,Y);if(Pt)return Pt}let ut=yi(J*w.getoffsetX(p.glyphStartIndex),lt,ht,s,k,F,p.segment,p.lineStartIndex,p.lineStartIndex+p.lineLength,T,y,j,$);if(!ut)return{notEnoughRoom:!0};gt=[ut]}for(let ut of gt)a.addDynamicAttributes(C,ut.point,ut.angle);return{}}function rr(p,e,s,c,d){let y=ke(p.add(p.sub(e)._unit()),d).point,v=s.sub(y);return s.add(v._mult(c/v.mag()))}function yi(p,e,s,c,d,y,v,w,T,C,k,F,j){let Y=c?p-e:p+e,$=Y>0?1:-1,J=0;c&&($*=-1,J=Math.PI),$<0&&(J+=Math.PI);let lt=$>0?w+v:w+v+1,ht=d,gt=d,ut=0,kt=0,Mt=Math.abs(Y),Tt=[];for(;ut+kt<=Mt;){if(lt+=$,lt<w||lt>=T)return null;if(gt=ht,Tt.push(ht),ht=F[lt],ht===void 0){let Kt=new a.pointGeometry(C.getx(lt),C.gety(lt)),we=ke(Kt,k);if(we.signedDistanceFromCamera>0)ht=F[lt]=we.point;else{let Ue=lt-$;ht=rr(ut===0?y:new a.pointGeometry(C.getx(Ue),C.gety(Ue)),Kt,gt,Mt-ut+1,k)}}ut+=kt,kt=gt.dist(ht)}let Ut=(Mt-ut)/kt,$t=ht.sub(gt),Pt=$t.mult(Ut)._add(gt);Pt._add($t._unit()._perp()._mult(s*$));let se=J+Math.atan2(ht.y-gt.y,ht.x-gt.x);return Tt.push(Pt),{point:Pt,angle:j?se:0,path:Tt}}let nr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ni(p,e){for(let s=0;s<p;s++){let c=e.length;e.resize(c+4),e.float32.set(nr,3*c)}}function Xe(p,e,s){let c=e[0],d=e[1];return p[0]=s[0]*c+s[4]*d+s[12],p[1]=s[1]*c+s[5]*d+s[13],p[3]=s[3]*c+s[7]*d+s[15],p}let Gi=100;class _r{constructor(e,s=new Ve(e.width+200,e.height+200,25),c=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=s,this.ignoredGrid=c,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Gi,this.screenBottomBoundary=e.height+Gi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200}placeCollisionBox(e,s,c,d,y){let v=this.projectAndGetPerspectiveRatio(d,e.anchorPointX,e.anchorPointY),w=c*v.perspectiveRatio,T=e.x1*w+v.point.x,C=e.y1*w+v.point.y,k=e.x2*w+v.point.x,F=e.y2*w+v.point.y;return!this.isInsideGrid(T,C,k,F)||s!=="always"&&this.grid.hitTest(T,C,k,F,s,y)?{box:[],offscreen:!1}:{box:[T,C,k,F],offscreen:this.isOffscreen(T,C,k,F)}}placeCollisionCircles(e,s,c,d,y,v,w,T,C,k,F,j,Y){let $=[],J=new a.pointGeometry(s.anchorX,s.anchorY),lt=ke(J,v),ht=Gt(this.transform.cameraToCenterDistance,lt.signedDistanceFromCamera),gt=(k?y/ht:y*ht)/a.ONE_EM,ut=ke(J,w).point,kt=oi(gt,d,s.lineOffsetX*gt,s.lineOffsetY*gt,!1,ut,J,s,c,w,{},!1),Mt=!1,Tt=!1,Ut=!0;if(kt){let $t=.5*j*ht+Y,Pt=new a.pointGeometry(-100,-100),se=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Kt=new Ae,we=kt.first,Ue=kt.last,De=[];for(let Me=we.path.length-1;Me>=1;Me--)De.push(we.path[Me]);for(let Me=1;Me<Ue.path.length;Me++)De.push(Ue.path[Me]);let Oe=2.5*$t;if(T){let Me=De.map(je=>ke(je,T));De=Me.some(je=>je.signedDistanceFromCamera<=0)?[]:Me.map(je=>je.point)}let xi=[];if(De.length>0){let Me=De[0].clone(),je=De[0].clone();for(let ii=1;ii<De.length;ii++)Me.x=Math.min(Me.x,De[ii].x),Me.y=Math.min(Me.y,De[ii].y),je.x=Math.max(je.x,De[ii].x),je.y=Math.max(je.y,De[ii].y);xi=Me.x>=Pt.x&&je.x<=se.x&&Me.y>=Pt.y&&je.y<=se.y?[De]:je.x<Pt.x||Me.x>se.x||je.y<Pt.y||Me.y>se.y?[]:a.clipLine([De],Pt.x,Pt.y,se.x,se.y)}for(let Me of xi){Kt.reset(Me,.25*$t);let je=0;je=Kt.length<=.5*$t?1:Math.ceil(Kt.paddedLength/Oe)+1;for(let ii=0;ii<je;ii++){let Hi=ii/Math.max(je-1,1),br=Kt.lerp(Hi),Or=br.x+Gi,Nr=br.y+Gi;$.push(Or,Nr,$t,0);let Cn=Or-$t,pr=Nr-$t,ln=Or+$t,Zn=Nr+$t;if(Ut=Ut&&this.isOffscreen(Cn,pr,ln,Zn),Tt=Tt||this.isInsideGrid(Cn,pr,ln,Zn),e!=="always"&&this.grid.hitTestCircle(Or,Nr,$t,e,F)&&(Mt=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Mt}}}}return{circles:!C&&Mt||!Tt?[]:$,offscreen:Ut,collisionDetected:Mt}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let s=[],c=1/0,d=1/0,y=-1/0,v=-1/0;for(let k of e){let F=new a.pointGeometry(k.x+Gi,k.y+Gi);c=Math.min(c,F.x),d=Math.min(d,F.y),y=Math.max(y,F.x),v=Math.max(v,F.y),s.push(F)}let w=this.grid.query(c,d,y,v).concat(this.ignoredGrid.query(c,d,y,v)),T={},C={};for(let k of w){let F=k.key;if(T[F.bucketInstanceId]===void 0&&(T[F.bucketInstanceId]={}),T[F.bucketInstanceId][F.featureIndex])continue;let j=[new a.pointGeometry(k.x1,k.y1),new a.pointGeometry(k.x2,k.y1),new a.pointGeometry(k.x2,k.y2),new a.pointGeometry(k.x1,k.y2)];a.polygonIntersectsPolygon(s,j)&&(T[F.bucketInstanceId][F.featureIndex]=!0,C[F.bucketInstanceId]===void 0&&(C[F.bucketInstanceId]=[]),C[F.bucketInstanceId].push(F.featureIndex))}return C}insertCollisionBox(e,s,c,d,y,v){(c?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:y,collisionGroupID:v,overlapMode:s},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,s,c,d,y,v){let w=c?this.ignoredGrid:this.grid,T={bucketInstanceId:d,featureIndex:y,collisionGroupID:v,overlapMode:s};for(let C=0;C<e.length;C+=4)w.insertCircle(T,e[C],e[C+1],e[C+2])}projectAndGetPerspectiveRatio(e,s,c){let d=[s,c,0,1];return Xe(d,d,e),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Gi,(-d[1]/d[3]+1)/2*this.transform.height+Gi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(e,s,c,d){return c<Gi||e>=this.screenRightBoundary||d<Gi||s>this.screenBottomBoundary}isInsideGrid(e,s,c,d){return c>=0&&e<this.gridRightBoundary&&d>=0&&s<this.gridBottomBoundary}getViewportMatrix(){let e=a.identity([]);return a.translate(e,e,[-100,-100,0]),e}}function _i(p,e,s){return e*(a.EXTENT/(p.tileSize*Math.pow(2,s-p.tileID.overscaledZ)))}class Hr{constructor(e,s,c,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?s:-s))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Xr{constructor(e,s,c,d,y){this.text=new Hr(e?e.text:null,s,c,y),this.icon=new Hr(e?e.icon:null,s,d,y)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Zs{constructor(e,s,c){this.text=e,this.icon=s,this.skipFade=c}}class _s{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class xs{constructor(e,s,c,d,y){this.bucketInstanceId=e,this.featureIndex=s,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=y}}class Z{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let s=++this.maxGroupID;this.collisionGroups[e]={ID:s,predicate:c=>c.collisionGroupID===s}}return this.collisionGroups[e]}}function I(p,e,s,c,d){let{horizontalAlign:y,verticalAlign:v}=a.getAnchorAlignment(p),w=-(y-.5)*e,T=-(v-.5)*s,C=a.evaluateVariableOffset(p,c);return new a.pointGeometry(w+C[0]*d,T+C[1]*d)}function P(p,e,s,c,d,y){let{x1:v,x2:w,y1:T,y2:C,anchorPointX:k,anchorPointY:F}=p,j=new a.pointGeometry(e,s);return c&&j._rotate(d?y:-y),{x1:v+j.x,y1:T+j.y,x2:w+j.x,y2:C+j.y,anchorPointX:k,anchorPointY:F}}class q{constructor(e,s,c,d){this.transform=e.clone(),this.collisionIndex=new _r(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Z(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,s,c,d){let y=c.getBucket(s),v=c.latestFeatureIndex;if(!y||!v||s.id!==y.layerIds[0])return;let w=c.collisionBoxArray,T=y.layers[0].layout,C=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),k=c.tileSize/a.EXTENT,F=this.transform.calculatePosMatrix(c.tileID.toUnwrapped()),j=T.get("text-pitch-alignment")==="map",Y=T.get("text-rotation-alignment")==="map",$=_i(c,1,this.transform.zoom),J=Pe(F,j,Y,this.transform,$),lt=null;if(j){let gt=ei(F,j,Y,this.transform,$);lt=a.multiply([],this.transform.labelPlaneMatrix,gt)}this.retainedQueryData[y.bucketInstanceId]=new xs(y.bucketInstanceId,v,y.sourceLayerIndex,y.index,c.tileID);let ht={bucket:y,layout:T,posMatrix:F,textLabelPlaneMatrix:J,labelToScreenMatrix:lt,scale:C,textPixelRatio:k,holdingForFade:c.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(d)for(let gt of y.sortKeyRanges){let{sortKey:ut,symbolInstanceStart:kt,symbolInstanceEnd:Mt}=gt;e.push({sortKey:ut,symbolInstanceStart:kt,symbolInstanceEnd:Mt,parameters:ht})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:ht})}attemptAnchorPlacement(e,s,c,d,y,v,w,T,C,k,F,j,Y,$,J){let lt=[j.textOffset0,j.textOffset1],ht=I(e,c,d,lt,y),gt=this.collisionIndex.placeCollisionBox(P(s,ht.x,ht.y,v,w,this.transform.angle),F,T,C,k.predicate);if((!J||this.collisionIndex.placeCollisionBox(P(J,ht.x,ht.y,v,w,this.transform.angle),F,T,C,k.predicate).box.length!==0)&>.box.length>0){let ut;return this.prevPlacement&&this.prevPlacement.variableOffsets[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID].text&&(ut=this.prevPlacement.variableOffsets[j.crossTileID].anchor),this.variableOffsets[j.crossTileID]={textOffset:lt,width:c,height:d,anchor:e,textBoxScale:y,prevAnchor:ut},this.markUsedJustification(Y,e,j,$),Y.allowVerticalPlacement&&(this.markUsedOrientation(Y,$,j),this.placedOrientations[j.crossTileID]=$),{shift:ht,placedGlyphBoxes:gt}}}placeLayerBucketPart(e,s,c){let{bucket:d,layout:y,posMatrix:v,textLabelPlaneMatrix:w,labelToScreenMatrix:T,textPixelRatio:C,holdingForFade:k,collisionBoxArray:F,partiallyEvaluatedTextSize:j,collisionGroup:Y}=e.parameters,$=y.get("text-optional"),J=y.get("icon-optional"),lt=a.getOverlapMode(y,"text-overlap","text-allow-overlap"),ht=lt==="always",gt=a.getOverlapMode(y,"icon-overlap","icon-allow-overlap"),ut=gt==="always",kt=y.get("text-rotation-alignment")==="map",Mt=y.get("text-pitch-alignment")==="map",Tt=y.get("icon-text-fit")!=="none",Ut=y.get("symbol-z-order")==="viewport-y",$t=ht&&(ut||!d.hasIconData()||J),Pt=ut&&(ht||!d.hasTextData()||$);!d.collisionArrays&&F&&d.deserializeCollisionBoxes(F);let se=(Kt,we)=>{if(s[Kt.crossTileID])return;if(k)return void(this.placements[Kt.crossTileID]=new Zs(!1,!1,!1));let Ue=!1,De=!1,Oe=!0,xi=null,Me={box:null,offscreen:null},je={box:null,offscreen:null},ii=null,Hi=null,br=null,Or=0,Nr=0,Cn=0;we.textFeatureIndex?Or=we.textFeatureIndex:Kt.useRuntimeCollisionCircles&&(Or=Kt.featureIndex),we.verticalTextFeatureIndex&&(Nr=we.verticalTextFeatureIndex);let pr=we.textBox;if(pr){let wr=Ke=>{let ki=a.WritingMode.horizontal;if(d.allowVerticalPlacement&&!Ke&&this.prevPlacement){let sr=this.prevPlacement.placedOrientations[Kt.crossTileID];sr&&(this.placedOrientations[Kt.crossTileID]=sr,ki=sr,this.markUsedOrientation(d,ki,Kt))}return ki},$e=(Ke,ki)=>{if(d.allowVerticalPlacement&&Kt.numVerticalGlyphVertices>0&&we.verticalTextBox){for(let sr of d.writingModes)if(sr===a.WritingMode.vertical?(Me=ki(),je=Me):Me=Ke(),Me&&Me.box&&Me.box.length)break}else Me=Ke()};if(y.get("text-variable-anchor")){let Ke=y.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Kt.crossTileID]){let ui=this.prevPlacement.variableOffsets[Kt.crossTileID];Ke.indexOf(ui.anchor)>0&&(Ke=Ke.filter(Hn=>Hn!==ui.anchor),Ke.unshift(ui.anchor))}let ki=(ui,Hn,hn)=>{let Qa=ui.x2-ui.x1,yl=ui.y2-ui.y1,to=Kt.textBoxScale,Ch=Tt&>==="never"?Hn:null,Xn={box:[],offscreen:!1},eo=lt!=="never"?2*Ke.length:Ke.length;for(let cn=0;cn<eo;++cn){let ks=this.attemptAnchorPlacement(Ke[cn%Ke.length],ui,Qa,yl,to,kt,Mt,C,v,Y,cn>=Ke.length?lt:"never",Kt,d,hn,Ch);if(ks&&(Xn=ks.placedGlyphBoxes,Xn&&Xn.box&&Xn.box.length)){Ue=!0,xi=ks.shift;break}}return Xn};$e(()=>ki(pr,we.iconBox,a.WritingMode.horizontal),()=>{let ui=we.verticalTextBox;return d.allowVerticalPlacement&&!(Me&&Me.box&&Me.box.length)&&Kt.numVerticalGlyphVertices>0&&ui?ki(ui,we.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Me&&(Ue=Me.box,Oe=Me.offscreen);let sr=wr(Me&&Me.box);if(!Ue&&this.prevPlacement){let ui=this.prevPlacement.variableOffsets[Kt.crossTileID];ui&&(this.variableOffsets[Kt.crossTileID]=ui,this.markUsedJustification(d,ui.anchor,Kt,sr))}}else{let Ke=(ki,sr)=>{let ui=this.collisionIndex.placeCollisionBox(ki,lt,C,v,Y.predicate);return ui&&ui.box&&ui.box.length&&(this.markUsedOrientation(d,sr,Kt),this.placedOrientations[Kt.crossTileID]=sr),ui};$e(()=>Ke(pr,a.WritingMode.horizontal),()=>{let ki=we.verticalTextBox;return d.allowVerticalPlacement&&Kt.numVerticalGlyphVertices>0&&ki?Ke(ki,a.WritingMode.vertical):{box:null,offscreen:null}}),wr(Me&&Me.box&&Me.box.length)}}if(ii=Me,Ue=ii&&ii.box&&ii.box.length>0,Oe=ii&&ii.offscreen,Kt.useRuntimeCollisionCircles){let wr=d.text.placedSymbolArray.get(Kt.centerJustifiedTextSymbolIndex),$e=a.evaluateSizeForFeature(d.textSizeData,j,wr),Ke=y.get("text-padding");Hi=this.collisionIndex.placeCollisionCircles(lt,wr,d.lineVertexArray,d.glyphOffsetArray,$e,v,w,T,c,Mt,Y.predicate,Kt.collisionCircleDiameter,Ke),Ue=ht||Hi.circles.length>0&&!Hi.collisionDetected,Oe=Oe&&Hi.offscreen}if(we.iconFeatureIndex&&(Cn=we.iconFeatureIndex),we.iconBox){let wr=$e=>{let Ke=Tt&&xi?P($e,xi.x,xi.y,kt,Mt,this.transform.angle):$e;return this.collisionIndex.placeCollisionBox(Ke,gt,C,v,Y.predicate)};je&&je.box&&je.box.length&&we.verticalIconBox?(br=wr(we.verticalIconBox),De=br.box.length>0):(br=wr(we.iconBox),De=br.box.length>0),Oe=Oe&&br.offscreen}let ln=$||Kt.numHorizontalGlyphVertices===0&&Kt.numVerticalGlyphVertices===0,Zn=J||Kt.numIconVertices===0;if(ln||Zn?Zn?ln||(De=De&&Ue):Ue=De&&Ue:De=Ue=De&&Ue,Ue&&ii&&ii.box&&this.collisionIndex.insertCollisionBox(ii.box,lt,y.get("text-ignore-placement"),d.bucketInstanceId,je&&je.box&&Nr?Nr:Or,Y.ID),De&&br&&this.collisionIndex.insertCollisionBox(br.box,gt,y.get("icon-ignore-placement"),d.bucketInstanceId,Cn,Y.ID),Hi&&(Ue&&this.collisionIndex.insertCollisionCircles(Hi.circles,lt,y.get("text-ignore-placement"),d.bucketInstanceId,Or,Y.ID),c)){let wr=d.bucketInstanceId,$e=this.collisionCircleArrays[wr];$e===void 0&&($e=this.collisionCircleArrays[wr]=new _s);for(let Ke=0;Ke<Hi.circles.length;Ke+=4)$e.circles.push(Hi.circles[Ke+0]),$e.circles.push(Hi.circles[Ke+1]),$e.circles.push(Hi.circles[Ke+2]),$e.circles.push(Hi.collisionDetected?1:0)}this.placements[Kt.crossTileID]=new Zs(Ue||$t,De||Pt,Oe||d.justReloaded),s[Kt.crossTileID]=!0};if(Ut){let Kt=d.getSortedSymbolIndexes(this.transform.angle);for(let we=Kt.length-1;we>=0;--we){let Ue=Kt[we];se(d.symbolInstances.get(Ue),d.collisionArrays[Ue])}}else for(let Kt=e.symbolInstanceStart;Kt<e.symbolInstanceEnd;Kt++)se(d.symbolInstances.get(Kt),d.collisionArrays[Kt]);if(c&&d.bucketInstanceId in this.collisionCircleArrays){let Kt=this.collisionCircleArrays[d.bucketInstanceId];a.invert(Kt.invProjMatrix,v),Kt.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}markUsedJustification(e,s,c,d){let y;y=d===a.WritingMode.vertical?c.verticalPlacedTextSymbolIndex:{left:c.leftJustifiedTextSymbolIndex,center:c.centerJustifiedTextSymbolIndex,right:c.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(s)];let v=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,c.verticalPlacedTextSymbolIndex];for(let w of v)w>=0&&(e.text.placedSymbolArray.get(w).crossTileID=y>=0&&w!==y?0:c.crossTileID)}markUsedOrientation(e,s,c){let d=s===a.WritingMode.horizontal||s===a.WritingMode.horizontalOnly?s:0,y=s===a.WritingMode.vertical?s:0,v=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex];for(let w of v)e.text.placedSymbolArray.get(w).placedOrientation=d;c.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let s=this.prevPlacement,c=!1;this.prevZoomAdjustment=s?s.zoomAdjustment(this.transform.zoom):0;let d=s?s.symbolFadeChange(e):1,y=s?s.opacities:{},v=s?s.variableOffsets:{},w=s?s.placedOrientations:{};for(let T in this.placements){let C=this.placements[T],k=y[T];k?(this.opacities[T]=new Xr(k,d,C.text,C.icon),c=c||C.text!==k.text.placed||C.icon!==k.icon.placed):(this.opacities[T]=new Xr(null,d,C.text,C.icon,C.skipFade),c=c||C.text||C.icon)}for(let T in y){let C=y[T];if(!this.opacities[T]){let k=new Xr(C,d,!1,!1);k.isHidden()||(this.opacities[T]=k,c=c||C.text.placed||C.icon.placed)}}for(let T in v)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=v[T]);for(let T in w)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=w[T]);c?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=s?s.lastPlacementChangeTime:e)}updateLayerOpacities(e,s){let c={};for(let d of s){let y=d.getBucket(e);y&&d.latestFeatureIndex&&e.id===y.layerIds[0]&&this.updateBucketOpacities(y,c,d.collisionBoxArray)}}updateBucketOpacities(e,s,c){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let d=e.layers[0].layout,y=new Xr(null,0,!1,!1,!0),v=d.get("text-allow-overlap"),w=d.get("icon-allow-overlap"),T=d.get("text-variable-anchor"),C=d.get("text-rotation-alignment")==="map",k=d.get("text-pitch-alignment")==="map",F=d.get("icon-text-fit")!=="none",j=new Xr(null,0,v&&(w||!e.hasIconData()||d.get("icon-optional")),w&&(v||!e.hasTextData()||d.get("text-optional")),!0);!e.collisionArrays&&c&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(c);let Y=($,J,lt)=>{for(let ht=0;ht<J/4;ht++)$.opacityVertexArray.emplaceBack(lt)};for(let $=0;$<e.symbolInstances.length;$++){let J=e.symbolInstances.get($),{numHorizontalGlyphVertices:lt,numVerticalGlyphVertices:ht,crossTileID:gt}=J,ut=this.opacities[gt];s[gt]?ut=y:ut||(ut=j,this.opacities[gt]=ut),s[gt]=!0;let kt=J.numIconVertices>0,Mt=this.placedOrientations[J.crossTileID],Tt=Mt===a.WritingMode.vertical,Ut=Mt===a.WritingMode.horizontal||Mt===a.WritingMode.horizontalOnly;if(lt>0||ht>0){let $t=wt(ut.text);Y(e.text,lt,Tt?ae:$t),Y(e.text,ht,Ut?ae:$t);let Pt=ut.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach(we=>{we>=0&&(e.text.placedSymbolArray.get(we).hidden=Pt||Tt?1:0)}),J.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=Pt||Ut?1:0);let se=this.variableOffsets[J.crossTileID];se&&this.markUsedJustification(e,se.anchor,J,Mt);let Kt=this.placedOrientations[J.crossTileID];Kt&&(this.markUsedJustification(e,"left",J,Kt),this.markUsedOrientation(e,Kt,J))}if(kt){let $t=wt(ut.icon),Pt=!(F&&J.verticalPlacedIconSymbolIndex&&Tt);J.placedIconSymbolIndex>=0&&(Y(e.icon,J.numIconVertices,Pt?$t:ae),e.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=ut.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(Y(e.icon,J.numVerticalIconVertices,Pt?ae:$t),e.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=ut.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let $t=e.collisionArrays[$];if($t){let Pt=new a.pointGeometry(0,0);if($t.textBox||$t.verticalTextBox){let Kt=!0;if(T){let we=this.variableOffsets[gt];we?(Pt=I(we.anchor,we.width,we.height,we.textOffset,we.textBoxScale),C&&Pt._rotate(k?this.transform.angle:-this.transform.angle)):Kt=!1}$t.textBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Kt||Tt,Pt.x,Pt.y),$t.verticalTextBox&&H(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Kt||Ut,Pt.x,Pt.y)}let se=Boolean(!Ut&&$t.verticalIconBox);$t.iconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,se,F?Pt.x:0,F?Pt.y:0),$t.verticalIconBox&&H(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,!se,F?Pt.x:0,F?Pt.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){let $=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=$.invProjMatrix,e.placementViewportMatrix=$.viewportMatrix,e.collisionCircleArray=$.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,s){let c=this.zoomAtLastRecencyCheck===s?1-this.zoomAdjustment(s):1;return this.zoomAtLastRecencyCheck=s,this.commitTime+this.fadeDuration*c>e}setStale(){this.stale=!0}}function H(p,e,s,c,d){p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0),p.emplaceBack(e?1:0,s?1:0,c||0,d||0)}let K=Math.pow(2,25),st=Math.pow(2,24),it=Math.pow(2,17),rt=Math.pow(2,16),at=Math.pow(2,9),St=Math.pow(2,8),Bt=Math.pow(2,1);function wt(p){if(p.opacity===0&&!p.placed)return 0;if(p.opacity===1&&p.placed)return 4294967295;let e=p.placed?1:0,s=Math.floor(127*p.opacity);return s*K+e*st+s*it+e*rt+s*at+e*St+s*Bt+e}let ae=0;class te{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,s,c,d,y){let v=this._bucketParts;for(;this._currentTileIndex<e.length;)if(s.getBucketParts(v,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,y())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((w,T)=>w.sortKey-T.sortKey));this._currentPartIndex<v.length;)if(s.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,c),this._currentPartIndex++,y())return!0;return!1}}class he{constructor(e,s,c,d,y,v,w){this.placement=new q(e,y,v,w),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(e,s,c){let d=a.exported.now(),y=()=>{let v=a.exported.now()-d;return!this._forceFullPlacement&&v>2};for(;this._currentPlacementIndex>=0;){let v=s[e[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&(!v.minzoom||v.minzoom<=w)&&(!v.maxzoom||v.maxzoom>w)){if(this._inProgressLayer||(this._inProgressLayer=new te(v)),this._inProgressLayer.continuePlacement(c[v.source],this.placement,this._showCollisionBoxes,v,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let ge=512/a.EXTENT/2;class Ge{constructor(e,s,c){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=c;for(let d=0;d<s.length;d++){let y=s.get(d),v=y.key;this.indexedSymbolInstances[v]||(this.indexedSymbolInstances[v]=[]),this.indexedSymbolInstances[v].push({crossTileID:y.crossTileID,coord:this.getScaledCoordinates(y,e)})}}getScaledCoordinates(e,s){let c=ge/Math.pow(2,s.canonical.z-this.tileID.canonical.z);return{x:Math.floor((s.canonical.x*a.EXTENT+e.anchorX)*c),y:Math.floor((s.canonical.y*a.EXTENT+e.anchorY)*c)}}findMatches(e,s,c){let d=this.tileID.canonical.z<s.canonical.z?1:Math.pow(2,this.tileID.canonical.z-s.canonical.z);for(let y=0;y<e.length;y++){let v=e.get(y);if(v.crossTileID)continue;let w=this.indexedSymbolInstances[v.key];if(!w)continue;let T=this.getScaledCoordinates(v,s);for(let C of w)if(Math.abs(C.coord.x-T.x)<=d&&Math.abs(C.coord.y-T.y)<=d&&!c[C.crossTileID]){c[C.crossTileID]=!0,v.crossTileID=C.crossTileID;break}}}}class Fe{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Le{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let s=Math.round((e-this.lng)/360);if(s!==0)for(let c in this.indexes){let d=this.indexes[c],y={};for(let v in d){let w=d[v];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+s),y[w.tileID.key]=w}this.indexes[c]=y}this.lng=e}addBucket(e,s,c){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===s.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let y=0;y<s.symbolInstances.length;y++)s.symbolInstances.get(y).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let d=this.usedCrossTileIDs[e.overscaledZ];for(let y in this.indexes){let v=this.indexes[y];if(Number(y)>e.overscaledZ)for(let w in v){let T=v[w];T.tileID.isChildOf(e)&&T.findMatches(s.symbolInstances,e,d)}else{let w=v[e.scaledTo(Number(y)).key];w&&w.findMatches(s.symbolInstances,e,d)}}for(let y=0;y<s.symbolInstances.length;y++){let v=s.symbolInstances.get(y);v.crossTileID||(v.crossTileID=c.generate(),d[v.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ge(e,s.symbolInstances,s.bucketInstanceId),!0}removeBucketCrossTileIDs(e,s){for(let c in s.indexedSymbolInstances)for(let d of s.indexedSymbolInstances[c])delete this.usedCrossTileIDs[e][d.crossTileID]}removeStaleBuckets(e){let s=!1;for(let c in this.indexes){let d=this.indexes[c];for(let y in d)e[d[y].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[y]),delete d[y],s=!0)}return s}}class Ie{constructor(){this.layerIndexes={},this.crossTileIDs=new Fe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,s,c){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new Le);let y=!1,v={};d.handleWrapJump(c);for(let w of s){let T=w.getBucket(e);T&&e.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(w.tileID,T,this.crossTileIDs)&&(y=!0),v[T.bucketInstanceId]=!0)}return d.removeStaleBuckets(v)&&(y=!0),y}pruneUnusedLayers(e){let s={};e.forEach(c=>{s[c]=!0});for(let c in this.layerIndexes)s[c]||delete this.layerIndexes[c]}}let Te=(p,e)=>a.emitValidationErrors(p,e&&e.filter(s=>s.identifier!=="source.canvas")),Ti=a.pick(X,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),wi=a.pick(X,["setCenter","setZoom","setBearing","setPitch"]),qi=function(){let p={},e=a.spec.$version;for(let s in a.spec.$root){let c=a.spec.$root[s];if(c.required){let d=null;d=s==="version"?e:c.type==="array"?[]:{},d!=null&&(p[s]=d)}}return p}();class Zi extends a.Evented{constructor(e,s={}){super(),this.map=e,this.dispatcher=new Oi(U(),this),this.imageManager=new Ht,this.imageManager.setEventedParent(this),this.glyphManager=new Ce(e._requestManager,s.localIdeographFontFamily),this.lineAtlas=new Yi(256,512),this.crossTileSymbolIndex=new Ie,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());let c=this;this._rtlTextPluginCallback=Zi.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(y,v)=>{if(a.triggerPluginCompletionEvent(y),v&&v.every(w=>w))for(let w in c.sourceCaches)c.sourceCaches[w].reload()})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;let y=this.sourceCaches[d.sourceId];if(!y)return;let v=y.getSource();if(v&&v.vectorLayerIds)for(let w in this._layers){let T=this._layers[w];T.source===v.id&&this._validateLayer(T)}})}loadURL(e,s={}){this.fire(new a.Event("dataloading",{dataType:"style"}));let c=typeof s.validate!="boolean"||s.validate,d=this.map._requestManager.transformRequest(e,a.ResourceType.Style);this._request=a.getJSON(d,(y,v)=>{this._request=null,y?this.fire(new a.ErrorEvent(y)):v&&this._load(v,c)})}loadJSON(e,s={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(e,s.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(qi,!1)}_load(e,s){if(s&&Te(this,a.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(let d in e.sources)this.addSource(d,e.sources[d],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);let c=V(this.stylesheet.layers);this._order=c.map(d=>d.id),this._layers={},this._serializedLayers={};for(let d of c)d=a.createStyleLayer(d),d.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=d,this._serializedLayers[d.id]=d.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Fi(this.stylesheet.light),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(s,c,d,y){let v,w,T,C=d>1?"@2x":"",k=a.getJSON(c.transformRequest(c.normalizeSpriteURL(s,C,".json"),a.ResourceType.SpriteJSON),(Y,$)=>{k=null,T||(T=Y,v=$,j())}),F=a.getImage(c.transformRequest(c.normalizeSpriteURL(s,C,".png"),a.ResourceType.SpriteImage),(Y,$)=>{F=null,T||(T=Y,w=$,j())});function j(){if(T)y(T);else if(v&&w){let Y=a.exported.getImageData(w),$={};for(let J in v){let{width:lt,height:ht,x:gt,y:ut,sdf:kt,pixelRatio:Mt,stretchX:Tt,stretchY:Ut,content:$t}=v[J],Pt=new a.RGBAImage({width:lt,height:ht});a.RGBAImage.copy(Y,Pt,{x:gt,y:ut},{x:0,y:0},{width:lt,height:ht}),$[J]={data:Pt,pixelRatio:Mt,sdf:kt,stretchX:Tt,stretchY:Ut,content:$t}}y(null,$)}}return{cancel(){k&&(k.cancel(),k=null),F&&(F.cancel(),F=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(s,c)=>{if(this._spriteRequest=null,s)this.fire(new a.ErrorEvent(s));else if(c)for(let d in c)this.imageManager.addImage(d,c[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(e){let s=this.sourceCaches[e.source];if(!s)return;let c=e.sourceLayer;if(!c)return;let d=s.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(c)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${c}" does not exist on source "${d.id}" as specified by style layer "${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()}_serializeLayers(e){let s=[];for(let c of e){let d=this._layers[c];d.type!=="custom"&&s.push(d.serialize())}return s}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 s=this._changed;if(this._changed){let d=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(d.length||y.length)&&this._updateWorkerLayers(d,y);for(let v in this._updatedSources){let w=this._updatedSources[v];w==="reload"?this._reloadSource(v):w==="clear"&&this._clearSource(v)}this._updateTilesForChangedImages();for(let v in this._updatedPaintProps)this._layers[v].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let c={};for(let d in this.sourceCaches){let y=this.sourceCaches[d];c[d]=y.used,y.used=!1}for(let d of this._order){let y=this._layers[d];y.recalculate(e,this._availableImages),!y.isHidden(e.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(let d in c){let y=this.sourceCaches[d];c[d]!==y.used&&y.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,s&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,s){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:s})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Te(this,a.validateStyle(e)))return!1;(e=a.clone$1(e)).layers=V(e.layers);let s=function(d,y){if(!d)return[{command:X.setStyle,args:[y]}];let v=[];try{if(!N(d.version,y.version))return[{command:X.setStyle,args:[y]}];N(d.center,y.center)||v.push({command:X.setCenter,args:[y.center]}),N(d.zoom,y.zoom)||v.push({command:X.setZoom,args:[y.zoom]}),N(d.bearing,y.bearing)||v.push({command:X.setBearing,args:[y.bearing]}),N(d.pitch,y.pitch)||v.push({command:X.setPitch,args:[y.pitch]}),N(d.sprite,y.sprite)||v.push({command:X.setSprite,args:[y.sprite]}),N(d.glyphs,y.glyphs)||v.push({command:X.setGlyphs,args:[y.glyphs]}),N(d.transition,y.transition)||v.push({command:X.setTransition,args:[y.transition]}),N(d.light,y.light)||v.push({command:X.setLight,args:[y.light]});let w={},T=[];(function(k,F,j,Y){let $;for($ in F=F||{},k=k||{})Object.prototype.hasOwnProperty.call(k,$)&&(Object.prototype.hasOwnProperty.call(F,$)||_t($,j,Y));for($ in F)Object.prototype.hasOwnProperty.call(F,$)&&(Object.prototype.hasOwnProperty.call(k,$)?N(k[$],F[$])||(k[$].type==="geojson"&&F[$].type==="geojson"&&Vt(k,F,$)?j.push({command:X.setGeoJSONSourceData,args:[$,F[$].data]}):Ft($,F,j,Y)):nt($,F,j))})(d.sources,y.sources,T,w);let C=[];d.layers&&d.layers.forEach(k=>{w[k.source]?v.push({command:X.removeLayer,args:[k.id]}):C.push(k)}),v=v.concat(T),function(k,F,j){F=F||[];let Y=(k=k||[]).map(zt),$=F.map(zt),J=k.reduce(Ee,{}),lt=F.reduce(Ee,{}),ht=Y.slice(),gt=Object.create(null),ut,kt,Mt,Tt,Ut,$t,Pt;for(ut=0,kt=0;ut<Y.length;ut++)Mt=Y[ut],Object.prototype.hasOwnProperty.call(lt,Mt)?kt++:(j.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.indexOf(Mt,kt),1));for(ut=0,kt=0;ut<$.length;ut++)Mt=$[$.length-1-ut],ht[ht.length-1-ut]!==Mt&&(Object.prototype.hasOwnProperty.call(J,Mt)?(j.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.lastIndexOf(Mt,ht.length-kt),1)):kt++,$t=ht[ht.length-ut],j.push({command:X.addLayer,args:[lt[Mt],$t]}),ht.splice(ht.length-ut,0,Mt),gt[Mt]=!0);for(ut=0;ut<$.length;ut++)if(Mt=$[ut],Tt=J[Mt],Ut=lt[Mt],!gt[Mt]&&!N(Tt,Ut))if(N(Tt.source,Ut.source)&&N(Tt["source-layer"],Ut["source-layer"])&&N(Tt.type,Ut.type)){for(Pt in ct(Tt.layout,Ut.layout,j,Mt,null,X.setLayoutProperty),ct(Tt.paint,Ut.paint,j,Mt,null,X.setPaintProperty),N(Tt.filter,Ut.filter)||j.push({command:X.setFilter,args:[Mt,Ut.filter]}),N(Tt.minzoom,Ut.minzoom)&&N(Tt.maxzoom,Ut.maxzoom)||j.push({command:X.setLayerZoomRange,args:[Mt,Ut.minzoom,Ut.maxzoom]}),Tt)Object.prototype.hasOwnProperty.call(Tt,Pt)&&Pt!=="layout"&&Pt!=="paint"&&Pt!=="filter"&&Pt!=="metadata"&&Pt!=="minzoom"&&Pt!=="maxzoom"&&(Pt.indexOf("paint.")===0?ct(Tt[Pt],Ut[Pt],j,Mt,Pt.slice(6),X.setPaintProperty):N(Tt[Pt],Ut[Pt])||j.push({command:X.setLayerProperty,args:[Mt,Pt,Ut[Pt]]}));for(Pt in Ut)Object.prototype.hasOwnProperty.call(Ut,Pt)&&!Object.prototype.hasOwnProperty.call(Tt,Pt)&&Pt!=="layout"&&Pt!=="paint"&&Pt!=="filter"&&Pt!=="metadata"&&Pt!=="minzoom"&&Pt!=="maxzoom"&&(Pt.indexOf("paint.")===0?ct(Tt[Pt],Ut[Pt],j,Mt,Pt.slice(6),X.setPaintProperty):N(Tt[Pt],Ut[Pt])||j.push({command:X.setLayerProperty,args:[Mt,Pt,Ut[Pt]]}))}else j.push({command:X.removeLayer,args:[Mt]}),$t=ht[ht.lastIndexOf(Mt)+1],j.push({command:X.addLayer,args:[Ut,$t]})}(C,y.layers,v)}catch(w){console.warn("Unable to compute style diff:",w),v=[{command:X.setStyle,args:[y]}]}return v}(this.serialize(),e).filter(d=>!(d.command in wi));if(s.length===0)return!1;let c=s.filter(d=>!(d.command in Ti));if(c.length>0)throw new Error(`Unimplemented: ${c.map(d=>d.command).join(", ")}.`);return s.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=e,!0}addImage(e,s){if(this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,s),this._afterImageUpdated(e)}updateImage(e,s){this.imageManager.updateImage(e,s)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${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 a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,s,c={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!s.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(s).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(s.type)>=0&&this._validate(a.validateStyle.source,`sources.${e}`,s,null,c))return;this.map&&this.map._collectResourceTiming&&(s.collectResourceTiming=!0);let d=this.sourceCaches[e]=new ti(e,s,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:e})),d.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 c in this._layers)if(this._layers[c].source===e)return this.fire(new a.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${c}" is using it.`)));let s=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],s.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),s.setEventedParent(null),s.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,s){this._checkLoaded(),this.sourceCaches[e].getSource().setData(s),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,s,c={}){this._checkLoaded();let d=e.id;if(this.getLayer(d))return void this.fire(new a.ErrorEvent(new Error(`Layer "${d}" already exists on this map.`)));let y;if(e.type==="custom"){if(Te(this,a.validateCustomStyleLayer(e)))return;y=a.createStyleLayer(e)}else{if(typeof e.source=="object"&&(this.addSource(d,e.source),e=a.clone$1(e),e=a.extend(e,{source:d})),this._validate(a.validateStyle.layer,`layers.${d}`,e,{arrayIndex:-1},c))return;y=a.createStyleLayer(e),this._validateLayer(y),y.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[y.id]=y.serialize()}let v=s?this._order.indexOf(s):this._order.length;if(s&&v===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${d}" before non-existing layer "${s}".`)));else{if(this._order.splice(v,0,d),this._layerOrderChanged=!0,this._layers[d]=y,this._removedLayers[d]&&y.source&&y.type!=="custom"){let w=this._removedLayers[d];delete this._removedLayers[d],w.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(e,s){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new a.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===s)return;let c=this._order.indexOf(e);this._order.splice(c,1);let d=s?this._order.indexOf(s):this._order.length;s&&d===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${s}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let s=this._layers[e];if(!s)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));s.setEventedParent(null);let c=this._order.indexOf(e);this._order.splice(c,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=s,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],s.onRemove&&s.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,s,c){this._checkLoaded();let d=this.getLayer(e);d?d.minzoom===s&&d.maxzoom===c||(s!=null&&(d.minzoom=s),c!=null&&(d.maxzoom=c),this._updateLayer(d)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,s,c={}){this._checkLoaded();let d=this.getLayer(e);if(d){if(!N(d.filter,s))return s==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(a.validateStyle.filter,`layers.${d.id}.filter`,s,null,c)||(d.filter=a.clone$1(s),this._updateLayer(d)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return a.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,s,c,d={}){this._checkLoaded();let y=this.getLayer(e);y?N(y.getLayoutProperty(s),c)||(y.setLayoutProperty(s,c,d),this._updateLayer(y)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,s){let c=this.getLayer(e);if(c)return c.getLayoutProperty(s);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,s,c,d={}){this._checkLoaded();let y=this.getLayer(e);y?N(y.getPaintProperty(s),c)||(y.setPaintProperty(s,c,d)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,s){return this.getLayer(e).getPaintProperty(s)}setFeatureState(e,s){this._checkLoaded();let c=e.source,d=e.sourceLayer,y=this.sourceCaches[c];if(y===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));let v=y.getSource().type;v==="geojson"&&d?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):v!=="vector"||d?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),y.setFeatureState(d,e.id,s)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,s){this._checkLoaded();let c=e.source,d=this.sourceCaches[c];if(d===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)));let y=d.getSource().type,v=y==="vector"?e.sourceLayer:void 0;y!=="vector"||v?s&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(v,e.id,s):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let s=e.source,c=e.sourceLayer,d=this.sourceCaches[s];if(d!==void 0)return d.getSource().type!=="vector"||c?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),d.getFeatureState(c,e.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,e=>e.serialize()),layers:this._serializeLayers(this._order)},e=>e!==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._changed=!0}_flattenAndSortRenderedFeatures(e){let s=v=>this._layers[v].type==="fill-extrusion",c={},d=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(s(w)){c[w]=v;for(let T of e){let C=T[w];if(C)for(let k of C)d.push(k)}}}d.sort((v,w)=>w.intersectionZ-v.intersectionZ);let y=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(s(w))for(let T=d.length-1;T>=0;T--){let C=d[T].feature;if(c[C.layer.id]<v)break;y.push(C),d.pop()}else for(let T of e){let C=T[w];if(C)for(let k of C)y.push(k.feature)}}return y}queryRenderedFeatures(e,s,c){s&&s.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",s.filter,null,s);let d={};if(s&&s.layers){if(!Array.isArray(s.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(let v of s.layers){let w=this._layers[v];if(!w)return this.fire(new a.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];d[w.source]=!0}}let y=[];s.availableImages=this._availableImages;for(let v in this.sourceCaches)s.layers&&!d[v]||y.push(Zr(this.sourceCaches[v],this._layers,this._serializedLayers,e,s,c));return this.placement&&y.push(function(v,w,T,C,k,F,j){let Y={},$=F.queryRenderedSymbols(C),J=[];for(let lt of Object.keys($).map(Number))J.push(j[lt]);J.sort(En);for(let lt of J){let ht=lt.featureIndex.lookupSymbolFeatures($[lt.bucketInstanceId],w,lt.bucketIndex,lt.sourceLayerIndex,k.filter,k.layers,k.availableImages,v);for(let gt in ht){let ut=Y[gt]=Y[gt]||[],kt=ht[gt];kt.sort((Mt,Tt)=>{let Ut=lt.featureSortOrder;if(Ut){let $t=Ut.indexOf(Mt.featureIndex);return Ut.indexOf(Tt.featureIndex)-$t}return Tt.featureIndex-Mt.featureIndex});for(let Mt of kt)ut.push(Mt)}}for(let lt in Y)Y[lt].forEach(ht=>{let gt=ht.feature,ut=T[v[lt].source].getFeatureState(gt.layer["source-layer"],gt.id);gt.source=gt.layer.source,gt.layer["source-layer"]&&(gt.sourceLayer=gt.layer["source-layer"]),gt.state=ut});return Y}(this._layers,this._serializedLayers,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(e,s){s&&s.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",s.filter,null,s);let c=this.sourceCaches[e];return c?function(d,y){let v=d.getRenderableIds().map(C=>d.getTileByID(C)),w=[],T={};for(let C=0;C<v.length;C++){let k=v[C],F=k.tileID.canonical.key;T[F]||(T[F]=!0,k.querySourceFeatures(w,y))}return w}(c,s):[]}addSourceType(e,s,c){return Zi.getSourceType(e)?c(new Error(`A source type called "${e}" already exists.`)):(Zi.setSourceType(e,s),s.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:s.workerSourceURL},c):c(null,null))}getLight(){return this.light.getLight()}setLight(e,s={}){this._checkLoaded();let c=this.light.getLight(),d=!1;for(let v in e)if(!N(e[v],c[v])){d=!0;break}if(!d)return;let y={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,s),this.light.updateTransitions(y)}_validate(e,s,c,d,y={}){return(!y||y.validate!==!1)&&Te(this,e.call(a.validateStyle,a.extend({key:s,style:this.serialize(),value:c,styleSpec:a.spec},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let s=this.sourceCaches[e];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let s in this.sourceCaches)this.sourceCaches[s].update(e)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,s,c,d,y=!1){let v=!1,w=!1,T={};for(let C of this._order){let k=this._layers[C];if(k.type!=="symbol")continue;if(!T[k.source]){let j=this.sourceCaches[k.source];T[k.source]=j.getRenderableIds(!0).map(Y=>j.getTileByID(Y)).sort((Y,$)=>$.tileID.overscaledZ-Y.tileID.overscaledZ||(Y.tileID.isLessThan($.tileID)?-1:1))}let F=this.crossTileSymbolIndex.addLayer(k,T[k.source],e.center.lng);v=v||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||c===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),e.zoom))&&(this.pauseablePlacement=new he(e,this._order,y,s,c,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),w=!0),v&&this.pauseablePlacement.placement.setStale()),w||v)for(let C of this._order){let k=this._layers[C];k.type==="symbol"&&this.placement.updateLayerOpacities(k,T[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,s,c){this.imageManager.getImages(s.icons,c),this._updateTilesForChangedImages();let d=this.sourceCaches[s.source];d&&d.setDependencies(s.tileID.key,s.type,s.icons)}getGlyphs(e,s,c){this.glyphManager.getGlyphs(s.stacks,c)}getResource(e,s,c){return a.makeRequest(s,c)}}Zi.getSourceType=function(p){return yr[p]},Zi.setSourceType=function(p,e){yr[p]=e},Zi.registerForPluginStateChange=a.registerForPluginStateChange;var Do=a.createLayout([{name:"a_pos",type:"Int16",components:2}]),Ro={prelude:si(`#ifdef GL_ES
|
|
4
|
+
precision mediump float;
|
|
5
|
+
#else
|
|
6
|
+
#if !defined(lowp)
|
|
7
|
+
#define lowp
|
|
8
|
+
#endif
|
|
9
|
+
#if !defined(mediump)
|
|
10
|
+
#define mediump
|
|
11
|
+
#endif
|
|
12
|
+
#if !defined(highp)
|
|
13
|
+
#define highp
|
|
14
|
+
#endif
|
|
15
|
+
#endif`,`#ifdef GL_ES
|
|
16
|
+
precision highp float;
|
|
17
|
+
#else
|
|
18
|
+
#if !defined(lowp)
|
|
19
|
+
#define lowp
|
|
20
|
+
#endif
|
|
21
|
+
#if !defined(mediump)
|
|
22
|
+
#define mediump
|
|
23
|
+
#endif
|
|
24
|
+
#if !defined(highp)
|
|
25
|
+
#define highp
|
|
26
|
+
#endif
|
|
27
|
+
#endif
|
|
28
|
+
vec2 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
|
|
29
|
+
);}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;}`),background:si(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
30
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
31
|
+
gl_FragColor=vec4(1.0);
|
|
32
|
+
#endif
|
|
33
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:si(`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;
|
|
34
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
35
|
+
gl_FragColor=vec4(1.0);
|
|
36
|
+
#endif
|
|
37
|
+
}`,"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);}"),circle:si(`varying vec3 v_data;
|
|
38
|
+
#pragma mapbox: define highp vec4 color
|
|
39
|
+
#pragma mapbox: define mediump float radius
|
|
40
|
+
#pragma mapbox: define lowp float blur
|
|
41
|
+
#pragma mapbox: define lowp float opacity
|
|
42
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
43
|
+
#pragma mapbox: define mediump float stroke_width
|
|
44
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
45
|
+
void main() {
|
|
46
|
+
#pragma mapbox: initialize highp vec4 color
|
|
47
|
+
#pragma mapbox: initialize mediump float radius
|
|
48
|
+
#pragma mapbox: initialize lowp float blur
|
|
49
|
+
#pragma mapbox: initialize lowp float opacity
|
|
50
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
51
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
52
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
53
|
+
vec2 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=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
54
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
55
|
+
gl_FragColor=vec4(1.0);
|
|
56
|
+
#endif
|
|
57
|
+
}`,`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;
|
|
58
|
+
#pragma mapbox: define highp vec4 color
|
|
59
|
+
#pragma mapbox: define mediump float radius
|
|
60
|
+
#pragma mapbox: define lowp float blur
|
|
61
|
+
#pragma mapbox: define lowp float opacity
|
|
62
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
63
|
+
#pragma mapbox: define mediump float stroke_width
|
|
64
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
65
|
+
void main(void) {
|
|
66
|
+
#pragma mapbox: initialize highp vec4 color
|
|
67
|
+
#pragma mapbox: initialize mediump float radius
|
|
68
|
+
#pragma mapbox: initialize lowp float blur
|
|
69
|
+
#pragma mapbox: initialize lowp float opacity
|
|
70
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
71
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
72
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
73
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);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,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,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);}`),clippingMask:si("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:si(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
74
|
+
#pragma mapbox: define highp float weight
|
|
75
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
76
|
+
void main() {
|
|
77
|
+
#pragma mapbox: initialize highp float weight
|
|
78
|
+
float 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);
|
|
79
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
80
|
+
gl_FragColor=vec4(1.0);
|
|
81
|
+
#endif
|
|
82
|
+
}`,`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;
|
|
83
|
+
#pragma mapbox: define highp float weight
|
|
84
|
+
#pragma mapbox: define mediump float radius
|
|
85
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
86
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
87
|
+
void main(void) {
|
|
88
|
+
#pragma mapbox: initialize highp float weight
|
|
89
|
+
#pragma mapbox: initialize mediump float radius
|
|
90
|
+
vec2 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;}`),heatmapTexture:si(`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;
|
|
91
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
92
|
+
gl_FragColor=vec4(0.0);
|
|
93
|
+
#endif
|
|
94
|
+
}`,"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;}"),collisionBox:si("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;}}","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,0.0,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;}"),collisionCircle:si("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;}","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);}"),debug:si("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);}","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,0,1);}"),fill:si(`#pragma mapbox: define highp vec4 color
|
|
95
|
+
#pragma mapbox: define lowp float opacity
|
|
96
|
+
void main() {
|
|
97
|
+
#pragma mapbox: initialize highp vec4 color
|
|
98
|
+
#pragma mapbox: initialize lowp float opacity
|
|
99
|
+
gl_FragColor=color*opacity;
|
|
100
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
101
|
+
gl_FragColor=vec4(1.0);
|
|
102
|
+
#endif
|
|
103
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
104
|
+
#pragma mapbox: define highp vec4 color
|
|
105
|
+
#pragma mapbox: define lowp float opacity
|
|
106
|
+
void main() {
|
|
107
|
+
#pragma mapbox: initialize highp vec4 color
|
|
108
|
+
#pragma mapbox: initialize lowp float opacity
|
|
109
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:si(`varying vec2 v_pos;
|
|
110
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
111
|
+
#pragma mapbox: define lowp float opacity
|
|
112
|
+
void main() {
|
|
113
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
114
|
+
#pragma mapbox: initialize lowp float opacity
|
|
115
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
116
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
117
|
+
gl_FragColor=vec4(1.0);
|
|
118
|
+
#endif
|
|
119
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
120
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
121
|
+
#pragma mapbox: define lowp float opacity
|
|
122
|
+
void main() {
|
|
123
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
124
|
+
#pragma mapbox: initialize lowp float opacity
|
|
125
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:si(`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;
|
|
126
|
+
#pragma mapbox: define lowp float opacity
|
|
127
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
128
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
129
|
+
void main() {
|
|
130
|
+
#pragma mapbox: initialize lowp float opacity
|
|
131
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
132
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
133
|
+
vec2 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;
|
|
134
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
135
|
+
gl_FragColor=vec4(1.0);
|
|
136
|
+
#endif
|
|
137
|
+
}`,`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;
|
|
138
|
+
#pragma mapbox: define lowp float opacity
|
|
139
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
140
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
141
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
142
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
143
|
+
void main() {
|
|
144
|
+
#pragma mapbox: initialize lowp float opacity
|
|
145
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
146
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
147
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
148
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
149
|
+
vec2 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;}`),fillPattern:si(`#ifdef GL_ES
|
|
150
|
+
precision highp float;
|
|
151
|
+
#endif
|
|
152
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
153
|
+
#pragma mapbox: define lowp float opacity
|
|
154
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
155
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
156
|
+
void main() {
|
|
157
|
+
#pragma mapbox: initialize lowp float opacity
|
|
158
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
159
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
160
|
+
vec2 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;
|
|
161
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
162
|
+
gl_FragColor=vec4(1.0);
|
|
163
|
+
#endif
|
|
164
|
+
}`,`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;
|
|
165
|
+
#pragma mapbox: define lowp float opacity
|
|
166
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
167
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
168
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
169
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
170
|
+
void main() {
|
|
171
|
+
#pragma mapbox: initialize lowp float opacity
|
|
172
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
173
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
174
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
175
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
176
|
+
vec2 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);}`),fillExtrusion:si(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
177
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
178
|
+
gl_FragColor=vec4(1.0);
|
|
179
|
+
#endif
|
|
180
|
+
}`,`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;varying vec4 v_color;
|
|
181
|
+
#pragma mapbox: define highp float base
|
|
182
|
+
#pragma mapbox: define highp float height
|
|
183
|
+
#pragma mapbox: define highp vec4 color
|
|
184
|
+
void main() {
|
|
185
|
+
#pragma mapbox: initialize highp float base
|
|
186
|
+
#pragma mapbox: initialize highp float height
|
|
187
|
+
#pragma mapbox: initialize highp vec4 color
|
|
188
|
+
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);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;}`),fillExtrusionPattern:si(`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;
|
|
189
|
+
#pragma mapbox: define lowp float base
|
|
190
|
+
#pragma mapbox: define lowp float height
|
|
191
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
192
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
193
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
194
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
195
|
+
void main() {
|
|
196
|
+
#pragma mapbox: initialize lowp float base
|
|
197
|
+
#pragma mapbox: initialize lowp float height
|
|
198
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
199
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
200
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
201
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
202
|
+
vec2 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;
|
|
203
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
204
|
+
gl_FragColor=vec4(1.0);
|
|
205
|
+
#endif
|
|
206
|
+
}`,`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;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
207
|
+
#pragma mapbox: define lowp float base
|
|
208
|
+
#pragma mapbox: define lowp float height
|
|
209
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
210
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
211
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
212
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
213
|
+
void main() {
|
|
214
|
+
#pragma mapbox: initialize lowp float base
|
|
215
|
+
#pragma mapbox: initialize lowp float height
|
|
216
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
217
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
218
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
219
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
220
|
+
vec2 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;base=max(0.0,base);height=max(0.0,height);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
|
|
221
|
+
? a_pos
|
|
222
|
+
: 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;}`),hillshadePrepare:si(`#ifdef GL_ES
|
|
223
|
+
precision highp float;
|
|
224
|
+
#endif
|
|
225
|
+
uniform 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);
|
|
226
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
227
|
+
gl_FragColor=vec4(1.0);
|
|
228
|
+
#endif
|
|
229
|
+
}`,"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;}"),hillshade:si(`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;
|
|
230
|
+
#define PI 3.141592653589793
|
|
231
|
+
void 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;
|
|
232
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
233
|
+
gl_FragColor=vec4(1.0);
|
|
234
|
+
#endif
|
|
235
|
+
}`,"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;}"),line:si(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
236
|
+
#pragma mapbox: define highp vec4 color
|
|
237
|
+
#pragma mapbox: define lowp float blur
|
|
238
|
+
#pragma mapbox: define lowp float opacity
|
|
239
|
+
void main() {
|
|
240
|
+
#pragma mapbox: initialize highp vec4 color
|
|
241
|
+
#pragma mapbox: initialize lowp float blur
|
|
242
|
+
#pragma mapbox: initialize lowp float opacity
|
|
243
|
+
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);gl_FragColor=color*(alpha*opacity);
|
|
244
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
245
|
+
gl_FragColor=vec4(1.0);
|
|
246
|
+
#endif
|
|
247
|
+
}`,`
|
|
248
|
+
#define scale 0.015873016
|
|
249
|
+
attribute 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;
|
|
250
|
+
#pragma mapbox: define highp vec4 color
|
|
251
|
+
#pragma mapbox: define lowp float blur
|
|
252
|
+
#pragma mapbox: define lowp float opacity
|
|
253
|
+
#pragma mapbox: define mediump float gapwidth
|
|
254
|
+
#pragma mapbox: define lowp float offset
|
|
255
|
+
#pragma mapbox: define mediump float width
|
|
256
|
+
void main() {
|
|
257
|
+
#pragma mapbox: initialize highp vec4 color
|
|
258
|
+
#pragma mapbox: initialize lowp float blur
|
|
259
|
+
#pragma mapbox: initialize lowp float opacity
|
|
260
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
261
|
+
#pragma mapbox: initialize lowp float offset
|
|
262
|
+
#pragma mapbox: initialize mediump float width
|
|
263
|
+
float 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;float 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;v_width2=vec2(outset,inset);}`),lineGradient:si(`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;
|
|
264
|
+
#pragma mapbox: define lowp float blur
|
|
265
|
+
#pragma mapbox: define lowp float opacity
|
|
266
|
+
void main() {
|
|
267
|
+
#pragma mapbox: initialize lowp float blur
|
|
268
|
+
#pragma mapbox: initialize lowp float opacity
|
|
269
|
+
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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
270
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
271
|
+
gl_FragColor=vec4(1.0);
|
|
272
|
+
#endif
|
|
273
|
+
}`,`
|
|
274
|
+
#define scale 0.015873016
|
|
275
|
+
attribute 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;
|
|
276
|
+
#pragma mapbox: define lowp float blur
|
|
277
|
+
#pragma mapbox: define lowp float opacity
|
|
278
|
+
#pragma mapbox: define mediump float gapwidth
|
|
279
|
+
#pragma mapbox: define lowp float offset
|
|
280
|
+
#pragma mapbox: define mediump float width
|
|
281
|
+
void main() {
|
|
282
|
+
#pragma mapbox: initialize lowp float blur
|
|
283
|
+
#pragma mapbox: initialize lowp float opacity
|
|
284
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
285
|
+
#pragma mapbox: initialize lowp float offset
|
|
286
|
+
#pragma mapbox: initialize mediump float width
|
|
287
|
+
float 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;float 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;v_width2=vec2(outset,inset);}`),linePattern:si(`#ifdef GL_ES
|
|
288
|
+
precision highp float;
|
|
289
|
+
#endif
|
|
290
|
+
uniform 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;
|
|
291
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
292
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
293
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
294
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
295
|
+
#pragma mapbox: define lowp float blur
|
|
296
|
+
#pragma mapbox: define lowp float opacity
|
|
297
|
+
void main() {
|
|
298
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
299
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
300
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
301
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
302
|
+
#pragma mapbox: initialize lowp float blur
|
|
303
|
+
#pragma mapbox: initialize lowp float opacity
|
|
304
|
+
vec2 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;
|
|
305
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
306
|
+
gl_FragColor=vec4(1.0);
|
|
307
|
+
#endif
|
|
308
|
+
}`,`
|
|
309
|
+
#define scale 0.015873016
|
|
310
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
311
|
+
attribute 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;
|
|
312
|
+
#pragma mapbox: define lowp float blur
|
|
313
|
+
#pragma mapbox: define lowp float opacity
|
|
314
|
+
#pragma mapbox: define lowp float offset
|
|
315
|
+
#pragma mapbox: define mediump float gapwidth
|
|
316
|
+
#pragma mapbox: define mediump float width
|
|
317
|
+
#pragma mapbox: define lowp float floorwidth
|
|
318
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
319
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
320
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
321
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
322
|
+
void main() {
|
|
323
|
+
#pragma mapbox: initialize lowp float blur
|
|
324
|
+
#pragma mapbox: initialize lowp float opacity
|
|
325
|
+
#pragma mapbox: initialize lowp float offset
|
|
326
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
327
|
+
#pragma mapbox: initialize mediump float width
|
|
328
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
329
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
330
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
331
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
332
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
333
|
+
float 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;float 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;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:si(`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;
|
|
334
|
+
#pragma mapbox: define highp vec4 color
|
|
335
|
+
#pragma mapbox: define lowp float blur
|
|
336
|
+
#pragma mapbox: define lowp float opacity
|
|
337
|
+
#pragma mapbox: define mediump float width
|
|
338
|
+
#pragma mapbox: define lowp float floorwidth
|
|
339
|
+
void main() {
|
|
340
|
+
#pragma mapbox: initialize highp vec4 color
|
|
341
|
+
#pragma mapbox: initialize lowp float blur
|
|
342
|
+
#pragma mapbox: initialize lowp float opacity
|
|
343
|
+
#pragma mapbox: initialize mediump float width
|
|
344
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
345
|
+
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 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);
|
|
346
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
347
|
+
gl_FragColor=vec4(1.0);
|
|
348
|
+
#endif
|
|
349
|
+
}`,`
|
|
350
|
+
#define scale 0.015873016
|
|
351
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
352
|
+
attribute 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;
|
|
353
|
+
#pragma mapbox: define highp vec4 color
|
|
354
|
+
#pragma mapbox: define lowp float blur
|
|
355
|
+
#pragma mapbox: define lowp float opacity
|
|
356
|
+
#pragma mapbox: define mediump float gapwidth
|
|
357
|
+
#pragma mapbox: define lowp float offset
|
|
358
|
+
#pragma mapbox: define mediump float width
|
|
359
|
+
#pragma mapbox: define lowp float floorwidth
|
|
360
|
+
void main() {
|
|
361
|
+
#pragma mapbox: initialize highp vec4 color
|
|
362
|
+
#pragma mapbox: initialize lowp float blur
|
|
363
|
+
#pragma mapbox: initialize lowp float opacity
|
|
364
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
365
|
+
#pragma mapbox: initialize lowp float offset
|
|
366
|
+
#pragma mapbox: initialize mediump float width
|
|
367
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
368
|
+
float 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;float 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;v_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);}`),raster:si(`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);
|
|
369
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
370
|
+
gl_FragColor=vec4(1.0);
|
|
371
|
+
#endif
|
|
372
|
+
}`,"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;}"),symbolIcon:si(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
373
|
+
#pragma mapbox: define lowp float opacity
|
|
374
|
+
void main() {
|
|
375
|
+
#pragma mapbox: initialize lowp float opacity
|
|
376
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
377
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
378
|
+
gl_FragColor=vec4(1.0);
|
|
379
|
+
#endif
|
|
380
|
+
}`,`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;
|
|
381
|
+
#pragma mapbox: define lowp float opacity
|
|
382
|
+
void main() {
|
|
383
|
+
#pragma mapbox: initialize lowp float opacity
|
|
384
|
+
vec2 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;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,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
385
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
386
|
+
u_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),0,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,0.0,1.0);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),0.0,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;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),symbolSDF:si(`#define SDF_PX 8.0
|
|
387
|
+
uniform 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;
|
|
388
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
389
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
390
|
+
#pragma mapbox: define lowp float opacity
|
|
391
|
+
#pragma mapbox: define lowp float halo_width
|
|
392
|
+
#pragma mapbox: define lowp float halo_blur
|
|
393
|
+
void main() {
|
|
394
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
395
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
396
|
+
#pragma mapbox: initialize lowp float opacity
|
|
397
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
398
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
399
|
+
float 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);
|
|
400
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
401
|
+
gl_FragColor=vec4(1.0);
|
|
402
|
+
#endif
|
|
403
|
+
}`,`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;
|
|
404
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
405
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
406
|
+
#pragma mapbox: define lowp float opacity
|
|
407
|
+
#pragma mapbox: define lowp float halo_width
|
|
408
|
+
#pragma mapbox: define lowp float halo_blur
|
|
409
|
+
void main() {
|
|
410
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
411
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
412
|
+
#pragma mapbox: initialize lowp float opacity
|
|
413
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
414
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
415
|
+
vec2 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;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,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
416
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
417
|
+
u_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),0,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,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:si(`#define SDF_PX 8.0
|
|
418
|
+
#define SDF 1.0
|
|
419
|
+
#define ICON 0.0
|
|
420
|
+
uniform 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;
|
|
421
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
422
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
423
|
+
#pragma mapbox: define lowp float opacity
|
|
424
|
+
#pragma mapbox: define lowp float halo_width
|
|
425
|
+
#pragma mapbox: define lowp float halo_blur
|
|
426
|
+
void main() {
|
|
427
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
428
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
429
|
+
#pragma mapbox: initialize lowp float opacity
|
|
430
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
431
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
432
|
+
float 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;
|
|
433
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
434
|
+
gl_FragColor=vec4(1.0);
|
|
435
|
+
#endif
|
|
436
|
+
return;}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);
|
|
437
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
438
|
+
gl_FragColor=vec4(1.0);
|
|
439
|
+
#endif
|
|
440
|
+
}`,`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;
|
|
441
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
442
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
443
|
+
#pragma mapbox: define lowp float opacity
|
|
444
|
+
#pragma mapbox: define lowp float halo_width
|
|
445
|
+
#pragma mapbox: define lowp float halo_blur
|
|
446
|
+
void main() {
|
|
447
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
448
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
449
|
+
#pragma mapbox: initialize lowp float opacity
|
|
450
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
451
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
452
|
+
vec2 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;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,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
453
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
454
|
+
u_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),0,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,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,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);}`)};function si(p,e){let s=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,c=e.match(/attribute ([\w]+) ([\w]+)/g),d=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=y?y.concat(d):d,w={};return{fragmentSource:p=p.replace(s,(T,C,k,F,j)=>(w[j]=!0,C==="define"?`
|
|
455
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
456
|
+
varying ${k} ${F} ${j};
|
|
457
|
+
#else
|
|
458
|
+
uniform ${k} ${F} u_${j};
|
|
459
|
+
#endif
|
|
460
|
+
`:`
|
|
461
|
+
#ifdef HAS_UNIFORM_u_${j}
|
|
462
|
+
${k} ${F} ${j} = u_${j};
|
|
463
|
+
#endif
|
|
464
|
+
`)),vertexSource:e=e.replace(s,(T,C,k,F,j)=>{let Y=F==="float"?"vec2":"vec4",$=j.match(/color/)?"color":Y;return w[j]?C==="define"?`
|
|
465
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
466
|
+
uniform lowp float u_${j}_t;
|
|
467
|
+
attribute ${k} ${Y} a_${j};
|
|
468
|
+
varying ${k} ${F} ${j};
|
|
469
|
+
#else
|
|
470
|
+
uniform ${k} ${F} u_${j};
|
|
471
|
+
#endif
|
|
472
|
+
`:$==="vec4"?`
|
|
473
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
474
|
+
${j} = a_${j};
|
|
475
|
+
#else
|
|
476
|
+
${k} ${F} ${j} = u_${j};
|
|
477
|
+
#endif
|
|
478
|
+
`:`
|
|
479
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
480
|
+
${j} = unpack_mix_${$}(a_${j}, u_${j}_t);
|
|
481
|
+
#else
|
|
482
|
+
${k} ${F} ${j} = u_${j};
|
|
483
|
+
#endif
|
|
484
|
+
`:C==="define"?`
|
|
485
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
486
|
+
uniform lowp float u_${j}_t;
|
|
487
|
+
attribute ${k} ${Y} a_${j};
|
|
488
|
+
#else
|
|
489
|
+
uniform ${k} ${F} u_${j};
|
|
490
|
+
#endif
|
|
491
|
+
`:$==="vec4"?`
|
|
492
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
493
|
+
${k} ${F} ${j} = a_${j};
|
|
494
|
+
#else
|
|
495
|
+
${k} ${F} ${j} = u_${j};
|
|
496
|
+
#endif
|
|
497
|
+
`:`
|
|
498
|
+
#ifndef HAS_UNIFORM_u_${j}
|
|
499
|
+
${k} ${F} ${j} = unpack_mix_${$}(a_${j}, u_${j}_t);
|
|
500
|
+
#else
|
|
501
|
+
${k} ${F} ${j} = u_${j};
|
|
502
|
+
#endif
|
|
503
|
+
`}),staticAttributes:c,staticUniforms:v}}class Fc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,s,c,d,y,v,w,T){this.context=e;let C=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!C&&k<d.length;k++)this.boundPaintVertexBuffers[k]!==d[k]&&(C=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===s&&this.boundLayoutVertexBuffer===c&&!C&&this.boundIndexBuffer===y&&this.boundVertexOffset===v&&this.boundDynamicVertexBuffer===w&&this.boundDynamicVertexBuffer2===T?(e.bindVertexArrayOES.set(this.vao),w&&w.bind(),y&&y.dynamicDraw&&y.bind(),T&&T.bind()):this.freshBind(s,c,d,y,v,w,T)}freshBind(e,s,c,d,y,v,w){let T,C=e.numAttributes,k=this.context,F=k.gl;if(k.extVertexArrayObject)this.vao&&this.destroy(),this.vao=k.extVertexArrayObject.createVertexArrayOES(),k.bindVertexArrayOES.set(this.vao),T=0,this.boundProgram=e,this.boundLayoutVertexBuffer=s,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=y,this.boundDynamicVertexBuffer=v,this.boundDynamicVertexBuffer2=w;else{T=k.currentNumAttributes||0;for(let j=C;j<T;j++)F.disableVertexAttribArray(j)}s.enableAttributes(F,e);for(let j of c)j.enableAttributes(F,e);v&&v.enableAttributes(F,e),w&&w.enableAttributes(F,e),s.bind(),s.setVertexAttribPointers(F,e,y);for(let j of c)j.bind(),j.setVertexAttribPointers(F,e,y);v&&(v.bind(),v.setVertexAttribPointers(F,e,y)),d&&d.bind(),w&&(w.bind(),w.setVertexAttribPointers(F,e,y)),k.currentNumAttributes=C}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Bo(p){let e=[];for(let s=0;s<p.length;s++){if(p[s]===null)continue;let c=p[s].split(" ");e.push(c.pop())}return e}class Oc{constructor(e,s,c,d,y,v){let w=e.gl;this.program=w.createProgram();let T=Bo(c.staticAttributes),C=d?d.getBinderAttributes():[],k=T.concat(C),F=c.staticUniforms?Bo(c.staticUniforms):[],j=d?d.getBinderUniforms():[],Y=F.concat(j),$=[];for(let Mt of Y)$.indexOf(Mt)<0&&$.push(Mt);let J=d?d.defines():[];v&&J.push("#define OVERDRAW_INSPECTOR;");let lt=J.concat(Ro.prelude.fragmentSource,c.fragmentSource).join(`
|
|
504
|
+
`),ht=J.concat(Ro.prelude.vertexSource,c.vertexSource).join(`
|
|
505
|
+
`),gt=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(gt,lt),w.compileShader(gt),w.attachShader(this.program,gt);let ut=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(ut,ht),w.compileShader(ut),w.attachShader(this.program,ut),this.attributes={};let kt={};this.numAttributes=k.length;for(let Mt=0;Mt<this.numAttributes;Mt++)k[Mt]&&(w.bindAttribLocation(this.program,Mt,k[Mt]),this.attributes[k[Mt]]=Mt);w.linkProgram(this.program),w.deleteShader(ut),w.deleteShader(gt);for(let Mt=0;Mt<$.length;Mt++){let Tt=$[Mt];if(Tt&&!kt[Tt]){let Ut=w.getUniformLocation(this.program,Tt);Ut&&(kt[Tt]=Ut)}}this.fixedUniforms=y(e,kt),this.binderUniforms=d?d.getUniforms(e,kt):[]}draw(e,s,c,d,y,v,w,T,C,k,F,j,Y,$,J,lt){let ht=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(c),e.setStencilMode(d),e.setColorMode(y),e.setCullFace(v);for(let ut in this.fixedUniforms)this.fixedUniforms[ut].set(w[ut]);$&&$.setUniforms(e,this.binderUniforms,j,{zoom:Y});let gt={[ht.LINES]:2,[ht.TRIANGLES]:3,[ht.LINE_STRIP]:1}[s];for(let ut of F.get()){let kt=ut.vaos||(ut.vaos={});(kt[T]||(kt[T]=new Fc)).bind(e,this,C,$?$.getPaintVertexBuffers():[],k,ut.vertexOffset,J,lt),ht.drawElements(s,ut.primitiveLength*gt,ht.UNSIGNED_SHORT,ut.primitiveOffset*gt*2)}}}function Fo(p,e,s){let c=1/_i(s,1,e.transform.tileZoom),d=Math.pow(2,s.tileID.overscaledZ),y=s.tileSize*Math.pow(2,e.transform.tileZoom)/d,v=y*(s.tileID.canonical.x+s.tileID.wrap*d),w=y*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_scale:[c,p.fromScale,p.toScale],u_fade:p.t,u_pixel_coord_upper:[v>>16,w>>16],u_pixel_coord_lower:[65535&v,65535&w]}}let Kl=(p,e,s,c)=>{let d=e.style.light,y=d.properties.get("position"),v=[y.x,y.y,y.z],w=function(){var C=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C}();d.properties.get("anchor")==="viewport"&&function(C,k){var F=Math.sin(k),j=Math.cos(k);C[0]=j,C[1]=F,C[2]=0,C[3]=-F,C[4]=j,C[5]=0,C[6]=0,C[7]=0,C[8]=1}(w,-e.transform.angle),function(C,k,F){var j=k[0],Y=k[1],$=k[2];C[0]=j*F[0]+Y*F[3]+$*F[6],C[1]=j*F[1]+Y*F[4]+$*F[7],C[2]=j*F[2]+Y*F[5]+$*F[8]}(v,v,w);let T=d.properties.get("color");return{u_matrix:p,u_lightpos:v,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+s,u_opacity:c}},Oo=(p,e,s,c,d,y,v)=>a.extend(Kl(p,e,s,c),Fo(y,e,v),{u_height_factor:-Math.pow(2,d.overscaledZ)/v.tileSize/8}),No=p=>({u_matrix:p}),Uo=(p,e,s,c)=>a.extend(No(p),Fo(s,e,c)),Jl=(p,e)=>({u_matrix:p,u_world:e}),Yl=(p,e,s,c,d)=>a.extend(Uo(p,e,s,c),{u_world:d}),Nn=(p,e,s,c)=>{let d=p.transform,y,v;if(c.paint.get("circle-pitch-alignment")==="map"){let w=_i(s,1,d.zoom);y=!0,v=[w,w]}else y=!1,v=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(c.paint.get("circle-pitch-scale")==="map"),u_matrix:p.translatePosMatrix(e.posMatrix,s,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:v}},Ea=(p,e,s)=>{let c=_i(s,1,e.zoom),d=Math.pow(2,e.zoom-s.tileID.overscaledZ),y=s.tileID.overscaleFactor();return{u_matrix:p,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:c,u_extrude_scale:[e.pixelsToGLUnits[0]/(c*d),e.pixelsToGLUnits[1]/(c*d)],u_overscale_factor:y}},vs=(p,e,s=1)=>({u_matrix:p,u_color:e,u_overlay:0,u_overlay_scale:s}),Hs=p=>({u_matrix:p}),Ia=(p,e,s,c)=>({u_matrix:p,u_extrude_scale:_i(e,1,s),u_intensity:c});function Ca(p,e){let s=Math.pow(2,e.canonical.z),c=e.canonical.y;return[new a.MercatorCoordinate(0,c/s).toLngLat().lat,new a.MercatorCoordinate(0,(c+1)/s).toLngLat().lat]}let Xs=(p,e,s)=>{let c=p.transform;return{u_matrix:Vo(p,e,s),u_ratio:1/_i(e,1,c.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Aa=(p,e,s,c)=>a.extend(Xs(p,e,s),{u_image:0,u_image_height:c}),Ks=(p,e,s,c)=>{let d=p.transform,y=Js(e,d);return{u_matrix:Vo(p,e,s),u_texsize:e.imageAtlasTexture.size,u_ratio:1/_i(e,1,d.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[y,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},zi=(p,e,s,c,d)=>{let y=p.lineAtlas,v=Js(e,p.transform),w=s.layout.get("line-cap")==="round",T=y.getDash(c.from,w),C=y.getDash(c.to,w),k=T.width*d.fromScale,F=C.width*d.toScale;return a.extend(Xs(p,e,s),{u_patternscale_a:[v/k,-T.height/2],u_patternscale_b:[v/F,-C.height/2],u_sdfgamma:y.width/(256*Math.min(k,F)*p.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:C.y,u_mix:d.t})};function Js(p,e){return 1/_i(p,1,e.tileZoom)}function Vo(p,e,s){return p.translatePosMatrix(e.tileID.posMatrix,e,s.paint.get("line-translate"),s.paint.get("line-translate-anchor"))}let Ql=(p,e,s,c,d)=>{return{u_matrix:p,u_tl_parent:e,u_scale_parent:s,u_buffer_scale:1,u_fade_t:c.mix,u_opacity:c.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(v=d.paint.get("raster-saturation"),v>0?1-1/(1.001-v):-v),u_contrast_factor:(y=d.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:th(d.paint.get("raster-hue-rotate"))};var y,v};function th(p){p*=Math.PI/180;let e=Math.sin(p),s=Math.cos(p);return[(2*s+1)/3,(-Math.sqrt(3)*e-s+1)/3,(Math.sqrt(3)*e-s+1)/3]}let Pa=(p,e,s,c,d,y,v,w,T,C)=>{let k=d.transform;return{u_is_size_zoom_constant:+(p==="constant"||p==="source"),u_is_size_feature_constant:+(p==="constant"||p==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+s,u_aspect_ratio:k.width/k.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:w,u_is_text:+T,u_pitch_with_map:+c,u_texsize:C,u_texture:0}},Go=(p,e,s,c,d,y,v,w,T,C,k)=>{let F=d.transform;return a.extend(Pa(p,e,s,c,d,y,v,w,T,C),{u_gamma_scale:c?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+k})},Nc=(p,e,s,c,d,y,v,w,T,C)=>a.extend(Go(p,e,s,c,d,y,v,w,!0,T,!0),{u_texsize_icon:C,u_texture_icon:1}),Uc=(p,e,s)=>({u_matrix:p,u_opacity:e,u_color:s}),qo=(p,e,s,c,d,y)=>a.extend(function(v,w,T,C){let k=T.imageManager.getPattern(v.from.toString()),F=T.imageManager.getPattern(v.to.toString()),{width:j,height:Y}=T.imageManager.getPixelSize(),$=Math.pow(2,C.tileID.overscaledZ),J=C.tileSize*Math.pow(2,T.transform.tileZoom)/$,lt=J*(C.tileID.canonical.x+C.tileID.wrap*$),ht=J*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[j,Y],u_mix:w.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:w.fromScale,u_scale_b:w.toScale,u_tile_units_to_pixels:1/_i(C,1,T.transform.tileZoom),u_pixel_coord_upper:[lt>>16,ht>>16],u_pixel_coord_lower:[65535<,65535&ht]}}(c,y,s,d),{u_matrix:p,u_opacity:e}),jo={fillExtrusion:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fillExtrusionPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_height_factor:new a.Uniform1f(p,e.u_height_factor),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fill:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),fillPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),fillOutline:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world)}),fillOutlinePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),circle:(p,e)=>({u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(p,e.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),collisionBox:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(p,e.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_overscale_factor:new a.Uniform1f(p,e.u_overscale_factor)}),collisionCircle:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_inv_matrix:new a.UniformMatrix4f(p,e.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(p,e.u_viewport_size)}),debug:(p,e)=>({u_color:new a.UniformColor(p,e.u_color),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_overlay:new a.Uniform1i(p,e.u_overlay),u_overlay_scale:new a.Uniform1f(p,e.u_overlay_scale)}),clippingMask:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmap:(p,e)=>({u_extrude_scale:new a.Uniform1f(p,e.u_extrude_scale),u_intensity:new a.Uniform1f(p,e.u_intensity),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmapTexture:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_color_ramp:new a.Uniform1i(p,e.u_color_ramp),u_opacity:new a.Uniform1f(p,e.u_opacity)}),hillshade:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_latrange:new a.Uniform2f(p,e.u_latrange),u_light:new a.Uniform2f(p,e.u_light),u_shadow:new a.UniformColor(p,e.u_shadow),u_highlight:new a.UniformColor(p,e.u_highlight),u_accent:new a.UniformColor(p,e.u_accent)}),hillshadePrepare:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_dimension:new a.Uniform2f(p,e.u_dimension),u_zoom:new a.Uniform1f(p,e.u_zoom),u_unpack:new a.Uniform4f(p,e.u_unpack)}),line:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels)}),lineGradient:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_image:new a.Uniform1i(p,e.u_image),u_image_height:new a.Uniform1f(p,e.u_image_height)}),linePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_texsize:new a.Uniform2f(p,e.u_texsize),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_image:new a.Uniform1i(p,e.u_image),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),lineSDF:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(p,e.u_patternscale_a),u_patternscale_b:new a.Uniform2f(p,e.u_patternscale_b),u_sdfgamma:new a.Uniform1f(p,e.u_sdfgamma),u_image:new a.Uniform1i(p,e.u_image),u_tex_y_a:new a.Uniform1f(p,e.u_tex_y_a),u_tex_y_b:new a.Uniform1f(p,e.u_tex_y_b),u_mix:new a.Uniform1f(p,e.u_mix)}),raster:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_tl_parent:new a.Uniform2f(p,e.u_tl_parent),u_scale_parent:new a.Uniform1f(p,e.u_scale_parent),u_buffer_scale:new a.Uniform1f(p,e.u_buffer_scale),u_fade_t:new a.Uniform1f(p,e.u_fade_t),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image0:new a.Uniform1i(p,e.u_image0),u_image1:new a.Uniform1i(p,e.u_image1),u_brightness_low:new a.Uniform1f(p,e.u_brightness_low),u_brightness_high:new a.Uniform1f(p,e.u_brightness_high),u_saturation_factor:new a.Uniform1f(p,e.u_saturation_factor),u_contrast_factor:new a.Uniform1f(p,e.u_contrast_factor),u_spin_weights:new a.Uniform3f(p,e.u_spin_weights)}),symbolIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture)}),symbolSDF:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),symbolTextAndIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texsize_icon:new a.Uniform2f(p,e.u_texsize_icon),u_texture:new a.Uniform1i(p,e.u_texture),u_texture_icon:new a.Uniform1i(p,e.u_texture_icon),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),background:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_color:new a.UniformColor(p,e.u_color)}),backgroundPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image:new a.Uniform1i(p,e.u_image),u_pattern_tl_a:new a.Uniform2f(p,e.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(p,e.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(p,e.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(p,e.u_pattern_br_b),u_texsize:new a.Uniform2f(p,e.u_texsize),u_mix:new a.Uniform1f(p,e.u_mix),u_pattern_size_a:new a.Uniform2f(p,e.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(p,e.u_pattern_size_b),u_scale_a:new a.Uniform1f(p,e.u_scale_a),u_scale_b:new a.Uniform1f(p,e.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(p,e.u_tile_units_to_pixels)})};class $o{constructor(e,s,c){this.context=e;let d=e.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(c),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let s=this.context.gl;this.context.unbindVAO(),this.bind(),s.bufferSubData(s.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Wo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class eh{constructor(e,s,c,d){this.length=s.length,this.attributes=c,this.itemSize=s.bytesPerElement,this.dynamicDraw=d,this.context=e;let y=e.gl;this.buffer=y.createBuffer(),e.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,s.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete s.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let s=this.context.gl;this.bind(),s.bufferSubData(s.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,s){for(let c=0;c<this.attributes.length;c++){let d=s.attributes[this.attributes[c].name];d!==void 0&&e.enableVertexAttribArray(d)}}setVertexAttribPointers(e,s,c){for(let d=0;d<this.attributes.length;d++){let y=this.attributes[d],v=s.attributes[y.name];v!==void 0&&e.vertexAttribPointer(v,y.components,e[Wo[y.type]],!1,this.itemSize,y.offset+this.itemSize*(c||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class We{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Vc extends We{getDefault(){return a.Color.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ys extends We{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Qs extends We{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class ih extends We{getDefault(){return[!0,!0,!0,!0]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class xr extends We{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Zo extends We{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class za extends We{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let s=this.current;(e.func!==s.func||e.ref!==s.ref||e.mask!==s.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class ka extends We{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ho extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.STENCIL_TEST):s.disable(s.STENCIL_TEST),this.current=e,this.dirty=!1}}class Xo extends We{getDefault(){return[0,1]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class La extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.DEPTH_TEST):s.disable(s.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ko extends We{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Jo extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.BLEND):s.disable(s.BLEND),this.current=e,this.dirty=!1}}class Da extends We{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class rh extends We{getDefault(){return a.Color.transparent}set(e){let s=this.current;(e.r!==s.r||e.g!==s.g||e.b!==s.b||e.a!==s.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class nh extends We{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class bs extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;e?s.enable(s.CULL_FACE):s.disable(s.CULL_FACE),this.current=e,this.dirty=!1}}class Gc extends We{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class qc extends We{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class jc extends We{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class $c extends We{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Wc extends We{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let s=this.current;(e[0]!==s[0]||e[1]!==s[1]||e[2]!==s[2]||e[3]!==s[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Zc extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindFramebuffer(s.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Yo extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindRenderbuffer(s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Qo extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindTexture(s.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class ws extends We{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class sh extends We{getDefault(){return null}set(e){let s=this.gl;s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ah extends We{constructor(e){super(e),this.vao=e.extVertexArrayObject}getDefault(){return null}set(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}class tl extends We{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Un extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class oh extends We{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let s=this.gl;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Vn extends We{constructor(e,s){super(e),this.context=e,this.parent=s}getDefault(){return null}}class Ms extends Vn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class lh extends Vn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let s=this.gl;s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class el{constructor(e,s,c,d){this.context=e,this.width=s,this.height=c;let y=this.framebuffer=e.gl.createFramebuffer();this.colorAttachment=new Ms(e,y),d&&(this.depthAttachment=new lh(e,y))}destroy(){let e=this.context.gl,s=this.colorAttachment.get();if(s&&e.deleteTexture(s),this.depthAttachment){let c=this.depthAttachment.get();c&&e.deleteRenderbuffer(c)}e.deleteFramebuffer(this.framebuffer)}}class Se{constructor(e,s,c){this.blendFunction=e,this.blendColor=s,this.mask=c}}Se.Replace=[1,0],Se.disabled=new Se(Se.Replace,a.Color.transparent,[!1,!1,!1,!1]),Se.unblended=new Se(Se.Replace,a.Color.transparent,[!0,!0,!0,!0]),Se.alphaBlended=new Se([1,771],a.Color.transparent,[!0,!0,!0,!0]);class Ra{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Vc(this),this.clearDepth=new Ys(this),this.clearStencil=new Qs(this),this.colorMask=new ih(this),this.depthMask=new xr(this),this.stencilMask=new Zo(this),this.stencilFunc=new za(this),this.stencilOp=new ka(this),this.stencilTest=new Ho(this),this.depthRange=new Xo(this),this.depthTest=new La(this),this.depthFunc=new Ko(this),this.blend=new Jo(this),this.blendFunc=new Da(this),this.blendColor=new rh(this),this.blendEquation=new nh(this),this.cullFace=new bs(this),this.cullFaceSide=new Gc(this),this.frontFace=new qc(this),this.program=new jc(this),this.activeTexture=new $c(this),this.viewport=new Wc(this),this.bindFramebuffer=new Zc(this),this.bindRenderbuffer=new Yo(this),this.bindTexture=new Qo(this),this.bindVertexBuffer=new ws(this),this.bindElementBuffer=new sh(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ah(this),this.pixelStoreUnpack=new tl(this),this.pixelStoreUnpackPremultiplyAlpha=new Un(this),this.pixelStoreUnpackFlipY=new oh(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,s){return new $o(this,e,s)}createVertexBuffer(e,s,c){return new eh(this,e,s,c)}createRenderbuffer(e,s,c){let d=this.gl,y=d.createRenderbuffer();return this.bindRenderbuffer.set(y),d.renderbufferStorage(d.RENDERBUFFER,e,s,c),this.bindRenderbuffer.set(null),y}createFramebuffer(e,s,c){return new el(this,e,s,c)}clear({color:e,depth:s}){let c=this.gl,d=0;e&&(d|=c.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),s!==void 0&&(d|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(s),this.depthMask.set(!0)),c.clear(d)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){N(e.blendFunction,Se.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Qe{constructor(e,s,c){this.func=e,this.mask=s,this.range=c}}Qe.ReadOnly=!1,Qe.ReadWrite=!0,Qe.disabled=new Qe(519,Qe.ReadOnly,[0,1]);let Ba=7680;class hi{constructor(e,s,c,d,y,v){this.test=e,this.ref=s,this.mask=c,this.fail=d,this.depthFail=y,this.pass=v}}hi.disabled=new hi({func:519,mask:0},0,0,Ba,Ba,Ba);class Mi{constructor(e,s,c){this.enable=e,this.mode=s,this.frontFace=c}}let Fa;function il(p,e,s,c,d,y,v){let w=p.context,T=w.gl,C=p.useProgram("collisionBox"),k=[],F=0,j=0;for(let ut=0;ut<c.length;ut++){let kt=c[ut],Mt=e.getTile(kt),Tt=Mt.getBucket(s);if(!Tt)continue;let Ut=kt.posMatrix;d[0]===0&&d[1]===0||(Ut=p.translatePosMatrix(kt.posMatrix,Mt,d,y));let $t=v?Tt.textCollisionBox:Tt.iconCollisionBox,Pt=Tt.collisionCircleArray;if(Pt.length>0){let se=a.create(),Kt=Ut;a.mul(se,Tt.placementInvProjMatrix,p.transform.glCoordMatrix),a.mul(se,se,Tt.placementViewportMatrix),k.push({circleArray:Pt,circleOffset:j,transform:Kt,invTransform:se}),F+=Pt.length/4,j=F}$t&&C.draw(w,T.LINES,Qe.disabled,hi.disabled,p.colorModeForRenderPass(),Mi.disabled,Ea(Ut,p.transform,Mt),s.id,$t.layoutVertexBuffer,$t.indexBuffer,$t.segments,null,p.transform.zoom,null,null,$t.collisionVertexBuffer)}if(!v||!k.length)return;let Y=p.useProgram("collisionCircle"),$=new a.CollisionCircleLayoutArray;$.resize(4*F),$._trim();let J=0;for(let ut of k)for(let kt=0;kt<ut.circleArray.length/4;kt++){let Mt=4*kt,Tt=ut.circleArray[Mt+0],Ut=ut.circleArray[Mt+1],$t=ut.circleArray[Mt+2],Pt=ut.circleArray[Mt+3];$.emplace(J++,Tt,Ut,$t,Pt,0),$.emplace(J++,Tt,Ut,$t,Pt,1),$.emplace(J++,Tt,Ut,$t,Pt,2),$.emplace(J++,Tt,Ut,$t,Pt,3)}(!Fa||Fa.length<2*F)&&(Fa=function(ut){let kt=2*ut,Mt=new a.QuadTriangleArray;Mt.resize(kt),Mt._trim();for(let Tt=0;Tt<kt;Tt++){let Ut=6*Tt;Mt.uint16[Ut+0]=4*Tt+0,Mt.uint16[Ut+1]=4*Tt+1,Mt.uint16[Ut+2]=4*Tt+2,Mt.uint16[Ut+3]=4*Tt+2,Mt.uint16[Ut+4]=4*Tt+3,Mt.uint16[Ut+5]=4*Tt+0}return Mt}(F));let lt=w.createIndexBuffer(Fa,!0),ht=w.createVertexBuffer($,a.collisionCircleLayout.members,!0);for(let ut of k){let kt={u_matrix:ut.transform,u_inv_matrix:ut.invTransform,u_camera_to_center_distance:(gt=p.transform).cameraToCenterDistance,u_viewport_size:[gt.width,gt.height]};Y.draw(w,T.TRIANGLES,Qe.disabled,hi.disabled,p.colorModeForRenderPass(),Mi.disabled,kt,s.id,ht,lt,a.SegmentVector.simpleSegment(0,2*ut.circleOffset,ut.circleArray.length,ut.circleArray.length/2),null,p.transform.zoom,null,null,null)}var gt;ht.destroy(),lt.destroy()}Mi.disabled=new Mi(!1,1029,2305),Mi.backCCW=new Mi(!0,1029,2305);let Hc=a.identity(new Float32Array(16));function rl(p,e,s,c,d,y){let{horizontalAlign:v,verticalAlign:w}=a.getAnchorAlignment(p),T=-(v-.5)*e,C=-(w-.5)*s,k=a.evaluateVariableOffset(p,c);return new a.pointGeometry((T/d+k[0])*y,(C/d+k[1])*y)}function Oa(p,e,s,c,d,y,v,w,T,C){let k=p.text.placedSymbolArray,F=p.text.dynamicLayoutVertexArray,j=p.icon.dynamicLayoutVertexArray,Y={};F.clear();for(let $=0;$<k.length;$++){let J=k.get($),lt=p.allowVerticalPlacement&&!J.placedOrientation,ht=J.hidden||!J.crossTileID||lt?null:c[J.crossTileID];if(ht){let gt=new a.pointGeometry(J.anchorX,J.anchorY),ut=ke(gt,s?v:y),kt=Gt(d.cameraToCenterDistance,ut.signedDistanceFromCamera),Mt=a.evaluateSizeForFeature(p.textSizeData,T,J)*kt/a.ONE_EM;s&&(Mt*=p.tilePixelRatio/w);let{width:Tt,height:Ut,anchor:$t,textOffset:Pt,textBoxScale:se}=ht,Kt=rl($t,Tt,Ut,Pt,se,Mt),we=s?ke(gt.add(Kt),y).point:ut.point.add(e?Kt.rotate(-d.angle):Kt),Ue=p.allowVerticalPlacement&&J.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let De=0;De<J.numGlyphs;De++)a.addDynamicAttributes(F,we,Ue);C&&J.associatedIconIndex>=0&&(Y[J.associatedIconIndex]={shiftedAnchor:we,angle:Ue})}else ni(J.numGlyphs,F)}if(C){j.clear();let $=p.icon.placedSymbolArray;for(let J=0;J<$.length;J++){let lt=$.get(J);if(lt.hidden)ni(lt.numGlyphs,j);else{let ht=Y[J];if(ht)for(let gt=0;gt<lt.numGlyphs;gt++)a.addDynamicAttributes(j,ht.shiftedAnchor,ht.angle);else ni(lt.numGlyphs,j)}}p.icon.dynamicLayoutVertexBuffer.updateData(j)}p.text.dynamicLayoutVertexBuffer.updateData(F)}function Na(p,e,s){return s.iconsInText&&e?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Ua(p,e,s,c,d,y,v,w,T,C,k,F){let j=p.context,Y=j.gl,$=p.transform,J=w==="map",lt=T==="map",ht=w!=="viewport"&&s.layout.get("symbol-placement")!=="point",gt=J&&!lt&&!ht,ut=!s.layout.get("symbol-sort-key").isConstant(),kt=!1,Mt=p.depthModeForSublayer(0,Qe.ReadOnly),Tt=s.layout.get("text-variable-anchor"),Ut=[];for(let $t of c){let Pt=e.getTile($t),se=Pt.getBucket(s);if(!se)continue;let Kt=d?se.text:se.icon;if(!Kt||!Kt.segments.get().length)continue;let we=Kt.programConfigurations.get(s.id),Ue=d||se.sdfIcons,De=d?se.textSizeData:se.iconSizeData,Oe=lt||$.pitch!==0,xi=p.useProgram(Na(Ue,d,se),we),Me=a.evaluateSizeForZoom(De,$.zoom),je,ii,Hi,br,Or=[0,0],Nr=null;if(d){if(ii=Pt.glyphAtlasTexture,Hi=Y.LINEAR,je=Pt.glyphAtlasTexture.size,se.iconsInText){Or=Pt.imageAtlasTexture.size,Nr=Pt.imageAtlasTexture;let hn=De.kind==="composite"||De.kind==="camera";br=Oe||p.options.rotating||p.options.zooming||hn?Y.LINEAR:Y.NEAREST}}else{let hn=s.layout.get("icon-size").constantOr(0)!==1||se.iconsNeedLinear;ii=Pt.imageAtlasTexture,Hi=Ue||p.options.rotating||p.options.zooming||hn||Oe?Y.LINEAR:Y.NEAREST,je=Pt.imageAtlasTexture.size}let Cn=_i(Pt,1,p.transform.zoom),pr=Pe($t.posMatrix,lt,J,p.transform,Cn),ln=ei($t.posMatrix,lt,J,p.transform,Cn),Zn=Tt&&se.hasTextData(),wr=s.layout.get("icon-text-fit")!=="none"&&Zn&&se.hasIconData();if(ht){let hn=s.layout.get("text-rotation-alignment")==="map";pe(se,$t.posMatrix,p,d,pr,ln,lt,C,hn)}let $e=p.translatePosMatrix($t.posMatrix,Pt,y,v),Ke=ht||d&&Tt||wr?Hc:pr,ki=p.translatePosMatrix(ln,Pt,y,v,!0),sr=Ue&&s.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ui;ui=Ue?se.iconsInText?Nc(De.kind,Me,gt,lt,p,$e,Ke,ki,je,Or):Go(De.kind,Me,gt,lt,p,$e,Ke,ki,d,je,!0):Pa(De.kind,Me,gt,lt,p,$e,Ke,ki,d,je);let Hn={program:xi,buffers:Kt,uniformValues:ui,atlasTexture:ii,atlasTextureIcon:Nr,atlasInterpolation:Hi,atlasInterpolationIcon:br,isSDF:Ue,hasHalo:sr};if(ut&&se.canOverlap){kt=!0;let hn=Kt.segments.get();for(let Qa of hn)Ut.push({segments:new a.SegmentVector([Qa]),sortKey:Qa.sortKey,state:Hn})}else Ut.push({segments:Kt.segments,sortKey:0,state:Hn})}kt&&Ut.sort(($t,Pt)=>$t.sortKey-Pt.sortKey);for(let $t of Ut){let Pt=$t.state;if(j.activeTexture.set(Y.TEXTURE0),Pt.atlasTexture.bind(Pt.atlasInterpolation,Y.CLAMP_TO_EDGE),Pt.atlasTextureIcon&&(j.activeTexture.set(Y.TEXTURE1),Pt.atlasTextureIcon&&Pt.atlasTextureIcon.bind(Pt.atlasInterpolationIcon,Y.CLAMP_TO_EDGE)),Pt.isSDF){let se=Pt.uniformValues;Pt.hasHalo&&(se.u_is_halo=1,Va(Pt.buffers,$t.segments,s,p,Pt.program,Mt,k,F,se)),se.u_is_halo=0}Va(Pt.buffers,$t.segments,s,p,Pt.program,Mt,k,F,Pt.uniformValues)}}function Va(p,e,s,c,d,y,v,w,T){let C=c.context;d.draw(C,C.gl.TRIANGLES,y,v,w,Mi.disabled,T,s.id,p.layoutVertexBuffer,p.indexBuffer,e,s.paint,c.transform.zoom,p.programConfigurations.get(s.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function nl(p,e,s,c,d,y,v){let w=p.context.gl,T=s.paint.get("fill-pattern"),C=T&&T.constantOr(1),k=s.getCrossfadeParameters(),F,j,Y,$,J;v?(j=C&&!s.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=w.LINES):(j=C?"fillPattern":"fill",F=w.TRIANGLES);for(let lt of c){let ht=e.getTile(lt);if(C&&!ht.patternsLoaded())continue;let gt=ht.getBucket(s);if(!gt)continue;let ut=gt.programConfigurations.get(s.id),kt=p.useProgram(j,ut);C&&(p.context.activeTexture.set(w.TEXTURE0),ht.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ut.updatePaintBuffers(k));let Mt=T.constantOr(null);if(Mt&&ht.imageAtlas){let Ut=ht.imageAtlas,$t=Ut.patternPositions[Mt.to.toString()],Pt=Ut.patternPositions[Mt.from.toString()];$t&&Pt&&ut.setConstantPatternPositions($t,Pt)}let Tt=p.translatePosMatrix(lt.posMatrix,ht,s.paint.get("fill-translate"),s.paint.get("fill-translate-anchor"));if(v){$=gt.indexBuffer2,J=gt.segments2;let Ut=[w.drawingBufferWidth,w.drawingBufferHeight];Y=j==="fillOutlinePattern"&&C?Yl(Tt,p,k,ht,Ut):Jl(Tt,Ut)}else $=gt.indexBuffer,J=gt.segments,Y=C?Uo(Tt,p,k,ht):No(Tt);kt.draw(p.context,F,d,p.stencilModeForClipping(lt),y,Mi.disabled,Y,s.id,gt.layoutVertexBuffer,$,J,s.paint,p.transform.zoom,ut)}}function Ss(p,e,s,c,d,y,v){let w=p.context,T=w.gl,C=s.paint.get("fill-extrusion-pattern"),k=C.constantOr(1),F=s.getCrossfadeParameters(),j=s.paint.get("fill-extrusion-opacity");for(let Y of c){let $=e.getTile(Y),J=$.getBucket(s);if(!J)continue;let lt=J.programConfigurations.get(s.id),ht=p.useProgram(k?"fillExtrusionPattern":"fillExtrusion",lt);k&&(p.context.activeTexture.set(T.TEXTURE0),$.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),lt.updatePaintBuffers(F));let gt=C.constantOr(null);if(gt&&$.imageAtlas){let Tt=$.imageAtlas,Ut=Tt.patternPositions[gt.to.toString()],$t=Tt.patternPositions[gt.from.toString()];Ut&&$t&<.setConstantPatternPositions(Ut,$t)}let ut=p.translatePosMatrix(Y.posMatrix,$,s.paint.get("fill-extrusion-translate"),s.paint.get("fill-extrusion-translate-anchor")),kt=s.paint.get("fill-extrusion-vertical-gradient"),Mt=k?Oo(ut,p,kt,j,Y,F,$):Kl(ut,p,kt,j);ht.draw(w,w.gl.TRIANGLES,d,y,v,Mi.backCCW,Mt,s.id,J.layoutVertexBuffer,J.indexBuffer,J.segments,s.paint,p.transform.zoom,lt)}}function Ga(p,e,s,c,d,y){let v=p.context,w=v.gl,T=e.fbo;if(!T)return;let C=p.useProgram("hillshade");v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,T.colorAttachment.get());let k=((F,j,Y)=>{let $=Y.paint.get("hillshade-shadow-color"),J=Y.paint.get("hillshade-highlight-color"),lt=Y.paint.get("hillshade-accent-color"),ht=Y.paint.get("hillshade-illumination-direction")*(Math.PI/180);Y.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=F.transform.angle);let gt=!F.options.moving;return{u_matrix:F.transform.calculatePosMatrix(j.tileID.toUnwrapped(),gt),u_image:0,u_latrange:Ca(0,j.tileID),u_light:[Y.paint.get("hillshade-exaggeration"),ht],u_shadow:$,u_highlight:J,u_accent:lt}})(p,e,s);C.draw(v,w.TRIANGLES,c,d,y,Mi.disabled,k,s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}function Kr(p,e,s,c,d,y){let v=p.context,w=v.gl,T=e.dem;if(T&&T.data){let C=T.dim,k=T.stride,F=T.getPixels();if(v.activeTexture.set(w.TEXTURE1),v.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||p.getTileTexture(k),e.demTexture){let Y=e.demTexture;Y.update(F,{premultiply:!1}),Y.bind(w.NEAREST,w.CLAMP_TO_EDGE)}else e.demTexture=new Dt(v,F,w.RGBA,{premultiply:!1}),e.demTexture.bind(w.NEAREST,w.CLAMP_TO_EDGE);v.activeTexture.set(w.TEXTURE0);let j=e.fbo;if(!j){let Y=new Dt(v,{width:C,height:C,data:null},w.RGBA);Y.bind(w.LINEAR,w.CLAMP_TO_EDGE),j=e.fbo=v.createFramebuffer(C,C,!0),j.colorAttachment.set(Y.texture)}v.bindFramebuffer.set(j.framebuffer),v.viewport.set([0,0,C,C]),p.useProgram("hillshadePrepare").draw(v,w.TRIANGLES,c,d,y,Mi.disabled,((Y,$)=>{let J=$.stride,lt=a.create();return a.ortho(lt,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(lt,lt,[0,-a.EXTENT,0]),{u_matrix:lt,u_image:1,u_dimension:[J,J],u_zoom:Y.overscaledZ,u_unpack:$.getUnpackVector()}})(e.tileID,T),s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function hh(p,e,s,c,d){let y=c.paint.get("raster-fade-duration");if(y>0){let v=a.exported.now(),w=(v-p.timeAdded)/y,T=e?(v-e.timeAdded)/y:-1,C=s.getSource(),k=d.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),F=!e||Math.abs(e.tileID.overscaledZ-k)>Math.abs(p.tileID.overscaledZ-k),j=F&&p.refreshedUponExpiration?1:a.clamp(F?w:1-T,0,1);return p.refreshedUponExpiration&&w>=1&&(p.refreshedUponExpiration=!1),e?{opacity:1,mix:1-j}:{opacity:j,mix:0}}return{opacity:1,mix:0}}let ch=new a.Color(1,0,0,1),uh=new a.Color(0,1,0,1),Ts=new a.Color(0,0,1,1),qa=new a.Color(1,0,1,1),sl=new a.Color(0,1,1,1);function ph(p,e,s,c){$a(p,0,e+s/2,p.transform.width,s,c)}function ja(p,e,s,c){$a(p,e-s/2,0,s,p.transform.height,c)}function $a(p,e,s,c,d,y){let v=p.context,w=v.gl;w.enable(w.SCISSOR_TEST),w.scissor(e*p.pixelRatio,s*p.pixelRatio,c*p.pixelRatio,d*p.pixelRatio),v.clear({color:y}),w.disable(w.SCISSOR_TEST)}function dh(p,e,s){let c=p.context,d=c.gl,y=s.posMatrix,v=p.useProgram("debug"),w=Qe.disabled,T=hi.disabled,C=p.colorModeForRenderPass(),k="$debug";c.activeTexture.set(d.TEXTURE0),p.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),v.draw(c,d.LINE_STRIP,w,T,C,Mi.disabled,vs(y,a.Color.red),k,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments);let F=e.getTileByID(s.key).latestRawTileData,j=Math.floor((F&&F.byteLength||0)/1024),Y=e.getTile(s).tileSize,$=512/Math.min(Y,512)*(s.overscaledZ/p.transform.zoom)*.5,J=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(J+=` => ${s.overscaledZ}`),function(lt,ht){lt.initDebugOverlayCanvas();let gt=lt.debugOverlayCanvas,ut=lt.context.gl,kt=lt.debugOverlayCanvas.getContext("2d");kt.clearRect(0,0,gt.width,gt.height),kt.shadowColor="white",kt.shadowBlur=2,kt.lineWidth=1.5,kt.strokeStyle="white",kt.textBaseline="top",kt.font="bold 36px Open Sans, sans-serif",kt.fillText(ht,5,5),kt.strokeText(ht,5,5),lt.debugOverlayTexture.update(gt),lt.debugOverlayTexture.bind(ut.LINEAR,ut.CLAMP_TO_EDGE)}(p,`${J} ${j}kb`),v.draw(c,d.TRIANGLES,w,T,Se.alphaBlended,Mi.disabled,vs(y,a.Color.transparent,$),k,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments)}let ta={symbol:function(p,e,s,c,d){if(p.renderPass!=="translucent")return;let y=hi.disabled,v=p.colorModeForRenderPass();s.layout.get("text-variable-anchor")&&function(w,T,C,k,F,j,Y){let $=T.transform,J=F==="map",lt=j==="map";for(let ht of w){let gt=k.getTile(ht),ut=gt.getBucket(C);if(!ut||!ut.text||!ut.text.segments.get().length)continue;let kt=a.evaluateSizeForZoom(ut.textSizeData,$.zoom),Mt=_i(gt,1,T.transform.zoom),Tt=Pe(ht.posMatrix,lt,J,T.transform,Mt),Ut=C.layout.get("icon-text-fit")!=="none"&&ut.hasIconData();if(kt){let $t=Math.pow(2,$.zoom-gt.tileID.overscaledZ);Oa(ut,J,lt,Y,$,Tt,ht.posMatrix,$t,kt,Ut)}}}(c,p,s,e,s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),d),s.paint.get("icon-opacity").constantOr(1)!==0&&Ua(p,e,s,c,!1,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),s.layout.get("icon-rotation-alignment"),s.layout.get("icon-pitch-alignment"),s.layout.get("icon-keep-upright"),y,v),s.paint.get("text-opacity").constantOr(1)!==0&&Ua(p,e,s,c,!0,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),s.layout.get("text-rotation-alignment"),s.layout.get("text-pitch-alignment"),s.layout.get("text-keep-upright"),y,v),e.map.showCollisionBoxes&&(il(p,e,s,c,s.paint.get("text-translate"),s.paint.get("text-translate-anchor"),!0),il(p,e,s,c,s.paint.get("icon-translate"),s.paint.get("icon-translate-anchor"),!1))},circle:function(p,e,s,c){if(p.renderPass!=="translucent")return;let d=s.paint.get("circle-opacity"),y=s.paint.get("circle-stroke-width"),v=s.paint.get("circle-stroke-opacity"),w=!s.layout.get("circle-sort-key").isConstant();if(d.constantOr(1)===0&&(y.constantOr(1)===0||v.constantOr(1)===0))return;let T=p.context,C=T.gl,k=p.depthModeForSublayer(0,Qe.ReadOnly),F=hi.disabled,j=p.colorModeForRenderPass(),Y=[];for(let $=0;$<c.length;$++){let J=c[$],lt=e.getTile(J),ht=lt.getBucket(s);if(!ht)continue;let gt=ht.programConfigurations.get(s.id),ut={programConfiguration:gt,program:p.useProgram("circle",gt),layoutVertexBuffer:ht.layoutVertexBuffer,indexBuffer:ht.indexBuffer,uniformValues:Nn(p,J,lt,s)};if(w){let kt=ht.segments.get();for(let Mt of kt)Y.push({segments:new a.SegmentVector([Mt]),sortKey:Mt.sortKey,state:ut})}else Y.push({segments:ht.segments,sortKey:0,state:ut})}w&&Y.sort(($,J)=>$.sortKey-J.sortKey);for(let $ of Y){let{programConfiguration:J,program:lt,layoutVertexBuffer:ht,indexBuffer:gt,uniformValues:ut}=$.state;lt.draw(T,C.TRIANGLES,k,F,j,Mi.disabled,ut,s.id,ht,gt,$.segments,s.paint,p.transform.zoom,J)}},heatmap:function(p,e,s,c){if(s.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){let d=p.context,y=d.gl,v=hi.disabled,w=new Se([y.ONE,y.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(T,C,k){let F=T.gl;T.activeTexture.set(F.TEXTURE1),T.viewport.set([0,0,C.width/4,C.height/4]);let j=k.heatmapFbo;if(j)F.bindTexture(F.TEXTURE_2D,j.colorAttachment.get()),T.bindFramebuffer.set(j.framebuffer);else{let Y=F.createTexture();F.bindTexture(F.TEXTURE_2D,Y),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),j=k.heatmapFbo=T.createFramebuffer(C.width/4,C.height/4,!1),function($,J,lt,ht){let gt=$.gl;gt.texImage2D(gt.TEXTURE_2D,0,gt.RGBA,J.width/4,J.height/4,0,gt.RGBA,$.extRenderToTextureHalfFloat?$.extTextureHalfFloat.HALF_FLOAT_OES:gt.UNSIGNED_BYTE,null),ht.colorAttachment.set(lt)}(T,C,Y,j)}})(d,p,s),d.clear({color:a.Color.transparent});for(let T=0;T<c.length;T++){let C=c[T];if(e.hasRenderableParent(C))continue;let k=e.getTile(C),F=k.getBucket(s);if(!F)continue;let j=F.programConfigurations.get(s.id),Y=p.useProgram("heatmap",j),{zoom:$}=p.transform;Y.draw(d,y.TRIANGLES,Qe.disabled,v,w,Mi.disabled,Ia(C.posMatrix,k,$,s.paint.get("heatmap-intensity")),s.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,s.paint,p.transform.zoom,j)}d.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(d,y){let v=d.context,w=v.gl,T=y.heatmapFbo;if(!T)return;v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,T.colorAttachment.get()),v.activeTexture.set(w.TEXTURE1);let C=y.colorRampTexture;C||(C=y.colorRampTexture=new Dt(v,y.colorRamp,w.RGBA)),C.bind(w.LINEAR,w.CLAMP_TO_EDGE),d.useProgram("heatmapTexture").draw(v,w.TRIANGLES,Qe.disabled,hi.disabled,d.colorModeForRenderPass(),Mi.disabled,((k,F,j,Y)=>{let $=a.create();a.ortho($,0,k.width,k.height,0,0,1);let J=k.context.gl;return{u_matrix:$,u_world:[J.drawingBufferWidth,J.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}})(d,y),y.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,y.paint,d.transform.zoom)}(p,s))},line:function(p,e,s,c){if(p.renderPass!=="translucent")return;let d=s.paint.get("line-opacity"),y=s.paint.get("line-width");if(d.constantOr(1)===0||y.constantOr(1)===0)return;let v=p.depthModeForSublayer(0,Qe.ReadOnly),w=p.colorModeForRenderPass(),T=s.paint.get("line-dasharray"),C=s.paint.get("line-pattern"),k=C.constantOr(1),F=s.paint.get("line-gradient"),j=s.getCrossfadeParameters(),Y=k?"linePattern":T?"lineSDF":F?"lineGradient":"line",$=p.context,J=$.gl,lt=!0;for(let ht of c){let gt=e.getTile(ht);if(k&&!gt.patternsLoaded())continue;let ut=gt.getBucket(s);if(!ut)continue;let kt=ut.programConfigurations.get(s.id),Mt=p.context.program.get(),Tt=p.useProgram(Y,kt),Ut=lt||Tt.program!==Mt,$t=C.constantOr(null);if($t&>.imageAtlas){let se=gt.imageAtlas,Kt=se.patternPositions[$t.to.toString()],we=se.patternPositions[$t.from.toString()];Kt&&we&&kt.setConstantPatternPositions(Kt,we)}let Pt=k?Ks(p,gt,s,j):T?zi(p,gt,s,T,j):F?Aa(p,gt,s,ut.lineClipsArray.length):Xs(p,gt,s);if(k)$.activeTexture.set(J.TEXTURE0),gt.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),kt.updatePaintBuffers(j);else if(T&&(Ut||p.lineAtlas.dirty))$.activeTexture.set(J.TEXTURE0),p.lineAtlas.bind($);else if(F){let se=ut.gradients[s.id],Kt=se.texture;if(s.gradientVersion!==se.version){let we=256;if(s.stepInterpolant){let Ue=e.getSource().maxzoom,De=ht.canonical.z===Ue?Math.ceil(1<<p.transform.maxZoom-ht.canonical.z):1;we=a.clamp(a.nextPowerOfTwo(ut.maxLineLength/a.EXTENT*1024*De),256,$.maxTextureSize)}se.gradient=a.renderColorRamp({expression:s.gradientExpression(),evaluationKey:"lineProgress",resolution:we,image:se.gradient||void 0,clips:ut.lineClipsArray}),se.texture?se.texture.update(se.gradient):se.texture=new Dt($,se.gradient,J.RGBA),se.version=s.gradientVersion,Kt=se.texture}$.activeTexture.set(J.TEXTURE0),Kt.bind(s.stepInterpolant?J.NEAREST:J.LINEAR,J.CLAMP_TO_EDGE)}Tt.draw($,J.TRIANGLES,v,p.stencilModeForClipping(ht),w,Mi.disabled,Pt,s.id,ut.layoutVertexBuffer,ut.indexBuffer,ut.segments,s.paint,p.transform.zoom,kt,ut.layoutVertexBuffer2),lt=!1}},fill:function(p,e,s,c){let d=s.paint.get("fill-color"),y=s.paint.get("fill-opacity");if(y.constantOr(1)===0)return;let v=p.colorModeForRenderPass(),w=s.paint.get("fill-pattern"),T=p.opaquePassEnabledForLayer()&&!w.constantOr(1)&&d.constantOr(a.Color.transparent).a===1&&y.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===T){let C=p.depthModeForSublayer(1,p.renderPass==="opaque"?Qe.ReadWrite:Qe.ReadOnly);nl(p,e,s,c,C,v,!1)}if(p.renderPass==="translucent"&&s.paint.get("fill-antialias")){let C=p.depthModeForSublayer(s.getPaintProperty("fill-outline-color")?2:0,Qe.ReadOnly);nl(p,e,s,c,C,v,!0)}},"fill-extrusion":function(p,e,s,c){let d=s.paint.get("fill-extrusion-opacity");if(d!==0&&p.renderPass==="translucent"){let y=new Qe(p.context.gl.LEQUAL,Qe.ReadWrite,p.depthRangeFor3D);if(d!==1||s.paint.get("fill-extrusion-pattern").constantOr(1))Ss(p,e,s,c,y,hi.disabled,Se.disabled),Ss(p,e,s,c,y,p.stencilModeFor3D(),p.colorModeForRenderPass());else{let v=p.colorModeForRenderPass();Ss(p,e,s,c,y,hi.disabled,v)}}},hillshade:function(p,e,s,c){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;let d=p.context,y=p.depthModeForSublayer(0,Qe.ReadOnly),v=p.colorModeForRenderPass(),[w,T]=p.renderPass==="translucent"?p.stencilConfigForOverlap(c):[{},c];for(let C of T){let k=e.getTile(C);k.needsHillshadePrepare&&p.renderPass==="offscreen"?Kr(p,k,s,y,hi.disabled,v):p.renderPass==="translucent"&&Ga(p,k,s,y,w[C.overscaledZ],v)}d.viewport.set([0,0,p.width,p.height])},raster:function(p,e,s,c){if(p.renderPass!=="translucent"||s.paint.get("raster-opacity")===0||!c.length)return;let d=p.context,y=d.gl,v=e.getSource(),w=p.useProgram("raster"),T=p.colorModeForRenderPass(),[C,k]=v instanceof Dr?[{},c]:p.stencilConfigForOverlap(c),F=k[k.length-1].overscaledZ,j=!p.options.moving;for(let Y of k){let $=p.depthModeForSublayer(Y.overscaledZ-F,s.paint.get("raster-opacity")===1?Qe.ReadWrite:Qe.ReadOnly,y.LESS),J=e.getTile(Y),lt=p.transform.calculatePosMatrix(Y.toUnwrapped(),j);J.registerFadeDuration(s.paint.get("raster-fade-duration"));let ht=e.findLoadedParent(Y,0),gt=hh(J,ht,e,s,p.transform),ut,kt,Mt=s.paint.get("raster-resampling")==="nearest"?y.NEAREST:y.LINEAR;d.activeTexture.set(y.TEXTURE0),J.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(y.TEXTURE1),ht?(ht.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),ut=Math.pow(2,ht.tileID.overscaledZ-J.tileID.overscaledZ),kt=[J.tileID.canonical.x*ut%1,J.tileID.canonical.y*ut%1]):J.texture.bind(Mt,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST);let Tt=Ql(lt,kt||[0,0],ut||1,gt,s);v instanceof Dr?w.draw(d,y.TRIANGLES,$,hi.disabled,T,Mi.disabled,Tt,s.id,v.boundsBuffer,p.quadTriangleIndexBuffer,v.boundsSegments):w.draw(d,y.TRIANGLES,$,C[Y.overscaledZ],T,Mi.disabled,Tt,s.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}},background:function(p,e,s){let c=s.paint.get("background-color"),d=s.paint.get("background-opacity");if(d===0)return;let y=p.context,v=y.gl,w=p.transform,T=w.tileSize,C=s.paint.get("background-pattern");if(p.isPatternMissing(C))return;let k=!C&&c.a===1&&d===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==k)return;let F=hi.disabled,j=p.depthModeForSublayer(0,k==="opaque"?Qe.ReadWrite:Qe.ReadOnly),Y=p.colorModeForRenderPass(),$=p.useProgram(C?"backgroundPattern":"background"),J=w.coveringTiles({tileSize:T});C&&(y.activeTexture.set(v.TEXTURE0),p.imageManager.bind(p.context));let lt=s.getCrossfadeParameters();for(let ht of J){let gt=p.transform.calculatePosMatrix(ht.toUnwrapped()),ut=C?qo(gt,d,p,C,{tileID:ht,tileSize:T},lt):Uc(gt,d,c);$.draw(y,v.TRIANGLES,j,F,Y,Mi.disabled,ut,s.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}},debug:function(p,e,s){for(let c=0;c<s.length;c++)dh(p,e,s[c])},custom:function(p,e,s){let c=p.context,d=s.implementation;if(p.renderPass==="offscreen"){let y=d.prerender;y&&(p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),y.call(d,c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),c.setColorMode(p.colorModeForRenderPass()),c.setStencilMode(hi.disabled);let y=d.renderingMode==="3d"?new Qe(p.context.gl.LEQUAL,Qe.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,Qe.ReadOnly);c.setDepthMode(y),d.render(c.gl,p.transform.customLayerMatrix()),c.setDirty(),p.setBaseState(),c.bindFramebuffer.set(null)}}};class al{constructor(e,s){this.context=new Ra(e),this.transform=s,this._tileTextures={},this.setup(),this.numSublayers=ti.maxUnderzooming+ti.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ie,this.gpuTimers={}}resize(e,s,c){if(this.width=e*c,this.height=s*c,this.pixelRatio=c,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let d of this.style._order)this.style._layers[d].resize()}setup(){let e=this.context,s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(s,Do.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);let c=new a.PosArray;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=e.createVertexBuffer(c,Do.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);let d=new a.RasterBoundsArray;d.emplaceBack(0,0,0,0),d.emplaceBack(a.EXTENT,0,a.EXTENT,0),d.emplaceBack(0,a.EXTENT,0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(d,Lr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);let y=new a.PosArray;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(y,Do.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);let v=new a.LineStripIndexArray;v.emplaceBack(0),v.emplaceBack(1),v.emplaceBack(3),v.emplaceBack(2),v.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(v);let w=new a.TriangleIndexArray;w.emplaceBack(0,1,2),w.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(w),this.emptyTexture=new Dt(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);let T=this.context.gl;this.stencilClearMode=new hi({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){let e=this.context,s=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let c=a.create();a.ortho(c,0,this.width,this.height,0,0,1),a.scale(c,c,[s.drawingBufferWidth,s.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,s.TRIANGLES,Qe.disabled,this.stencilClearMode,Se.disabled,Mi.disabled,Hs(c),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!s||!s.length)return;this.currentStencilSource=e.source;let c=this.context,d=c.gl;this.nextStencilID+s.length>256&&this.clearStencil(),c.setColorMode(Se.disabled),c.setDepthMode(Qe.disabled);let y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let v of s){let w=this._tileClippingMaskIDs[v.key]=this.nextStencilID++;y.draw(c,d.TRIANGLES,Qe.disabled,new hi({func:d.ALWAYS,mask:0},w,255,d.KEEP,d.KEEP,d.REPLACE),Se.disabled,Mi.disabled,Hs(v.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,s=this.context.gl;return new hi({func:s.NOTEQUAL,mask:255},e,255,s.KEEP,s.KEEP,s.REPLACE)}stencilModeForClipping(e){let s=this.context.gl;return new hi({func:s.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,s.KEEP,s.KEEP,s.REPLACE)}stencilConfigForOverlap(e){let s=this.context.gl,c=e.sort((v,w)=>w.overscaledZ-v.overscaledZ),d=c[c.length-1].overscaledZ,y=c[0].overscaledZ-d+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();let v={};for(let w=0;w<y;w++)v[w+d]=new hi({func:s.GEQUAL,mask:255},w+this.nextStencilID,255,s.KEEP,s.KEEP,s.REPLACE);return this.nextStencilID+=y,[v,c]}return[{[d]:hi.disabled},c]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Se([e.CONSTANT_COLOR,e.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Se.unblended:Se.alphaBlended}depthModeForSublayer(e,s,c){if(!this.opaquePassEnabledForLayer())return Qe.disabled;let d=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Qe(c||this.context.gl.LEQUAL,s,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,s){this.style=e,this.options=s,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();let c=this.style._order,d=this.style.sourceCaches;for(let T in d){let C=d[T];C.used&&C.prepare(this.context)}let y={},v={},w={};for(let T in d){let C=d[T];y[T]=C.getVisibleCoordinates(),v[T]=y[T].slice().reverse(),w[T]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<c.length;T++)if(this.style._layers[c[T]].is3D()){this.opaquePassCutoff=T;break}this.renderPass="offscreen";for(let T of c){let C=this.style._layers[T];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;let k=v[C.source];(C.type==="custom"||k.length)&&this.renderLayer(this,d[C.source],C,k)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:s.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=s.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=c.length-1;this.currentLayer>=0;this.currentLayer--){let T=this.style._layers[c[this.currentLayer]],C=d[T.source],k=y[T.source];this._renderTileClippingMasks(T,k),this.renderLayer(this,C,T,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<c.length;this.currentLayer++){let T=this.style._layers[c[this.currentLayer]],C=d[T.source],k=(T.type==="symbol"?w:v)[T.source];this._renderTileClippingMasks(T,y[T.source]),this.renderLayer(this,C,T,k)}if(this.options.showTileBoundaries){let T,C;Object.values(this.style._layers).forEach(k=>{k.source&&!k.isHidden(this.transform.zoom)&&(k.source!==(C&&C.id)&&(C=this.style.sourceCaches[k.source]),(!T||T.getSource().maxzoom<C.getSource().maxzoom)&&(T=C))}),T&&ta.debug(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){let C=T.transform.padding;ph(T,T.transform.height-(C.top||0),3,ch),ph(T,C.bottom||0,3,uh),ja(T,C.left||0,3,Ts),ja(T,T.transform.width-(C.right||0),3,qa);let k=T.transform.centerPoint;(function(F,j,Y,$){$a(F,j-1,Y-10,2,20,$),$a(F,j-10,Y-1,20,2,$)})(T,k.x,T.transform.height-k.y,sl)}(this),this.context.setDefault()}renderLayer(e,s,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="custom"||d.length)&&(this.id=c.id,this.gpuTimingStart(c),ta[c.type](e,s,c,d,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let s=this.context.extTimerQuery,c=this.gpuTimers[e.id];c||(c=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:s.createQueryEXT()}),c.calls++,s.beginQueryEXT(s.TIME_ELAPSED_EXT,c.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){let s={};for(let c in e){let d=e[c],y=this.context.extTimerQuery,v=y.getQueryObjectEXT(d.query,y.QUERY_RESULT_EXT)/1e6;y.deleteQueryEXT(d.query),s[c]=v}return s}translatePosMatrix(e,s,c,d,y){if(!c[0]&&!c[1])return e;let v=y?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(v){let C=Math.sin(v),k=Math.cos(v);c=[c[0]*k-c[1]*C,c[0]*C+c[1]*k]}let w=[y?c[0]:_i(s,c[0],this.transform.zoom),y?c[1]:_i(s,c[1],this.transform.zoom),0],T=new Float32Array(16);return a.translate(T,e,w),T}saveTileTexture(e){let s=this._tileTextures[e.size[0]];s?s.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let s=this._tileTextures[e];return s&&s.length>0?s.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let s=this.imageManager.getPattern(e.from.toString()),c=this.imageManager.getPattern(e.to.toString());return!s||!c}useProgram(e,s){this.cache=this.cache||{};let c=`${e}${s?s.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[c]||(this.cache[c]=new Oc(this.context,e,Ro[e],s,jo[e],this._showOverdrawInspector)),this.cache[c]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Dt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Wa{constructor(e,s){this.points=e,this.planes=s}static fromInvProjectionMatrix(e,s,c){let d=Math.pow(2,c),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(w=>a.transformMat4([],w,e)).map(w=>a.scale$1([],w,1/w[3]/s*d)),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{let T=function(j,Y){var $=Y[0],J=Y[1],lt=Y[2],ht=$*$+J*J+lt*lt;return ht>0&&(ht=1/Math.sqrt(ht)),j[0]=Y[0]*ht,j[1]=Y[1]*ht,j[2]=Y[2]*ht,j}([],function(j,Y,$){var J=Y[0],lt=Y[1],ht=Y[2],gt=$[0],ut=$[1],kt=$[2];return j[0]=lt*kt-ht*ut,j[1]=ht*gt-J*kt,j[2]=J*ut-lt*gt,j}([],Rt([],y[w[0]],y[w[1]]),Rt([],y[w[2]],y[w[1]]))),C=-((k=T)[0]*(F=y[w[1]])[0]+k[1]*F[1]+k[2]*F[2]);var k,F;return T.concat(C)});return new Wa(y,v)}}class Za{constructor(e,s){this.min=e,this.max=s,this.center=function(c,d,y){return c[0]=.5*d[0],c[1]=.5*d[1],c[2]=.5*d[2],c}([],function(c,d,y){return c[0]=d[0]+y[0],c[1]=d[1]+y[1],c[2]=d[2]+y[2],c}([],this.min,this.max))}quadrant(e){let s=[e%2==0,e<2],c=ot(this.min),d=ot(this.max);for(let y=0;y<s.length;y++)c[y]=s[y]?this.min[y]:this.center[y],d[y]=s[y]?this.center[y]:this.max[y];return d[2]=this.max[2],new Za(c,d)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let s=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],c=!0;for(let d=0;d<e.planes.length;d++){let y=e.planes[d],v=0;for(let w=0;w<s.length;w++)a.dot(y,s[w])>=0&&v++;if(v===0)return 0;v!==s.length&&(c=!1)}if(c)return 2;for(let d=0;d<3;d++){let y=Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let w=0;w<e.points.length;w++){let T=e.points[w][d]-this.min[d];y=Math.min(y,T),v=Math.max(v,T)}if(v<0||y>this.max[d]-this.min[d])return 0}return 1}}class Es{constructor(e=0,s=0,c=0,d=0){if(isNaN(e)||e<0||isNaN(s)||s<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=s,this.left=c,this.right=d}interpolate(e,s,c){return s.top!=null&&e.top!=null&&(this.top=a.number(e.top,s.top,c)),s.bottom!=null&&e.bottom!=null&&(this.bottom=a.number(e.bottom,s.bottom,c)),s.left!=null&&e.left!=null&&(this.left=a.number(e.left,s.left,c)),s.right!=null&&e.right!=null&&(this.right=a.number(e.right,s.right,c)),this}getCenter(e,s){let c=a.clamp((this.left+e-this.right)/2,0,e),d=a.clamp((this.top+s-this.bottom)/2,0,s);return new a.pointGeometry(c,d)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Es(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ea{constructor(e,s,c,d,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=e||0,this._maxZoom=s||22,this._minPitch=c??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Es,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let e=new ea(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e._center=this._center,e.zoom=this.zoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._calcMatrices(),e}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let s=-a.wrap(e,-180,180)*Math.PI/180;this.angle!==s&&(this._unmodified=!1,this.angle=s,this._calcMatrices(),this.rotationMatrix=function(){var c=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(c[1]=0,c[2]=0),c[0]=1,c[3]=1,c}(),function(c,d,y){var v=d[0],w=d[1],T=d[2],C=d[3],k=Math.sin(y),F=Math.cos(y);c[0]=v*F+T*k,c[1]=w*F+C*k,c[2]=v*-k+T*F,c[3]=w*-k+C*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let s=a.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==s&&(this._unmodified=!1,this._pitch=s,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let s=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==s&&(this._unmodified=!1,this._zoom=s,this.scale=this.zoomScale(s),this.tileZoom=Math.floor(s),this.zoomFraction=s-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,s,c){this._unmodified=!1,this._edgeInsets.interpolate(e,s,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let s=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,s)}getVisibleUnwrappedCoordinates(e){let s=[new a.UnwrappedTileID(0,e)];if(this._renderWorldCopies){let c=this.pointCoordinate(new a.pointGeometry(0,0)),d=this.pointCoordinate(new a.pointGeometry(this.width,0)),y=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),v=this.pointCoordinate(new a.pointGeometry(0,this.height)),w=Math.floor(Math.min(c.x,d.x,y.x,v.x)),T=Math.floor(Math.max(c.x,d.x,y.x,v.x)),C=1;for(let k=w-C;k<=T+C;k++)k!==0&&s.push(new a.UnwrappedTileID(k,e))}return s}coveringTiles(e){let s=this.coveringZoomLevel(e),c=s;if(e.minzoom!==void 0&&s<e.minzoom)return[];e.maxzoom!==void 0&&s>e.maxzoom&&(s=e.maxzoom);let d=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,s),v=[y*d.x,y*d.y,0],w=Wa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,s),T=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(T=s);let C=$=>({aabb:new Za([$*y,0,0],[($+1)*y,y,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),k=[],F=[],j=s,Y=e.reparseOverscaled?c:s;if(this._renderWorldCopies)for(let $=1;$<=3;$++)k.push(C(-$)),k.push(C($));for(k.push(C(0));k.length>0;){let $=k.pop(),J=$.x,lt=$.y,ht=$.fullyVisible;if(!ht){let Tt=$.aabb.intersects(w);if(Tt===0)continue;ht=Tt===2}let gt=$.aabb.distanceX(v),ut=$.aabb.distanceY(v),kt=Math.max(Math.abs(gt),Math.abs(ut)),Mt=3+(1<<j-$.zoom)-2;if($.zoom===j||kt>Mt&&$.zoom>=T)F.push({tileID:new a.OverscaledTileID($.zoom===j?Y:$.zoom,$.wrap,$.zoom,J,lt),distanceSq:Ct([v[0]-.5-J,v[1]-.5-lt])});else for(let Tt=0;Tt<4;Tt++){let Ut=(J<<1)+Tt%2,$t=(lt<<1)+(Tt>>1);k.push({aabb:$.aabb.quadrant(Tt),zoom:$.zoom+1,x:Ut,y:$t,wrap:$.wrap,fullyVisible:ht})}}return F.sort(($,J)=>$.distanceSq-J.distanceSq).map($=>$.tileID)}resize(e,s){this.width=e,this.height=s,this.pixelsToGLUnits=[2/e,-2/s],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let s=a.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(e.lng)*this.worldSize,a.mercatorYfromLat(s)*this.worldSize)}unproject(e){return new a.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,s){let c=this.pointCoordinate(s),d=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(e),v=new a.MercatorCoordinate(y.x-(c.x-d.x),y.y-(c.y-d.y));this.center=this.coordinateLocation(v),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e){return this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}locationCoordinate(e){return a.MercatorCoordinate.fromLngLat(e)}coordinateLocation(e){return e.toLngLat()}pointCoordinate(e){let s=[e.x,e.y,0,1],c=[e.x,e.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(c,c,this.pixelMatrixInverse);let d=s[3],y=c[3],v=s[1]/d,w=c[1]/y,T=s[2]/d,C=c[2]/y,k=T===C?0:(0-T)/(C-T);return new a.MercatorCoordinate(a.number(s[0]/d,c[0]/y,k)/this.worldSize,a.number(v,w,k)/this.worldSize)}coordinatePoint(e){let s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(s,s,this.pixelMatrix),new a.pointGeometry(s[0]/s[3],s[1]/s[3])}getBounds(){return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,0))).extend(this.pointLocation(new a.pointGeometry(this.width,0))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,s=!1){let c=e.key,d=s?this._alignedPosMatrixCache:this._posMatrixCache;if(d[c])return d[c];let y=e.canonical,v=this.worldSize/this.zoomScale(y.z),w=y.x+Math.pow(2,y.z)*e.wrap,T=a.identity(new Float64Array(16));return a.translate(T,T,[w*v,y.y*v,0]),a.scale(T,T,[v/a.EXTENT,v/a.EXTENT,1]),a.multiply(T,s?this.alignedProjMatrix:this.projMatrix,T),d[c]=new Float32Array(T),d[c]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,s,c,d,y=-90,v=90,w=-180,T=180,C=this.size,k=this._unmodified;if(this.latRange){let Y=this.latRange;y=a.mercatorYfromLat(Y[1])*this.worldSize,v=a.mercatorYfromLat(Y[0])*this.worldSize,e=v-y<C.y?C.y/(v-y):0}if(this.lngRange){let Y=this.lngRange;w=a.mercatorXfromLng(Y[0])*this.worldSize,T=a.mercatorXfromLng(Y[1])*this.worldSize,s=T-w<C.x?C.x/(T-w):0}let F=this.point,j=Math.max(s||0,e||0);if(j)return this.center=this.unproject(new a.pointGeometry(s?(T+w)/2:F.x,e?(v+y)/2:F.y)),this.zoom+=this.scaleZoom(j),this._unmodified=k,void(this._constraining=!1);if(this.latRange){let Y=F.y,$=C.y/2;Y-$<y&&(d=y+$),Y+$>v&&(d=v-$)}if(this.lngRange){let Y=F.x,$=C.x/2;Y-$<w&&(c=w+$),Y+$>T&&(c=T-$)}c===void 0&&d===void 0||(this.center=this.unproject(new a.pointGeometry(c!==void 0?c:F.x,d!==void 0?d:F.y))),this._unmodified=k,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;let s=Math.PI/2+this._pitch,c=this._fov*(.5+e.y/this.height),d=Math.sin(c)*this.cameraToCenterDistance/Math.sin(a.clamp(Math.PI-s-c,.01,Math.PI-.01)),y=this.point,v=y.x,w=y.y,T=1.01*(Math.cos(Math.PI/2-this._pitch)*d+this.cameraToCenterDistance),C=this.height/50,k=new Float64Array(16);a.perspective(k,this._fov,this.width/this.height,C,T),k[8]=2*-e.x/this.width,k[9]=2*e.y/this.height,a.scale(k,k,[1,-1,1]),a.translate(k,k,[0,0,-this.cameraToCenterDistance]),a.rotateX(k,k,this._pitch),a.rotateZ(k,k,this.angle),a.translate(k,k,[-v,-w,0]),this.mercatorMatrix=a.scale([],k,[this.worldSize,this.worldSize,this.worldSize]),a.scale(k,k,[1,1,a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=k,this.invProjMatrix=a.invert([],this.projMatrix);let F=this.width%2/2,j=this.height%2/2,Y=Math.cos(this.angle),$=Math.sin(this.angle),J=v-Math.round(v)+Y*F+$*j,lt=w-Math.round(w)+Y*j+$*F,ht=new Float64Array(k);if(a.translate(ht,ht,[J>.5?J-1:J,lt>.5?lt-1:lt,0]),this.alignedProjMatrix=ht,k=a.create(),a.scale(k,k,[this.width/2,-this.height/2,1]),a.translate(k,k,[1,-1,0]),this.labelPlaneMatrix=k,k=a.create(),a.scale(k,k,[1,-1,1]),a.translate(k,k,[-1,-1,0]),a.scale(k,k,[2/this.width,2/this.height,1]),this.glCoordMatrix=k,this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),k=a.invert(new Float64Array(16),this.pixelMatrix),!k)throw new Error("failed to invert matrix");this.pixelMatrixInverse=k,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new a.pointGeometry(0,0)),s=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(s,s,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,e))}getCameraQueryGeometry(e){let s=this.getCameraPoint();if(e.length===1)return[e[0],s];{let c=s.x,d=s.y,y=s.x,v=s.y;for(let w of e)c=Math.min(c,w.x),d=Math.min(d,w.y),y=Math.max(y,w.x),v=Math.max(v,w.y);return[new a.pointGeometry(c,d),new a.pointGeometry(y,d),new a.pointGeometry(y,v),new a.pointGeometry(c,v),new a.pointGeometry(c,d)]}}}class fh{constructor(e){this._hashName=e&&encodeURIComponent(e),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(s,c){let d=!1,y=null,v=()=>{y=null,d&&(s(),y=setTimeout(v,300),d=!1)};return()=>(d=!0,y||v(),y)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,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(e){let s=this._map.getCenter(),c=Math.round(100*this._map.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,d),v=Math.round(s.lng*y)/y,w=Math.round(s.lat*y)/y,T=this._map.getBearing(),C=this._map.getPitch(),k="";if(k+=e?`/${v}/${w}/${c}`:`${c}/${w}/${v}`,(T||C)&&(k+="/"+Math.round(10*T)/10),C&&(k+=`/${Math.round(C)}`),this._hashName){let F=this._hashName,j=!1,Y=window.location.hash.slice(1).split("&").map($=>{let J=$.split("=")[0];return J===F?(j=!0,`${J}=${k}`):$}).filter($=>$);return j||Y.push(`${F}=${k}`),`#${Y.join("&")}`}return`#${k}`}_getCurrentHash(){let e=window.location.hash.replace("#","");if(this._hashName){let s;return e.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(s=c)}),(s&&s[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._getCurrentHash();if(e.length>=3&&!e.some(s=>isNaN(s))){let s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:s,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch{}}}let ia={linearity:.3,easing:a.bezier(0,0,.3,1)},mh=a.extend({deceleration:2500,maxSpeed:1400},ia),gh=a.extend({deceleration:20,maxSpeed:1400},ia),yh=a.extend({deceleration:1e3,maxSpeed:360},ia),Is=a.extend({deceleration:1e3,maxSpeed:90},ia);class _h{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,s=a.exported.now();for(;e.length>0&&s-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let s={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:y}of this._inertiaBuffer)s.zoom+=y.zoomDelta||0,s.bearing+=y.bearingDelta||0,s.pitch+=y.pitchDelta||0,y.panDelta&&s.pan._add(y.panDelta),y.around&&(s.around=y.around),y.pinchAround&&(s.pinchAround=y.pinchAround);let c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(s.pan.mag()){let y=na(s.pan.mag(),c,a.extend({},mh,e||{}));d.offset=s.pan.mult(y.amount/s.pan.mag()),d.center=this._map.transform.center,ra(d,y)}if(s.zoom){let y=na(s.zoom,c,gh);d.zoom=this._map.transform.zoom+y.amount,ra(d,y)}if(s.bearing){let y=na(s.bearing,c,yh);d.bearing=this._map.transform.bearing+a.clamp(y.amount,-179,179),ra(d,y)}if(s.pitch){let y=na(s.pitch,c,Is);d.pitch=this._map.transform.pitch+y.amount,ra(d,y)}if(d.zoom||d.bearing){let y=s.pinchAround===void 0?s.around:s.pinchAround;d.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),a.extend(d,{noMoveStart:!0})}}function ra(p,e){(!p.duration||p.duration<e.duration)&&(p.duration=e.duration,p.easing=e.easing)}function na(p,e,s){let{maxSpeed:c,linearity:d,deceleration:y}=s,v=a.clamp(p*d/(e/1e3),-c,c),w=Math.abs(v)/(y*d);return{easing:s.easing,duration:1e3*w,amount:v*(w/2)}}class vr extends a.Event{constructor(e,s,c,d={}){let y=L.mousePos(s.getCanvasContainer(),c),v=s.unproject(y);super(e,a.extend({point:y,lngLat:v,originalEvent:c},d)),this._defaultPrevented=!1,this.target=s}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hr extends a.Event{constructor(e,s,c){let d=e==="touchend"?c.changedTouches:c.touches,y=L.touchPos(s.getCanvasContainer(),d),v=y.map(T=>s.unproject(T)),w=y.reduce((T,C,k,F)=>T.add(C.div(F.length)),new a.pointGeometry(0,0));super(e,{points:y,point:w,lngLats:v,lngLat:s.unproject(w),originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Xc extends a.Event{constructor(e,s,c){super(e,{originalEvent:c}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Gn{constructor(e,s){this._map=e,this._clickTolerance=s.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Xc(e.type,this._map,e))}mousedown(e,s){return this._mousedownPos=s,this._firePreventable(new vr(e.type,this._map,e))}mouseup(e){this._map.fire(new vr(e.type,this._map,e))}click(e,s){this._mousedownPos&&this._mousedownPos.dist(s)>=this._clickTolerance||this._map.fire(new vr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new vr(e.type,this._map,e))}mouseover(e){this._map.fire(new vr(e.type,this._map,e))}mouseout(e){this._map.fire(new vr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new hr(e.type,this._map,e))}touchmove(e){this._map.fire(new hr(e.type,this._map,e))}touchend(e){this._map.fire(new hr(e.type,this._map,e))}touchcancel(e){this._map.fire(new hr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(e){this._map.fire(new vr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new vr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Cs{constructor(e,s){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=s.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,s){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=s,this._active=!0)}mousemoveWindow(e,s){if(!this._active)return;let c=s;if(this._lastPos.equals(c)||!this._box&&c.dist(this._startPos)<this._clickTolerance)return;let d=this._startPos;this._lastPos=c,this._box||(this._box=L.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let y=Math.min(d.x,c.x),v=Math.max(d.x,c.x),w=Math.min(d.y,c.y),T=Math.max(d.y,c.y);L.setTransform(this._box,`translate(${y}px,${w}px)`),this._box.style.width=v-y+"px",this._box.style.height=T-w+"px"}mouseupWindow(e,s){if(!this._active||e.button!==0)return;let c=this._startPos,d=s;if(this.reset(),L.suppressClick(),c.x!==d.x||c.y!==d.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:y=>y.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,s){return this._map.fire(new a.Event(e,{originalEvent:s}))}}function qn(p,e){let s={};for(let c=0;c<p.length;c++)s[p[c].identifier]=e[c];return s}class Kc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,s,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){let y=new a.pointGeometry(0,0);for(let v of d)y._add(v);return y.div(d.length)}(s),this.touches=qn(c,s)))}touchmove(e,s,c){if(this.aborted||!this.centroid)return;let d=qn(c,s);for(let y in this.touches){let v=this.touches[y],w=d[y];(!w||w.dist(v)>30)&&(this.aborted=!0)}}touchend(e,s,c){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){let d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class ol{constructor(e){this.singleTap=new Kc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,s,c){this.singleTap.touchstart(e,s,c)}touchmove(e,s,c){this.singleTap.touchmove(e,s,c)}touchend(e,s,c){let d=this.singleTap.touchend(e,s,c);if(d){let y=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(d)<30;if(y&&v||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Jc{constructor(){this._zoomIn=new ol({numTouches:1,numTaps:2}),this._zoomOut=new ol({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,s,c){this._zoomIn.touchstart(e,s,c),this._zoomOut.touchstart(e,s,c)}touchmove(e,s,c){this._zoomIn.touchmove(e,s,c),this._zoomOut.touchmove(e,s,c)}touchend(e,s,c){let d=this._zoomIn.touchend(e,s,c),y=this._zoomOut.touchend(e,s,c);return d?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()+1,around:v.unproject(d)},{originalEvent:e})}):y?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()-1,around:v.unproject(y)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let vh={0:1,2:2};class jn{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,s){return!1}_move(e,s){return{}}mousedown(e,s){if(this._lastPoint)return;let c=L.mouseButton(e);this._correctButton(e,c)&&(this._lastPoint=s,this._eventButton=c)}mousemoveWindow(e,s){let c=this._lastPoint;if(c){if(e.preventDefault(),function(d,y){let v=vh[y];return d.buttons===void 0||(d.buttons&v)!==v}(e,this._eventButton))this.reset();else if(this._moved||!(s.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=s,this._move(c,s)}}mouseupWindow(e){this._lastPoint&&L.mouseButton(e)===this._eventButton&&(this._moved&&L.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class As extends jn{mousedown(e,s){super.mousedown(e,s),this._lastPoint&&(this._active=!0)}_correctButton(e,s){return s===0&&!e.ctrlKey}_move(e,s){return{around:s,panDelta:s.sub(e)}}}class ie extends jn{_correctButton(e,s){return s===0&&e.ctrlKey||s===2}_move(e,s){let c=.8*(s.x-e.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(e){e.preventDefault()}}class ll extends jn{_correctButton(e,s){return s===0&&e.ctrlKey||s===2}_move(e,s){let c=-.5*(s.y-e.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(e){e.preventDefault()}}class sa{constructor(e){this._minTouches=1,this._clickTolerance=e.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0)}touchstart(e,s,c){return this._calculateTransform(e,s,c)}touchmove(e,s,c){if(this._active&&!(c.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,s,c)}touchend(e,s,c){this._calculateTransform(e,s,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,s,c){c.length>0&&(this._active=!0);let d=qn(c,s),y=new a.pointGeometry(0,0),v=new a.pointGeometry(0,0),w=0;for(let C in d){let k=d[C],F=this._touches[C];F&&(y._add(k),v._add(k.sub(F)),w++,d[C]=k)}if(this._touches=d,w<this._minTouches||!v.mag())return;let T=v.div(w);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:y.div(w),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $n{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,s,c){return{}}touchstart(e,s,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([s[0],s[1]]))}touchmove(e,s,c){if(!this._firstTwoTouches)return;e.preventDefault();let[d,y]=this._firstTwoTouches,v=aa(c,s,d),w=aa(c,s,y);if(!v||!w)return;let T=this._aroundCenter?null:v.add(w).div(2);return this._move([v,w],T,e)}touchend(e,s,c){if(!this._firstTwoTouches)return;let[d,y]=this._firstTwoTouches,v=aa(c,s,d),w=aa(c,s,y);v&&w||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function aa(p,e,s){for(let c=0;c<p.length;c++)if(p[c].identifier===s)return e[c]}function Xt(p,e){return Math.log(p/e)/Math.LN2}class hl extends $n{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,s){let c=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Xt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Xt(this._distance,c),pinchAround:s}}}function bh(p,e){return 180*p.angleWith(e)/Math.PI}class Yc extends $n{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,s){let c=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:bh(this._vector,c),pinchAround:s}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let s=25/(Math.PI*this._minDiameter)*360,c=bh(e,this._startVector);return Math.abs(c)<s}}function oa(p){return Math.abs(p.y)>Math.abs(p.x)}class wh extends $n{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(e){this._lastPoints=e,oa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,s,c){let d=e[0].sub(this._lastPoints[0]),y=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(d,y,c.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+y.y)/2*-.5}}gestureBeginsVertically(e,s,c){if(this._valid!==void 0)return this._valid;let d=e.mag()>=2,y=s.mag()>=2;if(!d&&!y)return;if(!d||!y)return this._firstMove===void 0&&(this._firstMove=c),c-this._firstMove<100&&void 0;let v=e.y>0==s.y>0;return oa(e)&&oa(s)&&v}}let Mh={panStep:100,bearingStep:15,pitchStep:10};class Qc{constructor(){let e=Mh;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let s=0,c=0,d=0,y=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:s=1;break;case 189:case 109:case 173:s=-1;break;case 37:e.shiftKey?c=-1:(e.preventDefault(),y=-1);break;case 39:e.shiftKey?c=1:(e.preventDefault(),y=1);break;case 38:e.shiftKey?d=1:(e.preventDefault(),v=-1);break;case 40:e.shiftKey?d=-1:(e.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:w=>{let T=w.getZoom();w.easeTo({duration:300,easeId:"keyboardHandler",easing:tu,zoom:s?Math.round(T)+s*(e.shiftKey?2:1):T,bearing:w.getBearing()+c*this._bearingStep,pitch:w.getPitch()+d*this._pitchStep,offset:[-y*this._panStep,-v*this._panStep],center:w.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function tu(p){return p*(2-p)}let Ha=4.000244140625;class cl{constructor(e,s){this._map=e,this._el=e.getCanvasContainer(),this._handler=s,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let s=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,c=a.exported.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,s!==0&&s%Ha==0?this._type="wheel":s!==0&&Math.abs(s)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=s,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*s)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,s+=this._lastValue)),e.shiftKey&&s&&(s/=4),this._type&&(this._lastWheelEvent=e,this._delta-=s,this._active||this._start(e)),e.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let s=L.mousePos(this._el,e);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(s)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._map.transform;if(this._delta!==0){let w=this._type==="wheel"&&Math.abs(this._delta)>Ha?this._wheelZoomRate:this._defaultZoomRate,T=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&T!==0&&(T=1/T);let C=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(C*T))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let s=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,c=this._startZoom,d=this._easing,y,v=!1;if(this._type==="wheel"&&c&&d){let w=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),T=d(w);y=a.number(c,s,T),w<1?this._frameId||(this._frameId=!0):v=!0}else y=s,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!v,zoomDelta:y-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let s=a.ease;if(this._prevEase){let c=this._prevEase,d=(a.exported.now()-c.start)/c.duration,y=c.easing(d+.01)-c.easing(d),v=.27/Math.sqrt(y*y+1e-4)*.01,w=Math.sqrt(.0729-v*v);s=a.bezier(v,w,.25,1)}return this._prevEase={start:a.exported.now(),duration:e,easing:s},s}reset(){this._active=!1}}class ul{constructor(e,s){this._clickZoom=e,this._tapZoom=s}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class pl{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,s){return e.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(e.shiftKey?-1:1),around:c.unproject(s)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cr{constructor(){this._tap=new ol({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,s,c){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=s[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(e,s,c))}touchmove(e,s,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;let d=s[0],y=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(e,s,c)}touchend(e,s,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(e,s,c)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class In{constructor(e,s,c){this._el=e,this._mousePan=s,this._touchPan=c}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Sh{constructor(e,s,c){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=s,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class dl{constructor(e,s,c,d){this._el=e,this._touchZoom=s,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Ps=p=>p.zoom||p.drag||p.pitch||p.rotate;class fl extends a.Event{}function Xa(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta}class Fr{constructor(e,s){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _h(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s),a.bindAll(["handleEvent","handleWindowEvent"],this);let c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(let[d,y,v]of this._listeners)L.addEventListener(d,y,d===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,s,c]of this._listeners)L.removeEventListener(e,s,e===document?this.handleWindowEvent:this.handleEvent,c)}_addDefaultHandlers(e){let s=this._map,c=s.getCanvasContainer();this._add("mapEvent",new Gn(s,e));let d=s.boxZoom=new Cs(s,e);this._add("boxZoom",d);let y=new Jc,v=new pl;s.doubleClickZoom=new ul(v,y),this._add("tapZoom",y),this._add("clickZoom",v);let w=new cr;this._add("tapDragZoom",w);let T=s.touchPitch=new wh;this._add("touchPitch",T);let C=new ie(e),k=new ll(e);s.dragRotate=new Sh(e,C,k),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);let F=new As(e),j=new sa(e);s.dragPan=new In(c,F,j),this._add("mousePan",F),this._add("touchPan",j,["touchZoom","touchRotate"]);let Y=new Yc,$=new hl;s.touchZoomRotate=new dl(c,$,Y,w),this._add("touchRotate",Y,["touchPan","touchZoom"]),this._add("touchZoom",$,["touchPan","touchRotate"]);let J=s.scrollZoom=new cl(s,this);this._add("scrollZoom",J,["mousePan"]);let lt=s.keyboard=new Qc;this._add("keyboard",lt),this._add("blockableMapEvent",new xh(s));for(let ht of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[ht]&&s[ht].enable(e[ht])}_add(e,s,c){this._handlers.push({handlerName:e,handler:s,allowed:c}),this._handlersById[e]=s}stop(e){if(!this._updatingCamera){for(let{handler:s}of this._handlers)s.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ps(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,s,c){for(let d in e)if(d!==c&&(!s||s.indexOf(d)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let s=[];for(let c of e)this._el.contains(c.target)&&s.push(c);return s}handleEvent(e,s){if(e.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let c=e.type==="renderFrame"?void 0:e,d={needsRenderFrame:!1},y={},v={},w=e.touches,T=w?this._getMapTouches(w):void 0,C=T?L.touchPos(this._el,T):L.mousePos(this._el,e);for(let{handlerName:j,handler:Y,allowed:$}of this._handlers){if(!Y.isEnabled())continue;let J;this._blockedByActive(v,$,j)?Y.reset():Y[s||e.type]&&(J=Y[s||e.type](e,C,T),this.mergeHandlerResult(d,y,J,j,c),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||Y.isActive())&&(v[j]=Y)}let k={};for(let j in this._previousActiveHandlers)v[j]||(k[j]=c);this._previousActiveHandlers=v,(Object.keys(k).length||Xa(d))&&(this._changes.push([d,y,k]),this._triggerRenderFrame()),(Object.keys(v).length||Xa(d))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:F}=d;F&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],F(this._map))}mergeHandlerResult(e,s,c,d,y){if(!c)return;a.extend(e,c);let v={handlerName:d,originalEvent:c.originalEvent||y};c.zoomDelta!==void 0&&(s.zoom=v),c.panDelta!==void 0&&(s.drag=v),c.pitchDelta!==void 0&&(s.pitch=v),c.bearingDelta!==void 0&&(s.rotate=v)}_applyChanges(){let e={},s={},c={};for(let[d,y,v]of this._changes)d.panDelta&&(e.panDelta=(e.panDelta||new a.pointGeometry(0,0))._add(d.panDelta)),d.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(e.around=d.around),d.pinchAround!==void 0&&(e.pinchAround=d.pinchAround),d.noInertia&&(e.noInertia=d.noInertia),a.extend(s,y),a.extend(c,v);this._updateMapTransform(e,s,c),this._changes=[]}_updateMapTransform(e,s,c){let d=this._map,y=d.transform;if(!Xa(e))return this._fireEvents(s,c,!0);let{panDelta:v,zoomDelta:w,bearingDelta:T,pitchDelta:C,around:k,pinchAround:F}=e;F!==void 0&&(k=F),d._stop(!0),k=k||d.transform.centerPoint;let j=y.pointLocation(v?k.sub(v):k);T&&(y.bearing+=T),C&&(y.pitch+=C),w&&(y.zoom+=w),y.setLocationAtPoint(j,k),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(s,c,!0)}_fireEvents(e,s,c){let d=Ps(this._eventsInProgress),y=Ps(e),v={};for(let k in e){let{originalEvent:F}=e[k];this._eventsInProgress[k]||(v[`${k}start`]=F),this._eventsInProgress[k]=e[k]}!d&&y&&this._fireEvent("movestart",y.originalEvent);for(let k in v)this._fireEvent(k,v[k]);y&&this._fireEvent("move",y.originalEvent);for(let k in e){let{originalEvent:F}=e[k];this._fireEvent(k,F)}let w={},T;for(let k in this._eventsInProgress){let{handlerName:F,originalEvent:j}=this._eventsInProgress[k];this._handlersById[F].isActive()||(delete this._eventsInProgress[k],T=s[F]||j,w[`${k}end`]=T)}for(let k in w)this._fireEvent(k,w[k]);let C=Ps(this._eventsInProgress);if(c&&(d||y)&&!C){this._updatingCamera=!0;let k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=j=>j!==0&&-this._bearingSnap<j&&j<this._bearingSnap;k?(F(k.bearing||this._map.getBearing())&&(k.bearing=0),this._map.easeTo(k,{originalEvent:T})):(this._map.fire(new a.Event("moveend",{originalEvent:T})),F(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,s){this._map.fire(new a.Event(e,s?{originalEvent:s}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new fl("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let ci={extend:(p,...e)=>a.extend(p,...e),run(p){p()},logToElement(p,e=!1,s="log"){let c=window.document.getElementById(s);c&&(e&&(c.innerHTML=""),c.innerHTML+=`<br>${p}`)}};class Ka extends a.Evented{constructor(e,s){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,s){return this.jumpTo({center:e},s)}panBy(e,s,c){return e=a.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,a.extend({offset:e},s),c)}panTo(e,s,c){return this.easeTo(a.extend({center:e},s),c)}getZoom(){return this.transform.zoom}setZoom(e,s){return this.jumpTo({zoom:e},s),this}zoomTo(e,s,c){return this.easeTo(a.extend({zoom:e},s),c)}zoomIn(e,s){return this.zoomTo(this.getZoom()+1,e,s),this}zoomOut(e,s){return this.zoomTo(this.getZoom()-1,e,s),this}getBearing(){return this.transform.bearing}setBearing(e,s){return this.jumpTo({bearing:e},s),this}getPadding(){return this.transform.padding}setPadding(e,s){return this.jumpTo({padding:e},s),this}rotateTo(e,s,c){return this.easeTo(a.extend({bearing:e},s),c)}resetNorth(e,s){return this.rotateTo(0,a.extend({duration:1e3},e),s),this}resetNorthPitch(e,s){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},e),s),this}snapToNorth(e,s){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,s):this}getPitch(){return this.transform.pitch}setPitch(e,s){return this.jumpTo({pitch:e},s),this}cameraForBounds(e,s){e=a.LngLatBounds.convert(e);let c=s&&s.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),c,s)}_cameraForBoxAndBearing(e,s,c,d){let y={top:0,bottom:0,right:0,left:0};if(typeof(d=a.extend({padding:y,offset:[0,0],maxZoom:this.transform.maxZoom},d)).padding=="number"){let Mt=d.padding;d.padding={top:Mt,bottom:Mt,right:Mt,left:Mt}}d.padding=a.extend(y,d.padding);let v=this.transform,w=v.padding,T=v.project(a.LngLat.convert(e)),C=v.project(a.LngLat.convert(s)),k=T.rotate(-c*Math.PI/180),F=C.rotate(-c*Math.PI/180),j=new a.pointGeometry(Math.max(k.x,F.x),Math.max(k.y,F.y)),Y=new a.pointGeometry(Math.min(k.x,F.x),Math.min(k.y,F.y)),$=j.sub(Y),J=(v.width-(w.left+w.right+d.padding.left+d.padding.right))/$.x,lt=(v.height-(w.top+w.bottom+d.padding.top+d.padding.bottom))/$.y;if(lt<0||J<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let ht=Math.min(v.scaleZoom(v.scale*Math.min(J,lt)),d.maxZoom),gt=a.pointGeometry.convert(d.offset),ut=new a.pointGeometry((d.padding.left-d.padding.right)/2,(d.padding.top-d.padding.bottom)/2).rotate(c*Math.PI/180),kt=gt.add(ut).mult(v.scale/v.zoomScale(ht));return{center:v.unproject(T.add(C).div(2).sub(kt)),zoom:ht,bearing:c}}fitBounds(e,s,c){return this._fitInternal(this.cameraForBounds(e,s),s,c)}fitScreenCoordinates(e,s,c,d,y){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(e)),this.transform.pointLocation(a.pointGeometry.convert(s)),c,d),d,y)}_fitInternal(e,s,c){return e?(delete(s=a.extend(e,s)).padding,s.linear?this.easeTo(s,c):this.flyTo(s,c)):this}jumpTo(e,s){this.stop();let c=this.transform,d=!1,y=!1,v=!1;return"zoom"in e&&c.zoom!==+e.zoom&&(d=!0,c.zoom=+e.zoom),e.center!==void 0&&(c.center=a.LngLat.convert(e.center)),"bearing"in e&&c.bearing!==+e.bearing&&(y=!0,c.bearing=+e.bearing),"pitch"in e&&c.pitch!==+e.pitch&&(v=!0,c.pitch=+e.pitch),e.padding==null||c.isPaddingEqual(e.padding)||(c.padding=e.padding),this.fire(new a.Event("movestart",s)).fire(new a.Event("move",s)),d&&this.fire(new a.Event("zoomstart",s)).fire(new a.Event("zoom",s)).fire(new a.Event("zoomend",s)),y&&this.fire(new a.Event("rotatestart",s)).fire(new a.Event("rotate",s)).fire(new a.Event("rotateend",s)),v&&this.fire(new a.Event("pitchstart",s)).fire(new a.Event("pitch",s)).fire(new a.Event("pitchend",s)),this.fire(new a.Event("moveend",s))}easeTo(e,s){this._stop(!1,e.easeId),((e=a.extend({offset:[0,0],duration:500,easing:a.ease},e)).animate===!1||!e.essential&&a.exported.prefersReducedMotion)&&(e.duration=0);let c=this.transform,d=this.getZoom(),y=this.getBearing(),v=this.getPitch(),w=this.getPadding(),T="zoom"in e?+e.zoom:d,C="bearing"in e?this._normalizeBearing(e.bearing,y):y,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=a.pointGeometry.convert(e.offset),Y=c.centerPoint.add(j),$=c.pointLocation(Y),J=a.LngLat.convert(e.center||$);this._normalizeCenter(J);let lt=c.project($),ht=c.project(J).sub(lt),gt=c.zoomScale(T-d),ut,kt;e.around&&(ut=a.LngLat.convert(e.around),kt=c.locationPoint(ut));let Mt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||T!==d,this._rotating=this._rotating||y!==C,this._pitching=this._pitching||k!==v,this._padding=!c.isPaddingEqual(F),this._easeId=e.easeId,this._prepareEase(s,e.noMoveStart,Mt),this._ease(Tt=>{if(this._zooming&&(c.zoom=a.number(d,T,Tt)),this._rotating&&(c.bearing=a.number(y,C,Tt)),this._pitching&&(c.pitch=a.number(v,k,Tt)),this._padding&&(c.interpolatePadding(w,F,Tt),Y=c.centerPoint.add(j)),ut)c.setLocationAtPoint(ut,kt);else{let Ut=c.zoomScale(c.zoom-d),$t=T>d?Math.min(2,gt):Math.max(.5,gt),Pt=Math.pow($t,1-Tt),se=c.unproject(lt.add(ht.mult(Tt*Pt)).mult(Ut));c.setLocationAtPoint(c.renderWorldCopies?se.wrap():se,Y)}this._fireMoveEvents(s)},Tt=>{this._afterEase(s,Tt)},e),this}_prepareEase(e,s,c={}){this._moving=!0,s||c.moving||this.fire(new a.Event("movestart",e)),this._zooming&&!c.zooming&&this.fire(new a.Event("zoomstart",e)),this._rotating&&!c.rotating&&this.fire(new a.Event("rotatestart",e)),this._pitching&&!c.pitching&&this.fire(new a.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new a.Event("move",e)),this._zooming&&this.fire(new a.Event("zoom",e)),this._rotating&&this.fire(new a.Event("rotate",e)),this._pitching&&this.fire(new a.Event("pitch",e))}_afterEase(e,s){if(this._easeId&&s&&this._easeId===s)return;delete this._easeId;let c=this._zooming,d=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new a.Event("zoomend",e)),d&&this.fire(new a.Event("rotateend",e)),y&&this.fire(new a.Event("pitchend",e)),this.fire(new a.Event("moveend",e))}flyTo(e,s){if(!e.essential&&a.exported.prefersReducedMotion){let Oe=a.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Oe,s)}this.stop(),e=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},e);let c=this.transform,d=this.getZoom(),y=this.getBearing(),v=this.getPitch(),w=this.getPadding(),T="zoom"in e?a.clamp(+e.zoom,c.minZoom,c.maxZoom):d,C="bearing"in e?this._normalizeBearing(e.bearing,y):y,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:c.padding,j=c.zoomScale(T-d),Y=a.pointGeometry.convert(e.offset),$=c.centerPoint.add(Y),J=c.pointLocation($),lt=a.LngLat.convert(e.center||J);this._normalizeCenter(lt);let ht=c.project(J),gt=c.project(lt).sub(ht),ut=e.curve,kt=Math.max(c.width,c.height),Mt=kt/j,Tt=gt.mag();if("minZoom"in e){let Oe=a.clamp(Math.min(e.minZoom,d,T),c.minZoom,c.maxZoom),xi=kt/c.zoomScale(Oe-d);ut=Math.sqrt(xi/Tt*2)}let Ut=ut*ut;function $t(Oe){let xi=(Mt*Mt-kt*kt+(Oe?-1:1)*Ut*Ut*Tt*Tt)/(2*(Oe?Mt:kt)*Ut*Tt);return Math.log(Math.sqrt(xi*xi+1)-xi)}function Pt(Oe){return(Math.exp(Oe)-Math.exp(-Oe))/2}function se(Oe){return(Math.exp(Oe)+Math.exp(-Oe))/2}let Kt=$t(0),we=function(Oe){return se(Kt)/se(Kt+ut*Oe)},Ue=function(Oe){return kt*((se(Kt)*(Pt(xi=Kt+ut*Oe)/se(xi))-Pt(Kt))/Ut)/Tt;var xi},De=($t(1)-Kt)/ut;if(Math.abs(Tt)<1e-6||!isFinite(De)){if(Math.abs(kt-Mt)<1e-6)return this.easeTo(e,s);let Oe=Mt<kt?-1:1;De=Math.abs(Math.log(Mt/kt))/ut,Ue=function(){return 0},we=function(xi){return Math.exp(Oe*ut*xi)}}return e.duration="duration"in e?+e.duration:1e3*De/("screenSpeed"in e?+e.screenSpeed/ut:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=y!==C,this._pitching=k!==v,this._padding=!c.isPaddingEqual(F),this._prepareEase(s,!1),this._ease(Oe=>{let xi=Oe*De,Me=1/we(xi);c.zoom=Oe===1?T:d+c.scaleZoom(Me),this._rotating&&(c.bearing=a.number(y,C,Oe)),this._pitching&&(c.pitch=a.number(v,k,Oe)),this._padding&&(c.interpolatePadding(w,F,Oe),$=c.centerPoint.add(Y));let je=Oe===1?lt:c.unproject(ht.add(gt.mult(Ue(xi))).mult(Me));c.setLocationAtPoint(c.renderWorldCopies?je.wrap():je,$),this._fireMoveEvents(s)},()=>this._afterEase(s),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,s){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,s)}if(!e){let c=this.handlers;c&&c.stop(!1)}return this}_ease(e,s,c){c.animate===!1||c.duration===0?(e(1),s()):(this._easeStart=a.exported.now(),this._easeOptions=c,this._onEaseFrame=e,this._onEaseEnd=s,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let e=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,s){e=a.wrap(e,-180,180);let c=Math.abs(e-s);return Math.abs(e-360-s)<c&&(e-=360),Math.abs(e+360-s)<c&&(e+=360),e}_normalizeCenter(e){let s=this.transform;if(!s.renderWorldCopies||s.lngRange)return;let c=e.lng-s.center.lng;e.lng+=c>180?-360:c<-180?360:0}}class Ja{constructor(e={}){this.options=e,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",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(e,s){let c=this._map._getUIString(`AttributionControl.${s}`);e.title=c,e.setAttribute("aria-label",c)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(e){!e||e.sourceDataType!=="metadata"&&e.sourceDataType!=="visibility"&&e.dataType!=="style"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}let s=this._map.style.sourceCaches;for(let d in s){let y=s[d];if(y.used){let v=y.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(d=>String(d).trim()),e.sort((d,y)=>d.length-y.length),e=e.filter((d,y)=>{for(let v=y+1;v<e.length;v++)if(e[v].indexOf(d)>=0)return!1;return!0});let c=e.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,e.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class ml{constructor(e={}){this.options=e,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl mapboxgl-ctrl");let s=L.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return s.target="_blank",s.rel="noopener nofollow",s.href="https://maplibre.org/",s.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),s.setAttribute("rel","noopener nofollow"),this._container.appendChild(s),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let e=this._container.children;if(e.length){let s=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact","mapboxgl-compact"):s.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Th{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let s=++this._id;return this._queue.push({callback:e,id:s,cancelled:!1}),s}remove(e){let s=this._currentlyRunning,c=s?this._queue.concat(s):this._queue;for(let d of c)if(d.id===e)return void(d.cancelled=!0)}run(e=0){let s=this._currentlyRunning=this._queue;this._queue=[];for(let c of s)if(!c.cancelled&&(c.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let Eh={"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"},eu={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!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,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},on={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ya{constructor(e,s,c=!1){this._clickTolerance=10,this.element=s,this.mouseRotate=new ie({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,c&&(this.mousePitch=new ll({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),L.addEventListener(s,"mousedown",this.mousedown),L.addEventListener(s,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(s,"touchmove",this.touchmove),L.addEventListener(s,"touchend",this.touchend),L.addEventListener(s,"touchcancel",this.reset)}down(e,s){this.mouseRotate.mousedown(e,s),this.mousePitch&&this.mousePitch.mousedown(e,s),L.disableDrag()}move(e,s){let c=this.map,d=this.mouseRotate.mousemoveWindow(e,s);if(d&&d.bearingDelta&&c.setBearing(c.getBearing()+d.bearingDelta),this.mousePitch){let y=this.mousePitch.mousemoveWindow(e,s);y&&y.pitchDelta&&c.setPitch(c.getPitch()+y.pitchDelta)}}off(){let e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(e,"touchmove",this.touchmove),L.removeEventListener(e,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup)}mousedown(e){this.down(a.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),L.mousePos(this.element,e)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)}mousemove(e){this.move(e,L.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){e.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function le(p,e,s){if(p=new a.LngLat(p.lng,p.lat),e){let c=new a.LngLat(p.lng-360,p.lat),d=new a.LngLat(p.lng+360,p.lat),y=s.locationPoint(p).distSqr(e);s.locationPoint(c).distSqr(e)<y?p=c:s.locationPoint(d).distSqr(e)<y&&(p=d)}for(;Math.abs(p.lng-s.center.lng)>180;){let c=s.locationPoint(p);if(c.x>=0&&c.y>=0&&c.x<=s.width&&c.y<=s.height)break;p.lng>s.center.lng?p.lng-=360:p.lng+=360}return p}let ye={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 la(p,e,s){let c=p.classList;for(let d in ye)c.remove(`maplibregl-${s}-anchor-${d}`,`mapboxgl-${s}-anchor-${d}`);c.add(`maplibregl-${s}-anchor-${e}`,`mapboxgl-${s}-anchor-${e}`)}class ha extends a.Evented{constructor(e,s){if(super(),(e instanceof HTMLElement||s)&&(e=a.extend({element:e},s)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),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._element=e.element,this._offset=a.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");let c=L.createNS("http://www.w3.org/2000/svg","svg"),d=41,y=27;c.setAttributeNS(null,"display","block"),c.setAttributeNS(null,"height",`${d}px`),c.setAttributeNS(null,"width",`${y}px`),c.setAttributeNS(null,"viewBox",`0 0 ${y} ${d}`);let v=L.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let w=L.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");let T=L.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.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 gt of C){let ut=L.createNS("http://www.w3.org/2000/svg","ellipse");ut.setAttributeNS(null,"opacity","0.04"),ut.setAttributeNS(null,"cx","10.5"),ut.setAttributeNS(null,"cy","5.80029008"),ut.setAttributeNS(null,"rx",gt.rx),ut.setAttributeNS(null,"ry",gt.ry),T.appendChild(ut)}let k=L.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);let F=L.createNS("http://www.w3.org/2000/svg","path");F.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"),k.appendChild(F);let j=L.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"opacity","0.25"),j.setAttributeNS(null,"fill","#000000");let Y=L.createNS("http://www.w3.org/2000/svg","path");Y.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"),j.appendChild(Y);let $=L.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");let J=L.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(8.0, 8.0)");let lt=L.createNS("http://www.w3.org/2000/svg","circle");lt.setAttributeNS(null,"fill","#000000"),lt.setAttributeNS(null,"opacity","0.25"),lt.setAttributeNS(null,"cx","5.5"),lt.setAttributeNS(null,"cy","5.5"),lt.setAttributeNS(null,"r","5.4999962");let ht=L.createNS("http://www.w3.org/2000/svg","circle");ht.setAttributeNS(null,"fill","#FFFFFF"),ht.setAttributeNS(null,"cx","5.5"),ht.setAttributeNS(null,"cy","5.5"),ht.setAttributeNS(null,"r","5.4999962"),J.appendChild(lt),J.appendChild(ht),w.appendChild(T),w.appendChild(k),w.appendChild(j),w.appendChild($),w.appendChild(J),c.appendChild(w),c.setAttributeNS(null,"height",d*this._scale+"px"),c.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(c),this._offset=a.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",c=>{c.preventDefault()}),this._element.addEventListener("mousedown",c=>{c.preventDefault()}),la(this._element,this._anchor,"marker"),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._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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=a.LngLat.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 d=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":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=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}_onKeyPress(e){let s=e.code,c=e.charCode||e.keyCode;s!=="Space"&&s!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(e){let s=e.originalEvent.target,c=this._element;this._popup&&(s===c||c.contains(s))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}_update(e){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=le(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let s="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?s=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(s=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let c="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?c="rotateX(0deg)":this._pitchAlignment==="map"&&(c=`rotateX(${this._map.getPitch()}deg)`),e&&e.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${ye[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${c} ${s}`)}getOffset(){return this._offset}setOffset(e){return this._offset=a.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){let s=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=s}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 a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){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 a.Event("dragend")),this._state="inactive"}_addDragHandler(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))}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}}let gl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Ni,Wn=0,ur=!1,iu={maxWidth:100,unit:"metric"};function ca(p,e,s){let c=s&&s.maxWidth||100,d=p._container.clientHeight/2,y=p.unproject([0,d]),v=p.unproject([c,d]),w=y.distanceTo(v);if(s&&s.unit==="imperial"){let T=3.2808*w;T>5280?li(e,c,T/5280,p._getUIString("ScaleControl.Miles")):li(e,c,T,p._getUIString("ScaleControl.Feet"))}else s&&s.unit==="nautical"?li(e,c,w/1852,p._getUIString("ScaleControl.NauticalMiles")):w>=1e3?li(e,c,w/1e3,p._getUIString("ScaleControl.Kilometers")):li(e,c,w,p._getUIString("ScaleControl.Meters"))}function li(p,e,s,c){let d=function(y){let v=Math.pow(10,`${Math.floor(y)}`.length-1),w=y/v;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:function(T){let C=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*C)/C}(w),v*w}(s);p.style.width=e*(d/s)+"px",p.innerHTML=`${d} ${c}`}let Ui={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ih=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function zs(p){if(p){if(typeof p=="number"){let e=Math.round(Math.sqrt(.5*Math.pow(p,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,p),"top-left":new a.pointGeometry(e,e),"top-right":new a.pointGeometry(-e,e),bottom:new a.pointGeometry(0,-p),"bottom-left":new a.pointGeometry(e,-e),"bottom-right":new a.pointGeometry(-e,-e),left:new a.pointGeometry(p,0),right:new a.pointGeometry(-p,0)}}if(p instanceof a.pointGeometry||Array.isArray(p)){let e=a.pointGeometry.convert(p);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:a.pointGeometry.convert(p.center||[0,0]),top:a.pointGeometry.convert(p.top||[0,0]),"top-left":a.pointGeometry.convert(p["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(p["top-right"]||[0,0]),bottom:a.pointGeometry.convert(p.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(p["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(p["bottom-right"]||[0,0]),left:a.pointGeometry.convert(p.left||[0,0]),right:a.pointGeometry.convert(p.right||[0,0])}}return zs(new a.pointGeometry(0,0))}let ua={supported:M,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Ka{constructor(p){var e;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(p=a.extend({},eu,p)).minZoom!=null&&p.maxZoom!=null&&p.minZoom>p.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(p.minPitch!=null&&p.maxPitch!=null&&p.minPitch>p.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(p.minPitch!=null&&p.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(p.maxPitch!=null&&p.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ea(p.minZoom,p.maxZoom,p.minPitch,p.maxPitch,p.renderWorldCopies),{bearingSnap:p.bearingSnap}),this._interactive=p.interactive,this._maxTileCacheSize=p.maxTileCacheSize,this._failIfMajorPerformanceCaveat=p.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=p.preserveDrawingBuffer,this._antialias=p.antialias,this._trackResize=p.trackResize,this._bearingSnap=p.bearingSnap,this._refreshExpiredTiles=p.refreshExpiredTiles,this._fadeDuration=p.fadeDuration,this._crossSourceCollisions=p.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=p.collectResourceTiming,this._renderTaskQueue=new Th,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Eh,p.locale),this._clickTolerance=p.clickTolerance,this._pixelRatio=(e=p.pixelRatio)!==null&&e!==void 0?e:devicePixelRatio,this._requestManager=new Q(p.transformRequest),typeof p.container=="string"){if(this._container=document.getElementById(p.container),!this._container)throw new Error(`Container '${p.container}' not found.`)}else{if(!(p.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=p.container}if(p.maxBounds&&this.setMaxBounds(p.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Fr(this,p),this._hash=p.hash&&new fh(typeof p.hash=="string"&&p.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch}),p.bounds&&(this.resize(),this.fitBounds(p.bounds,a.extend({},p.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=p.localIdeographFontFamily,p.style&&this.setStyle(p.style,{localIdeographFontFamily:p.localIdeographFontFamily}),p.attributionControl&&this.addControl(new Ja({customAttribution:p.customAttribution})),p.maplibreLogo&&this.addControl(new ml,p.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new a.Event(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new a.Event(`${s.dataType}dataloading`,s))}),this.on("dataabort",s=>{this.fire(new a.Event("sourcedataabort",s))})}_getMapId(){return this._mapId}addControl(p,e){if(e===void 0&&(e=p.getDefaultPosition?p.getDefaultPosition():"top-right"),!p||!p.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let s=p.onAdd(this);this._controls.push(p);let c=this._controlPositions[e];return e.indexOf("bottom")!==-1?c.insertBefore(s,c.firstChild):c.appendChild(s),this}removeControl(p){if(!p||!p.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(p);return e>-1&&this._controls.splice(e,1),p.onRemove(this),this}hasControl(p){return this._controls.indexOf(p)>-1}resize(p){let e=this._containerDimensions(),s=e[0],c=e[1];this._resizeCanvas(s,c,this.getPixelRatio()),this.transform.resize(s,c),this.painter.resize(s,c,this.getPixelRatio());let d=!this._moving;return d&&(this.stop(),this.fire(new a.Event("movestart",p)).fire(new a.Event("move",p))),this.fire(new a.Event("resize",p)),d&&this.fire(new a.Event("moveend",p)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(p){let[e,s]=this._containerDimensions();this._pixelRatio=p,this._resizeCanvas(e,s,p),this.painter.resize(e,s,p)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(p){return this.transform.setMaxBounds(a.LngLatBounds.convert(p)),this._update()}setMinZoom(p){if((p=p??-2)>=-2&&p<=this.transform.maxZoom)return this.transform.minZoom=p,this._update(),this.getZoom()<p&&this.setZoom(p),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(p){if((p=p??22)>=this.transform.minZoom)return this.transform.maxZoom=p,this._update(),this.getZoom()>p&&this.setZoom(p),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(p){if((p=p??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(p>=0&&p<=this.transform.maxPitch)return this.transform.minPitch=p,this._update(),this.getPitch()<p&&this.setPitch(p),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(p){if((p=p??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(p>=this.transform.minPitch)return this.transform.maxPitch=p,this._update(),this.getPitch()>p&&this.setPitch(p),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(p){return this.transform.renderWorldCopies=p,this._update()}project(p){return this.transform.locationPoint(a.LngLat.convert(p))}unproject(p){return this.transform.pointLocation(a.pointGeometry.convert(p))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(p,e,s){if(p==="mouseenter"||p==="mouseover"){let c=!1;return{layer:e,listener:s,delegates:{mousemove:y=>{let v=this.getLayer(e)?this.queryRenderedFeatures(y.point,{layers:[e]}):[];v.length?c||(c=!0,s.call(this,new vr(p,this,y.originalEvent,{features:v}))):c=!1},mouseout:()=>{c=!1}}}}if(p==="mouseleave"||p==="mouseout"){let c=!1;return{layer:e,listener:s,delegates:{mousemove:v=>{(this.getLayer(e)?this.queryRenderedFeatures(v.point,{layers:[e]}):[]).length?c=!0:c&&(c=!1,s.call(this,new vr(p,this,v.originalEvent)))},mouseout:v=>{c&&(c=!1,s.call(this,new vr(p,this,v.originalEvent)))}}}}{let c=d=>{let y=this.getLayer(e)?this.queryRenderedFeatures(d.point,{layers:[e]}):[];y.length&&(d.features=y,s.call(this,d),delete d.features)};return{layer:e,listener:s,delegates:{[p]:c}}}}on(p,e,s){if(s===void 0)return super.on(p,e);let c=this._createDelegatedListener(p,e,s);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[p]=this._delegatedListeners[p]||[],this._delegatedListeners[p].push(c);for(let d in c.delegates)this.on(d,c.delegates[d]);return this}once(p,e,s){if(s===void 0)return super.once(p,e);let c=this._createDelegatedListener(p,e,s);for(let d in c.delegates)this.once(d,c.delegates[d]);return this}off(p,e,s){return s===void 0?super.off(p,e):(this._delegatedListeners&&this._delegatedListeners[p]&&(c=>{let d=this._delegatedListeners[p];for(let y=0;y<d.length;y++){let v=d[y];if(v.layer===e&&v.listener===s){for(let w in v.delegates)this.off(w,v.delegates[w]);return d.splice(y,1),this}}})(),this)}queryRenderedFeatures(p,e){if(!this.style)return[];let s;if(e!==void 0||p===void 0||p instanceof a.pointGeometry||Array.isArray(p)||(e=p,p=void 0),e=e||{},(p=p||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof p[0]=="number")s=[a.pointGeometry.convert(p)];else{let c=a.pointGeometry.convert(p[0]),d=a.pointGeometry.convert(p[1]);s=[c,new a.pointGeometry(d.x,c.y),d,new a.pointGeometry(c.x,d.y),c]}return this.style.queryRenderedFeatures(s,e,this.transform)}querySourceFeatures(p,e){return this.style.querySourceFeatures(p,e)}setStyle(p,e){return(e=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&p?(this._diffStyle(p,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(p,e))}setTransformRequest(p){return this._requestManager.setTransformRequest(p),this}_getUIString(p){let e=this._locale[p];if(e==null)throw new Error(`Missing UI string '${p}'`);return e}_updateStyle(p,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),p?(this.style=new Zi(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof p=="string"?this.style.loadURL(p):this.style.loadJSON(p),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Zi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,e){if(typeof p=="string"){let s=this._requestManager.transformRequest(p,a.ResourceType.Style);a.getJSON(s,(c,d)=>{c?this.fire(new a.ErrorEvent(c)):d&&this._updateDiff(d,e)})}else typeof p=="object"&&this._updateDiff(p,e)}_updateDiff(p,e){try{this.style.setState(p)&&this._update(!0)}catch(s){a.warnOnce(`Unable to perform style diff: ${s.message||s.error||s}. Rebuilding the style from scratch.`),this._updateStyle(p,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(p,e){return this._lazyInitEmptyStyle(),this.style.addSource(p,e),this._update(!0)}isSourceLoaded(p){let e=this.style&&this.style.sourceCaches[p];if(e!==void 0)return e.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${p}'`)))}areTilesLoaded(){let p=this.style&&this.style.sourceCaches;for(let e in p){let s=p[e]._tiles;for(let c in s){let d=s[c];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(p,e,s){return this._lazyInitEmptyStyle(),this.style.addSourceType(p,e,s)}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}addImage(p,e,{pixelRatio:s=1,sdf:c=!1,stretchX:d,stretchY:y,content:v}={}){if(this._lazyInitEmptyStyle(),e instanceof HTMLImageElement||a.isImageBitmap(e)){let{width:w,height:T,data:C}=a.exported.getImageData(e);this.style.addImage(p,{data:new a.RGBAImage({width:w,height:T},C),pixelRatio:s,stretchX:d,stretchY:y,content:v,sdf:c,version:0})}else{if(e.width===void 0||e.height===void 0)return this.fire(new a.ErrorEvent(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:w,height:T,data:C}=e,k=e;this.style.addImage(p,{data:new a.RGBAImage({width:w,height:T},new Uint8Array(C)),pixelRatio:s,stretchX:d,stretchY:y,content:v,sdf:c,version:0,userImage:k}),k.onAdd&&k.onAdd(this,p)}}}updateImage(p,e){let s=this.style.getImage(p);if(!s)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let c=e instanceof HTMLImageElement||a.isImageBitmap(e)?a.exported.getImageData(e):e,{width:d,height:y,data:v}=c;if(d===void 0||y===void 0)return this.fire(new a.ErrorEvent(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(d!==s.data.width||y!==s.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let w=!(e instanceof HTMLImageElement||a.isImageBitmap(e));s.data.replace(v,w),this.style.updateImage(p,s)}hasImage(p){return p?!!this.style.getImage(p):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(p){this.style.removeImage(p)}loadImage(p,e){a.getImage(this._requestManager.transformRequest(p,a.ResourceType.Image),e)}listImages(){return this.style.listImages()}addLayer(p,e){return this._lazyInitEmptyStyle(),this.style.addLayer(p,e),this._update(!0)}moveLayer(p,e){return this.style.moveLayer(p,e),this._update(!0)}removeLayer(p){return this.style.removeLayer(p),this._update(!0)}getLayer(p){return this.style.getLayer(p)}setLayerZoomRange(p,e,s){return this.style.setLayerZoomRange(p,e,s),this._update(!0)}setFilter(p,e,s={}){return this.style.setFilter(p,e,s),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,e,s,c={}){return this.style.setPaintProperty(p,e,s,c),this._update(!0)}getPaintProperty(p,e){return this.style.getPaintProperty(p,e)}setLayoutProperty(p,e,s,c={}){return this.style.setLayoutProperty(p,e,s,c),this._update(!0)}getLayoutProperty(p,e){return this.style.getLayoutProperty(p,e)}setLight(p,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(p,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(p,e){return this.style.setFeatureState(p,e),this._update()}removeFeatureState(p,e){return this.style.removeFeatureState(p,e),this._update()}getFeatureState(p){return this.style.getFeatureState(p)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let p=0,e=0;return this._container&&(p=this._container.clientWidth||400,e=this._container.clientHeight||300),[p,e]}_setupContainer(){let p=this._container;p.classList.add("maplibregl-map","mapboxgl-map");let e=this._canvasContainer=L.create("div","maplibregl-canvas-container mapboxgl-canvas-container",p);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let s=this._containerDimensions();this._resizeCanvas(s[0],s[1],this.getPixelRatio());let c=this._controlContainer=L.create("div","maplibregl-control-container mapboxgl-control-container",p),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(y=>{d[y]=L.create("div",`maplibregl-ctrl-${y} mapboxgl-ctrl-${y}`,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,e,s){this._canvas.width=s*p,this._canvas.height=s*e,this._canvas.style.width=`${p}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let p=a.extend({},M.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),e=this._canvas.getContext("webgl",p)||this._canvas.getContext("experimental-webgl",p);e?(this.painter=new al(e,this.transform),a.exported$1.testSupport(e)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(p){p.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:p}))}_contextRestored(p){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:p}))}_onMapScroll(p){if(p.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(p){return this.style?(this._styleDirty=this._styleDirty||p,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(p){return this._update(),this._renderTaskQueue.add(p)}_cancelRenderFrame(p){this._renderTaskQueue.remove(p)}_render(p){let e,s=0,c=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(e=c.createQueryEXT(),c.beginQueryEXT(c.TIME_ELAPSED_EXT,e),s=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(p),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let v=this.transform.zoom,w=a.exported.now();this.style.zoomHistory.update(v,w);let T=new a.EvaluationParameters(v,{now:w,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=T.crossFadingFactor();C===1&&C===this._crossFadingFactor||(d=!0,this._crossFadingFactor=C),this.style.update(T)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let v=a.exported.now()-s;c.endQueryEXT(c.TIME_ELAPSED_EXT,e),setTimeout(()=>{let w=c.getQueryObjectEXT(e,c.QUERY_RESULT_EXT)/1e6;c.deleteQueryEXT(e),this.fire(new a.Event("gpu-timing-frame",{cpuTime:v,gpuTime:w}))},50)}if(this.listens("gpu-timing-layer")){let v=this.painter.collectGpuTimers();setTimeout(()=>{let w=this.painter.queryGpuTimers(v);this.fire(new a.Event("gpu-timing-layer",{layerTimes:w}))},50)}let y=this._sourcesDirty||this._styleDirty||this._placementDirty;return y||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.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("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let p=this.painter.context.gl.getExtension("WEBGL_lose_context");p&&p.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(p=>{a.PerformanceUtils.frame(p),this._frame=null,this._render(p)}))}_onWindowOnline(){this._update()}_onWindowResize(p){this._trackResize&&this.resize({originalEvent:p})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(p){this._showTileBoundaries!==p&&(this._showTileBoundaries=p,this._update())}get showPadding(){return!!this._showPadding}set showPadding(p){this._showPadding!==p&&(this._showPadding=p,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(p){this._showCollisionBoxes!==p&&(this._showCollisionBoxes=p,p?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(p){this._showOverdrawInspector!==p&&(this._showOverdrawInspector=p,this._update())}get repaint(){return!!this._repaint}set repaint(p){this._repaint!==p&&(this._repaint=p,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(p){this._vertices=p,this._update()}_setCacheLimits(p,e){a.setCacheLimits(p,e)}},NavigationControl:class{constructor(p){this.options=a.extend({},on,p),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let p=this._map.getZoom(),e=p===this._map.getMaxZoom(),s=p===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())}_rotateCompassArrow(){let p=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=p}onAdd(p){return this._map=p,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 Ya(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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(p,e){let s=L.create("button",p,this._container);return s.type="button",s.addEventListener("click",e),s}_setButtonTitle(p,e){let s=this._map._getUIString(`NavigationControl.${e}`);p.title=s,p.setAttribute("aria-label",s)}},GeolocateControl:class extends a.Evented{constructor(p){super(),this.options=a.extend({},gl,p),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(p){var e;return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,Ni!==void 0?e(Ni):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(s=>{Ni=s.state!=="denied",e(Ni)}):(Ni=!!window.navigator.geolocation,e(Ni)),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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Wn=0,ur=!1}_isOutOfMapMaxBounds(p){let e=this._map.getMaxBounds(),s=p.coords;return e&&(s.longitude<e.getWest()||s.longitude>e.getEast()||s.latitude<e.getSouth()||s.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(p){if(this._map){if(this._isOutOfMapMaxBounds(p))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",p)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=p,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(p),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(p),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",p)),this._finish()}}_updateCamera(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude),s=p.coords.accuracy,c=this._map.getBearing(),d=a.extend({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(e.toBounds(s),d,{geolocateSource:!0})}_updateMarker(p){if(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude);this._accuracyCircleMarker.setLngLat(e).addTo(this._map),this._userLocationDotMarker.setLngLat(e).addTo(this._map),this._accuracy=p.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let p=this._map._container.clientHeight/2,e=this._map.unproject([0,p]),s=this._map.unproject([1,p]),c=e.distanceTo(s),d=Math.ceil(2*this._accuracy/c);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(p){if(this._map){if(this.options.trackUserLocation)if(p.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(p.code===3&&ur)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",p)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(p){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",p===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ha(this._dotElement),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ha({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",e=>{e.geolocateSource||this._watchState!=="ACTIVE_LOCK"||e.originalEvent&&e.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Wn--,ur=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let p;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Wn++,Wn>1?(p={maximumAge:6e5,timeout:0},ur=!0):(p=this.options.positionOptions,ur=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ja,LogoControl:ml,ScaleControl:class{constructor(p){this.options=a.extend({},iu,p),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ca(this._map,this._container,this.options)}onAdd(p){return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",p.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(p){this.options.unit=p,ca(this._map,this._container,this.options)}},FullscreenControl:class{constructor(p){this._fullscreen=!1,p&&p.container&&(p.container instanceof HTMLElement?this._container=p.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(p){return this._map=p,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let p=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",p).setAttribute("aria-hidden","true"),p.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let p=this._getTitle();this._fullscreenButton.setAttribute("aria-label",p),this._fullscreenButton.title=p}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?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._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(p){super(),this.options=a.extend(Object.create(Ui),p),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(p){return this._map&&this.remove(),this._map=p,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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&L.remove(this._content),this._container&&(L.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 a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(p){return this._lngLat=a.LngLat.convert(p),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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(p){return this.setDOMContent(document.createTextNode(p))}setHTML(p){let e=document.createDocumentFragment(),s=document.createElement("body"),c;for(s.innerHTML=p;c=s.firstChild,c;)e.appendChild(c);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(p){return this.options.maxWidth=p,this._update(),this}setDOMContent(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(p){this._container&&this._container.classList.add(p)}removeClassName(p){this._container&&this._container.classList.remove(p)}setOffset(p){return this.options.offset=p,this._update(),this}toggleClassName(p){if(this._container)return this._container.classList.toggle(p)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button mapboxgl-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))}_onMouseUp(p){this._update(p.point)}_onMouseMove(p){this._update(p.point)}_onDrag(p){this._update(p.point)}_update(p){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=L.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(y=>this._container.classList.add(y)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),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=le(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!p))return;let e=this._pos=this._trackPointer&&p?p:this._map.project(this._lngLat),s=this.options.anchor,c=zs(this.options.offset);if(!s){let y=this._container.offsetWidth,v=this._container.offsetHeight,w;w=e.y+c.bottom.y<v?["top"]:e.y>this._map.transform.height-v?["bottom"]:[],e.x<y/2?w.push("left"):e.x>this._map.transform.width-y/2&&w.push("right"),s=w.length===0?"bottom":w.join("-")}let d=e.add(c[s]).round();L.setTransform(this._container,`${ye[s]} translate(${d.x}px,${d.y}px)`),la(this._container,s,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let p=this._container.querySelector(Ih);p&&p.focus()}_onClose(){this.remove()}},Marker:ha,Style:Zi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:sn,GeoJSONSource:gn,ImageSource:Dr,RasterDEMTileSource:bi,RasterTileSource:Wr,VectorTileSource:kr,VideoSource:nn,prewarm:function(){U().acquire(yn)},clearPrewarmedResources:function(){let p=mt;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(yn),mt=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()"))},get workerCount(){return Br.workerCount},set workerCount(p){Br.workerCount=p},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(p){a.config.MAX_PARALLEL_IMAGE_REQUESTS=p},clearStorage(p){a.clearTileCache(p)},workerUrl:"",addProtocol(p,e){a.config.REGISTERED_PROTOCOLS[p]=e},removeProtocol(p){delete a.config.REGISTERED_PROTOCOLS[p]}};return ci.extend(ua,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),ua});var _=h;return _})});W();Qr();W();Qr();W();W();W();function ya(n){var o=new Error(n);return o.source="ulid",o}var ec="0123456789ABCDEFGHJKMNPQRSTVWXYZ",fo=ec.length,qu=Math.pow(2,48)-1,ju=10,of=16;function C0(n){var o=Math.floor(n()*fo);return o===fo&&(o=fo-1),ec.charAt(o)}function A0(n,o){if(isNaN(n))throw new Error(n+" must be a number");if(n>qu)throw ya("cannot encode time greater than "+qu);if(n<0)throw ya("time must be positive");if(Number.isInteger(n)===!1)throw ya("time must be an integer");for(var h=void 0,g="";o>0;o--)h=n%fo,g=ec.charAt(h)+g,n=(n-h)/fo;return g}function P0(n,o){for(var h="";n>0;n--)h=C0(o)+h;return h}function lf(n){if(n.length!==ju+of)throw ya("malformed ulid");var o=n.substr(0,ju).split("").reverse().reduce(function(h,g,_){var a=ec.indexOf(g);if(a===-1)throw ya("invalid character found: "+g);return h+=a*Math.pow(fo,_)},0);if(o>qu)throw ya("malformed ulid, timestamp too large");return o}function z0(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=arguments[1];o||(o=typeof window<"u"?window:null);var h=o&&(o.crypto||o.msCrypto);if(h)return function(){var _=new Uint8Array(1);return h.getRandomValues(_),_[0]/255};try{var g=af();return function(){return g.randomBytes(1).readUInt8()/255}}catch{}if(n){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw ya("secure crypto unusable, insecure Math.random not allowed")}function k0(n){return n||(n=z0()),function(h){return isNaN(h)&&(h=Date.now()),A0(h,ju)+P0(of,n)}}var hf=k0();var cf=()=>typeof localStorage<"u",uf=24*60*60*1e3,L0=30*uf,Q1=91*uf;function Bl(){let n="c"+hf().toLowerCase();return cf()&&localStorage.setItem("api-key",n),n}function pf(){if(!cf())return Bl();let n=localStorage.getItem("api-key");if(n==null||!n.startsWith("c"))return Bl();try{let o=lf(n.slice(1).toUpperCase());return Date.now()-L0<o?n:Bl()}catch{return Bl()}}W();W();W();var Bi=class{constructor(o,h,g,_){this.x=o,this.y=h,this.width=g,this.height=_}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(o){return this.x<o.right&&o.x<this.right&&this.y<o.bottom&&o.y<this.bottom}containsBounds(o){return Bi.contains(this,o)}intersection(o){let h=Math.max(this.x,o.x),g=Math.min(this.x+this.width,o.x+o.width),_=Math.max(this.y,o.y),a=Math.min(this.y+this.height,o.y+o.height);return g>h&&a>_?new Bi(h,_,g-h,a-_):null}static union(o){if(o.length===0)throw new Error("Union on empty list is not allowed");let{x:h,y:g}=o[0],_=h+o[0].width,a=g+o[0].height;for(let M=1;M<o.length;++M){let S=o[M];h=Math.min(h,S.x),_=Math.max(_,S.x+S.width),g=Math.min(g,S.y),a=Math.max(a,S.y+S.height)}return new Bi(h,g,_-h,a-g)}union(o){return Bi.union([this,o])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(o,h=o){return new Bi(this.x*o,this.y*h,this.width*o,this.height*h)}scaleFromCenter(o,h=o){let g=this.width*o,_=this.height*h;return new Bi(this.x-.5*(g-this.width),this.y-.5*(_-this.height),g,_)}pad(o,h=o){return new Bi(this.x-o,this.y-h,this.width+o*2,this.height+h*2)}round(o=0){let h=Math.round(this.x-o),g=Math.round(this.y-o);return new Bi(h,g,Math.round(this.right+o)-h,Math.round(this.bottom+o)-g)}add(o){return new Bi(this.x+o.x,this.y+o.y,this.width,this.height)}subtract(o){return new Bi(this.x-o.x,this.y-o.y,this.width,this.height)}static fromMultiPolygon(o){if(o.length===0)return new Bi(0,0,0,0);let h=o[0][0][0][0],g=o[0][0][0][1],_=h,a=g;for(let[M]of o)for(let[S,D]of M)S<h?h=S:S>_&&(_=S),D<g?g=D:D>a&&(a=D);return new Bi(h,g,_-h,a-g)}static fromBbox([o,h,g,_]){return new Bi(Math.min(o,g),Math.min(h,_),Math.abs(g-o),Math.abs(_-h))}static fromUpperLeftLowerRight(o,h){return new Bi(o.x,o.y,h.x-o.x,h.y-o.y)}static fromJson(o){return new Bi(o.x,o.y,o.width,o.height)}static compareArea(o,h){let g=o.width*o.height-h.width*h.height;if(g!==0)return g;let _=o.x-h.x;return _===0?o.y-h.y:_}static contains(o,h){return o.x<=h.x&&o.x+o.width>=h.x+h.width&&o.y<=h.y&&o.y+o.height>=h.y+h.height}};W();var Ze;(function(n){n[n.Google=3857]="Google",n[n.Wgs84=4326]="Wgs84",n[n.Nztm2000=2193]="Nztm2000",n[n.Citm2000=3793]="Citm2000"})(Ze||(Ze={}));var $u={google:Ze.Google,epsg3857:Ze.Google,[Ze.Google]:Ze.Google,globalmercator:Ze.Google,wgs84:Ze.Wgs84,epsg4326:Ze.Wgs84,[Ze.Wgs84]:Ze.Wgs84,nztm:Ze.Nztm2000,epsg2193:Ze.Nztm2000,[Ze.Nztm2000]:Ze.Nztm2000,nztm2000:Ze.Nztm2000,citm:Ze.Citm2000,epsg3793:Ze.Citm2000,[Ze.Citm2000]:Ze.Citm2000,citm2000:Ze.Citm2000},qe=class{constructor(o){if(this.code=o,qe.Codes.has(o))throw new Error(`Duplicate EPSG code created: ${o}`);qe.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(o){let h=qe.Codes.get(o);if(h==null)throw new Error(`Invalid EPSG:${o}`);return h}static tryGet(o){if(o!=null)return qe.Codes.get(o)}static parseCode(o){var h;return o.startsWith("urn:")?$u[o.slice(o.lastIndexOf(":")+1)]:o.startsWith("https://")?$u[o.slice(o.lastIndexOf("/")+1)]:(h=$u[o.replace(/[\W_]/g,"").toLowerCase()])!==null&&h!==void 0?h:null}static parse(o){let h=qe.parseCode(o);return h==null?null:qe.get(h)}};qe.Codes=new Map;qe.Google=new qe(Ze.Google);qe.Wgs84=new qe(Ze.Wgs84);qe.Nztm2000=new qe(Ze.Nztm2000);qe.Citm2000=new qe(Ze.Citm2000);W();var rb="0".charCodeAt(0),nb="1".charCodeAt(0),sb="2".charCodeAt(0),ab="3".charCodeAt(0);W();W();var mo;(function(n){n[n.Xy=0]="Xy",n[n.Yx=1]="Yx"})(mo||(mo={}));function df(n){return n===qe.Nztm2000?mo.Yx:mo.Xy}function D0(n,o){return o.scaleDenominator-n.scaleDenominator}var Vs=class{constructor(o){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=o,this.tileSize=o.tileMatrix[0].tileHeight;let h=o.tileMatrix.slice().sort(D0),g={};for(let N of h){if(g[N.identifier])throw new Error(`Duplicate tileMatrix identifier ${N.identifier}`);if(N.tileHeight!==N.tileWidth)throw new Error("Only square tiles supported");if(N.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");g[N.identifier]=!0}this.zooms=h;let _=qe.parse(o.supportedCRS);if(_==null)throw new Error(`Unable to find supported projection ${o.supportedCRS}`);this.projection=_,df(this.projection)===mo.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:a,upperCorner:M}=o.boundingBox,S=a[this.indexX],D=a[this.indexY];this.extent=new Bi(S,D,M[this.indexX]-S,M[this.indexY]-D)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(o){let h=this.zooms[o];if(h==null)throw new Error(`Zoom not found :${o}`);return h.scaleDenominator*28e-5}tileToPixels(o,h){return{x:o*this.tileSize,y:h*this.tileSize}}pixelsToTile(o,h,g){let _=Math.floor(o/this.tileSize),a=Math.floor(h/this.tileSize);return{x:_,y:a,z:g}}sourceToPixels(o,h,g){let _=this.zooms[g],a=this.pixelScale(g),M=(o-_.topLeftCorner[this.indexX])/a,S=(_.topLeftCorner[this.indexY]-h)/a;return{x:M,y:S}}pixelsToSource(o,h,g){let _=this.zooms[g],a=this.pixelScale(g),M=_.topLeftCorner[this.indexX]+o*a,S=_.topLeftCorner[this.indexY]-h*a;return{x:M,y:S}}tileToSource(o){let h=this.tileToPixels(o.x,o.y);return this.pixelsToSource(h.x,h.y,o.z)}tileToSourceBounds(o){let h=this.tileToSource(o),g=this.pixelScale(o.z)*this.tileSize;return new Bi(h.x,h.y-g,g,g)}*topLevelTiles(){let{matrixWidth:h,matrixHeight:g}=this.zooms[0];for(let _=0;_<g;++_)for(let a=0;a<h;++a)yield{x:a,y:_,z:0};return null}*coverTile(o){if(o==null)return yield*this.topLevelTiles(),null;let h=o.z+1,{matrixWidth:g,matrixHeight:_}=this.zooms[o.z],{matrixWidth:a,matrixHeight:M}=this.zooms[h],S=a/g,D=M/_,N=Math.floor(o.x*S),L=Math.floor(o.y*D),Q=Math.ceil((o.x+1)*S),pt=Math.ceil((o.y+1)*D);for(let ot=L;ot<pt;++ot)for(let ft=N;ft<Q;++ft)yield{x:ft,y:ot,z:h};return null}static tileToName(o){return`${o.z}-${o.x}-${o.y}`}static nameToTile(o){let h=o.split("-");if(h.length===3){let g=Number(h[0]),_=Number(h[1]),a=Number(h[2]);if(!(isNaN(g)||isNaN(a)||isNaN(_)))return{x:_,y:a,z:g}}throw new Error(`Invalid tile name '${o}'`)}findBestZoom(o){let h=this.zoomConversionMap.get(o);return h==null&&(h=this.convertZoomLevel(o),this.zoomConversionMap.set(o,h)),h}convertZoomLevel(o){for(let h=0;h<this.zooms.length;h++){let g=this.zooms[h].scaleDenominator-o;if(g>1e-5)continue;if(h===0)return h;let _=this.zooms[h-1].scaleDenominator-o;return Math.abs(g)<_?h:h-1}return this.maxZoom}static convertZoomLevel(o,h,g,_=!0){return h.identifier===g.identifier||(o>=h.maxZoom&&(o=h.maxZoom),_&&o===0)?o:_&&o===h.maxZoom?g.maxZoom:g.findBestZoom(h.zooms[o].scaleDenominator)}};W();var ff={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};W();W();var R0={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},Ye=new Vs(R0);W();var nc=Ns(yf(),1),rs=new Vs(nc.Nztm2000),Pn=new Vs(nc.Nztm2000Quad);var ns={All:[Ye,rs,Pn],Defaults:new Map([[qe.Google.code,Ye],[qe.Nztm2000.code,rs]]),get(n){let o=this.tryGet(n);if(o==null)throw new Error("Failed to lookup TileMatrixSet: "+n);return o},tryGet(n){var o,h;return n==null?null:typeof n=="number"?(o=this.Defaults.get(n))!==null&&o!==void 0?o:null:(h=this.Defaults.get(n.code))!==null&&h!==void 0?h:null},find(n){if(n==null)return null;let o=qe.parse(n);if(o!=null)return ns.tryGet(o);for(let h of ns.All)if(h.identifier===n)return h;return null}};W();var Fl;(function(n){n.Png="png",n.Jpeg="jpeg",n.Webp="webp",n.Avif="avif"})(Fl||(Fl={}));var Wu;(function(n){n.MapboxVectorTiles="pbf"})(Wu||(Wu={}));var xg=Ns(xf(),1);W();var yo={debug:!1,"debug.background":!1,"debug.source":!1,"debug.cog":!1,"debug.screenshot":!1,"debug.layer.linz-aerial":0,"debug.layer.linz-topographic":0,"debug.layer.osm":0},Ol=class{static toUrl(o,h){if(o.debug===!0){h.append("debug","true");for(let[g,_]of Object.entries(o))g==="debug"||yo[g]===_||h.append(g,String(_))}}static fromUrl(o,h){let g=h.get("debug")!=null,_=!1;if(g===!1){for(let[a,M]of Object.entries(yo))_=_a(o,a,M)||_;return _}return _=_a(o,"debug",!0),_=_a(o,"debug.background",h.get("debug.background"))||_,_=_a(o,"debug.source",h.get("debug.source")!=null)||_,_=_a(o,"debug.cog",h.get("debug.cog")!=null)||_,_=_a(o,"debug.screenshot",h.get("debug.screenshot")!=null)||_,_=Hu(o,"debug.layer.linz-aerial",h.get("debug.layer.linz-aerial"))||_,_=Hu(o,"debug.layer.linz-topographic",h.get("debug.layer.linz-topographic"))||_,_=Hu(o,"debug.layer.osm",h.get("debug.layer.osm"))||_,_}};function U0(n,o=0){if(n==null)return o;let h=Number(n);return isNaN(h)?o:h}function _a(n,o,h){return h==null&&(h=yo[o]),n[o]===h?!1:(n[o]=h,!0)}function Hu(n,o,h){return _a(n,o,U0(h))}W();W();W();W();var Sf=Ns(bf(),1),Tf=Ns(wf(),1);W();function Mf(n){return[[[n[0],n[1]],[n[2],n[1]],[n[2],n[3]],[n[0],n[3]],[n[0],n[1]]]]}var{intersection:Yu,union:qb}=Tf.default;function G0(n,o){return n[0]===o[0]&&n[1]===o[1]}function q0(n,o){return Yu(n,Mf(o))}function Qu(n,o){let h=[];for(let g of n){let _=Sf.default.polygon(g[0],o);_.length!==0&&(G0(_[0],_[_.length-1])||_.push(_[0]),h.push([_]))}return q0(h,o)}W();W();var Nl=n=>(n<-360?n=-(-n%360):n>360&&(n=n%360),n<-180?360+n:n>180?n-360:n),xa=(n,o)=>{let h=o-n;return h>180?h-360:h<-180?h+360:h},j0=(n,o)=>Nl(n+(o<n?o+360-n:o-n)),Gs={boxLonCenter(n){return Nl(n[0]+.5*(n[2]<n[0]?360+n[2]-n[0]:n[2]-n[0]))},delta:xa,crossesAM(n,o){return Math.sign(xa(n,o))!==Math.sign(o-n)},normLon:Nl,normExtent(n){return[Nl(n[0]),n[1],Nl(n[2]),n[3]]},union(n,o){if(o==null)return n.slice();let h=Gs.boxLonCenter(n),g=Gs.boxLonCenter(o);if(xa(h,g)<0)return this.union(o,n);let _=n.slice(),a=j0(h,g);return xa(a,o[0])<xa(a,n[0])&&(_[0]=o[0]),xa(a,o[2])>xa(a,n[2])&&(_[2]=o[2]),o[1]<n[1]&&(_[1]=o[1]),o[3]>n[3]&&(_[3]=o[3]),_},intersects(n,o){if(n[1]>o[3]||o[1]>n[3])return!1;let h=n[0],g=o[0],_=h<n[2]?n[2]:n[2]+360,a=g<o[2]?o[2]:o[2]+360;return h<=a&&g<=_||h+360<=a&&g<=_+360||h<=a+360&&g+360<=_},ringToBbox(n){if(n.length<3)throw new Error("Invalid ring");let o=!1,h=n[0],g=h[0],_=h[1],a=g,M=_,S=g;for(let D=1;D<n.length;++D){let N=n[D],L=N[0];Gs.crossesAM(S,L)&&(o=!o),o&&(L<0?L+=360:(S+=360,D===1&&(g=a=S))),L<g?g=L:L>a&&(a=L);let pt=N[1];pt<_?_=pt:pt>M&&(M=pt),S=N[0]}return[this.normLon(g),_,this.normLon(a),M]},multiPolygonToBbox(n){let o=null;for(let h of n){if(h.length===0)continue;let g=h[0];if(g.length<3)continue;let _=this.ringToBbox(g);o=o==null?_:this.union(o,_)}if(o==null)throw new Error("Invalid multipolygon");return o},bboxToMultiPolygon(n){let o=[n[0],n[1]],h=[n[2],n[1]],g=[n[0],n[3]],_=[n[2],n[3]];return n[0]<n[2]?[[[o,g,_,h,o]]]:[[[o,g,[180,_[1]],[180,h[1]],o]],[[_,h,[-180,o[1]],[-180,g[1]],_]]]}};var $0=[-180,-90,180,90],W0=[180,-90,360,90];function Z0(n,o,h){return[o[0]+(h[0]-o[0])*n,o[1]+(h[1]-o[1])*n]}function H0(n){let o=[];for(let h of Qu(n,$0))o.push(h);for(let h of Qu(n,W0))o.push(h.map(g=>g.map(_=>[_[0]-360,_[1]])));return o}function Ef(n,o,h=!0){let g=!1,_=!1,a=n.map(M=>M.map(S=>{let D=[];if(S.length===0)return D;let N=S[0],L=null,Q=0;for(let pt of S){let ot=o(pt),ft=ot[0];if(L!=null){let Rt=Gs.crossesAM(Q,ft);if(Rt&&(g=!0,_=!_),_&&(ft<0?ot[0]=ft+360:L[0]=Q+360),Rt){let Ct=(180-ot[0])/(L[0]-ot[0]),Dt=o(Z0(Ct,pt,N));D.push([180,Dt[1]])}}D.push(ot),N=pt,L=ot,Q=ft}return D}));return g&&h?H0(a):a}W();W();function X0(n){return{type:"Polygon",coordinates:n}}function If(n,o={}){return{type:"Feature",geometry:X0(n),properties:o}}function Cf(n,o={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:n},properties:o}}W();W();W();W();W();W();function Af(n){n("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),n("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),n("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),n.WGS84=n["EPSG:4326"],n["EPSG:3785"]=n["EPSG:3857"],n.GOOGLE=n["EPSG:3857"],n["EPSG:900913"]=n["EPSG:3857"],n["EPSG:102113"]=n["EPSG:3857"]}W();W();var wn=1,Mn=2,xo=3,Pf=4,Ul=5,tp=6378137,zf=6356752314e-3,ep=.0066943799901413165,va=484813681109536e-20,Nt=Math.PI/2,kf=.16666666666666666,Lf=.04722222222222222,Df=.022156084656084655,jt=1e-10,Ci=.017453292519943295,Vr=57.29577951308232,He=Math.PI/4,qs=Math.PI*2,Ai=3.14159265359;W();var Cr={};Cr.greenwich=0;Cr.lisbon=-9.131906111111;Cr.paris=2.337229166667;Cr.bogota=-74.080916666667;Cr.madrid=-3.687938888889;Cr.rome=12.452333333333;Cr.bern=7.439583333333;Cr.jakarta=106.807719444444;Cr.ferro=-17.666666666667;Cr.brussels=4.367975;Cr.stockholm=18.058277777778;Cr.athens=23.7163375;Cr.oslo=10.722916666667;W();var Rf={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};W();var Bf=/[\s_\-\/\(\)]/g;function tn(n,o){if(n[o])return n[o];for(var h=Object.keys(n),g=o.toLowerCase().replace(Bf,""),_=-1,a,M;++_<h.length;)if(a=h[_],M=a.toLowerCase().replace(Bf,""),M===g)return n[a]}function Vl(n){var o={},h=n.split("+").map(function(S){return S.trim()}).filter(function(S){return S}).reduce(function(S,D){var N=D.split("=");return N.push(!0),S[N[0].toLowerCase()]=N[1],S},{}),g,_,a,M={proj:"projName",datum:"datumCode",rf:function(S){o.rf=parseFloat(S)},lat_0:function(S){o.lat0=S*Ci},lat_1:function(S){o.lat1=S*Ci},lat_2:function(S){o.lat2=S*Ci},lat_ts:function(S){o.lat_ts=S*Ci},lon_0:function(S){o.long0=S*Ci},lon_1:function(S){o.long1=S*Ci},lon_2:function(S){o.long2=S*Ci},alpha:function(S){o.alpha=parseFloat(S)*Ci},gamma:function(S){o.rectified_grid_angle=parseFloat(S)},lonc:function(S){o.longc=S*Ci},x_0:function(S){o.x0=parseFloat(S)},y_0:function(S){o.y0=parseFloat(S)},k_0:function(S){o.k0=parseFloat(S)},k:function(S){o.k0=parseFloat(S)},a:function(S){o.a=parseFloat(S)},b:function(S){o.b=parseFloat(S)},r_a:function(){o.R_A=!0},zone:function(S){o.zone=parseInt(S,10)},south:function(){o.utmSouth=!0},towgs84:function(S){o.datum_params=S.split(",").map(function(D){return parseFloat(D)})},to_meter:function(S){o.to_meter=parseFloat(S)},units:function(S){o.units=S;var D=tn(Rf,S);D&&(o.to_meter=D.to_meter)},from_greenwich:function(S){o.from_greenwich=S*Ci},pm:function(S){var D=tn(Cr,S);o.from_greenwich=(D||parseFloat(S))*Ci},nadgrids:function(S){S==="@null"?o.datumCode="none":o.nadgrids=S},axis:function(S){var D="ewnsud";S.length===3&&D.indexOf(S.substr(0,1))!==-1&&D.indexOf(S.substr(1,1))!==-1&&D.indexOf(S.substr(2,1))!==-1&&(o.axis=S)},approx:function(){o.approx=!0}};for(g in h)_=h[g],g in M?(a=M[g],typeof a=="function"?a(_):o[a]=_):o[g]=_;return typeof o.datumCode=="string"&&o.datumCode!=="WGS84"&&(o.datumCode=o.datumCode.toLowerCase()),o}W();W();var Ff=Q0,Gl=1,Of=2,Nf=3,ac=4,Uf=5,ip=-1,K0=/\s/,J0=/[A-Za-z]/,Y0=/[A-Za-z84_]/,oc=/[,\]]/,Vf=/[\d\.E\-\+]/;function as(n){if(typeof n!="string")throw new Error("not a string");this.text=n.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Gl}as.prototype.readCharicter=function(){var n=this.text[this.place++];if(this.state!==ac)for(;K0.test(n);){if(this.place>=this.text.length)return;n=this.text[this.place++]}switch(this.state){case Gl:return this.neutral(n);case Of:return this.keyword(n);case ac:return this.quoted(n);case Uf:return this.afterquote(n);case Nf:return this.number(n);case ip:return}};as.prototype.afterquote=function(n){if(n==='"'){this.word+='"',this.state=ac;return}if(oc.test(n)){this.word=this.word.trim(),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in afterquote yet, index '+this.place)};as.prototype.afterItem=function(n){if(n===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Gl;return}if(n==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Gl,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ip);return}};as.prototype.number=function(n){if(Vf.test(n)){this.word+=n;return}if(oc.test(n)){this.word=parseFloat(this.word),this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in number yet, index '+this.place)};as.prototype.quoted=function(n){if(n==='"'){this.state=Uf;return}this.word+=n};as.prototype.keyword=function(n){if(Y0.test(n)){this.word+=n;return}if(n==="["){var o=[];o.push(this.word),this.level++,this.root===null?this.root=o:this.currentObject.push(o),this.stack.push(this.currentObject),this.currentObject=o,this.state=Gl;return}if(oc.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in keyword yet, index '+this.place)};as.prototype.neutral=function(n){if(J0.test(n)){this.word=n,this.state=Of;return}if(n==='"'){this.word="",this.state=ac;return}if(Vf.test(n)){this.word=n,this.state=Nf;return}if(oc.test(n)){this.afterItem(n);return}throw new Error(`havn't handled "`+n+'" in neutral yet, index '+this.place)};as.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ip)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Q0(n){var o=new as(n);return o.output()}W();function Gf(n,o,h){Array.isArray(o)&&(h.unshift(o),o=null);var g=o?{}:n,_=h.reduce(function(a,M){return ba(M,a),a},g);o&&(n[o]=_)}function ba(n,o){if(!Array.isArray(n)){o[n]=!0;return}var h=n.shift();if(h==="PARAMETER"&&(h=n.shift()),n.length===1){if(Array.isArray(n[0])){o[h]={},ba(n[0],o[h]);return}o[h]=n[0];return}if(!n.length){o[h]=!0;return}if(h==="TOWGS84"){o[h]=n;return}if(h==="AXIS"){h in o||(o[h]=[]),o[h].push(n);return}Array.isArray(h)||(o[h]={});var g;switch(h){case"UNIT":case"PRIMEM":case"VERT_DATUM":o[h]={name:n[0].toLowerCase(),convert:n[1]},n.length===3&&ba(n[2],o[h]);return;case"SPHEROID":case"ELLIPSOID":o[h]={name:n[0],a:n[1],rf:n[2]},n.length===4&&ba(n[3],o[h]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":n[0]=["name",n[0]],Gf(o,h,n);return;default:for(g=-1;++g<n.length;)if(!Array.isArray(n[g]))return ba(n,o[h]);return Gf(o,h,n)}}var t_=.017453292519943295;function e_(n,o){var h=o[0],g=o[1];!(h in n)&&g in n&&(n[h]=n[g],o.length===3&&(n[h]=o[2](n[h])))}function os(n){return n*t_}function i_(n){if(n.type==="GEOGCS"?n.projName="longlat":n.type==="LOCAL_CS"?(n.projName="identity",n.local=!0):typeof n.PROJECTION=="object"?n.projName=Object.keys(n.PROJECTION)[0]:n.projName=n.PROJECTION,n.AXIS){for(var o="",h=0,g=n.AXIS.length;h<g;++h){var _=[n.AXIS[h][0].toLowerCase(),n.AXIS[h][1].toLowerCase()];_[0].indexOf("north")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="north"?o+="n":_[0].indexOf("south")!==-1||(_[0]==="y"||_[0]==="lat")&&_[1]==="south"?o+="s":_[0].indexOf("east")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="east"?o+="e":(_[0].indexOf("west")!==-1||(_[0]==="x"||_[0]==="lon")&&_[1]==="west")&&(o+="w")}o.length===2&&(o+="u"),o.length===3&&(n.axis=o)}n.UNIT&&(n.units=n.UNIT.name.toLowerCase(),n.units==="metre"&&(n.units="meter"),n.UNIT.convert&&(n.type==="GEOGCS"?n.DATUM&&n.DATUM.SPHEROID&&(n.to_meter=n.UNIT.convert*n.DATUM.SPHEROID.a):n.to_meter=n.UNIT.convert));var a=n.GEOGCS;n.type==="GEOGCS"&&(a=n),a&&(a.DATUM?n.datumCode=a.DATUM.name.toLowerCase():n.datumCode=a.name.toLowerCase(),n.datumCode.slice(0,2)==="d_"&&(n.datumCode=n.datumCode.slice(2)),(n.datumCode==="new_zealand_geodetic_datum_1949"||n.datumCode==="new_zealand_1949")&&(n.datumCode="nzgd49"),(n.datumCode==="wgs_1984"||n.datumCode==="world_geodetic_system_1984")&&(n.PROJECTION==="Mercator_Auxiliary_Sphere"&&(n.sphere=!0),n.datumCode="wgs84"),n.datumCode.slice(-6)==="_ferro"&&(n.datumCode=n.datumCode.slice(0,-6)),n.datumCode.slice(-8)==="_jakarta"&&(n.datumCode=n.datumCode.slice(0,-8)),~n.datumCode.indexOf("belge")&&(n.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(n.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),n.ellps.toLowerCase().slice(0,13)==="international"&&(n.ellps="intl"),n.a=a.DATUM.SPHEROID.a,n.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(n.datum_params=a.DATUM.TOWGS84),~n.datumCode.indexOf("osgb_1936")&&(n.datumCode="osgb36"),~n.datumCode.indexOf("osni_1952")&&(n.datumCode="osni52"),(~n.datumCode.indexOf("tm65")||~n.datumCode.indexOf("geodetic_datum_of_1965"))&&(n.datumCode="ire65"),n.datumCode==="ch1903+"&&(n.datumCode="ch1903"),~n.datumCode.indexOf("israel")&&(n.datumCode="isr93")),n.b&&!isFinite(n.b)&&(n.b=n.a);function M(N){var L=n.to_meter||1;return N*L}var S=function(N){return e_(n,N)},D=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",os],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",os],["x0","false_easting",M],["y0","false_northing",M],["long0","central_meridian",os],["lat0","latitude_of_origin",os],["lat0","standard_parallel_1",os],["lat1","standard_parallel_1",os],["lat2","standard_parallel_2",os],["azimuth","Azimuth"],["alpha","azimuth",os],["srsCode","name"]];D.forEach(S),!n.long0&&n.longc&&(n.projName==="Albers_Conic_Equal_Area"||n.projName==="Lambert_Azimuthal_Equal_Area")&&(n.long0=n.longc),!n.lat_ts&&n.lat1&&(n.projName==="Stereographic_South_Pole"||n.projName==="Polar Stereographic (variant B)")&&(n.lat0=os(n.lat1>0?90:-90),n.lat_ts=n.lat1)}function lc(n){var o=Ff(n),h=o.shift(),g=o.shift();o.unshift(["name",g]),o.unshift(["type",h]);var _={};return ba(o,_),i_(_),_}function fn(n){var o=this;if(arguments.length===2){var h=arguments[1];typeof h=="string"?h.charAt(0)==="+"?fn[n]=Vl(arguments[1]):fn[n]=lc(arguments[1]):fn[n]=h}else if(arguments.length===1){if(Array.isArray(n))return n.map(function(g){Array.isArray(g)?fn.apply(o,g):fn(g)});if(typeof n=="string"){if(n in fn)return fn[n]}else"EPSG"in n?fn["EPSG:"+n.EPSG]=n:"ESRI"in n?fn["ESRI:"+n.ESRI]=n:"IAU2000"in n?fn["IAU2000:"+n.IAU2000]=n:console.log(n);return}}Af(fn);var vo=fn;function r_(n){return typeof n=="string"}function n_(n){return n in vo}var s_=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function a_(n){return s_.some(function(o){return n.indexOf(o)>-1})}var o_=["3857","900913","3785","102113"];function l_(n){var o=tn(n,"authority");if(!!o){var h=tn(o,"epsg");return h&&o_.indexOf(h)>-1}}function h_(n){var o=tn(n,"extension");if(!!o)return tn(o,"proj4")}function c_(n){return n[0]==="+"}function u_(n){if(r_(n)){if(n_(n))return vo[n];if(a_(n)){var o=lc(n);if(l_(o))return vo["EPSG:3857"];var h=h_(o);return h?Vl(h):o}if(c_(n))return Vl(n)}else return n}var qf=u_;W();function rp(n,o){n=n||{};var h,g;if(!o)return n;for(g in o)h=o[g],h!==void 0&&(n[g]=h);return n}W();W();W();function fr(n,o,h){var g=n*o;return h/Math.sqrt(1-g*g)}W();W();function zn(n){return n<0?-1:1}function Wt(n){return Math.abs(n)<=Ai?n:n-zn(n)*qs}W();function Ar(n,o,h){var g=n*h,_=.5*n;return g=Math.pow((1-g)/(1+g),_),Math.tan(.5*(Nt-o))/g}W();function ls(n,o){for(var h=.5*n,g,_,a=Nt-2*Math.atan(o),M=0;M<=15;M++)if(g=n*Math.sin(a),_=Nt-2*Math.atan(o*Math.pow((1-g)/(1+g),h))-a,a+=_,Math.abs(_)<=1e-10)return a;return-9999}function p_(){var n=this.b/this.a;this.es=1-n*n,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function d_(n){var o=n.x,h=n.y;if(h*Vr>90&&h*Vr<-90&&o*Vr>180&&o*Vr<-180)return null;var g,_;if(Math.abs(Math.abs(h)-Nt)<=jt)return null;if(this.sphere)g=this.x0+this.a*this.k0*Wt(o-this.long0),_=this.y0+this.a*this.k0*Math.log(Math.tan(He+.5*h));else{var a=Math.sin(h),M=Ar(this.e,h,a);g=this.x0+this.a*this.k0*Wt(o-this.long0),_=this.y0-this.a*this.k0*Math.log(M)}return n.x=g,n.y=_,n}function f_(n){var o=n.x-this.x0,h=n.y-this.y0,g,_;if(this.sphere)_=Nt-2*Math.atan(Math.exp(-h/(this.a*this.k0)));else{var a=Math.exp(-h/(this.a*this.k0));if(_=ls(this.e,a),_===-9999)return null}return g=Wt(this.long0+o/(this.a*this.k0)),n.x=g,n.y=_,n}var m_=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],jf={init:p_,forward:d_,inverse:f_,names:m_};W();function g_(){}function $f(n){return n}var y_=["longlat","identity"],Wf={init:g_,forward:$f,inverse:$f,names:y_};var __=[jf,Wf],hc={},cc=[];function Zf(n,o){var h=cc.length;return n.names?(cc[h]=n,n.names.forEach(function(g){hc[g.toLowerCase()]=h}),this):(console.log(o),!0)}function x_(n){if(!n)return!1;var o=n.toLowerCase();if(typeof hc[o]<"u"&&cc[hc[o]])return cc[hc[o]]}function v_(){__.forEach(Zf)}var Hf={start:v_,add:Zf,get:x_};W();W();var ze={};ze.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};ze.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};ze.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};ze.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};ze.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};ze.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};ze.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};ze.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};ze.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};ze.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};ze.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};ze.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};ze.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};ze.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};ze.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};ze.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};ze.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};ze.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};ze.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};ze.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};ze.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};ze.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};ze.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};ze.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};ze.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};ze.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};ze.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};ze.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};ze.hough={a:6378270,rf:297,ellipseName:"Hough"};ze.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};ze.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};ze.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};ze.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};ze.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};ze.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};ze.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};ze.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};ze.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};ze.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};ze.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};ze.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Xf=ze.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};ze.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Kf(n,o,h,g){var _=n*n,a=o*o,M=(_-a)/_,S=0;g?(n*=1-M*(kf+M*(Lf+M*Df)),_=n*n,M=0):S=Math.sqrt(M);var D=(_-a)/a;return{es:M,e:S,ep2:D}}function Jf(n,o,h,g,_){if(!n){var a=tn(ze,g);a||(a=Xf),n=a.a,o=a.b,h=a.rf}return h&&!o&&(o=(1-1/h)*n),(h===0||Math.abs(n-o)<jt)&&(_=!0,o=n),{a:n,b:o,rf:h,sphere:_}}W();var Ki={};Ki.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Ki.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Ki.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Ki.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Ki.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Ki.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Ki.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Ki.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"};Ki.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};Ki.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Ki.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Ki.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Ki.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Ki.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Ki.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Ki.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Ki.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};W();function b_(n,o,h,g,_,a,M){var S={};return n===void 0||n==="none"?S.datum_type=Ul:S.datum_type=Pf,o&&(S.datum_params=o.map(parseFloat),(S.datum_params[0]!==0||S.datum_params[1]!==0||S.datum_params[2]!==0)&&(S.datum_type=wn),S.datum_params.length>3&&(S.datum_params[3]!==0||S.datum_params[4]!==0||S.datum_params[5]!==0||S.datum_params[6]!==0)&&(S.datum_type=Mn,S.datum_params[3]*=va,S.datum_params[4]*=va,S.datum_params[5]*=va,S.datum_params[6]=S.datum_params[6]/1e6+1)),M&&(S.datum_type=xo,S.grids=M),S.a=h,S.b=g,S.es=_,S.ep2=a,S}var Yf=b_;W();var Qf={};function sp(n,o){var h=new DataView(o),g=M_(h),_=S_(h,g);_.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var a=T_(h,_,g),M={header:_,subgrids:a};return Qf[n]=M,M}function tm(n){if(n===void 0)return null;var o=n.split(",");return o.map(w_)}function w_(n){if(n.length===0)return null;var o=n[0]==="@";return o&&(n=n.slice(1)),n==="null"?{name:"null",mandatory:!o,grid:null,isNull:!0}:{name:n,mandatory:!o,grid:Qf[n]||null,isNull:!1}}function bo(n){return n/3600*Math.PI/180}function M_(n){var o=n.getInt32(8,!1);return o===11?!1:(o=n.getInt32(8,!0),o!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function S_(n,o){return{nFields:n.getInt32(8,o),nSubgridFields:n.getInt32(24,o),nSubgrids:n.getInt32(40,o),shiftType:np(n,56,56+8).trim(),fromSemiMajorAxis:n.getFloat64(120,o),fromSemiMinorAxis:n.getFloat64(136,o),toSemiMajorAxis:n.getFloat64(152,o),toSemiMinorAxis:n.getFloat64(168,o)}}function np(n,o,h){return String.fromCharCode.apply(null,new Uint8Array(n.buffer.slice(o,h)))}function T_(n,o,h){for(var g=176,_=[],a=0;a<o.nSubgrids;a++){var M=I_(n,g,h),S=C_(n,g,M,h),D=Math.round(1+(M.upperLongitude-M.lowerLongitude)/M.longitudeInterval),N=Math.round(1+(M.upperLatitude-M.lowerLatitude)/M.latitudeInterval);_.push({ll:[bo(M.lowerLongitude),bo(M.lowerLatitude)],del:[bo(M.longitudeInterval),bo(M.latitudeInterval)],lim:[D,N],count:M.gridNodeCount,cvs:E_(S)})}return _}function E_(n){return n.map(function(o){return[bo(o.longitudeShift),bo(o.latitudeShift)]})}function I_(n,o,h){return{name:np(n,o+8,o+16).trim(),parent:np(n,o+24,o+24+8).trim(),lowerLatitude:n.getFloat64(o+72,h),upperLatitude:n.getFloat64(o+88,h),lowerLongitude:n.getFloat64(o+104,h),upperLongitude:n.getFloat64(o+120,h),latitudeInterval:n.getFloat64(o+136,h),longitudeInterval:n.getFloat64(o+152,h),gridNodeCount:n.getInt32(o+168,h)}}function C_(n,o,h,g){for(var _=o+176,a=16,M=[],S=0;S<h.gridNodeCount;S++){var D={latitudeShift:n.getFloat32(_+S*a,g),longitudeShift:n.getFloat32(_+S*a+4,g),latitudeAccuracy:n.getFloat32(_+S*a+8,g),longitudeAccuracy:n.getFloat32(_+S*a+12,g)};M.push(D)}return M}function wo(n,o){if(!(this instanceof wo))return new wo(n);o=o||function(N){if(N)throw N};var h=qf(n);if(typeof h!="object"){o(n);return}var g=wo.projections.get(h.projName);if(!g){o(n);return}if(h.datumCode&&h.datumCode!=="none"){var _=tn(Ki,h.datumCode);_&&(h.datum_params=h.datum_params||(_.towgs84?_.towgs84.split(","):null),h.ellps=_.ellipse,h.datumName=_.datumName?_.datumName:h.datumCode)}h.k0=h.k0||1,h.axis=h.axis||"enu",h.ellps=h.ellps||"wgs84",h.lat1=h.lat1||h.lat0;var a=Jf(h.a,h.b,h.rf,h.ellps,h.sphere),M=Kf(a.a,a.b,a.rf,h.R_A),S=tm(h.nadgrids),D=h.datum||Yf(h.datumCode,h.datum_params,a.a,a.b,M.es,M.ep2,S);rp(this,h),rp(this,g),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=M.es,this.e=M.e,this.ep2=M.ep2,this.datum=D,this.init(),o(null,this)}wo.projections=Hf;wo.projections.start();var js=wo;W();W();W();function em(n,o){return n.datum_type!==o.datum_type||n.a!==o.a||Math.abs(n.es-o.es)>5e-11?!1:n.datum_type===wn?n.datum_params[0]===o.datum_params[0]&&n.datum_params[1]===o.datum_params[1]&&n.datum_params[2]===o.datum_params[2]:n.datum_type===Mn?n.datum_params[0]===o.datum_params[0]&&n.datum_params[1]===o.datum_params[1]&&n.datum_params[2]===o.datum_params[2]&&n.datum_params[3]===o.datum_params[3]&&n.datum_params[4]===o.datum_params[4]&&n.datum_params[5]===o.datum_params[5]&&n.datum_params[6]===o.datum_params[6]:!0}function uc(n,o,h){var g=n.x,_=n.y,a=n.z?n.z:0,M,S,D,N;if(_<-Nt&&_>-1.001*Nt)_=-Nt;else if(_>Nt&&_<1.001*Nt)_=Nt;else{if(_<-Nt)return{x:-1/0,y:-1/0,z:n.z};if(_>Nt)return{x:1/0,y:1/0,z:n.z}}return g>Math.PI&&(g-=2*Math.PI),S=Math.sin(_),N=Math.cos(_),D=S*S,M=h/Math.sqrt(1-o*D),{x:(M+a)*N*Math.cos(g),y:(M+a)*N*Math.sin(g),z:(M*(1-o)+a)*S}}function pc(n,o,h,g){var _=1e-12,a=_*_,M=30,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe=n.x,me=n.y,oe=n.z?n.z:0,Ce,Re,mi;if(S=Math.sqrt(fe*fe+me*me),D=Math.sqrt(fe*fe+me*me+oe*oe),S/h<_){if(Ce=0,D/h<_)return Re=Nt,mi=-g,{x:n.x,y:n.y,z:n.z}}else Ce=Math.atan2(me,fe);N=oe/D,L=S/D,Q=1/Math.sqrt(1-o*(2-o)*L*L),ft=L*(1-o)*Q,Rt=N*Q,Ht=0;do Ht++,ot=h/Math.sqrt(1-o*Rt*Rt),mi=S*ft+oe*Rt-ot*(1-o*Rt*Rt),pt=o*ot/(ot+mi),Q=1/Math.sqrt(1-pt*(2-pt)*L*L),Ct=L*(1-pt)*Q,Dt=N*Q,ne=Dt*ft-Ct*Rt,ft=Ct,Rt=Dt;while(ne*ne>a&&Ht<M);return Re=Math.atan(Dt/Math.abs(Ct)),{x:Ce,y:Re,z:mi}}function im(n,o,h){if(o===wn)return{x:n.x+h[0],y:n.y+h[1],z:n.z+h[2]};if(o===Mn){var g=h[0],_=h[1],a=h[2],M=h[3],S=h[4],D=h[5],N=h[6];return{x:N*(n.x-D*n.y+S*n.z)+g,y:N*(D*n.x+n.y-M*n.z)+_,z:N*(-S*n.x+M*n.y+n.z)+a}}}function rm(n,o,h){if(o===wn)return{x:n.x-h[0],y:n.y-h[1],z:n.z-h[2]};if(o===Mn){var g=h[0],_=h[1],a=h[2],M=h[3],S=h[4],D=h[5],N=h[6],L=(n.x-g)/N,Q=(n.y-_)/N,pt=(n.z-a)/N;return{x:L+D*Q-S*pt,y:-D*L+Q+M*pt,z:S*L-M*Q+pt}}}function dc(n){return n===wn||n===Mn}function am(n,o,h){if(em(n,o)||n.datum_type===Ul||o.datum_type===Ul)return h;var g=n.a,_=n.es;if(n.datum_type===xo){var a=nm(n,!1,h);if(a!==0)return;g=tp,_=ep}var M=o.a,S=o.b,D=o.es;if(o.datum_type===xo&&(M=tp,S=zf,D=ep),_===D&&g===M&&!dc(n.datum_type)&&!dc(o.datum_type))return h;if(h=uc(h,_,g),dc(n.datum_type)&&(h=im(h,n.datum_type,n.datum_params)),dc(o.datum_type)&&(h=rm(h,o.datum_type,o.datum_params)),h=pc(h,D,M,S),o.datum_type===xo){var N=nm(o,!0,h);if(N!==0)return}return h}function nm(n,o,h){if(n.grids===null||n.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var g={x:-h.x,y:h.y},_={x:Number.NaN,y:Number.NaN},a=!1,M=[],S=0;S<n.grids.length;S++){var D=n.grids[S];if(M.push(D.name),D.isNull){_=g;break}if(a=D.mandatory,D.grid===null){if(D.mandatory)return console.log("Unable to find mandatory grid '"+D.name+"'"),-1;continue}var N=D.grid.subgrids[0],L=(Math.abs(N.del[1])+Math.abs(N.del[0]))/1e4,Q=N.ll[0]-L,pt=N.ll[1]-L,ot=N.ll[0]+(N.lim[0]-1)*N.del[0]+L,ft=N.ll[1]+(N.lim[1]-1)*N.del[1]+L;if(!(pt>g.y||Q>g.x||ft<g.y||ot<g.x)&&(_=A_(g,o,N),!isNaN(_.x)))break}return isNaN(_.x)?(console.log("Failed to find a grid shift table for location '"+-g.x*Vr+" "+g.y*Vr+" tried: '"+M+"'"),-1):(h.x=-_.x,h.y=_.y,0)}function A_(n,o,h){var g={x:Number.NaN,y:Number.NaN};if(isNaN(n.x))return g;var _={x:n.x,y:n.y};_.x-=h.ll[0],_.y-=h.ll[1],_.x=Wt(_.x-Math.PI)+Math.PI;var a=sm(_,h);if(o){if(isNaN(a.x))return g;a.x=_.x-a.x,a.y=_.y-a.y;var M=9,S=1e-12,D,N;do{if(N=sm(a,h),isNaN(N.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}D={x:_.x-(N.x+a.x),y:_.y-(N.y+a.y)},a.x+=D.x,a.y+=D.y}while(M--&&Math.abs(D.x)>S&&Math.abs(D.y)>S);if(M<0)return console.log("Inverse grid shift iterator failed to converge."),g;g.x=Wt(a.x+h.ll[0]),g.y=a.y+h.ll[1]}else isNaN(a.x)||(g.x=n.x+a.x,g.y=n.y+a.y);return g}function sm(n,o){var h={x:n.x/o.del[0],y:n.y/o.del[1]},g={x:Math.floor(h.x),y:Math.floor(h.y)},_={x:h.x-1*g.x,y:h.y-1*g.y},a={x:Number.NaN,y:Number.NaN},M;if(g.x<0||g.x>=o.lim[0]||g.y<0||g.y>=o.lim[1])return a;M=g.y*o.lim[0]+g.x;var S={x:o.cvs[M][0],y:o.cvs[M][1]};M++;var D={x:o.cvs[M][0],y:o.cvs[M][1]};M+=o.lim[0];var N={x:o.cvs[M][0],y:o.cvs[M][1]};M--;var L={x:o.cvs[M][0],y:o.cvs[M][1]},Q=_.x*_.y,pt=_.x*(1-_.y),ot=(1-_.x)*(1-_.y),ft=(1-_.x)*_.y;return a.x=ot*S.x+pt*D.x+ft*L.x+Q*N.x,a.y=ot*S.y+pt*D.y+ft*L.y+Q*N.y,a}W();function ap(n,o,h){var g=h.x,_=h.y,a=h.z||0,M,S,D,N={};for(D=0;D<3;D++)if(!(o&&D===2&&h.z===void 0))switch(D===0?(M=g,"ew".indexOf(n.axis[D])!==-1?S="x":S="y"):D===1?(M=_,"ns".indexOf(n.axis[D])!==-1?S="y":S="x"):(M=a,S="z"),n.axis[D]){case"e":N[S]=M;break;case"w":N[S]=-M;break;case"n":N[S]=M;break;case"s":N[S]=-M;break;case"u":h[S]!==void 0&&(N.z=M);break;case"d":h[S]!==void 0&&(N.z=-M);break;default:return null}return N}W();function fc(n){var o={x:n[0],y:n[1]};return n.length>2&&(o.z=n[2]),n.length>3&&(o.m=n[3]),o}W();function lm(n){om(n.x),om(n.y)}function om(n){if(typeof Number.isFinite=="function"){if(Number.isFinite(n))return;throw new TypeError("coordinates must be finite numbers")}if(typeof n!="number"||n!==n||!isFinite(n))throw new TypeError("coordinates must be finite numbers")}function P_(n,o){return(n.datum.datum_type===wn||n.datum.datum_type===Mn)&&o.datumCode!=="WGS84"||(o.datum.datum_type===wn||o.datum.datum_type===Mn)&&n.datumCode!=="WGS84"}function wa(n,o,h,g){var _;if(Array.isArray(h)&&(h=fc(h)),lm(h),n.datum&&o.datum&&P_(n,o)&&(_=new js("WGS84"),h=wa(n,_,h,g),n=_),g&&n.axis!=="enu"&&(h=ap(n,!1,h)),n.projName==="longlat")h={x:h.x*Ci,y:h.y*Ci,z:h.z||0};else if(n.to_meter&&(h={x:h.x*n.to_meter,y:h.y*n.to_meter,z:h.z||0}),h=n.inverse(h),!h)return;if(n.from_greenwich&&(h.x+=n.from_greenwich),h=am(n.datum,o.datum,h),!!h)return o.from_greenwich&&(h={x:h.x-o.from_greenwich,y:h.y,z:h.z||0}),o.projName==="longlat"?h={x:h.x*Vr,y:h.y*Vr,z:h.z||0}:(h=o.forward(h),o.to_meter&&(h={x:h.x/o.to_meter,y:h.y/o.to_meter,z:h.z||0})),g&&o.axis!=="enu"?ap(o,!0,h):h}var hm=js("WGS84");function op(n,o,h,g){var _,a,M;return Array.isArray(h)?(_=wa(n,o,h,g)||{x:NaN,y:NaN},h.length>2?typeof n.name<"u"&&n.name==="geocent"||typeof o.name<"u"&&o.name==="geocent"?typeof _.z=="number"?[_.x,_.y,_.z].concat(h.splice(3)):[_.x,_.y,h[2]].concat(h.splice(3)):[_.x,_.y].concat(h.splice(2)):[_.x,_.y]):(a=wa(n,o,h,g),M=Object.keys(h),M.length===2||M.forEach(function(S){if(typeof n.name<"u"&&n.name==="geocent"||typeof o.name<"u"&&o.name==="geocent"){if(S==="x"||S==="y"||S==="z")return}else if(S==="x"||S==="y")return;a[S]=h[S]}),a)}function cm(n){return n instanceof js?n:n.oProj?n.oProj:js(n)}function z_(n,o,h){n=cm(n);var g=!1,_;return typeof o>"u"?(o=n,n=hm,g=!0):(typeof o.x<"u"||Array.isArray(o))&&(h=o,o=n,n=hm,g=!0),o=cm(o),h?op(n,o,h):(_={forward:function(a,M){return op(n,o,a,M)},inverse:function(a,M){return op(o,n,a,M)}},g&&(_.oProj=o),_)}var Gr=z_;W();W();var um=6,dm="AJSAJS",fm="AFAFAF",Mo=65,qr=73,mn=79,ql=86,jl=90,mm={forward:hp,inverse:k_,toPoint:cp};function hp(n,o){return o=o||5,R_(L_({lat:n[1],lon:n[0]}),o)}function k_(n){var o=up(ym(n.toUpperCase()));return o.lat&&o.lon?[o.lon,o.lat,o.lon,o.lat]:[o.left,o.bottom,o.right,o.top]}function cp(n){var o=up(ym(n.toUpperCase()));return o.lat&&o.lon?[o.lon,o.lat]:[(o.left+o.right)/2,(o.top+o.bottom)/2]}function lp(n){return n*(Math.PI/180)}function pm(n){return 180*(n/Math.PI)}function L_(n){var o=n.lat,h=n.lon,g=6378137,_=.00669438,a=.9996,M,S,D,N,L,Q,pt,ot=lp(o),ft=lp(h),Rt,Ct;Ct=Math.floor((h+180)/6)+1,h===180&&(Ct=60),o>=56&&o<64&&h>=3&&h<12&&(Ct=32),o>=72&&o<84&&(h>=0&&h<9?Ct=31:h>=9&&h<21?Ct=33:h>=21&&h<33?Ct=35:h>=33&&h<42&&(Ct=37)),M=(Ct-1)*6-180+3,Rt=lp(M),S=_/(1-_),D=g/Math.sqrt(1-_*Math.sin(ot)*Math.sin(ot)),N=Math.tan(ot)*Math.tan(ot),L=S*Math.cos(ot)*Math.cos(ot),Q=Math.cos(ot)*(ft-Rt),pt=g*((1-_/4-3*_*_/64-5*_*_*_/256)*ot-(3*_/8+3*_*_/32+45*_*_*_/1024)*Math.sin(2*ot)+(15*_*_/256+45*_*_*_/1024)*Math.sin(4*ot)-35*_*_*_/3072*Math.sin(6*ot));var Dt=a*D*(Q+(1-N+L)*Q*Q*Q/6+(5-18*N+N*N+72*L-58*S)*Q*Q*Q*Q*Q/120)+5e5,ne=a*(pt+D*Math.tan(ot)*(Q*Q/2+(5-N+9*L+4*L*L)*Q*Q*Q*Q/24+(61-58*N+N*N+600*L-330*S)*Q*Q*Q*Q*Q*Q/720));return o<0&&(ne+=1e7),{northing:Math.round(ne),easting:Math.round(Dt),zoneNumber:Ct,zoneLetter:D_(o)}}function up(n){var o=n.northing,h=n.easting,g=n.zoneLetter,_=n.zoneNumber;if(_<0||_>60)return null;var a=.9996,M=6378137,S=.00669438,D,N=(1-Math.sqrt(1-S))/(1+Math.sqrt(1-S)),L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht=h-5e5,fe=o;g<"N"&&(fe-=1e7),Ct=(_-1)*6-180+3,D=S/(1-S),Rt=fe/a,Dt=Rt/(M*(1-S/4-3*S*S/64-5*S*S*S/256)),ne=Dt+(3*N/2-27*N*N*N/32)*Math.sin(2*Dt)+(21*N*N/16-55*N*N*N*N/32)*Math.sin(4*Dt)+151*N*N*N/96*Math.sin(6*Dt),L=M/Math.sqrt(1-S*Math.sin(ne)*Math.sin(ne)),Q=Math.tan(ne)*Math.tan(ne),pt=D*Math.cos(ne)*Math.cos(ne),ot=M*(1-S)/Math.pow(1-S*Math.sin(ne)*Math.sin(ne),1.5),ft=Ht/(L*a);var me=ne-L*Math.tan(ne)/ot*(ft*ft/2-(5+3*Q+10*pt-4*pt*pt-9*D)*ft*ft*ft*ft/24+(61+90*Q+298*pt+45*Q*Q-252*D-3*pt*pt)*ft*ft*ft*ft*ft*ft/720);me=pm(me);var oe=(ft-(1+2*Q+pt)*ft*ft*ft/6+(5-2*pt+28*Q-3*pt*pt+8*D+24*Q*Q)*ft*ft*ft*ft*ft/120)/Math.cos(ne);oe=Ct+pm(oe);var Ce;if(n.accuracy){var Re=up({northing:n.northing+n.accuracy,easting:n.easting+n.accuracy,zoneLetter:n.zoneLetter,zoneNumber:n.zoneNumber});Ce={top:Re.lat,right:Re.lon,bottom:me,left:oe}}else Ce={lat:me,lon:oe};return Ce}function D_(n){var o="Z";return 84>=n&&n>=72?o="X":72>n&&n>=64?o="W":64>n&&n>=56?o="V":56>n&&n>=48?o="U":48>n&&n>=40?o="T":40>n&&n>=32?o="S":32>n&&n>=24?o="R":24>n&&n>=16?o="Q":16>n&&n>=8?o="P":8>n&&n>=0?o="N":0>n&&n>=-8?o="M":-8>n&&n>=-16?o="L":-16>n&&n>=-24?o="K":-24>n&&n>=-32?o="J":-32>n&&n>=-40?o="H":-40>n&&n>=-48?o="G":-48>n&&n>=-56?o="F":-56>n&&n>=-64?o="E":-64>n&&n>=-72?o="D":-72>n&&n>=-80&&(o="C"),o}function R_(n,o){var h="00000"+n.easting,g="00000"+n.northing;return n.zoneNumber+n.zoneLetter+B_(n.easting,n.northing,n.zoneNumber)+h.substr(h.length-5,o)+g.substr(g.length-5,o)}function B_(n,o,h){var g=gm(h),_=Math.floor(n/1e5),a=Math.floor(o/1e5)%20;return F_(_,a,g)}function gm(n){var o=n%um;return o===0&&(o=um),o}function F_(n,o,h){var g=h-1,_=dm.charCodeAt(g),a=fm.charCodeAt(g),M=_+n-1,S=a+o,D=!1;M>jl&&(M=M-jl+Mo-1,D=!0),(M===qr||_<qr&&M>qr||(M>qr||_<qr)&&D)&&M++,(M===mn||_<mn&&M>mn||(M>mn||_<mn)&&D)&&(M++,M===qr&&M++),M>jl&&(M=M-jl+Mo-1),S>ql?(S=S-ql+Mo-1,D=!0):D=!1,(S===qr||a<qr&&S>qr||(S>qr||a<qr)&&D)&&S++,(S===mn||a<mn&&S>mn||(S>mn||a<mn)&&D)&&(S++,S===qr&&S++),S>ql&&(S=S-ql+Mo-1);var N=String.fromCharCode(M)+String.fromCharCode(S);return N}function ym(n){if(n&&n.length===0)throw"MGRSPoint coverting from nothing";for(var o=n.length,h=null,g="",_,a=0;!/[A-Z]/.test(_=n.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+n;g+=_,a++}var M=parseInt(g,10);if(a===0||a+3>o)throw"MGRSPoint bad conversion from: "+n;var S=n.charAt(a++);if(S<="A"||S==="B"||S==="Y"||S>="Z"||S==="I"||S==="O")throw"MGRSPoint zone letter "+S+" not handled: "+n;h=n.substring(a,a+=2);for(var D=gm(M),N=O_(h.charAt(0),D),L=N_(h.charAt(1),D);L<U_(S);)L+=2e6;var Q=o-a;if(Q%2!==0)throw`MGRSPoint has to have an even number
|
|
506
|
+
of digits after the zone letter and two 100km letters - front
|
|
507
|
+
half for easting meters, second half for
|
|
508
|
+
northing meters`+n;var pt=Q/2,ot=0,ft=0,Rt,Ct,Dt,ne,Ht;return pt>0&&(Rt=1e5/Math.pow(10,pt),Ct=n.substring(a,a+pt),ot=parseFloat(Ct)*Rt,Dt=n.substring(a+pt),ft=parseFloat(Dt)*Rt),ne=ot+N,Ht=ft+L,{easting:ne,northing:Ht,zoneLetter:S,zoneNumber:M,accuracy:Rt}}function O_(n,o){for(var h=dm.charCodeAt(o-1),g=1e5,_=!1;h!==n.charCodeAt(0);){if(h++,h===qr&&h++,h===mn&&h++,h>jl){if(_)throw"Bad character: "+n;h=Mo,_=!0}g+=1e5}return g}function N_(n,o){if(n>"V")throw"MGRSPoint given invalid Northing "+n;for(var h=fm.charCodeAt(o-1),g=0,_=!1;h!==n.charCodeAt(0);){if(h++,h===qr&&h++,h===mn&&h++,h>ql){if(_)throw"Bad character: "+n;h=Mo,_=!0}g+=1e5}return g}function U_(n){var o;switch(n){case"C":o=11e5;break;case"D":o=2e6;break;case"E":o=28e5;break;case"F":o=37e5;break;case"G":o=46e5;break;case"H":o=55e5;break;case"J":o=64e5;break;case"K":o=73e5;break;case"L":o=82e5;break;case"M":o=91e5;break;case"N":o=0;break;case"P":o=8e5;break;case"Q":o=17e5;break;case"R":o=26e5;break;case"S":o=35e5;break;case"T":o=44e5;break;case"U":o=53e5;break;case"V":o=62e5;break;case"W":o=7e6;break;case"X":o=79e5;break;default:o=-1}if(o>=0)return o;throw"Invalid zone letter: "+n}function So(n,o,h){if(!(this instanceof So))return new So(n,o,h);if(Array.isArray(n))this.x=n[0],this.y=n[1],this.z=n[2]||0;else if(typeof n=="object")this.x=n.x,this.y=n.y,this.z=n.z||0;else if(typeof n=="string"&&typeof o>"u"){var g=n.split(",");this.x=parseFloat(g[0],10),this.y=parseFloat(g[1],10),this.z=parseFloat(g[2],10)||0}else this.x=n,this.y=o,this.z=h||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}So.fromMGRS=function(n){return new So(cp(n))};So.prototype.toMGRS=function(n){return hp([this.x,this.y],n)};var _m=So;W();W();W();var V_=1,G_=.25,xm=.046875,vm=.01953125,bm=.01068115234375,q_=.75,j_=.46875,$_=.013020833333333334,W_=.007120768229166667,Z_=.3645833333333333,H_=.005696614583333333,X_=.3076171875;function mc(n){var o=[];o[0]=V_-n*(G_+n*(xm+n*(vm+n*bm))),o[1]=n*(q_-n*(xm+n*(vm+n*bm)));var h=n*n;return o[2]=h*(j_-n*($_+n*W_)),h*=n,o[3]=h*(Z_-n*H_),o[4]=h*n*X_,o}W();function Ma(n,o,h,g){return h*=o,o*=o,g[0]*n-h*(g[1]+o*(g[2]+o*(g[3]+o*g[4])))}W();var K_=20;function gc(n,o,h){for(var g=1/(1-o),_=n,a=K_;a;--a){var M=Math.sin(_),S=1-o*M*M;if(S=(Ma(_,M,Math.cos(_),h)-n)*(S*Math.sqrt(S))*g,_-=S,Math.abs(S)<jt)return _}return _}function J_(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=mc(this.es),this.ml0=Ma(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Y_(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_,a,M,S=Math.sin(h),D=Math.cos(h);if(this.es){var L=D*g,Q=Math.pow(L,2),pt=this.ep2*Math.pow(D,2),ot=Math.pow(pt,2),ft=Math.abs(D)>jt?Math.tan(h):0,Rt=Math.pow(ft,2),Ct=Math.pow(Rt,2);_=1-this.es*Math.pow(S,2),L=L/Math.sqrt(_);var Dt=Ma(h,S,D,this.en);a=this.a*(this.k0*L*(1+Q/6*(1-Rt+pt+Q/20*(5-18*Rt+Ct+14*pt-58*Rt*pt+Q/42*(61+179*Ct-Ct*Rt-479*Rt)))))+this.x0,M=this.a*(this.k0*(Dt-this.ml0+S*g*L/2*(1+Q/12*(5-Rt+9*pt+4*ot+Q/30*(61+Ct-58*Rt+270*pt-330*Rt*pt+Q/56*(1385+543*Ct-Ct*Rt-3111*Rt))))))+this.y0}else{var N=D*Math.sin(g);if(Math.abs(Math.abs(N)-1)<jt)return 93;if(a=.5*this.a*this.k0*Math.log((1+N)/(1-N))+this.x0,M=D*Math.cos(g)/Math.sqrt(1-Math.pow(N,2)),N=Math.abs(M),N>=1){if(N-1>jt)return 93;M=0}else M=Math.acos(M);h<0&&(M=-M),M=this.a*this.k0*(M-this.lat0)+this.y0}return n.x=a,n.y=M,n}function Q_(n){var o,h,g,_,a=(n.x-this.x0)*(1/this.a),M=(n.y-this.y0)*(1/this.a);if(this.es)if(o=this.ml0+M/this.k0,h=gc(o,this.es,this.en),Math.abs(h)<Nt){var Q=Math.sin(h),pt=Math.cos(h),ot=Math.abs(pt)>jt?Math.tan(h):0,ft=this.ep2*Math.pow(pt,2),Rt=Math.pow(ft,2),Ct=Math.pow(ot,2),Dt=Math.pow(Ct,2);o=1-this.es*Math.pow(Q,2);var ne=a*Math.sqrt(o)/this.k0,Ht=Math.pow(ne,2);o=o*ot,g=h-o*Ht/(1-this.es)*.5*(1-Ht/12*(5+3*Ct-9*ft*Ct+ft-4*Rt-Ht/30*(61+90*Ct-252*ft*Ct+45*Dt+46*ft-Ht/56*(1385+3633*Ct+4095*Dt+1574*Dt*Ct)))),_=Wt(this.long0+ne*(1-Ht/6*(1+2*Ct+ft-Ht/20*(5+28*Ct+24*Dt+8*ft*Ct+6*ft-Ht/42*(61+662*Ct+1320*Dt+720*Dt*Ct))))/pt)}else g=Nt*zn(M),_=0;else{var S=Math.exp(a/this.k0),D=.5*(S-1/S),N=this.lat0+M/this.k0,L=Math.cos(N);o=Math.sqrt((1-Math.pow(L,2))/(1+Math.pow(D,2))),g=Math.asin(o),M<0&&(g=-g),D===0&&L===0?_=0:_=Wt(Math.atan2(D,L)+this.long0)}return n.x=_,n.y=g,n}var tx=["Fast_Transverse_Mercator","Fast Transverse Mercator"],To={init:J_,forward:Y_,inverse:Q_,names:tx};W();W();function yc(n){var o=Math.exp(n);return o=(o-1/o)/2,o}W();function Pr(n,o){n=Math.abs(n),o=Math.abs(o);var h=Math.max(n,o),g=Math.min(n,o)/(h||1);return h*Math.sqrt(1+Math.pow(g,2))}W();W();function wm(n){var o=1+n,h=o-1;return h===0?n:n*Math.log(o)/h}function Mm(n){var o=Math.abs(n);return o=wm(o*(1+o/(Pr(1,o)+1))),n<0?-o:o}W();function _c(n,o){for(var h=2*Math.cos(2*o),g=n.length-1,_=n[g],a=0,M;--g>=0;)M=-a+h*_+n[g],a=_,_=M;return o+M*Math.sin(2*o)}W();function Sm(n,o){for(var h=2*Math.cos(o),g=n.length-1,_=n[g],a=0,M;--g>=0;)M=-a+h*_+n[g],a=_,_=M;return Math.sin(o)*M}W();W();function Tm(n){var o=Math.exp(n);return o=(o+1/o)/2,o}function pp(n,o,h){for(var g=Math.sin(o),_=Math.cos(o),a=yc(h),M=Tm(h),S=2*_*M,D=-2*g*a,N=n.length-1,L=n[N],Q=0,pt=0,ot=0,ft,Rt;--N>=0;)ft=pt,Rt=Q,pt=L,Q=ot,L=-ft+S*pt-D*Q+n[N],ot=-Rt+D*pt+S*Q;return S=g*M,D=_*a,[S*L-D*ot,S*ot+D*L]}function ex(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(To.init.apply(this),this.forward=To.forward,this.inverse=To.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var n=this.es/(1+Math.sqrt(1-this.es)),o=n/(2-n),h=o;this.cgb[0]=o*(2+o*(-2/3+o*(-2+o*(116/45+o*(26/45+o*(-2854/675)))))),this.cbg[0]=o*(-2+o*(2/3+o*(4/3+o*(-82/45+o*(32/45+o*(4642/4725)))))),h=h*o,this.cgb[1]=h*(7/3+o*(-8/5+o*(-227/45+o*(2704/315+o*(2323/945))))),this.cbg[1]=h*(5/3+o*(-16/15+o*(-13/9+o*(904/315+o*(-1522/945))))),h=h*o,this.cgb[2]=h*(56/15+o*(-136/35+o*(-1262/105+o*(73814/2835)))),this.cbg[2]=h*(-26/15+o*(34/21+o*(8/5+o*(-12686/2835)))),h=h*o,this.cgb[3]=h*(4279/630+o*(-332/35+o*(-399572/14175))),this.cbg[3]=h*(1237/630+o*(-12/5+o*(-24832/14175))),h=h*o,this.cgb[4]=h*(4174/315+o*(-144838/6237)),this.cbg[4]=h*(-734/315+o*(109598/31185)),h=h*o,this.cgb[5]=h*(601676/22275),this.cbg[5]=h*(444337/155925),h=Math.pow(o,2),this.Qn=this.k0/(1+o)*(1+h*(1/4+h*(1/64+h/256))),this.utg[0]=o*(-.5+o*(2/3+o*(-37/96+o*(1/360+o*(81/512+o*(-96199/604800)))))),this.gtu[0]=o*(.5+o*(-2/3+o*(5/16+o*(41/180+o*(-127/288+o*(7891/37800)))))),this.utg[1]=h*(-1/48+o*(-1/15+o*(437/1440+o*(-46/105+o*(1118711/3870720))))),this.gtu[1]=h*(13/48+o*(-3/5+o*(557/1440+o*(281/630+o*(-1983433/1935360))))),h=h*o,this.utg[2]=h*(-17/480+o*(37/840+o*(209/4480+o*(-5569/90720)))),this.gtu[2]=h*(61/240+o*(-103/140+o*(15061/26880+o*(167603/181440)))),h=h*o,this.utg[3]=h*(-4397/161280+o*(11/504+o*(830251/7257600))),this.gtu[3]=h*(49561/161280+o*(-179/168+o*(6601661/7257600))),h=h*o,this.utg[4]=h*(-4583/161280+o*(108847/3991680)),this.gtu[4]=h*(34729/80640+o*(-3418889/1995840)),h=h*o,this.utg[5]=h*(-20648693/638668800),this.gtu[5]=h*(212378941/319334400);var g=_c(this.cbg,this.lat0);this.Zb=-this.Qn*(g+Sm(this.gtu,2*g))}function ix(n){var o=Wt(n.x-this.long0),h=n.y;h=_c(this.cbg,h);var g=Math.sin(h),_=Math.cos(h),a=Math.sin(o),M=Math.cos(o);h=Math.atan2(g,M*_),o=Math.atan2(a*_,Pr(g,_*M)),o=Mm(Math.tan(o));var S=pp(this.gtu,2*h,2*o);h=h+S[0],o=o+S[1];var D,N;return Math.abs(o)<=2.623395162778?(D=this.a*(this.Qn*o)+this.x0,N=this.a*(this.Qn*h+this.Zb)+this.y0):(D=1/0,N=1/0),n.x=D,n.y=N,n}function rx(n){var o=(n.x-this.x0)*(1/this.a),h=(n.y-this.y0)*(1/this.a);h=(h-this.Zb)/this.Qn,o=o/this.Qn;var g,_;if(Math.abs(o)<=2.623395162778){var a=pp(this.utg,2*h,2*o);h=h+a[0],o=o+a[1],o=Math.atan(yc(o));var M=Math.sin(h),S=Math.cos(h),D=Math.sin(o),N=Math.cos(o);h=Math.atan2(M*N,Pr(D,N*S)),o=Math.atan2(D,N*S),g=Wt(o+this.long0),_=_c(this.cgb,h)}else g=1/0,_=1/0;return n.x=g,n.y=_,n}var nx=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Eo={init:ex,forward:ix,inverse:rx,names:nx};W();W();function Em(n,o){if(n===void 0){if(n=Math.floor((Wt(o)+Math.PI)*30/Math.PI)+1,n<0)return 0;if(n>60)return 60}return n}var sx="etmerc";function ax(){var n=Em(this.zone,this.long0);if(n===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(n)-183)*Ci,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Eo.init.apply(this),this.forward=Eo.forward,this.inverse=Eo.inverse}var ox=["Universal Transverse Mercator System","utm"],Im={init:ax,names:ox,dependsOn:sx};W();W();W();function xc(n,o){return Math.pow((1-n)/(1+n),o)}var lx=20;function hx(){var n=Math.sin(this.lat0),o=Math.cos(this.lat0);o*=o,this.rc=Math.sqrt(1-this.es)/(1-this.es*n*n),this.C=Math.sqrt(1+this.es*o*o/(1-this.es)),this.phic0=Math.asin(n/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+He)/(Math.pow(Math.tan(.5*this.lat0+He),this.C)*xc(this.e*n,this.ratexp))}function cx(n){var o=n.x,h=n.y;return n.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*h+He),this.C)*xc(this.e*Math.sin(h),this.ratexp))-Nt,n.x=this.C*o,n}function ux(n){for(var o=1e-14,h=n.x/this.C,g=n.y,_=Math.pow(Math.tan(.5*g+He)/this.K,1/this.C),a=lx;a>0&&(g=2*Math.atan(_*xc(this.e*Math.sin(n.y),-.5*this.e))-Nt,!(Math.abs(g-n.y)<o));--a)n.y=g;return a?(n.x=h,n.y=g,n):null}var px=["gauss"],vc={init:hx,forward:cx,inverse:ux,names:px};function dx(){vc.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function fx(n){var o,h,g,_;return n.x=Wt(n.x-this.long0),vc.forward.apply(this,[n]),o=Math.sin(n.y),h=Math.cos(n.y),g=Math.cos(n.x),_=this.k0*this.R2/(1+this.sinc0*o+this.cosc0*h*g),n.x=_*h*Math.sin(n.x),n.y=_*(this.cosc0*o-this.sinc0*h*g),n.x=this.a*n.x+this.x0,n.y=this.a*n.y+this.y0,n}function mx(n){var o,h,g,_,a;if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,a=Math.sqrt(n.x*n.x+n.y*n.y)){var M=2*Math.atan2(a,this.R2);o=Math.sin(M),h=Math.cos(M),_=Math.asin(h*this.sinc0+n.y*o*this.cosc0/a),g=Math.atan2(n.x*o,a*this.cosc0*h-n.y*this.sinc0*o)}else _=this.phic0,g=0;return n.x=g,n.y=_,vc.inverse.apply(this,[n]),n.x=Wt(n.x+this.long0),n}var gx=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Cm={init:dx,forward:fx,inverse:mx,names:gx};W();function yx(n,o,h){return o*=h,Math.tan(.5*(Nt+n))*Math.pow((1-o)/(1+o),.5*h)}function _x(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=jt&&(this.k0=.5*(1+zn(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=jt&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=jt&&(this.k0=.5*this.cons*fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ar(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=fr(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Nt,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function xx(n){var o=n.x,h=n.y,g=Math.sin(h),_=Math.cos(h),a,M,S,D,N,L,Q=Wt(o-this.long0);return Math.abs(Math.abs(o-this.long0)-Math.PI)<=jt&&Math.abs(h+this.lat0)<=jt?(n.x=NaN,n.y=NaN,n):this.sphere?(a=2*this.k0/(1+this.sinlat0*g+this.coslat0*_*Math.cos(Q)),n.x=this.a*a*_*Math.sin(Q)+this.x0,n.y=this.a*a*(this.coslat0*g-this.sinlat0*_*Math.cos(Q))+this.y0,n):(M=2*Math.atan(this.ssfn_(h,g,this.e))-Nt,D=Math.cos(M),S=Math.sin(M),Math.abs(this.coslat0)<=jt?(N=Ar(this.e,h*this.con,this.con*g),L=2*this.a*this.k0*N/this.cons,n.x=this.x0+L*Math.sin(o-this.long0),n.y=this.y0-this.con*L*Math.cos(o-this.long0),n):(Math.abs(this.sinlat0)<jt?(a=2*this.a*this.k0/(1+D*Math.cos(Q)),n.y=a*S):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*S+this.cosX0*D*Math.cos(Q))),n.y=a*(this.cosX0*S-this.sinX0*D*Math.cos(Q))+this.y0),n.x=a*D*Math.sin(Q)+this.x0,n))}function vx(n){n.x-=this.x0,n.y-=this.y0;var o,h,g,_,a,M=Math.sqrt(n.x*n.x+n.y*n.y);if(this.sphere){var S=2*Math.atan(M/(2*this.a*this.k0));return o=this.long0,h=this.lat0,M<=jt?(n.x=o,n.y=h,n):(h=Math.asin(Math.cos(S)*this.sinlat0+n.y*Math.sin(S)*this.coslat0/M),Math.abs(this.coslat0)<jt?this.lat0>0?o=Wt(this.long0+Math.atan2(n.x,-1*n.y)):o=Wt(this.long0+Math.atan2(n.x,n.y)):o=Wt(this.long0+Math.atan2(n.x*Math.sin(S),M*this.coslat0*Math.cos(S)-n.y*this.sinlat0*Math.sin(S))),n.x=o,n.y=h,n)}else if(Math.abs(this.coslat0)<=jt){if(M<=jt)return h=this.lat0,o=this.long0,n.x=o,n.y=h,n;n.x*=this.con,n.y*=this.con,g=M*this.cons/(2*this.a*this.k0),h=this.con*ls(this.e,g),o=this.con*Wt(this.con*this.long0+Math.atan2(n.x,-1*n.y))}else _=2*Math.atan(M*this.cosX0/(2*this.a*this.k0*this.ms1)),o=this.long0,M<=jt?a=this.X0:(a=Math.asin(Math.cos(_)*this.sinX0+n.y*Math.sin(_)*this.cosX0/M),o=Wt(this.long0+Math.atan2(n.x*Math.sin(_),M*this.cosX0*Math.cos(_)-n.y*this.sinX0*Math.sin(_)))),h=-1*ls(this.e,Math.tan(.5*(Nt+a)));return n.x=o,n.y=h,n}var bx=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Am={init:_x,forward:xx,inverse:vx,names:bx,ssfn_:yx};W();function wx(){var n=this.lat0;this.lambda0=this.long0;var o=Math.sin(n),h=this.a,g=this.rf,_=1/g,a=2*_-Math.pow(_,2),M=this.e=Math.sqrt(a);this.R=this.k0*h*Math.sqrt(1-a)/(1-a*Math.pow(o,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(n),4)),this.b0=Math.asin(o/this.alpha);var S=Math.log(Math.tan(Math.PI/4+this.b0/2)),D=Math.log(Math.tan(Math.PI/4+n/2)),N=Math.log((1+M*o)/(1-M*o));this.K=S-this.alpha*D+this.alpha*M/2*N}function Mx(n){var o=Math.log(Math.tan(Math.PI/4-n.y/2)),h=this.e/2*Math.log((1+this.e*Math.sin(n.y))/(1-this.e*Math.sin(n.y))),g=-this.alpha*(o+h)+this.K,_=2*(Math.atan(Math.exp(g))-Math.PI/4),a=this.alpha*(n.x-this.lambda0),M=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(_)+Math.cos(this.b0)*Math.cos(a))),S=Math.asin(Math.cos(this.b0)*Math.sin(_)-Math.sin(this.b0)*Math.cos(_)*Math.cos(a));return n.y=this.R/2*Math.log((1+Math.sin(S))/(1-Math.sin(S)))+this.y0,n.x=this.R*M+this.x0,n}function Sx(n){for(var o=n.x-this.x0,h=n.y-this.y0,g=o/this.R,_=2*(Math.atan(Math.exp(h/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(_)+Math.sin(this.b0)*Math.cos(_)*Math.cos(g)),M=Math.atan(Math.sin(g)/(Math.cos(this.b0)*Math.cos(g)-Math.sin(this.b0)*Math.tan(_))),S=this.lambda0+M/this.alpha,D=0,N=a,L=-1e3,Q=0;Math.abs(N-L)>1e-7;){if(++Q>20)return;D=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(N))/2)),L=N,N=2*Math.atan(Math.exp(D))-Math.PI/2}return n.x=S,n.y=N,n}var Tx=["somerc"],Pm={init:wx,forward:Mx,inverse:Sx,names:Tx};W();var Io=1e-7;function Ex(n){var o=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],h=typeof n.PROJECTION=="object"?Object.keys(n.PROJECTION)[0]:n.PROJECTION;return"no_uoff"in n||"no_off"in n||o.indexOf(h)!==-1}function Ix(){var n,o,h,g,_,a,M,S,D,N,L=0,Q,pt=0,ot=0,ft=0,Rt=0,Ct=0,Dt=0,ne;this.no_off=Ex(this),this.no_rot="no_rot"in this;var Ht=!1;"alpha"in this&&(Ht=!0);var fe=!1;if("rectified_grid_angle"in this&&(fe=!0),Ht&&(Dt=this.alpha),fe&&(L=this.rectified_grid_angle*Ci),Ht||fe)pt=this.longc;else if(ot=this.long1,Rt=this.lat1,ft=this.long2,Ct=this.lat2,Math.abs(Rt-Ct)<=Io||(n=Math.abs(Rt))<=Io||Math.abs(n-Nt)<=Io||Math.abs(Math.abs(this.lat0)-Nt)<=Io||Math.abs(Math.abs(Ct)-Nt)<=Io)throw new Error;var me=1-this.es;o=Math.sqrt(me),Math.abs(this.lat0)>jt?(S=Math.sin(this.lat0),h=Math.cos(this.lat0),n=1-this.es*S*S,this.B=h*h,this.B=Math.sqrt(1+this.es*this.B*this.B/me),this.A=this.B*this.k0*o/n,g=this.B*o/(h*Math.sqrt(n)),_=g*g-1,_<=0?_=0:(_=Math.sqrt(_),this.lat0<0&&(_=-_)),this.E=_+=g,this.E*=Math.pow(Ar(this.e,this.lat0,S),this.B)):(this.B=1/o,this.A=this.k0,this.E=g=_=1),Ht||fe?(Ht?(Q=Math.asin(Math.sin(Dt)/g),fe||(L=Dt)):(Q=L,Dt=Math.asin(g*Math.sin(Q))),this.lam0=pt-Math.asin(.5*(_-1/_)*Math.tan(Q))/this.B):(a=Math.pow(Ar(this.e,Rt,Math.sin(Rt)),this.B),M=Math.pow(Ar(this.e,Ct,Math.sin(Ct)),this.B),_=this.E/a,D=(M-a)/(M+a),N=this.E*this.E,N=(N-M*a)/(N+M*a),n=ot-ft,n<-Math.pi?ft-=qs:n>Math.pi&&(ft+=qs),this.lam0=Wt(.5*(ot+ft)-Math.atan(N*Math.tan(.5*this.B*(ot-ft))/D)/this.B),Q=Math.atan(2*Math.sin(this.B*Wt(ot-this.lam0))/(_-1/_)),L=Dt=Math.asin(g*Math.sin(Q))),this.singam=Math.sin(Q),this.cosgam=Math.cos(Q),this.sinrot=Math.sin(L),this.cosrot=Math.cos(L),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,ne=this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(g*g-1)/Math.cos(Dt))),this.lat0<0&&(this.u_0=-this.u_0)),_=.5*Q,this.v_pole_n=this.ArB*Math.log(Math.tan(He-_)),this.v_pole_s=this.ArB*Math.log(Math.tan(He+_))}function Cx(n){var o={},h,g,_,a,M,S,D,N;if(n.x=n.x-this.lam0,Math.abs(Math.abs(n.y)-Nt)>jt){if(M=this.E/Math.pow(Ar(this.e,n.y,Math.sin(n.y)),this.B),S=1/M,h=.5*(M-S),g=.5*(M+S),a=Math.sin(this.B*n.x),_=(h*this.singam-a*this.cosgam)/g,Math.abs(Math.abs(_)-1)<jt)throw new Error;N=.5*this.ArB*Math.log((1-_)/(1+_)),S=Math.cos(this.B*n.x),Math.abs(S)<Io?D=this.A*n.x:D=this.ArB*Math.atan2(h*this.cosgam+a*this.singam,S)}else N=n.y>0?this.v_pole_n:this.v_pole_s,D=this.ArB*n.y;return this.no_rot?(o.x=D,o.y=N):(D-=this.u_0,o.x=N*this.cosrot+D*this.sinrot,o.y=D*this.cosrot-N*this.sinrot),o.x=this.a*o.x+this.x0,o.y=this.a*o.y+this.y0,o}function Ax(n){var o,h,g,_,a,M,S,D={};if(n.x=(n.x-this.x0)*(1/this.a),n.y=(n.y-this.y0)*(1/this.a),this.no_rot?(h=n.y,o=n.x):(h=n.x*this.cosrot-n.y*this.sinrot,o=n.y*this.cosrot+n.x*this.sinrot+this.u_0),g=Math.exp(-this.BrA*h),_=.5*(g-1/g),a=.5*(g+1/g),M=Math.sin(this.BrA*o),S=(M*this.cosgam+_*this.singam)/a,Math.abs(Math.abs(S)-1)<jt)D.x=0,D.y=S<0?-Nt:Nt;else{if(D.y=this.E/Math.sqrt((1+S)/(1-S)),D.y=ls(this.e,Math.pow(D.y,1/this.B)),D.y===1/0)throw new Error;D.x=-this.rB*Math.atan2(_*this.cosgam-M*this.singam,Math.cos(this.BrA*o))}return D.x+=this.lam0,D}var Px=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],zm={init:Ix,forward:Cx,inverse:Ax,names:Px};W();function zx(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<jt)){var n=this.b/this.a;this.e=Math.sqrt(1-n*n);var o=Math.sin(this.lat1),h=Math.cos(this.lat1),g=fr(this.e,o,h),_=Ar(this.e,this.lat1,o),a=Math.sin(this.lat2),M=Math.cos(this.lat2),S=fr(this.e,a,M),D=Ar(this.e,this.lat2,a),N=Ar(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>jt?this.ns=Math.log(g/S)/Math.log(_/D):this.ns=o,isNaN(this.ns)&&(this.ns=o),this.f0=g/(this.ns*Math.pow(_,this.ns)),this.rh=this.a*this.f0*Math.pow(N,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function kx(n){var o=n.x,h=n.y;Math.abs(2*Math.abs(h)-Math.PI)<=jt&&(h=zn(h)*(Nt-2*jt));var g=Math.abs(Math.abs(h)-Nt),_,a;if(g>jt)_=Ar(this.e,h,Math.sin(h)),a=this.a*this.f0*Math.pow(_,this.ns);else{if(g=h*this.ns,g<=0)return null;a=0}var M=this.ns*Wt(o-this.long0);return n.x=this.k0*(a*Math.sin(M))+this.x0,n.y=this.k0*(this.rh-a*Math.cos(M))+this.y0,n}function Lx(n){var o,h,g,_,a,M=(n.x-this.x0)/this.k0,S=this.rh-(n.y-this.y0)/this.k0;this.ns>0?(o=Math.sqrt(M*M+S*S),h=1):(o=-Math.sqrt(M*M+S*S),h=-1);var D=0;if(o!==0&&(D=Math.atan2(h*M,h*S)),o!==0||this.ns>0){if(h=1/this.ns,g=Math.pow(o/(this.a*this.f0),h),_=ls(this.e,g),_===-9999)return null}else _=-Nt;return a=Wt(D/this.ns+this.long0),n.x=a,n.y=_,n}var Dx=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],km={init:zx,forward:kx,inverse:Lx,names:Dx};W();function Rx(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Bx(n){var o,h,g,_,a,M,S,D=n.x,N=n.y,L=Wt(D-this.long0);return o=Math.pow((1+this.e*Math.sin(N))/(1-this.e*Math.sin(N)),this.alfa*this.e/2),h=2*(Math.atan(this.k*Math.pow(Math.tan(N/2+this.s45),this.alfa)/o)-this.s45),g=-L*this.alfa,_=Math.asin(Math.cos(this.ad)*Math.sin(h)+Math.sin(this.ad)*Math.cos(h)*Math.cos(g)),a=Math.asin(Math.cos(h)*Math.sin(g)/Math.cos(_)),M=this.n*a,S=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(_/2+this.s45),this.n),n.y=S*Math.cos(M)/1,n.x=S*Math.sin(M)/1,this.czech||(n.y*=-1,n.x*=-1),n}function Fx(n){var o,h,g,_,a,M,S,D,N=n.x;n.x=n.y,n.y=N,this.czech||(n.y*=-1,n.x*=-1),M=Math.sqrt(n.x*n.x+n.y*n.y),a=Math.atan2(n.y,n.x),_=a/Math.sin(this.s0),g=2*(Math.atan(Math.pow(this.ro0/M,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),o=Math.asin(Math.cos(this.ad)*Math.sin(g)-Math.sin(this.ad)*Math.cos(g)*Math.cos(_)),h=Math.asin(Math.cos(g)*Math.sin(_)/Math.cos(o)),n.x=this.long0-h/this.alfa,S=o,D=0;var L=0;do n.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(o/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(S))/(1-this.e*Math.sin(S)),this.e/2))-this.s45),Math.abs(S-n.y)<1e-10&&(D=1),S=n.y,L+=1;while(D===0&&L<15);return L>=15?null:n}var Ox=["Krovak","krovak"],Lm={init:Rx,forward:Bx,inverse:Fx,names:Ox};W();W();function Ji(n,o,h,g,_){return n*_-o*Math.sin(2*_)+h*Math.sin(4*_)-g*Math.sin(6*_)}W();function hs(n){return 1-.25*n*(1+n/16*(3+1.25*n))}W();function cs(n){return .375*n*(1+.25*n*(1+.46875*n))}W();function us(n){return .05859375*n*n*(1+.75*n)}W();function ps(n){return n*n*n*(35/3072)}W();function ds(n,o,h){var g=o*h;return n/Math.sqrt(1-g*g)}W();function Sn(n){return Math.abs(n)<Nt?n:n-zn(n)*Math.PI}W();function Sa(n,o,h,g,_){var a,M;a=n/o;for(var S=0;S<15;S++)if(M=(n-(o*a-h*Math.sin(2*a)+g*Math.sin(4*a)-_*Math.sin(6*a)))/(o-2*h*Math.cos(2*a)+4*g*Math.cos(4*a)-6*_*Math.cos(6*a)),a+=M,Math.abs(M)<=1e-10)return a;return NaN}function Nx(){this.sphere||(this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.ml0=this.a*Ji(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ux(n){var o,h,g=n.x,_=n.y;if(g=Wt(g-this.long0),this.sphere)o=this.a*Math.asin(Math.cos(_)*Math.sin(g)),h=this.a*(Math.atan2(Math.tan(_),Math.cos(g))-this.lat0);else{var a=Math.sin(_),M=Math.cos(_),S=ds(this.a,this.e,a),D=Math.tan(_)*Math.tan(_),N=g*Math.cos(_),L=N*N,Q=this.es*M*M/(1-this.es),pt=this.a*Ji(this.e0,this.e1,this.e2,this.e3,_);o=S*N*(1-L*D*(1/6-(8-D+8*Q)*L/120)),h=pt-this.ml0+S*a/M*L*(.5+(5-D+6*Q)*L/24)}return n.x=o+this.x0,n.y=h+this.y0,n}function Vx(n){n.x-=this.x0,n.y-=this.y0;var o=n.x/this.a,h=n.y/this.a,g,_;if(this.sphere){var a=h+this.lat0;g=Math.asin(Math.sin(a)*Math.cos(o)),_=Math.atan2(Math.tan(o),Math.cos(a))}else{var M=this.ml0/this.a+h,S=Sa(M,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(S)-Nt)<=jt)return n.x=this.long0,n.y=Nt,h<0&&(n.y*=-1),n;var D=ds(this.a,this.e,Math.sin(S)),N=D*D*D/this.a/this.a*(1-this.es),L=Math.pow(Math.tan(S),2),Q=o*this.a/D,pt=Q*Q;g=S-D*Math.tan(S)/N*Q*Q*(.5-(1+3*L)*Q*Q/24),_=Q*(1-pt*(L/3+(1+3*L)*L*pt/15))/Math.cos(S)}return n.x=Wt(_+this.long0),n.y=Sn(g),n}var Gx=["Cassini","Cassini_Soldner","cass"],Dm={init:Nx,forward:Ux,inverse:Vx,names:Gx};W();W();function Tn(n,o){var h;return n>1e-7?(h=n*o,(1-n*n)*(o/(1-h*h)-.5/n*Math.log((1-h)/(1+h)))):2*o}var qx=1,jx=2,$x=3,Wx=4;function Zx(){var n=Math.abs(this.lat0);if(Math.abs(n-Nt)<jt?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(n)<jt?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var o;switch(this.qp=Tn(this.e,1),this.mmf=.5/(1-this.es),this.apa=iv(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),o=Math.sin(this.lat0),this.sinb1=Tn(this.e,o)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*o*o)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Hx(n){var o,h,g,_,a,M,S,D,N,L,Q=n.x,pt=n.y;if(Q=Wt(Q-this.long0),this.sphere){if(a=Math.sin(pt),L=Math.cos(pt),g=Math.cos(Q),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h=this.mode===this.EQUIT?1+L*g:1+this.sinph0*a+this.cosph0*L*g,h<=jt)return null;h=Math.sqrt(2/h),o=h*L*Math.sin(Q),h*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*L*g}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(g=-g),Math.abs(pt+this.lat0)<jt)return null;h=He-pt*.5,h=2*(this.mode===this.S_POLE?Math.cos(h):Math.sin(h)),o=h*Math.sin(Q),h*=g}}else{switch(S=0,D=0,N=0,g=Math.cos(Q),_=Math.sin(Q),a=Math.sin(pt),M=Tn(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(S=M/this.qp,D=Math.sqrt(1-S*S)),this.mode){case this.OBLIQ:N=1+this.sinb1*S+this.cosb1*D*g;break;case this.EQUIT:N=1+D*g;break;case this.N_POLE:N=Nt+pt,M=this.qp-M;break;case this.S_POLE:N=pt-Nt,M=this.qp+M;break}if(Math.abs(N)<jt)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:N=Math.sqrt(2/N),this.mode===this.OBLIQ?h=this.ymf*N*(this.cosb1*S-this.sinb1*D*g):h=(N=Math.sqrt(2/(1+D*g)))*S*this.ymf,o=this.xmf*N*D*_;break;case this.N_POLE:case this.S_POLE:M>=0?(o=(N=Math.sqrt(M))*_,h=g*(this.mode===this.S_POLE?N:-N)):o=h=0;break}}return n.x=this.a*o+this.x0,n.y=this.a*h+this.y0,n}function Xx(n){n.x-=this.x0,n.y-=this.y0;var o=n.x/this.a,h=n.y/this.a,g,_,a,M,S,D,N;if(this.sphere){var L=0,Q,pt=0;if(Q=Math.sqrt(o*o+h*h),_=Q*.5,_>1)return null;switch(_=2*Math.asin(_),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(pt=Math.sin(_),L=Math.cos(_)),this.mode){case this.EQUIT:_=Math.abs(Q)<=jt?0:Math.asin(h*pt/Q),o*=pt,h=L*Q;break;case this.OBLIQ:_=Math.abs(Q)<=jt?this.lat0:Math.asin(L*this.sinph0+h*pt*this.cosph0/Q),o*=pt*this.cosph0,h=(L-Math.sin(_)*this.sinph0)*Q;break;case this.N_POLE:h=-h,_=Nt-_;break;case this.S_POLE:_-=Nt;break}g=h===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(o,h)}else{if(N=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(o/=this.dd,h*=this.dd,D=Math.sqrt(o*o+h*h),D<jt)return n.x=this.long0,n.y=this.lat0,n;M=2*Math.asin(.5*D/this.rq),a=Math.cos(M),o*=M=Math.sin(M),this.mode===this.OBLIQ?(N=a*this.sinb1+h*M*this.cosb1/D,S=this.qp*N,h=D*this.cosb1*a-h*this.sinb1*M):(N=h*M/D,S=this.qp*N,h=D*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),S=o*o+h*h,!S)return n.x=this.long0,n.y=this.lat0,n;N=1-S/this.qp,this.mode===this.S_POLE&&(N=-N)}g=Math.atan2(o,h),_=rv(Math.asin(N),this.apa)}return n.x=Wt(this.long0+g),n.y=_,n}var Kx=.3333333333333333,Jx=.17222222222222222,Yx=.10257936507936508,Qx=.06388888888888888,tv=.0664021164021164,ev=.016415012942191543;function iv(n){var o,h=[];return h[0]=n*Kx,o=n*n,h[0]+=o*Jx,h[1]=o*Qx,o*=n,h[0]+=o*Yx,h[1]+=o*tv,h[2]=o*ev,h}function rv(n,o){var h=n+n;return n+o[0]*Math.sin(h)+o[1]*Math.sin(h+h)+o[2]*Math.sin(h+h+h)}var nv=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Rm={init:Zx,forward:Hx,inverse:Xx,names:nv,S_POLE:qx,N_POLE:jx,EQUIT:$x,OBLIQ:Wx};W();W();function jr(n){return Math.abs(n)>1&&(n=n>1?1:-1),Math.asin(n)}function sv(){Math.abs(this.lat1+this.lat2)<jt||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=fr(this.e3,this.sin_po,this.cos_po),this.qs1=Tn(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=fr(this.e3,this.sin_po,this.cos_po),this.qs2=Tn(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Tn(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>jt?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function av(n){var o=n.x,h=n.y;this.sin_phi=Math.sin(h),this.cos_phi=Math.cos(h);var g=Tn(this.e3,this.sin_phi,this.cos_phi),_=this.a*Math.sqrt(this.c-this.ns0*g)/this.ns0,a=this.ns0*Wt(o-this.long0),M=_*Math.sin(a)+this.x0,S=this.rh-_*Math.cos(a)+this.y0;return n.x=M,n.y=S,n}function ov(n){var o,h,g,_,a,M;return n.x-=this.x0,n.y=this.rh-n.y+this.y0,this.ns0>=0?(o=Math.sqrt(n.x*n.x+n.y*n.y),g=1):(o=-Math.sqrt(n.x*n.x+n.y*n.y),g=-1),_=0,o!==0&&(_=Math.atan2(g*n.x,g*n.y)),g=o*this.ns0/this.a,this.sphere?M=Math.asin((this.c-g*g)/(2*this.ns0)):(h=(this.c-g*g)/this.ns0,M=this.phi1z(this.e3,h)),a=Wt(_/this.ns0+this.long0),n.x=a,n.y=M,n}function lv(n,o){var h,g,_,a,M,S=jr(.5*o);if(n<jt)return S;for(var D=n*n,N=1;N<=25;N++)if(h=Math.sin(S),g=Math.cos(S),_=n*h,a=1-_*_,M=.5*a*a/g*(o/(1-D)-h/a+.5/n*Math.log((1-_)/(1+_))),S=S+M,Math.abs(M)<=1e-7)return S;return null}var hv=["Albers_Conic_Equal_Area","Albers","aea"],Bm={init:sv,forward:av,inverse:ov,names:hv,phi1z:lv};W();function cv(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function uv(n){var o,h,g,_,a,M,S,D,N=n.x,L=n.y;return g=Wt(N-this.long0),o=Math.sin(L),h=Math.cos(L),_=Math.cos(g),M=this.sin_p14*o+this.cos_p14*h*_,a=1,M>0||Math.abs(M)<=jt?(S=this.x0+this.a*a*h*Math.sin(g)/M,D=this.y0+this.a*a*(this.cos_p14*o-this.sin_p14*h*_)/M):(S=this.x0+this.infinity_dist*h*Math.sin(g),D=this.y0+this.infinity_dist*(this.cos_p14*o-this.sin_p14*h*_)),n.x=S,n.y=D,n}function pv(n){var o,h,g,_,a,M;return n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,n.x/=this.k0,n.y/=this.k0,(o=Math.sqrt(n.x*n.x+n.y*n.y))?(_=Math.atan2(o,this.rc),h=Math.sin(_),g=Math.cos(_),M=jr(g*this.sin_p14+n.y*h*this.cos_p14/o),a=Math.atan2(n.x*h,o*this.cos_p14*g-n.y*this.sin_p14*h),a=Wt(this.long0+a)):(M=this.phic0,a=0),n.x=a,n.y=M,n}var dv=["gnom"],Fm={init:cv,forward:uv,inverse:pv,names:dv};W();W();function Om(n,o){var h=1-(1-n*n)/(2*n)*Math.log((1-n)/(1+n));if(Math.abs(Math.abs(o)-h)<1e-6)return o<0?-1*Nt:Nt;for(var g=Math.asin(.5*o),_,a,M,S,D=0;D<30;D++)if(a=Math.sin(g),M=Math.cos(g),S=n*a,_=Math.pow(1-S*S,2)/(2*M)*(o/(1-n*n)-a/(1-S*S)+.5/n*Math.log((1-S)/(1+S))),g+=_,Math.abs(_)<=1e-10)return g;return NaN}function fv(){this.sphere||(this.k0=fr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function mv(n){var o=n.x,h=n.y,g,_,a=Wt(o-this.long0);if(this.sphere)g=this.x0+this.a*a*Math.cos(this.lat_ts),_=this.y0+this.a*Math.sin(h)/Math.cos(this.lat_ts);else{var M=Tn(this.e,Math.sin(h));g=this.x0+this.a*this.k0*a,_=this.y0+this.a*M*.5/this.k0}return n.x=g,n.y=_,n}function gv(n){n.x-=this.x0,n.y-=this.y0;var o,h;return this.sphere?(o=Wt(this.long0+n.x/this.a/Math.cos(this.lat_ts)),h=Math.asin(n.y/this.a*Math.cos(this.lat_ts))):(h=Om(this.e,2*n.y*this.k0/this.a),o=Wt(this.long0+n.x/(this.a*this.k0))),n.x=o,n.y=h,n}var yv=["cea"],Nm={init:fv,forward:mv,inverse:gv,names:yv};W();function _v(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function xv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_=Sn(h-this.lat0);return n.x=this.x0+this.a*g*this.rc,n.y=this.y0+this.a*_,n}function vv(n){var o=n.x,h=n.y;return n.x=Wt(this.long0+(o-this.x0)/(this.a*this.rc)),n.y=Sn(this.lat0+(h-this.y0)/this.a),n}var bv=["Equirectangular","Equidistant_Cylindrical","eqc"],Um={init:_v,forward:xv,inverse:vv,names:bv};W();var Vm=20;function wv(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.ml0=this.a*Ji(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Mv(n){var o=n.x,h=n.y,g,_,a,M=Wt(o-this.long0);if(a=M*Math.sin(h),this.sphere)Math.abs(h)<=jt?(g=this.a*M,_=-1*this.a*this.lat0):(g=this.a*Math.sin(a)/Math.tan(h),_=this.a*(Sn(h-this.lat0)+(1-Math.cos(a))/Math.tan(h)));else if(Math.abs(h)<=jt)g=this.a*M,_=-1*this.ml0;else{var S=ds(this.a,this.e,Math.sin(h))/Math.tan(h);g=S*Math.sin(a),_=this.a*Ji(this.e0,this.e1,this.e2,this.e3,h)-this.ml0+S*(1-Math.cos(a))}return n.x=g+this.x0,n.y=_+this.y0,n}function Sv(n){var o,h,g,_,a,M,S,D,N;if(g=n.x-this.x0,_=n.y-this.y0,this.sphere)if(Math.abs(_+this.a*this.lat0)<=jt)o=Wt(g/this.a+this.long0),h=0;else{M=this.lat0+_/this.a,S=g*g/this.a/this.a+M*M,D=M;var L;for(a=Vm;a;--a)if(L=Math.tan(D),N=-1*(M*(D*L+1)-D-.5*(D*D+S)*L)/((D-M)/L-1),D+=N,Math.abs(N)<=jt){h=D;break}o=Wt(this.long0+Math.asin(g*Math.tan(D)/this.a)/Math.sin(h))}else if(Math.abs(_+this.ml0)<=jt)h=0,o=Wt(this.long0+g/this.a);else{M=(this.ml0+_)/this.a,S=g*g/this.a/this.a+M*M,D=M;var Q,pt,ot,ft,Rt;for(a=Vm;a;--a)if(Rt=this.e*Math.sin(D),Q=Math.sqrt(1-Rt*Rt)*Math.tan(D),pt=this.a*Ji(this.e0,this.e1,this.e2,this.e3,D),ot=this.e0-2*this.e1*Math.cos(2*D)+4*this.e2*Math.cos(4*D)-6*this.e3*Math.cos(6*D),ft=pt/this.a,N=(M*(Q*ft+1)-ft-.5*Q*(ft*ft+S))/(this.es*Math.sin(2*D)*(ft*ft+S-2*M*ft)/(4*Q)+(M-ft)*(Q*ot-2/Math.sin(2*D))-ot),D-=N,Math.abs(N)<=jt){h=D;break}Q=Math.sqrt(1-this.es*Math.pow(Math.sin(h),2))*Math.tan(h),o=Wt(this.long0+Math.asin(g*Q/this.a)/Math.sin(h))}return n.x=o,n.y=h,n}var Tv=["Polyconic","poly"],Gm={init:wv,forward:Mv,inverse:Sv,names:Tv};W();function Ev(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Iv(n){var o,h=n.x,g=n.y,_=g-this.lat0,a=h-this.long0,M=_/va*1e-5,S=a,D=1,N=0;for(o=1;o<=10;o++)D=D*M,N=N+this.A[o]*D;var L=N,Q=S,pt=1,ot=0,ft,Rt,Ct=0,Dt=0;for(o=1;o<=6;o++)ft=pt*L-ot*Q,Rt=ot*L+pt*Q,pt=ft,ot=Rt,Ct=Ct+this.B_re[o]*pt-this.B_im[o]*ot,Dt=Dt+this.B_im[o]*pt+this.B_re[o]*ot;return n.x=Dt*this.a+this.x0,n.y=Ct*this.a+this.y0,n}function Cv(n){var o,h=n.x,g=n.y,_=h-this.x0,a=g-this.y0,M=a/this.a,S=_/this.a,D=1,N=0,L,Q,pt=0,ot=0;for(o=1;o<=6;o++)L=D*M-N*S,Q=N*M+D*S,D=L,N=Q,pt=pt+this.C_re[o]*D-this.C_im[o]*N,ot=ot+this.C_im[o]*D+this.C_re[o]*N;for(var ft=0;ft<this.iterations;ft++){var Rt=pt,Ct=ot,Dt,ne,Ht=M,fe=S;for(o=2;o<=6;o++)Dt=Rt*pt-Ct*ot,ne=Ct*pt+Rt*ot,Rt=Dt,Ct=ne,Ht=Ht+(o-1)*(this.B_re[o]*Rt-this.B_im[o]*Ct),fe=fe+(o-1)*(this.B_im[o]*Rt+this.B_re[o]*Ct);Rt=1,Ct=0;var me=this.B_re[1],oe=this.B_im[1];for(o=2;o<=6;o++)Dt=Rt*pt-Ct*ot,ne=Ct*pt+Rt*ot,Rt=Dt,Ct=ne,me=me+o*(this.B_re[o]*Rt-this.B_im[o]*Ct),oe=oe+o*(this.B_im[o]*Rt+this.B_re[o]*Ct);var Ce=me*me+oe*oe;pt=(Ht*me+fe*oe)/Ce,ot=(fe*me-Ht*oe)/Ce}var Re=pt,mi=ot,Fi=1,Yi=0;for(o=1;o<=9;o++)Fi=Fi*Re,Yi=Yi+this.D[o]*Fi;var Oi=this.lat0+Yi*va*1e5,$r=this.long0+mi;return n.x=$r,n.y=Oi,n}var Av=["New_Zealand_Map_Grid","nzmg"],qm={init:Ev,forward:Iv,inverse:Cv,names:Av};W();function Pv(){}function zv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_=this.x0+this.a*g,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+h/2.5))*1.25;return n.x=_,n.y=a,n}function kv(n){n.x-=this.x0,n.y-=this.y0;var o=Wt(this.long0+n.x/this.a),h=2.5*(Math.atan(Math.exp(.8*n.y/this.a))-Math.PI/4);return n.x=o,n.y=h,n}var Lv=["Miller_Cylindrical","mill"],jm={init:Pv,forward:zv,inverse:kv,names:Lv};W();var Dv=20;function Rv(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=mc(this.es)}function Bv(n){var o,h,g=n.x,_=n.y;if(g=Wt(g-this.long0),this.sphere){if(!this.m)_=this.n!==1?Math.asin(this.n*Math.sin(_)):_;else for(var a=this.n*Math.sin(_),M=Dv;M;--M){var S=(this.m*_+Math.sin(_)-a)/(this.m+Math.cos(_));if(_-=S,Math.abs(S)<jt)break}o=this.a*this.C_x*g*(this.m+Math.cos(_)),h=this.a*this.C_y*_}else{var D=Math.sin(_),N=Math.cos(_);h=this.a*Ma(_,D,N,this.en),o=this.a*g*N/Math.sqrt(1-this.es*D*D)}return n.x=o,n.y=h,n}function Fv(n){var o,h,g,_;return n.x-=this.x0,g=n.x/this.a,n.y-=this.y0,o=n.y/this.a,this.sphere?(o/=this.C_y,g=g/(this.C_x*(this.m+Math.cos(o))),this.m?o=jr((this.m*o+Math.sin(o))/this.n):this.n!==1&&(o=jr(Math.sin(o)/this.n)),g=Wt(g+this.long0),o=Sn(o)):(o=gc(n.y/this.a,this.es,this.en),_=Math.abs(o),_<Nt?(_=Math.sin(o),h=this.long0+n.x*Math.sqrt(1-this.es*_*_)/(this.a*Math.cos(o)),g=Wt(h)):_-jt<Nt&&(g=this.long0)),n.x=g,n.y=o,n}var Ov=["Sinusoidal","sinu"],$m={init:Rv,forward:Bv,inverse:Fv,names:Ov};W();function Nv(){}function Uv(n){for(var o=n.x,h=n.y,g=Wt(o-this.long0),_=h,a=Math.PI*Math.sin(h);;){var M=-(_+Math.sin(_)-a)/(1+Math.cos(_));if(_+=M,Math.abs(M)<jt)break}_/=2,Math.PI/2-Math.abs(h)<jt&&(g=0);var S=.900316316158*this.a*g*Math.cos(_)+this.x0,D=1.4142135623731*this.a*Math.sin(_)+this.y0;return n.x=S,n.y=D,n}function Vv(n){var o,h;n.x-=this.x0,n.y-=this.y0,h=n.y/(1.4142135623731*this.a),Math.abs(h)>.999999999999&&(h=.999999999999),o=Math.asin(h);var g=Wt(this.long0+n.x/(.900316316158*this.a*Math.cos(o)));g<-Math.PI&&(g=-Math.PI),g>Math.PI&&(g=Math.PI),h=(2*o+Math.sin(2*o))/Math.PI,Math.abs(h)>1&&(h=1);var _=Math.asin(h);return n.x=g,n.y=_,n}var Gv=["Mollweide","moll"],Wm={init:Nv,forward:Uv,inverse:Vv,names:Gv};W();function qv(){Math.abs(this.lat1+this.lat2)<jt||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ps(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=fr(this.e,this.sinphi,this.cosphi),this.ml1=Ji(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<jt?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=fr(this.e,this.sinphi,this.cosphi),this.ml2=Ji(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Ji(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function jv(n){var o=n.x,h=n.y,g;if(this.sphere)g=this.a*(this.g-h);else{var _=Ji(this.e0,this.e1,this.e2,this.e3,h);g=this.a*(this.g-_)}var a=this.ns*Wt(o-this.long0),M=this.x0+g*Math.sin(a),S=this.y0+this.rh-g*Math.cos(a);return n.x=M,n.y=S,n}function $v(n){n.x-=this.x0,n.y=this.rh-n.y+this.y0;var o,h,g,_;this.ns>=0?(h=Math.sqrt(n.x*n.x+n.y*n.y),o=1):(h=-Math.sqrt(n.x*n.x+n.y*n.y),o=-1);var a=0;if(h!==0&&(a=Math.atan2(o*n.x,o*n.y)),this.sphere)return _=Wt(this.long0+a/this.ns),g=Sn(this.g-h/this.a),n.x=_,n.y=g,n;var M=this.g-h/this.a;return g=Sa(M,this.e0,this.e1,this.e2,this.e3),_=Wt(this.long0+a/this.ns),n.x=_,n.y=g,n}var Wv=["Equidistant_Conic","eqdc"],Zm={init:qv,forward:jv,inverse:$v,names:Wv};W();function Zv(){this.R=this.a}function Hv(n){var o=n.x,h=n.y,g=Wt(o-this.long0),_,a;Math.abs(h)<=jt&&(_=this.x0+this.R*g,a=this.y0);var M=jr(2*Math.abs(h/Math.PI));(Math.abs(g)<=jt||Math.abs(Math.abs(h)-Nt)<=jt)&&(_=this.x0,h>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*M):a=this.y0+Math.PI*this.R*-Math.tan(.5*M));var S=.5*Math.abs(Math.PI/g-g/Math.PI),D=S*S,N=Math.sin(M),L=Math.cos(M),Q=L/(N+L-1),pt=Q*Q,ot=Q*(2/N-1),ft=ot*ot,Rt=Math.PI*this.R*(S*(Q-ft)+Math.sqrt(D*(Q-ft)*(Q-ft)-(ft+D)*(pt-ft)))/(ft+D);g<0&&(Rt=-Rt),_=this.x0+Rt;var Ct=D+Q;return Rt=Math.PI*this.R*(ot*Ct-S*Math.sqrt((ft+D)*(D+1)-Ct*Ct))/(ft+D),h>=0?a=this.y0+Rt:a=this.y0-Rt,n.x=_,n.y=a,n}function Xv(n){var o,h,g,_,a,M,S,D,N,L,Q,pt,ot;return n.x-=this.x0,n.y-=this.y0,Q=Math.PI*this.R,g=n.x/Q,_=n.y/Q,a=g*g+_*_,M=-Math.abs(_)*(1+a),S=M-2*_*_+g*g,D=-2*M+1+2*_*_+a*a,ot=_*_/D+(2*S*S*S/D/D/D-9*M*S/D/D)/27,N=(M-S*S/3/D)/D,L=2*Math.sqrt(-N/3),Q=3*ot/N/L,Math.abs(Q)>1&&(Q>=0?Q=1:Q=-1),pt=Math.acos(Q)/3,n.y>=0?h=(-L*Math.cos(pt+Math.PI/3)-S/3/D)*Math.PI:h=-(-L*Math.cos(pt+Math.PI/3)-S/3/D)*Math.PI,Math.abs(g)<jt?o=this.long0:o=Wt(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(g*g-_*_)+a*a))/2/g),n.x=o,n.y=h,n}var Kv=["Van_der_Grinten_I","VanDerGrinten","vandg"],Hm={init:Zv,forward:Hv,inverse:Xv,names:Kv};W();function Jv(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Yv(n){var o=n.x,h=n.y,g=Math.sin(n.y),_=Math.cos(n.y),a=Wt(o-this.long0),M,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe,Ce,Re,mi,Fi,Yi,Oi;return this.sphere?Math.abs(this.sin_p12-1)<=jt?(n.x=this.x0+this.a*(Nt-h)*Math.sin(a),n.y=this.y0-this.a*(Nt-h)*Math.cos(a),n):Math.abs(this.sin_p12+1)<=jt?(n.x=this.x0+this.a*(Nt+h)*Math.sin(a),n.y=this.y0+this.a*(Nt+h)*Math.cos(a),n):(Ce=this.sin_p12*g+this.cos_p12*_*Math.cos(a),me=Math.acos(Ce),oe=me?me/Math.sin(me):1,n.x=this.x0+this.a*oe*_*Math.sin(a),n.y=this.y0+this.a*oe*(this.cos_p12*g-this.sin_p12*_*Math.cos(a)),n):(M=hs(this.es),S=cs(this.es),D=us(this.es),N=ps(this.es),Math.abs(this.sin_p12-1)<=jt?(L=this.a*Ji(M,S,D,N,Nt),Q=this.a*Ji(M,S,D,N,h),n.x=this.x0+(L-Q)*Math.sin(a),n.y=this.y0-(L-Q)*Math.cos(a),n):Math.abs(this.sin_p12+1)<=jt?(L=this.a*Ji(M,S,D,N,Nt),Q=this.a*Ji(M,S,D,N,h),n.x=this.x0+(L+Q)*Math.sin(a),n.y=this.y0+(L+Q)*Math.cos(a),n):(pt=g/_,ot=ds(this.a,this.e,this.sin_p12),ft=ds(this.a,this.e,g),Rt=Math.atan((1-this.es)*pt+this.es*ot*this.sin_p12/(ft*_)),Ct=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(Rt)-this.sin_p12*Math.cos(a)),Ct===0?Re=Math.asin(this.cos_p12*Math.sin(Rt)-this.sin_p12*Math.cos(Rt)):Math.abs(Math.abs(Ct)-Math.PI)<=jt?Re=-Math.asin(this.cos_p12*Math.sin(Rt)-this.sin_p12*Math.cos(Rt)):Re=Math.asin(Math.sin(a)*Math.cos(Rt)/Math.sin(Ct)),Dt=this.e*this.sin_p12/Math.sqrt(1-this.es),ne=this.e*this.cos_p12*Math.cos(Ct)/Math.sqrt(1-this.es),Ht=Dt*ne,fe=ne*ne,mi=Re*Re,Fi=mi*Re,Yi=Fi*Re,Oi=Yi*Re,me=ot*Re*(1-mi*fe*(1-fe)/6+Fi/8*Ht*(1-2*fe)+Yi/120*(fe*(4-7*fe)-3*Dt*Dt*(1-7*fe))-Oi/48*Ht),n.x=this.x0+me*Math.sin(Ct),n.y=this.y0+me*Math.cos(Ct),n))}function Qv(n){n.x-=this.x0,n.y-=this.y0;var o,h,g,_,a,M,S,D,N,L,Q,pt,ot,ft,Rt,Ct,Dt,ne,Ht,fe,me,oe,Ce,Re;return this.sphere?(o=Math.sqrt(n.x*n.x+n.y*n.y),o>2*Nt*this.a?void 0:(h=o/this.a,g=Math.sin(h),_=Math.cos(h),a=this.long0,Math.abs(o)<=jt?M=this.lat0:(M=jr(_*this.sin_p12+n.y*g*this.cos_p12/o),S=Math.abs(this.lat0)-Nt,Math.abs(S)<=jt?this.lat0>=0?a=Wt(this.long0+Math.atan2(n.x,-n.y)):a=Wt(this.long0-Math.atan2(-n.x,n.y)):a=Wt(this.long0+Math.atan2(n.x*g,o*this.cos_p12*_-n.y*this.sin_p12*g))),n.x=a,n.y=M,n)):(D=hs(this.es),N=cs(this.es),L=us(this.es),Q=ps(this.es),Math.abs(this.sin_p12-1)<=jt?(pt=this.a*Ji(D,N,L,Q,Nt),o=Math.sqrt(n.x*n.x+n.y*n.y),ot=pt-o,M=Sa(ot/this.a,D,N,L,Q),a=Wt(this.long0+Math.atan2(n.x,-1*n.y)),n.x=a,n.y=M,n):Math.abs(this.sin_p12+1)<=jt?(pt=this.a*Ji(D,N,L,Q,Nt),o=Math.sqrt(n.x*n.x+n.y*n.y),ot=o-pt,M=Sa(ot/this.a,D,N,L,Q),a=Wt(this.long0+Math.atan2(n.x,n.y)),n.x=a,n.y=M,n):(o=Math.sqrt(n.x*n.x+n.y*n.y),Ct=Math.atan2(n.x,n.y),ft=ds(this.a,this.e,this.sin_p12),Dt=Math.cos(Ct),ne=this.e*this.cos_p12*Dt,Ht=-ne*ne/(1-this.es),fe=3*this.es*(1-Ht)*this.sin_p12*this.cos_p12*Dt/(1-this.es),me=o/ft,oe=me-Ht*(1+Ht)*Math.pow(me,3)/6-fe*(1+3*Ht)*Math.pow(me,4)/24,Ce=1-Ht*oe*oe/2-me*oe*oe*oe/6,Rt=Math.asin(this.sin_p12*Math.cos(oe)+this.cos_p12*Math.sin(oe)*Dt),a=Wt(this.long0+Math.asin(Math.sin(Ct)*Math.sin(oe)/Math.cos(Rt))),Re=Math.sin(Rt),M=Math.atan2((Re-this.es*Ce*this.sin_p12)*Math.tan(Rt),Re*(1-this.es)),n.x=a,n.y=M,n))}var t1=["Azimuthal_Equidistant","aeqd"],Xm={init:Jv,forward:Yv,inverse:Qv,names:t1};W();function e1(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function i1(n){var o,h,g,_,a,M,S,D,N=n.x,L=n.y;return g=Wt(N-this.long0),o=Math.sin(L),h=Math.cos(L),_=Math.cos(g),M=this.sin_p14*o+this.cos_p14*h*_,a=1,(M>0||Math.abs(M)<=jt)&&(S=this.a*a*h*Math.sin(g),D=this.y0+this.a*a*(this.cos_p14*o-this.sin_p14*h*_)),n.x=S,n.y=D,n}function r1(n){var o,h,g,_,a,M,S;return n.x-=this.x0,n.y-=this.y0,o=Math.sqrt(n.x*n.x+n.y*n.y),h=jr(o/this.a),g=Math.sin(h),_=Math.cos(h),M=this.long0,Math.abs(o)<=jt?(S=this.lat0,n.x=M,n.y=S,n):(S=jr(_*this.sin_p14+n.y*g*this.cos_p14/o),a=Math.abs(this.lat0)-Nt,Math.abs(a)<=jt?(this.lat0>=0?M=Wt(this.long0+Math.atan2(n.x,-n.y)):M=Wt(this.long0-Math.atan2(-n.x,n.y)),n.x=M,n.y=S,n):(M=Wt(this.long0+Math.atan2(n.x*g,o*this.cos_p14*_-n.y*this.sin_p14*g)),n.x=M,n.y=S,n))}var n1=["ortho"],Km={init:e1,forward:i1,inverse:r1,names:n1};W();var Pi={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ai={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function s1(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Nt-He/2?this.face=Pi.TOP:this.lat0<=-(Nt-He/2)?this.face=Pi.BOTTOM:Math.abs(this.long0)<=He?this.face=Pi.FRONT:Math.abs(this.long0)<=Nt+He?this.face=this.long0>0?Pi.RIGHT:Pi.LEFT:this.face=Pi.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function a1(n){var o={x:0,y:0},h,g,_,a,M,S,D={value:0};if(n.x-=this.long0,this.es!==0?h=Math.atan(this.one_minus_f_squared*Math.tan(n.y)):h=n.y,g=n.x,this.face===Pi.TOP)a=Nt-h,g>=He&&g<=Nt+He?(D.value=ai.AREA_0,_=g-Nt):g>Nt+He||g<=-(Nt+He)?(D.value=ai.AREA_1,_=g>0?g-Ai:g+Ai):g>-(Nt+He)&&g<=-He?(D.value=ai.AREA_2,_=g+Nt):(D.value=ai.AREA_3,_=g);else if(this.face===Pi.BOTTOM)a=Nt+h,g>=He&&g<=Nt+He?(D.value=ai.AREA_0,_=-g+Nt):g<He&&g>=-He?(D.value=ai.AREA_1,_=-g):g<-He&&g>=-(Nt+He)?(D.value=ai.AREA_2,_=-g-Nt):(D.value=ai.AREA_3,_=g>0?-g+Ai:-g-Ai);else{var N,L,Q,pt,ot,ft,Rt;this.face===Pi.RIGHT?g=Co(g,+Nt):this.face===Pi.BACK?g=Co(g,+Ai):this.face===Pi.LEFT&&(g=Co(g,-Nt)),pt=Math.sin(h),ot=Math.cos(h),ft=Math.sin(g),Rt=Math.cos(g),N=ot*Rt,L=ot*ft,Q=pt,this.face===Pi.FRONT?(a=Math.acos(N),_=bc(a,Q,L,D)):this.face===Pi.RIGHT?(a=Math.acos(L),_=bc(a,Q,-N,D)):this.face===Pi.BACK?(a=Math.acos(-N),_=bc(a,Q,-L,D)):this.face===Pi.LEFT?(a=Math.acos(-L),_=bc(a,Q,N,D)):(a=_=0,D.value=ai.AREA_0)}return S=Math.atan(12/Ai*(_+Math.acos(Math.sin(_)*Math.cos(He))-Nt)),M=Math.sqrt((1-Math.cos(a))/(Math.cos(S)*Math.cos(S))/(1-Math.cos(Math.atan(1/Math.cos(_))))),D.value===ai.AREA_1?S+=Nt:D.value===ai.AREA_2?S+=Ai:D.value===ai.AREA_3&&(S+=1.5*Ai),o.x=M*Math.cos(S),o.y=M*Math.sin(S),o.x=o.x*this.a+this.x0,o.y=o.y*this.a+this.y0,n.x=o.x,n.y=o.y,n}function o1(n){var o={lam:0,phi:0},h,g,_,a,M,S,D,N,L,Q={value:0};if(n.x=(n.x-this.x0)/this.a,n.y=(n.y-this.y0)/this.a,g=Math.atan(Math.sqrt(n.x*n.x+n.y*n.y)),h=Math.atan2(n.y,n.x),n.x>=0&&n.x>=Math.abs(n.y)?Q.value=ai.AREA_0:n.y>=0&&n.y>=Math.abs(n.x)?(Q.value=ai.AREA_1,h-=Nt):n.x<0&&-n.x>=Math.abs(n.y)?(Q.value=ai.AREA_2,h=h<0?h+Ai:h-Ai):(Q.value=ai.AREA_3,h+=Nt),L=Ai/12*Math.tan(h),M=Math.sin(L)/(Math.cos(L)-1/Math.sqrt(2)),S=Math.atan(M),_=Math.cos(h),a=Math.tan(g),D=1-_*_*a*a*(1-Math.cos(Math.atan(1/Math.cos(S)))),D<-1?D=-1:D>1&&(D=1),this.face===Pi.TOP)N=Math.acos(D),o.phi=Nt-N,Q.value===ai.AREA_0?o.lam=S+Nt:Q.value===ai.AREA_1?o.lam=S<0?S+Ai:S-Ai:Q.value===ai.AREA_2?o.lam=S-Nt:o.lam=S;else if(this.face===Pi.BOTTOM)N=Math.acos(D),o.phi=N-Nt,Q.value===ai.AREA_0?o.lam=-S+Nt:Q.value===ai.AREA_1?o.lam=-S:Q.value===ai.AREA_2?o.lam=-S-Nt:o.lam=S<0?-S-Ai:-S+Ai;else{var pt,ot,ft;pt=D,L=pt*pt,L>=1?ft=0:ft=Math.sqrt(1-L)*Math.sin(S),L+=ft*ft,L>=1?ot=0:ot=Math.sqrt(1-L),Q.value===ai.AREA_1?(L=ot,ot=-ft,ft=L):Q.value===ai.AREA_2?(ot=-ot,ft=-ft):Q.value===ai.AREA_3&&(L=ot,ot=ft,ft=-L),this.face===Pi.RIGHT?(L=pt,pt=-ot,ot=L):this.face===Pi.BACK?(pt=-pt,ot=-ot):this.face===Pi.LEFT&&(L=pt,pt=ot,ot=-L),o.phi=Math.acos(-ft)-Nt,o.lam=Math.atan2(ot,pt),this.face===Pi.RIGHT?o.lam=Co(o.lam,-Nt):this.face===Pi.BACK?o.lam=Co(o.lam,-Ai):this.face===Pi.LEFT&&(o.lam=Co(o.lam,+Nt))}if(this.es!==0){var Rt,Ct,Dt;Rt=o.phi<0?1:0,Ct=Math.tan(o.phi),Dt=this.b/Math.sqrt(Ct*Ct+this.one_minus_f_squared),o.phi=Math.atan(Math.sqrt(this.a*this.a-Dt*Dt)/(this.one_minus_f*Dt)),Rt&&(o.phi=-o.phi)}return o.lam+=this.long0,n.x=o.lam,n.y=o.phi,n}function bc(n,o,h,g){var _;return n<jt?(g.value=ai.AREA_0,_=0):(_=Math.atan2(o,h),Math.abs(_)<=He?g.value=ai.AREA_0:_>He&&_<=Nt+He?(g.value=ai.AREA_1,_-=Nt):_>Nt+He||_<=-(Nt+He)?(g.value=ai.AREA_2,_=_>=0?_-Ai:_+Ai):(g.value=ai.AREA_3,_+=Nt)),_}function Co(n,o){var h=n+o;return h<-Ai?h+=qs:h>+Ai&&(h-=qs),h}var l1=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Jm={init:s1,forward:a1,inverse:o1,names:l1};W();var dp=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],$l=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ym=.8487,Qm=1.3523,tg=Vr/5,h1=1/tg,Ao=18,wc=function(n,o){return n[0]+o*(n[1]+o*(n[2]+o*n[3]))},c1=function(n,o){return n[1]+o*(2*n[2]+o*3*n[3])};function u1(n,o,h,g){for(var _=o;g;--g){var a=n(_);if(_-=a,Math.abs(a)<h)break}return _}function p1(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function d1(n){var o=Wt(n.x-this.long0),h=Math.abs(n.y),g=Math.floor(h*tg);g<0?g=0:g>=Ao&&(g=Ao-1),h=Vr*(h-h1*g);var _={x:wc(dp[g],h)*o,y:wc($l[g],h)};return n.y<0&&(_.y=-_.y),_.x=_.x*this.a*Ym+this.x0,_.y=_.y*this.a*Qm+this.y0,_}function f1(n){var o={x:(n.x-this.x0)/(this.a*Ym),y:Math.abs(n.y-this.y0)/(this.a*Qm)};if(o.y>=1)o.x/=dp[Ao][0],o.y=n.y<0?-Nt:Nt;else{var h=Math.floor(o.y*Ao);for(h<0?h=0:h>=Ao&&(h=Ao-1);;)if($l[h][0]>o.y)--h;else if($l[h+1][0]<=o.y)++h;else break;var g=$l[h],_=5*(o.y-g[0])/($l[h+1][0]-g[0]);_=u1(function(a){return(wc(g,a)-o.y)/c1(g,a)},_,jt,100),o.x/=wc(dp[h],_),o.y=(5*h+_)*Ci,n.y<0&&(o.y=-o.y)}return o.x=Wt(o.x+this.long0),o}var m1=["Robinson","robin"],eg={init:p1,forward:d1,inverse:f1,names:m1};W();function g1(){this.name="geocent"}function y1(n){var o=uc(n,this.es,this.a);return o}function _1(n){var o=pc(n,this.es,this.a,this.b);return o}var x1=["Geocentric","geocentric","geocent","Geocent"],ig={init:g1,forward:y1,inverse:_1,names:x1};W();var mr={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Wl={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function v1(){if(Object.keys(Wl).forEach(function(h){if(typeof this[h]>"u")this[h]=Wl[h].def;else{if(Wl[h].num&&isNaN(this[h]))throw new Error("Invalid parameter value, must be numeric "+h+" = "+this[h]);Wl[h].num&&(this[h]=parseFloat(this[h]))}Wl[h].degrees&&(this[h]=this[h]*Ci)}.bind(this)),Math.abs(Math.abs(this.lat0)-Nt)<jt?this.mode=this.lat0<0?mr.S_POLE:mr.N_POLE:Math.abs(this.lat0)<jt?this.mode=mr.EQUIT:(this.mode=mr.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var n=this.tilt,o=this.azi;this.cg=Math.cos(o),this.sg=Math.sin(o),this.cw=Math.cos(n),this.sw=Math.sin(n)}function b1(n){n.x-=this.long0;var o=Math.sin(n.y),h=Math.cos(n.y),g=Math.cos(n.x),_,a;switch(this.mode){case mr.OBLIQ:a=this.sinph0*o+this.cosph0*h*g;break;case mr.EQUIT:a=h*g;break;case mr.S_POLE:a=-o;break;case mr.N_POLE:a=o;break}switch(a=this.pn1/(this.p-a),_=a*h*Math.sin(n.x),this.mode){case mr.OBLIQ:a*=this.cosph0*o-this.sinph0*h*g;break;case mr.EQUIT:a*=o;break;case mr.N_POLE:a*=-(h*g);break;case mr.S_POLE:a*=h*g;break}var M,S;return M=a*this.cg+_*this.sg,S=1/(M*this.sw*this.h1+this.cw),_=(_*this.cg-a*this.sg)*this.cw*S,a=M*S,n.x=_*this.a,n.y=a*this.a,n}function w1(n){n.x/=this.a,n.y/=this.a;var o={x:n.x,y:n.y},h,g,_;_=1/(this.pn1-n.y*this.sw),h=this.pn1*n.x*_,g=this.pn1*n.y*this.cw*_,n.x=h*this.cg+g*this.sg,n.y=g*this.cg-h*this.sg;var a=Pr(n.x,n.y);if(Math.abs(a)<jt)o.x=0,o.y=n.y;else{var M,S;switch(S=1-a*a*this.pfact,S=(this.p-Math.sqrt(S))/(this.pn1/a+a/this.pn1),M=Math.sqrt(1-S*S),this.mode){case mr.OBLIQ:o.y=Math.asin(M*this.sinph0+n.y*S*this.cosph0/a),n.y=(M-this.sinph0*Math.sin(o.y))*a,n.x*=S*this.cosph0;break;case mr.EQUIT:o.y=Math.asin(n.y*S/a),n.y=M*a,n.x*=S;break;case mr.N_POLE:o.y=Math.asin(M),n.y=-n.y;break;case mr.S_POLE:o.y=-Math.asin(M);break}o.x=Math.atan2(n.x,n.y)}return n.x=o.x+this.long0,n.y=o.y,n}var M1=["Tilted_Perspective","tpers"],rg={init:v1,forward:b1,inverse:w1,names:M1};W();function S1(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var n=1-this.es,o=1/n;this.radius_p=Math.sqrt(n),this.radius_p2=n,this.radius_p_inv2=o,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function T1(n){var o=n.x,h=n.y,g,_,a,M;if(o=o-this.long0,this.shape==="ellipse"){h=Math.atan(this.radius_p2*Math.tan(h));var S=this.radius_p/Pr(this.radius_p*Math.cos(h),Math.sin(h));if(_=S*Math.cos(o)*Math.cos(h),a=S*Math.sin(o)*Math.cos(h),M=S*Math.sin(h),(this.radius_g-_)*_-a*a-M*M*this.radius_p_inv2<0)return n.x=Number.NaN,n.y=Number.NaN,n;g=this.radius_g-_,this.flip_axis?(n.x=this.radius_g_1*Math.atan(a/Pr(M,g)),n.y=this.radius_g_1*Math.atan(M/g)):(n.x=this.radius_g_1*Math.atan(a/g),n.y=this.radius_g_1*Math.atan(M/Pr(a,g)))}else this.shape==="sphere"&&(g=Math.cos(h),_=Math.cos(o)*g,a=Math.sin(o)*g,M=Math.sin(h),g=this.radius_g-_,this.flip_axis?(n.x=this.radius_g_1*Math.atan(a/Pr(M,g)),n.y=this.radius_g_1*Math.atan(M/g)):(n.x=this.radius_g_1*Math.atan(a/g),n.y=this.radius_g_1*Math.atan(M/Pr(a,g))));return n.x=n.x*this.a,n.y=n.y*this.a,n}function E1(n){var o=-1,h=0,g=0,_,a,M,S;if(n.x=n.x/this.a,n.y=n.y/this.a,this.shape==="ellipse"){this.flip_axis?(g=Math.tan(n.y/this.radius_g_1),h=Math.tan(n.x/this.radius_g_1)*Pr(1,g)):(h=Math.tan(n.x/this.radius_g_1),g=Math.tan(n.y/this.radius_g_1)*Pr(1,h));var D=g/this.radius_p;if(_=h*h+D*D+o*o,a=2*this.radius_g*o,M=a*a-4*_*this.C,M<0)return n.x=Number.NaN,n.y=Number.NaN,n;S=(-a-Math.sqrt(M))/(2*_),o=this.radius_g+S*o,h*=S,g*=S,n.x=Math.atan2(h,o),n.y=Math.atan(g*Math.cos(n.x)/o),n.y=Math.atan(this.radius_p_inv2*Math.tan(n.y))}else if(this.shape==="sphere"){if(this.flip_axis?(g=Math.tan(n.y/this.radius_g_1),h=Math.tan(n.x/this.radius_g_1)*Math.sqrt(1+g*g)):(h=Math.tan(n.x/this.radius_g_1),g=Math.tan(n.y/this.radius_g_1)*Math.sqrt(1+h*h)),_=h*h+g*g+o*o,a=2*this.radius_g*o,M=a*a-4*_*this.C,M<0)return n.x=Number.NaN,n.y=Number.NaN,n;S=(-a-Math.sqrt(M))/(2*_),o=this.radius_g+S*o,h*=S,g*=S,n.x=Math.atan2(h,o),n.y=Math.atan(g*Math.cos(n.x)/o)}return n.x=n.x+this.long0,n}var I1=["Geostationary Satellite View","Geostationary_Satellite","geos"],ng={init:S1,forward:T1,inverse:E1,names:I1};function sg(n){n.Proj.projections.add(To),n.Proj.projections.add(Eo),n.Proj.projections.add(Im),n.Proj.projections.add(Cm),n.Proj.projections.add(Am),n.Proj.projections.add(Pm),n.Proj.projections.add(zm),n.Proj.projections.add(km),n.Proj.projections.add(Lm),n.Proj.projections.add(Dm),n.Proj.projections.add(Rm),n.Proj.projections.add(Bm),n.Proj.projections.add(Fm),n.Proj.projections.add(Nm),n.Proj.projections.add(Um),n.Proj.projections.add(Gm),n.Proj.projections.add(qm),n.Proj.projections.add(jm),n.Proj.projections.add($m),n.Proj.projections.add(Wm),n.Proj.projections.add(Zm),n.Proj.projections.add(Hm),n.Proj.projections.add(Xm),n.Proj.projections.add(Km),n.Proj.projections.add(Jm),n.Proj.projections.add(eg),n.Proj.projections.add(ig),n.Proj.projections.add(rg),n.Proj.projections.add(ng)}Gr.defaultDatum="WGS84";Gr.Proj=js;Gr.WGS84=new Gr.Proj("WGS84");Gr.Point=_m;Gr.toPoint=fc;Gr.defs=vo;Gr.nadgrid=sp;Gr.transform=wa;Gr.mgrs=mm;Gr.version="__VERSION__";sg(Gr);var Po=Gr;W();W();W();var gr;(function(n){n[n.UInt8=1]="UInt8",n[n.UInt16=2]="UInt16",n[n.UInt32=4]="UInt32",n[n.UInt64=8]="UInt64",n[n.Double=8]="Double",n[n.Float=4]="Float"})(gr||(gr={}));W();var ag=2**32,C1=typeof setImmediate>"u"?setTimeout:setImmediate,zr=()=>{throw new Error("Method not implemented.")},kn=class{constructor(){this.isLittleEndian=!0,this.delayMs=kn.DefaultDelayMs,this.maxChunkCount=10,this.chunks=kn.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=zr,this.getFloat64=zr,this.getInt8=zr,this.getInt16=zr,this.getInt32=zr,this.setFloat32=zr,this.setFloat64=zr,this.setInt8=zr,this.setInt16=zr,this.setInt32=zr,this.setUint8=zr,this.setUint16=zr,this.setUint32=zr,this.setBigInt64=zr,this.setBigUint64=zr}static getByteRanges(o,h=32,g=16){if(o.size===0)return{chunks:[],blankFill:[]};let _=[...o.values()].sort((D,N)=>D-N),a=[],M=[];a.push(M);let S=[];for(let D=0;D<_.length;++D){let N=_[D],L=_[D-1];if(M.length>=h)M=[N],a.push(M);else if(D===0||N===L+1)M.push(N);else if(N<L+g){for(let Q=L;Q<N;Q++)M.push(Q+1),S.push(Q+1);S.pop()}else M=[N],a.push(M)}return{chunks:a,blankFill:S}}async fetchData(){if(this.toFetch.size===0)return;let o=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let h=kn.getByteRanges(o,this.maxChunkCount,this.blankFillCount),g=[];for(let _ of h.chunks){let a=_[0],M=_[_.length-1],S=a*this.chunkSize,D=M*this.chunkSize+this.chunkSize-S,N=await this.fetchBytes(S,D);if(_.length===1){g[a]=N,this.chunks.set(a,new DataView(N));continue}let L=a*this.chunkSize;for(let Q of _){let pt=Q*this.chunkSize-L,ot=N.slice(pt,pt+this.chunkSize);g[Q]=ot,this.chunks.set(Q,new DataView(ot))}}}async loadBytes(o,h){if(o<0)throw new Error("Offset must be positive");let g=Math.floor(o/this.chunkSize),_=Math.ceil((o+h)/this.chunkSize)-1;for(let a=g;a<=_;a++)this.chunks.has(a)||this.toFetch.add(a);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(a=>C1(a,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(o){return Math.floor(o/this.chunkSize)}getUint(o,h){switch(h){case gr.UInt8:return this.getUint8(o);case gr.UInt16:return this.getUint16(o);case gr.UInt32:return this.getUint32(o);case gr.UInt64:return this.getUint64(o)}}bytes(o,h){let g=this.isOneChunk(o,h);if(g){let N=this.getView(g),L=o-g*this.chunkSize;return new Uint8Array(N.buffer.slice(L,L+h))}let _=new Uint8Array(h),a=o+h,M=Math.floor(o/this.chunkSize),S=Math.ceil((o+h)/this.chunkSize)-1,D=0;for(let N=M;N<=S;N++){let L=o+D,Q=N*this.chunkSize,pt=this.getView(N),ot=Math.min(a,Q+this.chunkSize),ft=pt.buffer.slice(L-Q,ot-Q);_.set(new Uint8Array(ft),D),D+=ft.byteLength}return _}getView(o){let h=this.chunks.get(o);if(h==null)throw new Error(`Chunk:${o} is not ready`);return h}isOneChunk(o,h){let g=o+h-1,_=Math.floor(o/this.chunkSize);return Math.floor(g/this.chunkSize)-_<1?_:null}hasBytes(o,h=1){let g=Math.floor(o/this.chunkSize),_=Math.ceil((o+h)/this.chunkSize)-1;for(let a=g;a<=_;a++)if(!this.chunks.has(a))return!1;return!0}toRange(o,h){if(h==null)return`bytes=${o}`;if(o<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${o}-${o+h}`}parseContentRange(o){let[h,g]=o.split(" ");if(h!=="bytes")throw new Error("Failed to parse content-range: "+o);if(g==null)throw new Error("Failed to parse content-range: "+o);let[,_]=g.split("/"),a=Number(_);if(isNaN(a))throw new Error("Failed to parse content-range: "+o);return a}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(o){let h=Math.floor(o/this.chunkSize),g=this.chunks.get(h);if(g==null)throw new Error(`Chunk:${h} is not ready`);return g.getUint8(o-h*this.chunkSize)}getUint16(o){let h=this.isOneChunk(o,gr.UInt16);if(h!=null)return this.getView(h).getUint16(o-h*this.chunkSize,this.isLittleEndian);let g=this.getUint8(o),_=this.getUint8(o+gr.UInt8);return this.isLittleEndian?g+(_<<8):(g<<8)+_}getUint32(o){let h=this.isOneChunk(o,gr.UInt32);if(h!=null)return this.getView(h).getUint32(o-h*this.chunkSize,this.isLittleEndian);let g=this.getUint16(o),_=this.getUint16(o+gr.UInt16);return this.isLittleEndian?g+_*65536:g*65536+_}getUint64(o){let h=this.isOneChunk(o,gr.UInt64);if(h!=null){let a=this.getView(h);return Number(a.getBigUint64(o-h*this.chunkSize,this.isLittleEndian))}let g=this.getUint32(o),_=this.getUint32(o+gr.UInt32);return this.isLittleEndian?g+_*ag:g*ag+_}getBigUint64(o){let h=this.isOneChunk(o,gr.UInt64);if(h!=null)return this.getView(h).getBigUint64(o-h*this.chunkSize,this.isLittleEndian);let g=BigInt(this.getUint32(o)),_=BigInt(this.getUint32(o+gr.UInt32));return this.isLittleEndian?g+(_<<BigInt(32)):(g<<BigInt(32))+_}getBigInt64(){throw new Error("Not implemented.")}};kn.DefaultChunkCache=()=>new Map;kn.DefaultDelayMs=1;W();W();var zo=class extends Error{constructor(o,h,g){super(o),this.name="CompositeError",this.code=h,this.reason=g}static isCompositeError(o){return typeof o!="object"||o==null?!1:o.name==="CompositeError"}};W();var og=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
|
|
509
|
+
GEOGCS["NZGD2000",
|
|
510
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
511
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
512
|
+
AUTHORITY["EPSG","7019"]],
|
|
513
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
514
|
+
AUTHORITY["EPSG","6167"]],
|
|
515
|
+
PRIMEM["Greenwich",0,
|
|
516
|
+
AUTHORITY["EPSG","8901"]],
|
|
517
|
+
UNIT["degree",0.01745329251994328,
|
|
518
|
+
AUTHORITY["EPSG","9122"]],
|
|
519
|
+
AUTHORITY["EPSG","4167"]],
|
|
520
|
+
UNIT["metre",1,
|
|
521
|
+
AUTHORITY["EPSG","9001"]],
|
|
522
|
+
PROJECTION["Transverse_Mercator"],
|
|
523
|
+
PARAMETER["latitude_of_origin",0],
|
|
524
|
+
PARAMETER["central_meridian",-176.5],
|
|
525
|
+
PARAMETER["scale_factor",1],
|
|
526
|
+
PARAMETER["false_easting",3500000],
|
|
527
|
+
PARAMETER["false_northing",10000000],
|
|
528
|
+
AUTHORITY["EPSG","3793"],
|
|
529
|
+
AXIS["Easting",EAST],
|
|
530
|
+
AXIS["Northing",NORTH]]`;W();var lg=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
|
|
531
|
+
GEOGCS["NZGD2000",
|
|
532
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
533
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
534
|
+
AUTHORITY["EPSG","7019"]],
|
|
535
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
536
|
+
AUTHORITY["EPSG","6167"]],
|
|
537
|
+
PRIMEM["Greenwich",0,
|
|
538
|
+
AUTHORITY["EPSG","8901"]],
|
|
539
|
+
UNIT["degree",0.0174532925199433,
|
|
540
|
+
AUTHORITY["EPSG","9122"]],
|
|
541
|
+
AUTHORITY["EPSG","4167"]],
|
|
542
|
+
PROJECTION["Transverse_Mercator"],
|
|
543
|
+
PARAMETER["latitude_of_origin",0],
|
|
544
|
+
PARAMETER["central_meridian",173],
|
|
545
|
+
PARAMETER["scale_factor",0.9996],
|
|
546
|
+
PARAMETER["false_easting",1600000],
|
|
547
|
+
PARAMETER["false_northing",10000000],
|
|
548
|
+
UNIT["metre",1,
|
|
549
|
+
AUTHORITY["EPSG","9001"]],
|
|
550
|
+
AUTHORITY["EPSG","2193"]]`;Po.defs(qe.Nztm2000.toEpsgString(),lg);Po.defs(qe.Citm2000.toEpsgString(),og);var fp=new Map;function A1(n){return n==null?null:typeof n=="number"?n:"code"in n?n.code:"projection"in n?n.projection.code:null}var Ln=class{constructor(o){this.epsg=o;try{this.projection=Po(o.toEpsgString(),qe.Wgs84.toEpsgString())}catch(h){throw new zo(`Failed to create projection: ${o.toEpsgString()}, ${qe.Wgs84.toEpsgString()}`,500,h)}}static define(o,h){if(fp.get(o.code)!=null)throw new Error("Duplicate projection definition: "+o.toEpsgString());Po.defs(o.toEpsgString(),h)}static get(o){let h=this.tryGet(o);if(h==null)throw new Error(`Invalid projection: ${o}`);return h}static tryGet(o){let h=A1(o);if(h==null)return null;let g=fp.get(h);if(g!=null)return g;let _=qe.tryGet(h);return _==null||Po.defs(_.toEpsgString())==null?null:(g=new Ln(_),fp.set(h,g),g)}projectMultipolygon(o,h){if(h.epsg.code===this.epsg.code)return o;let{toWgs84:g}=this,{fromWgs84:_}=h;return o.map(a=>a.map(M=>M.map(S=>_(g(S)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(o){let h=this.toWgs84([o.x,o.y]),g=this.toWgs84([o.x+o.width,o.y+o.height]);return[h[0],h[1],g[0],g[1]]}boundsToGeoJsonFeature(o,h={}){let g=[o.x,o.y],_=[o.x+o.width,o.y],a=[o.x,o.y+o.height],M=[o.x+o.width,o.y+o.height],S=Ef([[[g,a,M,_,g]]],this.toWgs84),D=S.length===1?If(S[0],h):Cf(S,h);return D.bbox=this.boundsToWgs84BoundingBox(o),D}toGeoJson(o){return{type:"FeatureCollection",features:o.map(h=>this.boundsToGeoJsonFeature(h,{name:h.name}))}}static getTiffResZoom(o,h,g=1){let _=0;for(;_<o.zooms.length;++_)if(o.pixelScale(_)<=h*g)return _;if(_===o.zooms.length)return _-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(o,h){let g=o.tileToSource(h),_=o.tileToSource({x:h.x+1,y:h.y+1,z:h.z}),a=this.get(o),[M,S]=a.toWgs84([g.x,_.y]),[D,N]=a.toWgs84([_.x,g.y]);return[M,S,D,N]}static tileCenterToLatLon(o,h){let g=o.tileToSource({x:h.x+.5,y:h.y+.5,z:h.z}),[_,a]=this.get(o).toWgs84([g.x,g.y]);return Ln.wrapLatLon(a,_)}static wrapLatLon(o,h){let g={lat:o,lon:h},_=Math.floor(Math.abs(o)/90)%4,a=o>0?90:-90,M=o%90;switch(_){case 0:g.lat=M;break;case 1:g.lat=a-M,g.lon+=180;break;case 2:g.lat=-M,g.lon+=180;break;case 3:g.lat=-a+M;break}return(g.lon>180||g.lon<-180)&&(g.lon-=Math.floor((g.lon+180)/360)*360),g}static findAlignmentLevels(o,h,g){return Math.max(0,this.getTiffResZoom(o,g,2)-h.z)}static getImagePixelWidth(o,h,g){let _=o.tileToSource(h),a=o.tileToSource({x:h.x+1,y:h.y+1,z:h.z});return Math.round((a.x-_.x)/o.pixelScale(g))*2}};W();W();function Mc(n){let o=Object.entries(n);if(o.length===0)return"";let h=new URLSearchParams;for(let _ of o)_[1]!=null&&h.set(_[0],_[1]);h.sort();let g=h.toString();return g===""?"":`?${g}`}W();var ug=Ns(cg(),1),pg="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",dg=(0,ug.default)(pg),z1=new Set(pg);function fg(n){for(let o=0;o<n.length;o++)if(!z1.has(n.charAt(o)))return!1;return!0}function Sc(n){if(n==null)return null;if(fg(n))return n;let h=new TextEncoder().encode(n);return dg.encode(h)}var fi={ImageFormat:"png",toHash(n){return`#@${n.lat.toFixed(7)},${n.lon.toFixed(7)},z${n.zoom}`},parseZoom(n){return n==null||n===""?NaN:n.startsWith("z")?parseFloat(n.slice(1)):n.endsWith("z")?parseFloat(n):NaN},fromHash(n){let o={},h=n.replace("#@",""),[g,_,a]=h.split(","),M=parseFloat(g),S=parseFloat(_);!isNaN(M)&&!isNaN(S)&&(o.lat=M,o.lon=S);let D=fi.parseZoom(a);return isNaN(D)||(o.zoom=D),o},baseUrl(){let n=It.BaseUrl;if(n==="")return window.location.origin;if(!n.startsWith("http"))throw new Error("BaseURL must start with http(s)://");return n},toBaseWmts(){let n=Mc({api:It.ApiKey,config:Sc(It.map.config)});return`${this.baseUrl()}/v1/tiles/aerial/WMTSCapabilities.xml${n}`},toImageryUrl(n,o){return`${this.baseUrl()}/v1/imagery/${n}/${o}`},toTileUrl(n,o,h,g,_){let a=new URLSearchParams;It.ApiKey!=null&&It.ApiKey!==""&&a.set("api",It.ApiKey),_!=null&&a.set("config",Sc(_)),n==="style"&&(o.identifier!==Ye.identifier&&a.set("tileMatrix",o.identifier),fi.ImageFormat!==Fl.Webp&&a.set("format",fi.ImageFormat));let M="?"+a.toString(),S=`${this.baseUrl()}/v1/tiles/${h}/${o.identifier}`;if(n==="raster")return`${S}/{z}/{x}/{y}.${fi.ImageFormat}${M}`;if(n==="vector-xyz")return`${S}/{z}/{x}/{y}.pbf${M}`;if(n==="style")return`${this.baseUrl()}/v1/styles/${g??h}.json${M}`;if(n==="wmts")return`${S}/WMTSCapabilities.xml${M}`;if(n==="attribution")return`${S}/attribution.json${M}`;if(n==="tile-wmts")return`${S}/{TileMatrix}/{TileCol}/{TileRow}.${fi.ImageFormat}${M}`;throw new Error("Unknown url type: "+n)},toConfigUrl(n,o=It.map.config){let h=Mc({api:It.ApiKey,config:o});return`${this.baseUrl()}/v1/config/${n}.json${h}`},toConfigImageryUrl(n,o,h=It.map.config){let g=Mc({api:It.ApiKey,config:h});return`${this.baseUrl()}/v1/config/${n}/${o}.json${g}`}};var Zl=class{constructor(o,h=0){this.tileMatrix=o,this.extraZoomLevels=h}getStyle(o,h,g=It.map.config){return fi.toTileUrl("style",this.tileMatrix,o,h,g)}},k1=new Zl(rs,2),L1=new Zl(Pn),gg=new Zl(Ye),D1=[k1,L1,gg];function ko(n){for(let o of D1)if(n===o.tileMatrix.identifier)return o;return gg}function mg(n){return n.identifier===Ye.identifier}function Dn(n,o,h){if(o.identifier===h.identifier)return n;if(!mg(o)&&!mg(h))throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");let g=Ln.get(o).fromWgs84([n.lon,n.lat]),_=o.sourceToPixels(g[0],g[1],Math.round(n.zoom)),a={x:_.x/o.tileSize,y:_.y/o.tileSize,z:Math.round(n.zoom)},M=h.tileToSource(a),S=Ln.get(h).toWgs84([M.x,M.y]);return{lon:Math.round(S[0]*1e8)/1e8,lat:Math.round(S[1]*1e8)/1e8,zoom:n.zoom}}function yg(n,o){for(let h of n.features){if(h.geometry.type!=="Polygon")throw new Error("Only polygons supported");for(let g of h.geometry.coordinates)for(let _ of g){let a=Dn({lat:_[1],lon:_[0],zoom:o.maxZoom},o,Ye);_[0]=a.lon,_[1]=a.lat}}}var _g={[Ye.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:5},[rs.identifier]:{lat:-41.277848,lon:174.6763921,zoom:3},[Pn.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:3}},en=class extends xg.Emitter{constructor(){super(...arguments);this.style=null;this.layerId="aerial";this.tileMatrix=Ye;this.debug={...yo}}get layers(){return this._layers==null&&(this._layers=R1()),this._layers}get isDebug(){return this.debug.debug}get location(){return this._location==null&&(window.addEventListener("popstate",()=>{let h={..._g[this.tileMatrix.identifier],...fi.fromHash(window.location.hash)};this.setLocation(h)}),this.updateFromUrl(),this._location={..._g[this.tileMatrix.identifier],...fi.fromHash(window.location.hash)}),this._location}get transformedLocation(){return this.transformLocation(this.location.lat,this.location.lon,this.location.zoom)}get isVector(){return this.layerId==="topographic"}get layerKey(){return this.style==null?this.layerId:`${this.layerId}::${this.style}`}get layerKeyTms(){return`${this.layerKey}::${this.tileMatrix.identifier}`}updateFromUrl(h=window.location.search){let g=new URLSearchParams(h),_=g.get("s")??g.get("style"),a=g.get("c")??g.get("config"),M=g.get("i")??"aerial",S=(g.get("p")??g.get("tileMatrix")??Ye.identifier).toLowerCase(),D=ns.All.find(Q=>Q.identifier.toLowerCase()===S);D==null&&(D=ns.get(qe.parse(S)??qe.Google)),D.identifier===rs.identifier&&(D=Pn),Ol.fromUrl(this.debug,g)&&this.emit("change");let L=en.toUrl(this);this.config=a,this.style=_??null,this.layerId=M.startsWith("im_")?M.slice(3):M,this.tileMatrix=D,this.layerId==="topographic"&&this.style==null&&(this.style="topographic"),this.emit("tileMatrix",this.tileMatrix),this.emit("layer",this.layerId,this.style),L!==en.toUrl(this)&&this.emit("change")}static toUrl(h){let g=new URLSearchParams;return h.style&&g.append("s",h.style),h.config&&g.append("config",Sc(h.config)),h.layerId!=="aerial"&&g.append("i",h.layerId),h.tileMatrix.identifier!==Ye.identifier&&g.append("p",h.tileMatrix.identifier),Ol.toUrl(h.debug,g),g.toString()}toTileUrl(h,g=this.tileMatrix,_=this.layerId,a=this.style,M=this.config){return fi.toTileUrl(h,g,_,a,M)}getLocation(h){let g=h.getCenter();if(g==null)throw new Error("Invalid Map location");let _=Math.floor((h.getZoom()??0)*1e4)/1e4;return It.map.transformLocation(g.lat,g.lng,_)}transformLocation(h,g,_){return Dn({lat:h,lon:g,zoom:_},Ye,this.tileMatrix)}setLocation(h){h.lat===this.location.lat&&h.lon===this.location.lon&&h.zoom===this.location.zoom||(this.location.lat=h.lat,this.location.lon=h.lon,this.location.zoom=h.zoom,this.emit("location",this.location),this.emit("change"))}setTileMatrix(h){this.tileMatrix.identifier!==h.identifier&&(this.emit("tileMatrix",this.tileMatrix),this.emit("change"))}setLayerId(h,g){this.layerId===h&&this.style===g||(this.layerId=h,this.style=g??null,this.emit("layer",this.layerId,this.style),this.emit("change"))}setDebug(h,g=yo[h]){this.debug[h]!==g&&(this.debug[h]=g,this.emit("change"))}};async function R1(){let n=new Map,o=await fetch(fi.toBaseWmts());if(!o.ok)return n;let _=new DOMParser().parseFromString(await o.text(),"text/xml").getElementsByTagName("Layer"),a=[];for(let M=0;M<_.length;M++){let S=_.item(M);if(S==null)continue;let D=S.getElementsByTagName("ows:Title").item(0)?.textContent,N=S.getElementsByTagName("ows:Identifier").item(0)?.textContent;if(D==null||N==null||D==="aerial")continue;let L=S.getElementsByTagName("ows:Keyword").item(0)?.textContent,Q=S.getElementsByTagName("ows:WGS84BoundingBox").item(0),pt=Q?.getElementsByTagName("ows:UpperCorner").item(0)?.textContent?.split(" ").map(Number),ot=Q?.getElementsByTagName("ows:LowerCorner").item(0)?.textContent?.split(" ").map(Number),ft=S.getElementsByTagName("TileMatrixSet"),Rt=new Set;for(let Ct=0;Ct<ft.length;Ct++){let Dt=F1(ft.item(Ct)?.textContent??"");Dt!=null&&Rt.add(Dt.code)}pt==null||ot==null||pt.length!==2||a.push({id:N,name:D.replace("aerial ",""),upperLeft:pt,lowerRight:ot,projections:Rt,category:L})}a.sort((M,S)=>M.name.localeCompare(S.name)),B1(n);for(let M of a)n.set(M.id,M);return n}function B1(n){n.set("aerial",{id:"aerial",name:"Aerial Imagery",projections:new Set([Ze.Nztm2000,Ze.Google]),category:"Basemaps"}),n.set("topographic::topographic",{id:"topographic::topographic",name:"Topographic",projections:new Set([Ze.Google]),category:"Basemaps"})}function F1(n){if(n.toLowerCase().startsWith("epsg"))return qe.parse(n);let o=ns.find(n);return o==null?null:o.projection}var O1=pf(),It={get BaseUrl(){return""},get ApiKey(){return O1},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.35.0"},map:new en};if(It.GoogleAnalytics!==""&&typeof window<"u"){window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",`${It.GoogleAnalytics}`);let n=document.createElement("script");n.setAttribute("async",""),n.setAttribute("src",`https://www.googletagmanager.com/gtag/js?id=${It.GoogleAnalytics}`),document.head.appendChild(n)}function Ta(n,o,h){It.GoogleAnalytics!==""&&window.gtag("event",o,{event_category:n,value:h})}W();Qr();W();Qr();Qr();var N1=0;function At(n,o,h,g,_){var a,M,S={};for(M in o)M=="ref"?a=o[M]:S[M]=o[M];var D={type:n,props:S,key:h,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--N1,__source:_,__self:g};if(typeof n=="function"&&(a=n.defaultProps))for(M in a)S[M]===void 0&&(S[M]=a[M]);return vi.vnode&&vi.vnode(D),D}var Hl=class extends Ii{render(o){return At("i",{class:"material-icons-round md-36",children:o.name})}},Rn=class extends Ii{render(o){return At("a",{rel:"noopener",target:"_blank",href:o.href,style:"display:flex;","aria-label":o.ariaLabel,children:[o.children,o.icon?At(Hl,{name:o.icon}):void 0]})}};var Tc=class extends Ii{constructor(){super(...arguments);this._events=[]}componentWillMount(){this._events.push(It.map.on("change",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!It.map.isDebug)return At("footer",{class:"lui-footer lui-footer-small lui-hide-sm lui-hide-xs",role:"contentinfo",children:At("div",{class:"lui-footer-columns",children:[At("div",{style:"display:flex; align-items:center",children:At(Rn,{href:"http://www.govt.nz/",ariaLabel:"New Zealand Government",children:At("img",{src:"/assets/logo-nz-govt.svg"})})}),At("div",{class:"justify-end",children:At("ul",{class:"lui-footer-list",children:[At("li",{class:"lui-footer-inline-list-item",children:"\xA9 2021 Land Information New Zealand"}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/contact-us",children:"Contact"})}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/privacy",children:"Privacy"})}),At("li",{class:"lui-footer-inline-list-item",children:At(Rn,{href:"https://www.linz.govt.nz/data/linz-data/linz-basemaps/data-attribution",children:"Data Attribution"})})]})})]})})}};W();W();function vg(n){var o,h,g="";if(typeof n=="string"||typeof n=="number")g+=n;else if(typeof n=="object")if(Array.isArray(n))for(o=0;o<n.length;o++)n[o]&&(h=vg(n[o]))&&(g&&(g+=" "),g+=h);else for(o in n)n[o]&&(g&&(g+=" "),g+=o);return g}function Ec(){for(var n=0,o,h,g="";n<arguments.length;)(o=arguments[n++])&&(h=vg(o))&&(g&&(g+=" "),g+=h);return g}Qr();W();Qr();var fs=class extends Ii{constructor(){super(...arguments);this._copyTimeout=null;this.copy=()=>{Ta("Ui","copy:"+It.map.layerKey+":"+this.props.header.replace(/ /g,"").toLowerCase()),navigator.clipboard.writeText(this.props.value),this.setState({copied:!0}),this._copyTimeout!=null&&clearTimeout(this._copyTimeout),this._copyTimeout=setTimeout(()=>this.setState({copied:!1}),1e3)}}render(){return At("div",{class:"LuiDeprecatedForms",children:[At("label",{children:this.props.header}),At("div",{class:Ec({"lui-menu-label":!0,"menu-copyable":!0,"menu-copyable-copied":this.state.copied}),children:[At("button",{class:"menu-copyable-icon-button",title:"Copy",onClick:this.copy,children:At("i",{class:"material-icons-round",children:this.state.copied?"check":"content_copy"})}),At("input",{value:this.props.value,readonly:!0})]})]})}};W();Qr();var Ic=class extends Ii{constructor(){super(...arguments);this._events=[];this.onChange=h=>{let g=h.target,[_,a]=g.value.split("::");It.map.setLayerId(_,a),Ta("Ui","layer:"+g.value),It.map.layers.then(M=>{let S=M.get(_);S!=null&&It.map.emit("bounds",[S.upperLeft,S.lowerRight])}),window.history.pushState(null,"",`?${en.toUrl(It.map)}`)}}componentWillMount(){this.setState({...this.state,currentLayer:It.map.layerKey}),It.map.layers.then(h=>this.setState({...this.state,layers:h})),this._events.push(It.map.on("layer",()=>this.setState({...this.state,currentLayer:It.map.layerKey})),It.map.on("tileMatrix",()=>this.setState(this.state)))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){return At("div",{class:"LuiDeprecatedForms",children:[At("h6",{children:"Layers"}),At("select",{onChange:this.onChange,value:this.state.currentLayer,children:this.renderAerialLayers()})]})}renderAerialLayers(){if(this.state.layers==null||this.state.layers.size===0)return;let h=new Map;for(let _ of this.state.layers.values()){if(!_.projections.has(It.map.tileMatrix.projection.code))continue;let a=h.get(_.category??"Unknown")??[];a.push(At("option",{value:_.id,children:_.name.replace(` ${_.category}`,"")})),h.set(_.category??"Unknown",a)}if(h.size===0)return;let g=[];for(let[_,a]of h.entries())a.length!==0&&g.push(At("optgroup",{label:_,children:[...a]}));return At(yt,{children:g})}};var Cc=class extends Ii{constructor(){super(...arguments);this._events=[];this.menuToggle=()=>{let h=!this.state.isMenuOpen;Ta("Ui",h?"menu:open":"menu:close"),this.setState({...this.state,isMenuOpen:h})};this.contactUs=()=>{let h="Request Basemaps Developer Access",g=`
|
|
551
|
+
Give us a few key details to sign up for Developer Access to LINZ Basemaps. We will respond with your Apps' unique API key.
|
|
552
|
+
|
|
553
|
+
Your Name:
|
|
554
|
+
|
|
555
|
+
Your Email:
|
|
556
|
+
|
|
557
|
+
Your Service/App URL:
|
|
558
|
+
|
|
559
|
+
`;Ta("Ui","contact-us:click"),window.location.href=`mailto:basemaps@linz.govt.nz?subject=${encodeURI(h)}&body=${encodeURI(g)}`};this._validProjections=new Set([Ze.Google,Ze.Nztm2000])}componentWillMount(){this.setState({isMenuOpen:!1}),this._events.push(It.map.on("change",()=>this.setState(this.state))),It.map.layers.then(h=>this.setState({...this.state,layers:h}))}componentWillUnmount(){for(let h of this._events)h();this._events=[]}render(){if(!It.map.isDebug)return At("header",{class:"lui-header",children:[At("div",{class:"lui-header-row",children:[At("div",{class:"lui-header-col",children:[At("div",{class:"lui-header-logo",children:At("img",{class:"linz-logo",src:"/assets/logo-linz.svg"})}),At("div",{class:"lui-header-title",children:At("h1",{children:"Basemaps"})})]}),At("div",{class:"lui-header-col",children:At("div",{class:"lui-header-menu-item",children:At("div",{class:"lui-header-menu-icon",children:At("i",{class:"material-icons-round md-36",onClick:this.menuToggle,style:{cursor:"pointer"},children:this.state.isMenuOpen?"close":"menu"})})})})]}),At("div",{class:Ec({"lui-menu-drawer":!0,"lui-menu-drawer-closed":!this.state.isMenuOpen,"lui-menu-drawer-wide":!0}),"aria-hidden":this.state.isMenuOpen,children:[At(Ic,{}),this.renderLinks(),At("h6",{children:"Developer API Keys"}),At("p",{children:"Contact us for free API keys with better support for public web and mobile apps."}),At("button",{class:"lui-button lui-button-tertiary contact-us",onClick:this.contactUs,children:"Contact us"}),this.renderAbout()]})]})}renderAboutLi(h,g,_){return At("li",{children:At(Rn,{href:g,children:[h,_??At(Hl,{name:"launch"})]})})}renderAbout(){return At(yt,{children:[At("h6",{children:"About Basemaps"}),At("ul",{class:"about-links",children:[this.renderAboutLi("Get started","https://www.linz.govt.nz/data/linz-data/linz-basemaps/get-started-linz-basemaps"),this.renderAboutLi("Technical information","https://www.linz.govt.nz/data/linz-data/linz-basemaps/linz-basemaps-documentation"),this.renderAboutLi("How to use our APIs","https://www.linz.govt.nz/data/linz-data/linz-basemaps/how-use-linz-basemaps-apis"),this.renderAboutLi("Github","https://github.com/linz/basemaps",this.renderGithubLogo()),At("li",{children:At(Rn,{href:"https://github.com/linz/basemaps/blob/master/CHANGELOG.md",children:["Version ",At("span",{class:"basemaps-version",children:It.Version})]})})]})]})}renderGithubLogo(){return At("svg",{style:"width: 24px; height: 24px",viewBox:"0 0 24 24",children:At("path",{fill:"currentColor",d:"M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"})})}renderLinks(){return At(yt,{children:[At("h6",{children:"90 day API keys"}),At("p",{children:"API keys expire after 90 days, if a longer duration is needed please request a developer API key"}),At(fs,{header:"Api Key",value:It.ApiKey}),this.renderLinksTiles()]})}validProjections(){return this.state.layers==null?this._validProjections:this.state.layers.get(It.map.layerId)?.projections??this._validProjections}renderLinksTiles(){if(It.map.isVector)return At(yt,{children:[At(fs,{header:"StyleJSON",value:It.map.toTileUrl("style")}),At(fs,{header:"XYZ",value:It.map.toTileUrl("vector-xyz")})]});let h=this.validProjections(),g=[];if(h.has(Ze.Nztm2000)){let _=It.map.toTileUrl("wmts",Pn);g.push(At(fs,{header:"WMTS: NZTM2000Quad",value:_}))}if(h.has(Ze.Google)){let _=It.map.toTileUrl("wmts",Ye),a=It.map.toTileUrl("raster",Ye);g.push(At(fs,{header:"WMTS: WebMercatorQuad",value:_})),g.push(At(fs,{header:"XYZ",value:a}))}return At(yt,{children:g})}};W();var Lo=Ns(Ac(),1);Qr();W();W();W();function Mg(n){let o=document.createElement("span");return o.textContent=n,o.innerHTML}var _p=class{constructor(o){this.boundaries=[],this.collection=o;let h=o.summaries["linz:zoom"];this.minZoom=h.min,this.maxZoom=h.max,this.bbox=o.extent.spatial.bbox[0]}intersects(o,h){return h>this.maxZoom||h<this.minZoom||!Gs.intersects(o,this.bbox)?!1:this.intersection(Gs.bboxToMultiPolygon(o))}intersection(o){for(let h of this.boundaries)if(Yu(h,o).length>0)return!0;return!1}addBoundary(o){U1(o),this.boundaries.push(o)}};function U1(n){for(let o of n)for(let h of o)if(h.length!==2)throw new Error("Invalid ring wrong length")}function V1(n){var o;let h=new Map,g=[];for(let _ of n.collections){let a=new _p(_);g.push(a),h.set(_.id,a)}for(let _ of n.features){let a=h.get((o=_.collection)!==null&&o!==void 0?o:"");if(a==null)throw new Error("Could not match feature to collection: "+_.collection);if(_.geometry.type==="Polygon")a.addBoundary(_.geometry.coordinates);else if(_.geometry.type==="MultiPolygon")for(let M of _.geometry.coordinates)a.addBoundary(M)}return g}function Sg(n){let{interval:o}=n.extent.temporal;if(o==null||o.length===0)return[-1,-1];let h=o[0],g=new Date(h[0]).getFullYear(),_=(h.length<2?g:new Date(h[1]).getFullYear())-1;return[g,_<g?g:_]}var $s=class{constructor(o){this.attributions=o}static async load(o){let h=await fetch(o);if(h.ok){let g=await h.json();return $s.fromStac(g)}throw new Error(`fetch attribution failed [${h.status}] ${h.statusText}`)}static fromStac(o){return new $s(V1(o).reverse())}filter(o,h){h=Math.round(h);let g=[],{attributions:_}=this;if(_==null)return g;for(let a of _)this.isIgnored!=null&&this.isIgnored(a)||a.intersects(o,h)&&g.push(a.collection);return g}renderList(o){if(o.length===0)return"";let h=Mg(o[0].title);if(o.length>1)if(o.length===2)h+=` & ${Mg(o[1].title)}`;else{let[g,_]=Sg(o[1]);for(let a=1;a<o.length;++a){let[M,S]=Sg(o[a]);M!==-1&&(g===-1||M<g)&&(g=M),S!==-1&&(_===-1||S>_)&&(_=S)}g===-1&&(g=_),_!==-1&&(h+=` & others ${g}-${_}`)}return h}};var Xl=Ns(Ac(),1);var Tg=`\xA9 ${ff.License} LINZ`,Pc=new Map,Eg=new Map,zc=class{constructor(o){this._raf=0;this.attributionHtml="";this.bounds=new Xl.LngLatBounds([0,0,0,0]);this.zoom=-1;this.filteredRecords=[];this.resetAttribution=()=>{this.attributionHtml="",this.updateAttribution()};this.updateAttribution=()=>{if(It.map.isVector)return this.vectorAttribution();let o=It.map.layerKeyTms,h=Pc.get(o);h==null&&(h=$s.load(It.map.toTileUrl("attribution")).catch(()=>null),Pc.set(o,h),h.then(g=>{g!=null&&(g.isIgnored=this.isIgnored,Eg.set(o,g),this.scheduleRender())})),this.scheduleRender()};this.isIgnored=o=>{let h=o.collection.title.toLowerCase();return h.startsWith("geographx")||h.includes(" dem ")};this.renderAttribution=()=>{this._raf=0;let o=Eg.get(It.map.layerKeyTms);if(o==null)return this.removeAttribution();this.zoom=Math.round(this.map.getZoom()??0),this.bounds=this.map.getBounds(),this.zoom+=1;let h=this.mapboxBoundToBbox(this.bounds,It.map.tileMatrix),g=o.filter(h,this.zoom),_=o.renderList(g);if(_===""?_=Tg:_=Tg+" - "+_,_!==this.attributionHtml){let a=this.attributionHtml=_;this.removeAttribution(),this.attributionControl=new Xl.default.AttributionControl({compact:!1,customAttribution:a}),this.map.addControl(this.attributionControl,"bottom-right")}this.filteredRecords=g};this.map=o,Ws(o,this.resetAttribution),o.on("move",this.updateAttribution),It.map.on("tileMatrix",this.resetAttribution),It.map.on("layer",this.resetAttribution)}scheduleRender(){this._scheduled!=null||this._raf!==0||this.map.getZoom()===this.zoom&&this.map.getBounds()===this.bounds||(this.zoom=this.map.getZoom()??0,this.bounds=this.map.getBounds(),this._scheduled=setTimeout(()=>{this._scheduled=void 0,this._raf=requestAnimationFrame(this.renderAttribution)},200))}removeAttribution(){this.attributionControl!=null&&(this.map.removeControl(this.attributionControl),this.attributionControl=null)}mapboxBoundToBbox(o,h){let g={lon:o.getWest(),lat:o.getSouth(),zoom:this.zoom},_={lon:o.getEast(),lat:o.getNorth(),zoom:this.zoom},a=Dn(g,Ye,h),M=Dn(_,Ye,h);return[a.lon,a.lat,M.lon,M.lat]}vectorAttribution(){this.removeAttribution(),this.attributionControl=new Xl.default.AttributionControl({compact:!1}),this.map.addControl(this.attributionControl,"bottom-right")}};W();Qr();W();var ms=class{static getTileSet(o){let h=fi.toConfigUrl(o),g=this.tileSets.get(h);return g||(g=fetch(h).then(_=>_.ok?_.json():null),this.tileSets.set(h,g),g)}static getImagery(o,h){let g=fi.toConfigImageryUrl(o,h),_=this.imagery.get(g);return _||(_=fetch(g).then(a=>a.ok?a.json():null),this.imagery.set(g,_),_)}static getGeoJson(o){let h=ns.find(o.tileMatrix);if(h!=null)return Ln.get(h).toGeoJson(o.files)}};ms.tileSets=new Map,ms.imagery=new Map;W();var kc=class{constructor(){this._layerLoading=new Map;this._source=new Map;this._styleJson=null;this.adjustTopographic=o=>{let h=o.target;It.map.setDebug("debug.layer.linz-topographic",Number(h.value))};this.adjustOsm=o=>{It.map.setDebug("debug.layer.osm",Number(o.target.value))};this.adjustLinzAerial=o=>{It.map.setDebug("debug.layer.linz-aerial",Number(o.target.value))};this.togglePurple=o=>{let h=o.target;this.setPurple(h.checked)}}loadSourceLayer(o,h,g,_){let a=`${h}-${_}`,M=this._layerLoading.get(a);return M==null&&(M=this._loadSourceLayer(o,h,g,_),this._layerLoading.set(a,M)),M}async _loadSourceLayer(o,h,g,_){let a=`${h}_${_}`,M=`${a}_fill`;if(o.getLayer(M)!=null)return;let S=await this.fetchSourceLayer(g.id,_);if(S==null&&_==="source"&&(S=ms.getGeoJson(g)),S==null)return;It.map.tileMatrix.projection!==Ye.projection&&yg(S,It.map.tileMatrix);let D=0;for(let N of S.features)N.id=D++;o.addSource(a,{type:"geojson",data:S})}async fetchSourceLayer(o,h){let g=`${o}_${h}`,_=this._source.get(g);if(_==null){let a=fi.toImageryUrl(o,h==="source"?"source.geojson":"covering.geojson"),M=await fetch(a);if(!M.ok)return;_=await M.json()}return _}get styleJson(){return this._styleJson==null&&(this._styleJson=fetch(fi.toTileUrl("style",It.map.tileMatrix,"topographic","topographic",null)).then(o=>o.json())),this._styleJson}async adjustVector(o,h){let g=await this.styleJson;if(o.getSource("LINZ Basemaps")==null){if(h===0)return;let M=g.sources?.["LINZ Basemaps"];if(M==null)return;o.addSource("LINZ Basemaps",M),o.setStyle({...o.getStyle(),glyphs:g.glyphs,sprite:g.sprite}),o.once("style.load",()=>this.adjustVector(o,h));return}let a=g.layers?.filter(M=>M.type!=="background"&&M.source==="LINZ Basemaps")??[];if(It.map.layerId!=="topographic"){for(let M of a){let S=M.paint??{};M.type==="symbol"?(S["icon-opacity"]=0,S["text-opacity"]=0):S[`${M.type}-opacity`]=0,M.paint=S}if(h===0){for(let M of a)o.getLayer(M.id)!=null&&o.removeLayer(M.id);return}if(o.getLayer(a[0].id)==null){if(h===0)return;for(let M of a)o.addLayer(M)}for(let M of a)o.getLayer(M.id)!=null&&(M.type==="symbol"?(o.setPaintProperty(M.id,"icon-opacity",h),o.setPaintProperty(M.id,"text-opacity",h)):o.setPaintProperty(M.id,`${M.type}-opacity`,h))}}adjustRaster(o,h,g){o.getSource(h)==null&&o.addSource(h,{type:"raster",tiles:[this.getTileServerUrl(h)],tileSize:256});let _=o.getLayer(h)==null;if(g===0){_||o.removeLayer(h);return}if(_){o.addLayer({id:h,type:"raster",source:h,minzoom:0,maxzoom:24,paint:{"raster-opacity":0}});let a=`${It.map.layerId}_source_fill`;o.getLayer(a)!=null&&o.moveLayer(h,a)}o.setPaintProperty(h,"raster-opacity",g)}setPurple(o){It.map.setDebug("debug.background",o?"magenta":!1),o?document.body.style.backgroundColor="magenta":document.body.style.backgroundColor=""}getTileServerUrl(o){if(o==="osm")return"https://tile.openstreetmap.org/{z}/{x}/{y}.png";if(o==="linz-aerial")return fi.toTileUrl("raster",It.map.tileMatrix,"aerial",void 0,null);throw new Error("Unknown tile server")}};function Lc(n,o){return At("input",{className:"debug__slider",type:"range",min:"0",max:"1",step:"0.05",value:String(It.map.debug[`debug.layer.${n}`]),onInput:o})}var Dc=class extends Ii{constructor(){super(...arguments);this.debugMap=new kc;this.waitForMap=()=>{let h=this.props.map;if(h==null){setTimeout(this.waitForMap,20);return}window.MaplibreMap=h,h.resize(),Ws(h,()=>{It.map.on("change",()=>{if(this.props.map==null)return;let g=fi.toHash(It.map.getLocation(this.props.map)),_="?"+en.toUrl(It.map);window.history.replaceState(null,"",_+g),this.updateFromConfig()}),this.updateFromConfig(),It.map.debug["debug.screenshot"]&&h.once("idle",async()=>{await Promise.all([...Pc.values()]),await new Promise(_=>setTimeout(_,250));let g=document.createElement("div");g.id="map-loaded",g.style.width="1px",g.style.height="1px",document.body.appendChild(g)})})};this.toggleCogs=h=>{let g=h.target;It.map.setDebug("debug.cog",g.checked),this.setVectorShown(g.checked,"cog")};this.toggleSource=h=>{let g=h.target;It.map.setDebug("debug.source",g.checked),this.setVectorShown(g.checked,"source")};this._loadingConfig=Promise.resolve()}componentDidMount(){this.waitForMap()}updateFromConfig(){(this.state.tileSet?.id!==It.map.layerId||this.state.config!==It.map.config)&&(this._loadingConfig=this._loadingConfig.then(()=>this.loadConfig())),this.debugMap.setPurple(It.map.debug["debug.background"]==="magenta"),this.debugMap.adjustRaster(this.props.map,"osm",It.map.debug["debug.layer.osm"]),this.debugMap.adjustRaster(this.props.map,"linz-aerial",It.map.debug["debug.layer.linz-aerial"]),this.debugMap.adjustVector(this.props.map,It.map.debug["debug.layer.linz-topographic"]),this.setVectorShown(It.map.debug["debug.source"],"source"),this.setVectorShown(It.map.debug["debug.cog"],"cog")}async loadConfig(){let h=It.map.layerId;if(this.state.tileSet?.id!==h)return ms.getTileSet(h).then(g=>{if(this.setState({...this.state,tileSet:g,config:It.map.config}),g==null||g.layers.length!==1)return;let _=It.map.tileMatrix.projection.code,a=g.layers[0][_];if(a!=null)return this.debugMap.fetchSourceLayer(a,"cog").then(M=>{M!=null?this.setState({...this.state,isCog:!0}):this.setState({...this.state,isCog:!1})}),ms.getImagery(h,a).then(M=>{this.setState({...this.state,imagery:M,config:It.map.config})})})}render(){return It.map.debug["debug.screenshot"]?null:At("div",{className:"debug",children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"ImageId"}),At("div",{className:"debug__value",children:It.map.layerId})]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Projection "}),At("div",{className:"debug__value",children:It.map.tileMatrix.projection.toEpsgString()})]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"TileMatrix "}),At("div",{className:"debug__value",children:It.map.tileMatrix.identifier})]}),this.renderSliders(),this.renderPurple(),this.renderCogToggle(),this.renderSourceToggle()]})}renderPurple(){if(!It.map.debug["debug.screenshot"])return At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Purple"}),At("input",{type:"checkbox",onClick:this.debugMap.togglePurple,checked:It.map.debug["debug.background"]==="magenta"})]})}renderCogToggle(){if(this.state.imagery==null)return null;let h=fi.toImageryUrl(this.state.imagery.id,"covering.geojson");if(!!this.state.isCog)return At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:At("a",{href:h,title:"Source geojson",children:"Cogs"})}),At("input",{type:"checkbox",onClick:this.toggleCogs,checked:It.map.debug["debug.cog"]})]}),this.state.featureSourceId==null?null:At("div",{className:"debug__info",title:String(this.state.featureCogName),children:[At("label",{className:"debug__label",children:"CogId"}),String(this.state.featureCogName).split("/").pop()]})]})}renderSourceToggle(){if(this.state.imagery==null)return null;let h=fi.toImageryUrl(this.state.imagery.id,"source.geojson");return At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:At("a",{href:h,title:"Source geojson",children:"Source"})}),At("input",{type:"checkbox",onClick:this.toggleSource,checked:It.map.debug["debug.source"]})]}),this.state.featureSourceId==null?null:At("div",{className:"debug__info",title:String(this.state.featureSourceName),children:[At("label",{className:"debug__label",children:"SourceId"}),String(this.state.featureSourceName).split("/").pop()]})]})}renderSliders(){if(!It.map.debug["debug.screenshot"])return It.map.tileMatrix.identifier!==Ye.identifier?At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"LINZ Aerial"}),Lc("linz-aerial",this.debugMap.adjustLinzAerial)]}):At(yt,{children:[At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"OSM"}),Lc("osm",this.debugMap.adjustOsm)]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"Topographic"}),Lc("linz-topographic",this.debugMap.adjustTopographic)]}),At("div",{className:"debug__info",children:[At("label",{className:"debug__label",children:"LINZ Aerial"}),Lc("linz-aerial",this.debugMap.adjustLinzAerial)]})]})}trackMouseMove(h,g){let _=`${h}_${g}`,a=`${_}_fill`,M=this.props.map,S,D=g==="source"?"featureSource":"featureCog";M.on("mousemove",a,N=>{let L=N.features;if(L==null||L.length===0)return;let Q=L[0];Q.id!==S&&(S!=null&&M.setFeatureState({source:_,id:S},{hover:!1}),S=Q.id,this.setState({...this.state,[`${D}Id`]:S,[`${D}Name`]:Q.properties?.name}),M.setFeatureState({source:_,id:S},{hover:!0}))}),M.on("mouseleave",a,()=>{S!=null&&(M.setFeatureState({source:_,id:S},{hover:!1}),S=void 0,this.setState({...this.state,[`${D}Id`]:void 0,[`${D}Name`]:void 0}))})}setVectorShown(h,g){let _=this.props.map,a=It.map.layerId,M=`${a}_${g}`,S=`${M}_fill`,D=`${M}_line`;if(h===!1){if(_.getLayer(S)==null)return;_.removeLayer(S),_.removeLayer(D);return}if(_.getLayer(D)!=null)return;let N=g==="source"?"#ff00ff":"#ff0000";this.state.imagery!=null&&this.debugMap.loadSourceLayer(this.props.map,a,this.state.imagery,g).then(()=>{_.getLayer(D)==null&&(_.addLayer({id:S,type:"fill",source:M,paint:{"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.25,0],"fill-color":N}}),this.trackMouseMove(a,g),_.addLayer({id:D,type:"line",source:M,paint:{"line-color":N,"line-opacity":["case",["boolean",["feature-state","hover"],!1],1,.5],"line-width":["case",["boolean",["feature-state","hover"],!1],2,1]}}))})}};W();var Ig=Ns(Ac(),1);Qr();var Rc=class extends Ii{constructor(){super(...arguments);this._events=[];this._updateTimer=null;this.update=()=>{this._updateTimer==null&&(this._updateTimer=setTimeout(this.updateMap,1e3))};this.updateMap=()=>{this._updateTimer=null;let h=It.map.transformedLocation,g=this.getStyleType(),_=`${g.layerId}::${g.style}`;if(this.currentStyle!==_){let M=ko(It.map.tileMatrix.identifier).getStyle(g.layerId,g.style);this.currentStyle=_,this.map.setStyle(M)}this.map.setZoom(Math.max(h.zoom-4,0)),this.map.setCenter([h.lon,h.lat]),this.setState(this.state)};this.switchLayer=()=>{let h=this.getStyleType();It.map.setLayerId(h.layerId,h.style),this.updateMap(),window.history.pushState(null,"",`?${en.toUrl(It.map)}`)}}componentDidMount(){if(It.map.updateFromUrl(),this.el=document.getElementById("map-switcher-map"),this.el==null)return;let h=It.map,g=ko(h.tileMatrix.identifier),_=this.getStyleType();this.currentStyle=`${_.layerId}::${_.style}`;let a=g.getStyle(_.layerId,_.style),M=h.transformedLocation;this.map=new Ig.default.Map({container:this.el,style:a,center:[M.lon,M.lat],zoom:M.zoom,attributionControl:!1}),Ws(this.map,()=>{this._events.push(It.map.on("location",this.update),It.map.on("tileMatrix",this.update),It.map.on("layer",this.update),It.map.on("bounds",this.update)),this.updateMap()})}componentWillUnmount(){this.map&&this.map.remove();for(let h of this._events)h()}getStyleType(){return It.map.layerId!=="aerial"?{layerId:"aerial"}:{layerId:"topographic",style:"topographic"}}render(){let h=`Switch map to ${this.getStyleType().layerId}`;return At("div",{id:"map-switcher",class:"map-switcher",onClick:this.switchLayer,title:h,children:At("div",{id:"map-switcher-map",style:{width:"100%",height:"100%",pointerEvents:"none"}})})}};function Ws(n,o){if(n.loaded())return o();setTimeout(()=>Ws(n,o),100)}var Bc=class extends Ii{constructor(){super(...arguments);this.ignoreNextLocationUpdate=!1;this.updateLocation=()=>{if(this.ignoreNextLocationUpdate){this.ignoreNextLocationUpdate=!1;return}let h=It.map.location;this.map.setZoom(h.zoom),this.map.setCenter([h.lon,h.lat])};this.updateBounds=h=>{if(It.map.tileMatrix!==Ye){let g=Lo.default.LngLatBounds.convert(h),_=g.getNorthEast(),a=g.getSouthWest(),M=this.map.getZoom(),S=Dn({lat:_.lat,lon:_.lng,zoom:M},It.map.tileMatrix,Ye),D=Dn({lat:a.lat,lon:a.lng,zoom:M},It.map.tileMatrix,Ye);h=[[S.lon,S.lat],[D.lon,D.lat]]}this.map.fitBounds(h)};this.updateStyle=()=>{this.ensureGeoControl();let g=ko(It.map.tileMatrix.identifier).getStyle(It.map.layerId,It.map.style);this.map.setStyle(g),It.map.tileMatrix!==Ye?this.map.setMaxBounds([-180,-85.06,180,85.06]):this.map.setMaxBounds(),this.setState(this.state)};this._events=[];this.updateUrlTimer=null;this.onRender=()=>{this.updateUrlTimer==null&&(this.updateUrlTimer=setTimeout(()=>this.setLocationUrl(),1e3))}}ensureGeoControl(){if(!It.map.debug["debug.screenshot"])if(It.map.tileMatrix===Ye){if(this.controlGeo!=null)return;this.controlGeo=new Lo.default.GeolocateControl({}),this.map.addControl(this.controlGeo,"top-left")}else{if(this.controlGeo==null)return;this.map.removeControl(this.controlGeo)}}componentDidMount(){if(It.map.updateFromUrl(),this.el=document.getElementById("map"),this.el==null)throw new Error("Unable to find #map element");let h=It.map,_=ko(h.tileMatrix.identifier).getStyle(h.layerId,h.style),a=Dn(h.location,h.tileMatrix,Ye);if(this.map=new Lo.default.Map({container:this.el,style:_,center:[a.lon,a.lat],zoom:a.zoom,attributionControl:!1}),this.mapAttr=new zc(this.map),It.map.debug["debug.screenshot"]!==!0){let M=new Lo.default.NavigationControl({visualizePitch:!0});this.map.addControl(M,"top-left"),It.map.isDebug||this.map.addControl(new Lo.default.FullscreenControl({container:this.el}))}this.map.on("render",this.onRender),Ws(this.map,()=>{this._events.push(It.map.on("location",this.updateLocation),It.map.on("tileMatrix",this.updateStyle),It.map.on("layer",this.updateStyle),It.map.on("bounds",this.updateBounds)),this.updateStyle()})}componentWillUnmount(){this.map&&this.map.remove();for(let h of this._events)h();this._events=[]}render(){let h=It.map.tileMatrix===Ye&&!It.map.isDebug;return At("div",{style:{flex:1,position:"relative"},children:[At("div",{id:"map",style:{width:"100%",height:"100%"}}),It.map.isDebug?At(Dc,{map:this.map}):void 0,h?At(Rc,{}):void 0]})}setLocationUrl(){this.updateUrlTimer=null;let h=It.map.getLocation(this.map);this.ignoreNextLocationUpdate=!0,It.map.setLocation(h);let g=fi.toHash(h);window.history.replaceState(null,"",g)}};W();var G1="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=";function q1(){let n=document.createElement("canvas");return n.getContext&&n.getContext("2d")?n.toDataURL("image/webp").indexOf("data:image/webp")===0:!1}function j1(){let n=new Image,o=new Promise(h=>{n.onload=()=>h(!0),n.onerror=()=>h(!1)});return n.src=G1,o}function Cg(){return new Promise(n=>{if(q1())return n(!0);j1().then(n)})}var xp=class extends Ii{render(){return At(yt,{children:[At(Cc,{}),At(Bc,{}),At(Tc,{})]})}};document.addEventListener("DOMContentLoaded",async()=>{await await Cg()&&(fi.ImageFormat="webp"),It.map.updateFromUrl();let o=document.getElementById("main");if(o==null)throw new Error("Missing #main");sf(At(xp,{}),o)});
|
|
560
|
+
/**
|
|
561
|
+
* splaytree v3.1.0
|
|
562
|
+
* Fast Splay tree for Node and browser
|
|
563
|
+
*
|
|
564
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
565
|
+
* @license MIT
|
|
566
|
+
* @preserve
|
|
567
|
+
*/
|