1(()=>{function i(i,r,a,n){Object.defineProperty(i,r,{get:a,set:n,enumerable:!0,configurable:!0})}function r(i){return i&&i.__esModule?i.default:i}var a=globalThis,n={},o={},s=a.parcelRequire94c2;null==s&&((s=function(i){if(i in n)return n[i].exports;if(i in o){var r=o[i];delete o[i];var a={id:i,exports:{}};return n[i]=a,r.call(a.exports,a,a.exports),a.exports}var s=Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(i,r){o[i]=r},a.parcelRequire94c2=s);var l=s.register;l("bvJM2",function(r,a){function n(i){if(void 0===i)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function o(i,r){i.prototype=Object.create(r.prototype),i.prototype.constructor=i,i.__proto__=r}i(r.exports,"_config",()=>L),i(r.exports,"_isString",()=>V),i(r.exports,"_isUndefined",()=>H),i(r.exports,"_numExp",()=>ee),i(r.exports,"_numWithUnitExp",()=>et),i(r.exports,"_relExp",()=>er),i(r.exports,"gsap",()=>iR),i(r.exports,"_missingPlugin",()=>eh),i(r.exports,"_plugins",()=>ex),i(r.exports,"GSCache",()=>tq),i(r.exports,"_getCache",()=>eE),i(r.exports,"_getProperty",()=>eI),i(r.exports,"_forEachName",()=>eA),i(r.exports,"_round",()=>eM),i(r.exports,"_parseRelative",()=>eD),i(r.exports,"_ticker",()=>tR),i(r.exports,"getUnit",()=>tn),i(r.exports,"_replaceRandom",()=>t_),i(r.exports,"_getSetter",()=>is),i(r.exports,"PropTween",()=>ig),i(r.exports,"_colorExp",()=>tM),i(r.exports,"_colorStringFilter",()=>tD),i(r.exports,"_renderComplexString",()=>iu),i(r.exports,"_checkPlugin",()=>t3),i(r.exports,"_sortPropTweensByPriority",()=>i_);var s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P,L={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},z={duration:.5,overwrite:!1,delay:0},O=2*Math.PI,F=O/4,B=0,k=Math.sqrt,N=Math.cos,U=Math.sin,V=function(i){return"string"==typeof i},j=function(i){return"function"==typeof i},G=function(i){return"number"==typeof i},H=function(i){return void 0===i},q=function(i){return"object"==typeof i},$=function(i){return!1!==i},Z=function(){return"u">typeof window},W=function(i){return j(i)||V(i)},X="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Y=Array.isArray,K=/random\([^)]+\)/g,J=/,\s*/g,Q=/(?:-?\.?\d|\.)+/gi,ee=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,et=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,ei=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,er=/[+-]=-?[.\d]+/,ea=/[^,'"\[\]\s]+/gi,en=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,eo={},es={},el=function(i){return(es=ek(i,eo))&&iR},eh=function(i,r){return console.warn("Invalid property",i,"set to",r,"Missing plugin? gsap.registerPlugin()")},eu=function(i,r){return!r&&console.warn(i)},ec=function(i,r){return i&&(eo[i]=r)&&es&&(es[i]=r)||eo},ed=function(){return 0},ef={suppressEvents:!0,isStart:!0,kill:!1},ep={suppressEvents:!0,kill:!1},em={suppressEvents:!0},e_={},eg=[],ey={},ex={},ev={},eb=30,ew=[],eT="",eS=function(i){var r,a,n=i[0];if(q(n)||j(n)||(i=[i]),!(r=(n._gsap||{}).harness)){for(a=ew.length;a--&&!ew[a].targetTest(n););r=ew[a]}for(a=i.length;a--;)i[a]&&(i[a]._gsap||(i[a]._gsap=new tq(i[a],r)))||i.splice(a,1);return i},eE=function(i){return i._gsap||eS(tl(i))[0]._gsap},eI=function(i,r,a){return(a=i[r])&&j(a)?i[r]():H(a)&&i.getAttribute&&i.getAttribute(r)||a},eA=function(i,r){return(i=i.split(",")).forEach(r)||i},eM=function(i){return Math.round(1e5*i)/1e5||0},eC=function(i){return Math.round(1e7*i)/1e7||0},eD=function(i,r){var a=r.charAt(0),n=parseFloat(r.substr(2));return i=parseFloat(i),"+"===a?i+n:"-"===a?i-n:"*"===a?i*n:i/n},eR=function(i,r){for(var a=r.length,n=0;0>i.indexOf(r[n])&&++n<a;);return n<a},eP=function(){var i,r,a=eg.length,n=eg.slice(0);for(ey={},eg.length=0,i=0;i<a;i++)(r=n[i])&&r._lazy&&(r.render(r._lazy[0],r._lazy[1],!0)._lazy=0)},eL=function(i){return!!(i._initted||i._startAt||i.add)},ez=function(i,r,a,n){eg.length&&!T&&eP(),i.render(r,a,n||!!(T&&r<0&&eL(i))),eg.length&&!T&&eP()},eO=function(i){var r=parseFloat(i);return(r||0===r)&&(i+"").match(ea).length<2?r:V(i)?i.trim():i},eF=function(i){return i},eB=function(i,r){for(var a in r)a in i||(i[a]=r[a]);return i},ek=function(i,r){for(var a in r)i[a]=r[a];return i},eN=function i(r,a){for(var n in a)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(r[n]=q(a[n])?i(r[n]||(r[n]={}),a[n]):a[n]);return r},eU=function(i,r){var a,n={};for(a in i)a in r||(n[a]=i[a]);return n},eV=function(i){var r,a=i.parent||E,n=i.keyframes?(r=Y(i.keyframes),function(i,a){for(var n in a)n in i||"duration"===n&&r||"ease"===n||(i[n]=a[n])}):eB;
vendor: 4,873 bytes, line 1
1if($(i.inherit))for(;a;)n(i,a.vars.defaults),a=a.parent||a._dp;return i},ej=function(i,r){for(var a=i.length,n=a===r.length;n&&a--&&i[a]===r[a];);return a<0},eG=function(i,r,a,n,o){void 0===a&&(a="_first"),void 0===n&&(n="_last");var s,l=i[n];if(o)for(s=r[o];l&&l[o]>s;)l=l._prev;return l?(r._next=l._next,l._next=r):(r._next=i[a],i[a]=r),r._next?r._next._prev=r:i[n]=r,r._prev=l,r.parent=r._dp=i,r},eH=function(i,r,a,n){void 0===a&&(a="_first"),void 0===n&&(n="_last");var o=r._prev,s=r._next;o?o._next=s:i[a]===r&&(i[a]=s),s?s._prev=o:i[n]===r&&(i[n]=o),r._next=r._prev=r.parent=null},eq=function(i,r){i.parent&&(!r||i.parent.autoRemoveChildren)&&i.parent.remove&&i.parent.remove(i),i._act=0},e$=function(i,r){if(i&&(!r||r._end>i._dur||r._start<0))for(var a=i;a;)a._dirty=1,a=a.parent;return i},eZ=function(i){for(var r=i.parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return i},eW=function(i,r,a,n){return i._startAt&&(T?i._startAt.revert(ep):i.vars.immediateRender&&!i.vars.autoRevert||i._startAt.render(r,!0,n))},eX=function(i){return i._repeat?eY(i._tTime,i=i.duration()+i._rDelay)*i:0},eY=function(i,r){var a=Math.floor(i=eC(i/r));return i&&a===i?a-1:a},eK=function(i,r){return(i-r._start)*r._ts+(r._ts>=0?0:r._dirty?r.totalDuration():r._tDur)},eJ=function(i){return i._end=eC(i._start+(i._tDur/Math.abs(i._ts||i._rts||1e-8)||0))},eQ=function(i,r){var a=i._dp;return a&&a.smoothChildTiming&&i._ts&&(i._start=eC(a._time-(i._ts>0?r/i._ts:-(((i._dirty?i.totalDuration():i._tDur)-r)/i._ts))),eJ(i),a._dirty||e$(a,i)),i},e0=function(i,r){var a;if((r._time||!r._dur&&r._initted||r._start<i._time&&(r._dur||!r.add))&&(a=eK(i.rawTime(),r),(!r._dur||ta(0,r.totalDuration(),a)-r._tTime>1e-8)&&r.render(a,!0)),e$(i,r)._dp&&i._initted&&i._time>=i._dur&&i._ts){if(i._dur<i.duration())for(a=i;a._dp;)a.rawTime()>=0&&a.totalTime(a._tTime),a=a._dp;i._zTime=-1e-8}},e1=function(i,r,a,n){return r.parent&&eq(r),r._start=eC((G(a)?a:a||i!==E?tt(i,a,r):i._time)+r._delay),r._end=eC(r._start+(r.totalDuration()/Math.abs(r.timeScale())||0)),eG(i,r,"_first","_last",i._sort?"_start":0),e5(r)||(i._recent=r),n||e0(i,r),i._ts<0&&eQ(i,i._tTime),i},e2=function(i,r){return(eo.ScrollTrigger||eh("scrollTrigger",r))&&eo.ScrollTrigger.create(r,i)},e3=function(i,r,a,n,o){return(t4(i,r,o),i._initted)?!a&&i._pt&&!T&&(i._dur&&!1!==i.vars.lazy||!i._dur&&i.vars.lazy)&&D!==tR.frame?(eg.push(i),i._lazy=[o,n],1):void 0:1},e4=function i(r){var a=r.parent;return a&&a._ts&&a._initted&&!a._lock&&(0>a.rawTime()||i(a))},e5=function(i){var r=i.data;return"isFromStart"===r||"isStart"===r},e6=function(i,r,a,n){var o,s,l,h=i.ratio,u=r<0||!r&&(!i._start&&e4(i)&&!(!i._initted&&e5(i))||(i._ts<0||i._dp._ts<0)&&!e5(i))?0:1,c=i._rDelay,d=0;if(c&&i._repeat&&(s=eY(d=ta(0,i._tDur,r),c),i._yoyo&&1&s&&(u=1-u),s!==eY(i._tTime,c)&&(h=1-u,i.vars.repeatRefresh&&i._initted&&i.invalidate())),u!==h||T||n||1e-8===i._zTime||!r&&i._zTime){if(!i._initted&&e3(i,r,n,a,d))return;for(l=i._zTime,i._zTime=r||1e-8*!!a,a||(a=r&&!l),i.ratio=u,i._from&&(u=1-u),i._time=0,i._tTime=d,o=i._pt;o;)o.r(u,o.d),o=o._next;r<0&&eW(i,r,a,!0),i._onUpdate&&!a&&tx(i,"onUpdate"),d&&i._repeat&&!a&&i.parent&&tx(i,"onRepeat"),(r>=i._tDur||r<0)&&i.ratio===u&&(u&&eq(i,1),a||T||(tx(i,u?"onComplete":"onReverseComplete",!0),i._prom&&i._prom()))}else i._zTime||(i._zTime=r)},e8=function(i,r,a){var n;if(a>r)for(n=i._first;n&&n._start<=a;){if("isPause"===n.data&&n._start>r)return n;n=n._next}else for(n=i._last;n&&n._start>=a;){if("isPause"===n.data&&n._start<r)return n;n=n._prev}},e9=function(i,r,a,n){var o=i._repeat,s=eC(r)||0,l=i._tTime/i._tDur;return l&&!n&&(i._time*=s/i._dur),i._dur=s,i._tDur=o?o<0?1e10:eC(s*(o+1)+i._rDelay*o):s,l>0&&!n&&eQ(i,i._tTime=i._tDur*l),i.parent&&eJ(i),a||e$(i.parent,i),i},e7=function(i){return i instanceof tZ?e$(i):e9(i,i._dur)},te={_start:0,endTime:ed,totalDuration:ed},tt=function i(r,a,n){var o,s,l,h=r.labels,u=r._recent||te,c=r.duration()>=1e8?u.endTime(!1):r._dur;return V(a)&&(isNaN(a)||a in h)?(s=a.charAt(0),l="%"===a.substr(-1),o=a.indexOf("="),"<"===s||">"===s)?(o>=0&&(a=a.replace(/=/,"")),("<"===s?u._start:u.endTime(u._repeat>=0))+(parseFloat(a.substr(1))||0)*(l?(o<0?u:n).totalDuration()/100:1)):o<0?(a in h||(h[a]=c),h[a]):(s=parseFloat(a.charAt(o-1)+a.substr(o+1)),l&&n&&(s=s/100*(Y(n)?n[0]:n).totalDuration()),o>1?i(r,a.substr(0,o-1),n)+s:c+s):null==a?c:+a},ti=function(i,r,a){var n,o,s=G(r[1]),l=(s?2:1)+(i<2?0:1),h=r[l];if(s&&(h.duration=r[1]),h.parent=a,i){for(n=h,o=a;o&&!("immediateRender"in n);)n=o.vars.defaults||{},o=$(o.vars.inherit)&&o.parent;h.immediateRender=$(n.immediateRender),i<2?h.runBackwards=1:h.startAt=r[l-1]}return new it(r[0],h,r[l+1])},tr=function(i,r){return i||0===i?r(i):r},ta=function(i,r,a){return a<i?i:a>r?r:a},tn=function(i,r){return V(i)&&(r=en.exec(i))?r[1]:""},to=[].slice,ts=function(i,r){return i&&q(i)&&"length"in i&&(!r&&!i.length||i.length-1
1in i&&q(i[0]))&&!i.nodeType&&i!==I},tl=function(i,r,a){var n;return S&&!r&&S.selector?S.selector(i):V(i)&&!a&&(A||!tP())?to.call((r||M).querySelectorAll(i),0):Y(i)?(void 0===n&&(n=[]),i.forEach(function(i){var r;return V(i)&&!a||ts(i,1)?(r=n).push.apply(r,tl(i)):n.push(i)})||n):ts(i)?to.call(i,0):i?[i]:[]},th=function(i){return i=tl(i)[0]||eu("Invalid scope")||{},function(r){var a=i.current||i.nativeElement||i;return tl(r,a.querySelectorAll?a:a===i?eu("Invalid scope")||M.createElement("div"):i)}},tu=function(i){return i.sort(function(){return.5-Math.random()})},tc=function(i){if(j(i))return i;var r=q(i)?i:{each:i},a=tU(r.ease),n=r.from||0,o=parseFloat(r.base)||0,s={},l=n>0&&n<1,h=isNaN(n)||l,u=r.axis,c=n,d=n;return V(n)?c=d=({center:.5,edges:.5,end:1})[n]||0:!l&&h&&(c=n[0],d=n[1]),function(i,l,f){var p,m,_,g,y,x,v,b,w,T=(f||r).length,S=s[T];if(!S){if(!(w="auto"===r.grid?0:(r.grid||[1,1e8])[1])){for(v=-1e8;v<(v=f[w++].getBoundingClientRect().left)&&w<T;);w<T&&w--}for(S=s[T]=[],p=h?Math.min(w,T)*c-.5:n%w,m=1e8===w?0:h?T*d/w-.5:n/w|0,v=0,b=1e8,x=0;x<T;x++)_=x%w-p,g=m-(x/w|0),S[x]=y=u?Math.abs("y"===u?g:_):k(_*_+g*g),y>v&&(v=y),y<b&&(b=y);"random"===n&&tu(S),S.max=v-b,S.min=b,S.v=T=(parseFloat(r.amount)||parseFloat(r.each)*(w>T?T-1:u?"y"===u?T/w:w:Math.max(w,T/w))||0)*("edges"===n?-1:1),S.b=T<0?o-T:o,S.u=tn(r.amount||r.each)||0,a=a&&T<0?tN(a):a}return T=(S[i]-S.min)/S.max||0,eC(S.b+(a?a(T):T)*S.v)+S.u}},td=function(i){var r=Math.pow(10,((i+"").split(".")[1]||"").length);return function(a){var n=eC(Math.round(parseFloat(a)/i)*i*r);return(n-n%1)/r+(G(a)?0:tn(a))}},tf=function(i,r){var a,n,o=Y(i);return!o&&q(i)&&(a=o=i.radius||1e8,i.values?(n=!G((i=tl(i.values))[0]))&&(a*=a):i=td(i.increment)),tr(r,o?j(i)?function(r){return Math.abs((n=i(r))-r)<=a?n:r}:function(r){for(var o,s,l=parseFloat(n?r.x:r),h=parseFloat(n?r.y:0),u=1e8,c=0,d=i.length;d--;)(o=n?(o=i[d].x-l)*o+(s=i[d].y-h)*s:Math.abs(i[d]-l))<u&&(u=o,c=d);return c=!a||u<=a?i[c]:r,n||c===r||G(r)?c:c+tn(r)}:td(i))},tp=function(i,r,a,n){return tr(Y(i)?!r:!0===a?(a=0,!1):!n,function(){return Y(i)?i[~~(Math.random()*i.length)]:(n=(a=a||1e-5)<1?Math.pow(10,(a+"").length-2):1)&&Math.floor(Math.round((i-a/2+Math.random()*(r-i+.99*a))/a)*a*n)/n})},tm=function(i,r,a){return tr(a,function(a){return i[~~r(a)]})},t_=function(i){return i.replace(K,function(i){var r=i.indexOf("[")+1,a=i.substring(r||7,r?i.indexOf("]"):i.length-1).split(J);return tp(r?a:+a[0],r?0:+a[1],+a[2]||1e-5)})},tg=function(i,r,a,n,o){var s=r-i,l=n-a;return tr(o,function(r){return a+((r-i)/s*l||0)})},ty=function(i,r,a){var n,o,s,l=i.labels,h=1e8;for(n in l)(o=l[n]-r)<0==!!a&&o&&h>(o=Math.abs(o))&&(s=n,h=o);return s},tx=function(i,r,a){var n,o,s,l=i.vars,h=l[r],u=S,c=i._ctx;if(h)return n=l[r+"Params"],o=l.callbackScope||i,a&&eg.length&&eP(),c&&(S=c),s=n?h.apply(o,n):h.call(o),S=u,s},tv=function(i){return eq(i),i.scrollTrigger&&i.scrollTrigger.kill(!!T),1>i.progress()&&tx(i,"onInterrupt"),i},tb=[],tw=function(i){if(i)if(i=!i.name&&i.default||i,Z()||i.headless){var r=i.name,a=j(i),n=r&&!a&&i.init?function(){this._props=[]}:i,o={init:ed,render:ic,add:t1,kill:ip,modifier:id,rawVars:0},s={targetTest:0,get:0,getSetter:is,aliases:{},register:0};if(tP(),i!==n){if(ex[r])return;eB(n,eB(eU(i,o),s)),ek(n.prototype,ek(o,eU(i,s))),ex[n.prop=r]=n,i.targetTest&&(ew.push(n),e_[r]=1),r=("css"===r?"CSS":r.charAt(0).toUpperCase()+r.substr(1))+"Plugin"}ec(r,n),i.register&&i.register(iR,n,ig)}else tb.push(i)},tT={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},tS=function(i,r,a){return(6*(i+=i<0?1:i>1?-1:0)<1?r+(a-r)*i*6:i<.5?a:3*i<2?r+(a-r)*(2/3-i)*6:r)*255+.5|0},tE=function(i,r,a){var n,o,s,l,h,u,c,d,f,p,m=i?G(i)?[i>>16,i>>8&255,255&i]:0:tT.black;if(!m){if(","===i.substr(-1)&&(i=i.substr(0,i.length-1)),tT[i])m=tT[i];else if("#"===i.charAt(0)){if(i.length<6&&(n=i.charAt(1),i="#"+n+n+(o=i.charAt(2))+o+(s=i.charAt(3))+s+(5===i.length?i.charAt(4)+i.charAt(4):"")),9===i.length)return[(m=parseInt(i.substr(1,6),16))>>16,m>>8&255,255&m,parseInt(i.substr(7),16)/255];m=[(i=parseInt(i.substr(1),16))>>16,i>>8&255,255&i]}else if("hsl"===i.substr(0,3))if(m=p=i.match(Q),r){if(~i.indexOf("="))return m=i.match(ee),a&&m.length<4&&(m[3]=1),m}else l=m[0]%360/360,h=m[1]/100,o=(u=m[2]/100)<=.5?u*(h+1):u+h-u*h,n=2*u-o,m.length>3&&(m[3]*=1),m[0]=tS(l+1/3,n,o),m[1]=tS(l,n,o),m[2]=tS(l-1/3,n,o);else m=i.match(Q)||tT.transparent;m=m.map(Number)}return r&&!p&&(n=m[0]/255,u=((c=Math.max(n,o=m[1]/255,s=m[2]/255))+(d=Math.min(n,o,s)))/2,c===d?l=h=0:(f=c-d,h=u>.5?f/(2-c-d):f/(c+d),l=(c===n?(o-s)/f+6*(o<s):c===o?(s-n)/f+2:(n-o)/f+4)*60),m[0]=~~(l+.5),m[1]=~~(100*h+.5),m[2]=~~(100*u+.5)),a&&m.length<4&&(m[3]=1),m},tI=function(i){var r=[],a=[],n=-1;
vendor: 14,594 bytes, line 1
1return i.split(tM).forEach(function(i){var o=i.match(et)||[];r.push.apply(r,o),a.push(n+=o.length+1)}),r.c=a,r},tA=function(i,r,a){var n,o,s,l,h="",u=(i+h).match(tM),c=r?"hsla(":"rgba(",d=0;if(!u)return i;if(u=u.map(function(i){return(i=tE(i,r,1))&&c+(r?i[0]+","+i[1]+"%,"+i[2]+"%,"+i[3]:i.join(","))+")"}),a&&(s=tI(i),(n=a.c).join(h)!==s.c.join(h)))for(l=(o=i.replace(tM,"1").split(et)).length-1;d<l;d++)h+=o[d]+(~n.indexOf(d)?u.shift()||c+"0,0,0,0)":(s.length?s:u.length?u:a).shift());if(!o)for(l=(o=i.split(tM)).length-1;d<l;d++)h+=o[d]+u[d];return h+o[l]},tM=function(){var i,r="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(i in tT)r+="|"+i+"\\b";return RegExp(r+")","gi")}(),tC=/hsl[a]?\(/,tD=function(i){var r,a=i.join(" ");if(tM.lastIndex=0,tM.test(a))return r=tC.test(a),i[1]=tA(i[1],r),i[0]=tA(i[0],r,tI(i[1])),!0},tR=(f=Date.now,p=500,m=33,g=_=f(),y=1e3/240,x=1e3/240,v=[],b=function i(r){var a,n,o,h,b=f()-g,w=!0===r;if((b>p||b<0)&&(_+=b-m),g+=b,((a=(o=g-_)-x)>0||w)&&(h=++u.frame,c=o-1e3*u.time,u.time=o/=1e3,x+=a+(a>=y?4:y-a),n=1),w||(s=l(i)),n)for(d=0;d<v.length;d++)v[d](o,c,h,r)},u={time:0,frame:0,tick:function(){b(!0)},deltaRatio:function(i){return c/(1e3/(i||60))},wake:function(){C&&(!A&&Z()&&(M=(I=A=window).document||{},eo.gsap=iR,(I.gsapVersions||(I.gsapVersions=[])).push(iR.version),el(es||I.GreenSockGlobals||!I.gsap&&I||{}),tb.forEach(tw)),h="u">typeof requestAnimationFrame&&requestAnimationFrame,s&&u.sleep(),l=h||function(i){return setTimeout(i,x-1e3*u.time+1|0)},P=1,b(2))},sleep:function(){(h?cancelAnimationFrame:clearTimeout)(s),P=0,l=ed},lagSmoothing:function(i,r){m=Math.min(r||33,p=i||1/0)},fps:function(i){y=1e3/(i||240),x=1e3*u.time+y},add:function(i,r,a){var n=r?function(r,a,o,s){i(r,a,o,s),u.remove(n)}:i;return u.remove(i),v[a?"unshift":"push"](n),tP(),n},remove:function(i,r){~(r=v.indexOf(i))&&v.splice(r,1)&&d>=r&&d--},_listeners:v}),tP=function(){return!P&&tR.wake()},tL={},tz=/^[\d.\-M][\d.\-,\s]/,tO=/["']/g,tF=function(i){for(var r,a,n,o={},s=i.substr(1,i.length-3).split(":"),l=s[0],h=1,u=s.length;h<u;h++)a=s[h],r=h!==u-1?a.lastIndexOf(","):a.length,n=a.substr(0,r),o[l]=isNaN(n)?n.replace(tO,"").trim():+n,l=a.substr(r+1).trim();return o},tB=function(i){var r=i.indexOf("(")+1,a=i.indexOf(")"),n=i.indexOf("(",r);return i.substring(r,~n&&n<a?i.indexOf(")",a+1):a)},tk=function(i){var r=(i+"").split("("),a=tL[r[0]];return a&&r.length>1&&a.config?a.config.apply(null,~i.indexOf("{")?[tF(r[1])]:tB(i).split(",").map(eO)):tL._CE&&tz.test(i)?tL._CE("",i):a},tN=function(i){return function(r){return 1-i(1-r)}},tU=function(i,r){return i&&(j(i)?i:tL[i]||tk(i))||r},tV=function(i,r,a,n){void 0===a&&(a=function(i){return 1-r(1-i)}),void 0===n&&(n=function(i){return i<.5?r(2*i)/2:1-r((1-i)*2)/2});var o,s={easeIn:r,easeOut:a,easeInOut:n};return eA(i,function(i){for(var r in tL[i]=eo[i]=s,tL[o=i.toLowerCase()]=a,s)tL[o+("easeIn"===r?".in":"easeOut"===r?".out":".inOut")]=tL[i+"."+r]=s[r]}),s},tj=function(i){return function(r){return r<.5?(1-i(1-2*r))/2:.5+i((r-.5)*2)/2}},tG=function i(r,a,n){var o=a>=1?a:1,s=(n||(r?.3:.45))/(a<1?a:1),l=s/O*(Math.asin(1/o)||0),h=function(i){return 1===i?1:o*Math.pow(2,-10*i)*U((i-l)*s)+1},u="out"===r?h:"in"===r?function(i){return 1-h(1-i)}:tj(h);return s=O/s,u.config=function(a,n){return i(r,a,n)},u},tH=function i(r,a){void 0===a&&(a=1.70158);var n=function(i){return i?--i*i*((a+1)*i+a)+1:0},o="out"===r?n:"in"===r?function(i){return 1-n(1-i)}:tj(n);return o.config=function(a){return i(r,a)},o};eA("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,r){var a=r<5?r+1:r;tV(i+",Power"+(a-1),r?function(i){return Math.pow(i,a)}:function(i){return i},function(i){return 1-Math.pow(1-i,a)},function(i){return i<.5?Math.pow(2*i,a)/2:1-Math.pow((1-i)*2,a)/2})}),tL.Linear.easeNone=tL.none=tL.Linear.easeIn,tV("Elastic",tG("in"),tG("out"),tG()),tX=2*(tW=1/2.75),tY=2.5*tW,tV("Bounce",function(i){return 1-tK(1-i)},tK=function(i){return i<tW?7.5625*i*i:i<tX?7.5625*Math.pow(i-1.5/2.75,2)+.75:i<tY?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*Math.pow(i-2.625/2.75,2)+.984375}),tV("Expo",function(i){return Math.pow(2,10*(i-1))*i+i*i*i*i*i*i*(1-i)}),tV("Circ",function(i){return-(k(1-i*i)-1)}),tV("Sine",function(i){return 1===i?1:-N(i*F)+1}),tV("Back",tH("in"),tH("out"),tH()),tL.SteppedEase=tL.steps=eo.SteppedEase={config:function(i,r){void 0===i&&(i=1);var a=1/i,n=i+ +!r,o=+!!r,s=.99999999;return function(i){return((n*ta(0,s,i)|0)+o)*a}}},z.ease=tL["quad.out"],eA("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(i){return eT+=i+","+i+"Params,"});var tq=function(i,r){this.id=B++,i._gsap=this,this.target=i,this.harness=r,this.get=r?r.get:eI,this.set=r?r.getSetter:is},t$=function(){function i(i){this.vars=i,this._delay=+i.delay||0,(this._repeat=i.repeat===1/0?-2:i.repeat||0)&&(this._rDelay=i.repeatDelay||0,this._yoyo=!!i.yoyo||!!i.yoyoEase),this._ts=1,e9(this,+i.duration,1,1),this.data=i.data,S&&(this._ctx=S,S.data.push(this)),P||tR.wake()}var r=i.prototype;return r.delay=function(i){return i||0===i?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+i-this._delay),this._delay=i,this):this._delay},r.duration=function(i){return arguments.length?this.totalDuration(this._repeat>0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},r.totalDuration=function(i){return arguments.length?(this._dirty=0,e9(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},r.totalTime=function(i,r){if(tP(),!arguments.length)return this._tTime;var a=this._dp;if(a&&a.smoothChildTiming&&this._ts){for(eQ(this,i),!a._dp||a.parent||e0(a,this);a&&a.parent;)a.parent._time!==a._start+(a._ts>=0?a._tTime/a._ts:-((a.totalDuration()-a._tTime)/a._ts))&&a.totalTime(a._tTime,!0),a=a.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i<this._tDur||this._ts<0&&i>0||!this._tDur&&!i)&&e1(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!r||this._initted&&1e-8===Math.abs(this._zTime)||!this._initted&&this._dur&&i||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),ez(this,i,r)),this},r.time=function(i,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+eX(this))%(this._dur+this._rDelay)||(i?this._dur:0),r):this._time},r.totalProgress=function(i,r){return arguments.length?this.totalTime(this.totalDuration()*i,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},r.progress=function(i,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(1&this.iteration())?1-i:i)+eX(this),r):this.duration()?Math.min(1,this._time/this._dur):+(this.rawTime()>0)},r.iteration=function(i,r){var a=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*a,r):this._repeat?eY(this._tTime,a)+1:1},r.timeScale=function(i,r){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===i)return this;var a=this.parent&&this._ts?eK(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||-1e-8===i?0:this._rts,this.totalTime(ta(-Math.abs(this._delay),this.totalDuration(),a),!1!==r),eJ(this),eZ(this)},r.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(tP(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&1e-8!==Math.abs(this._zTime)&&(this._tTime-=1e-8)))),this):this._ps},r.startTime=function(i){if(arguments.length){this._start=eC(i);var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&e1(r,this,this._start-this._delay),this}return this._start},r.endTime=function(i){return this._start+($(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},r.rawTime=function(i){var r=this.parent||this._dp;return r?i&&(!this._ts||this._repeat&&this._time&&1>this.totalProgress())?this._tTime%(this._dur+this._rDelay):this._ts?eK(r.rawTime(i),this):this._tTime:this._tTime},r.revert=function(i){void 0===i&&(i=em);var r=T;return T=i,eL(this)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),"nested"!==this.data&&!1!==i.kill&&this.kill(),T=r,this},r.globalTime=function(i){for(var r=this,a=arguments.length?i:r.rawTime();r;)a=r._start+a/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(i):a},r.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,e7(this)):-2===this._repeat?1/0:this._repeat},r.repeatDelay=function(i){if(arguments.length){var r=this._time;return this._rDelay=i,e7(this),r?this.time(r):this}return this._rDelay},r.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},r.seek=function(i,r){return this.totalTime(tt(this,i),$(r))},r.restart=function(i,r){return this.play().totalTime(i?-this._delay:0,$(r)),this._dur||(this._zTime=-1e-8),this},r.play=function(i,r){return null!=i&&this.seek(i,r),this.reversed(!1).paused(!1)},r.reverse=function(i,r){return null!=i&&this.seek(i||this.totalDuration(),r),this.reversed(!0).paused(!1)},r.pause=function(i,r){return null!=i&&this.seek(i,r),this.paused(!0)},r.resume=function(){return this.paused(!1)},r.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-1e-8:0)),this):this._rts<0},r.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},r.isActive=function(){var i,r=this.parent||this._dp,a=this._start;return!!(!r||this._ts&&this._initted&&r.isActive()&&(i=r.rawTime(!0))>=a&&i<this.endTime(!0)-1e-8)},r.eventCallback=function(i,r,a){var n=this.vars;return arguments.length>1?(r?(n[i]=r,a&&(n[i+"Params"]=a),"onUpdate"===i&&(this._onUpdate=r)):delete n[i],this):n[i]},r.then=function(i){var r=this,a=r._prom;return new Promise(function(n){var o=j(i)?i:eF,s=function(){var i=r.then;r.then=null,a&&a(),j(o)&&(o=o(r))&&(o.then||o===r)&&(r.then=i),n(o),r.then=i};r._initted&&1===r.totalProgress()&&r._ts>=0||!r._tTime&&r._ts<0?s():r._prom=s})},r.kill=function(){tv(this)},i}();eB(t$.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var tZ=function(i){function r(r,a){var o;return void 0===r&&(r={}),(o=i.call(this,r)||this).labels={},o.smoothChildTiming=!!r.smoothChildTiming,o.autoRemoveChildren=!!r.autoRemoveChildren,o._sort=$(r.sortChildren),E&&e1(r.parent||E,n(o),a),r.reversed&&o.reverse(),r.paused&&o.paused(!0),r.scrollTrigger&&e2(n(o),r.scrollTrigger),o}o(r,i);var a=r.prototype;return a.to=function(i,r,a){return ti(0,arguments,this),this},a.from=function(i,r,a){return ti(1,arguments,this),this},a.fromTo=function(i,r,a,n){return ti(2,arguments,this),this},a.set=function(i,r,a){return r.duration=0,r.parent=this,eV(r).repeatDelay||(r.repeat=0),r.immediateRender=!!r.immediateRender,new it(i,r,tt(this,a),1),this},a.call=function(i,r,a){return e1(this,it.delayedCall(0,i,r),a)},a.staggerTo=function(i,r,a,n,o,s,l){return a.duration=r,a.stagger=a.stagger||n,a.onComplete=s,a.onCompleteParams=l,a.parent=this,new it(i,a,tt(this,o)),this},a.staggerFrom=function(i,r,a,n,o,s,l){return a.runBackwards=1,eV(a).immediateRender=$(a.immediateRender),this.staggerTo(i,r,a,n,o,s,l)},a.staggerFromTo=function(i,r,a,n,o,s,l,h){return n.startAt=a,eV(n).immediateRender=$(n.immediateRender),this.staggerTo(i,r,n,o,s,l,h)},a.render=function(i,r,a){var n,o,s,l,h,u,c,d,f,p,m,_,g=this._time,y=this._dirty?this.totalDuration():this._tDur,x=this._dur,v=i<=0?0:eC(i),b=this._zTime<0!=i<0&&(this._initted||!x);if(this!==E&&v>y&&i>=0&&(v=y),v!==this._tTime||a||b){if(g!==this._time&&x&&(v+=this._time-g,i+=this._time-g),n=v,f=this._start,u=!(d=this._ts),b&&(x||(g=this._zTime),(i||!r)&&(this._zTime=i)),this._repeat){if(m=this._yoyo,h=x+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(100*h+i,r,a);if(n=eC(v%h),v===y?(l=this._repeat,n=x):((l=~~(p=eC(v/h)))&&l===p&&(n=x,l--),n>x&&(n=x)),p=eY(this._tTime,h),!g&&this._tTime&&p!==l&&this._tTime-p*h-this._dur<=0&&(p=l),m&&1&l&&(n=x-n,_=1),l!==p&&!this._lock){var w=m&&1&p,S=w===(m&&1&l);if(l<p&&(w=!w),g=w?0:v%x?x:v,this._lock=1,this.render(g||(_?0:eC(l*h)),r,!x)._lock=0,this._tTime=v,!r&&this.parent&&tx(this,"onRepeat"),this.vars.repeatRefresh&&!_&&(this.invalidate()._lock=1,p=l),g&&g!==this._time||!this._ts!==u||this.vars.onRepeat&&!this.parent&&!this._act||(x=this._dur,y=this._tDur,S&&(this._lock=2,g=w?x:-1e-4,this.render(g,!0),this.vars.repeatRefresh&&!_&&this.invalidate()),this._lock=0,!this._ts&&!u))return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(c=e8(this,eC(g),eC(n)))&&(v-=n-(n=c._start)),this._tTime=v,this._time=n,this._act=!!d,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,g=0),!g&&v&&x&&!r&&!p&&(tx(this,"onStart"),this._tTime!==v))return this;if(n>=g&&i>=0)for(o=this._first;o;){if(s=o._next,(o._act||n>=o._start)&&o._ts&&c!==o){if(o.parent!==this)return this.render(i,r,a);if(o.render(o._ts>0?(n-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(n-o._start)*o._ts,r,a),n!==this._time||!this._ts&&!u){c=0,s&&(v+=this._zTime=-1e-8);break}}o=s}else{o=this._last;for(var I=i<0?i:n;o;){if(s=o._prev,(o._act||I<=o._end)&&o._ts&&c!==o){if(o.parent!==this)return this.render(i,r,a);if(o.render(o._ts>0?(I-o._start)*o._ts:(o._dirty?o.totalDuration():o._tDur)+(I-o._start)*o._ts,r,a||T&&eL(o)),n!==this._time||!this._ts&&!u){c=0,s&&(v+=this._zTime=I?-1e-8:1e-8);break}}o=s}}if(c&&!r&&(this.pause(),c.render(n>=g?0:-1e-8)._zTime=n>=g?1:-1,this._ts))return this._start=f,eJ(this),this.render(i,r,a);this._onUpdate&&!r&&tx(this,"onUpdate",!0),(v===y&&this._tTime>=this.totalDuration()||!v&&g)&&(f===this._start||Math.abs(d)!==Math.abs(this._ts))&&!this._lock&&((i||!x)&&(v===y&&this._ts>0||!v&&this._ts<0)&&eq(this,1),r||i<0&&!g||!v&&!g&&y||(tx(this,v===y&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(v<y&&this.timeScale()>0)&&this._prom()))}return this},a.add=function(i,r){var a=this;if(G(r)||(r=tt(this,r,i)),!(i instanceof t$)){if(Y(i))return i.forEach(function(i){return a.add(i,r)}),this;if(V(i))return this.addLabel(i,r);if(!j(i))return this;i=it.delayedCall(0,i)}return this!==i?e1(this,i,r):this},a.getChildren=function(i,r,a,n){void 0===i&&(i=!0),void 0===r&&(r=!0),void 0===a&&(a=!0),void 0===n&&(n=-1e8);for(var o=[],s=this._first;s;)s._start>=n&&(s instanceof it?r&&o.push(s):(a&&o.push(s),i&&o.push.apply(o,s.getChildren(!0,r,a)))),s=s._next;return o},a.getById=function(i){for(var r=this.getChildren(1,1,1),a=r.length;a--;
1)if(r[a].vars.id===i)return r[a]},a.remove=function(i){return V(i)?this.removeLabel(i):j(i)?this.killTweensOf(i):(i.parent===this&&eH(this,i),i===this._recent&&(this._recent=this._last),e$(this))},a.totalTime=function(r,a){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=eC(tR.time-(this._ts>0?r/this._ts:-((this.totalDuration()-r)/this._ts)))),i.prototype.totalTime.call(this,r,a),this._forcing=0,this):this._tTime},a.addLabel=function(i,r){return this.labels[i]=tt(this,r),this},a.removeLabel=function(i){return delete this.labels[i],this},a.addPause=function(i,r,a){var n=it.delayedCall(0,r||ed,a);return n.data="isPause",this._hasPause=1,e1(this,n,tt(this,i))},a.removePause=function(i){var r=this._first;for(i=tt(this,i);r;)r._start===i&&"isPause"===r.data&&eq(r),r=r._next},a.killTweensOf=function(i,r,a){for(var n=this.getTweensOf(i,a),o=n.length;o--;)tJ!==n[o]&&n[o].kill(i,r);return this},a.getTweensOf=function(i,r){for(var a,n=[],o=tl(i),s=this._first,l=G(r);s;)s instanceof it?eR(s._targets,o)&&(l?(!tJ||s._initted&&s._ts)&&s.globalTime(0)<=r&&s.globalTime(s.totalDuration())>r:!r||s.isActive())&&n.push(s):(a=s.getTweensOf(o,r)).length&&n.push.apply(n,a),s=s._next;return n},a.tweenTo=function(i,r){r=r||{};var a,n=this,o=tt(n,i),s=r,l=s.startAt,h=s.onStart,u=s.onStartParams,c=s.immediateRender,d=it.to(n,eB({ease:r.ease||"none",lazy:!1,immediateRender:!1,time:o,overwrite:"auto",duration:r.duration||Math.abs((o-(l&&"time"in l?l.time:n._time))/n.timeScale())||1e-8,onStart:function(){if(n.pause(),!a){var i=r.duration||Math.abs((o-(l&&"time"in l?l.time:n._time))/n.timeScale());d._dur!==i&&e9(d,i,0,1).render(d._time,!0,!0),a=1}h&&h.apply(d,u||[])}},r));return c?d.render(0):d},a.tweenFromTo=function(i,r,a){return this.tweenTo(r,eB({startAt:{time:tt(this,i)}},a))},a.recent=function(){return this._recent},a.nextLabel=function(i){return void 0===i&&(i=this._time),ty(this,tt(this,i))},a.previousLabel=function(i){return void 0===i&&(i=this._time),ty(this,tt(this,i),1)},a.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+1e-8)},a.shiftChildren=function(i,r,a){void 0===a&&(a=0);var n,o=this._first,s=this.labels;for(i=eC(i);o;)o._start>=a&&(o._start+=i,o._end+=i),o=o._next;if(r)for(n in s)s[n]>=a&&(s[n]+=i);return e$(this)},a.invalidate=function(r){var a=this._first;for(this._lock=0;a;)a.invalidate(r),a=a._next;return i.prototype.invalidate.call(this,r)},a.clear=function(i){void 0===i&&(i=!0);for(var r,a=this._first;a;)r=a._next,this.remove(a),a=r;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),e$(this)},a.totalDuration=function(i){var r,a,n,o=0,s=this._last,l=1e8;if(arguments.length)return this.timeScale((this._repeat<0?this.duration():this.totalDuration())/(this.reversed()?-i:i));if(this._dirty){for(n=this.parent;s;)r=s._prev,s._dirty&&s.totalDuration(),(a=s._start)>l&&this._sort&&s._ts&&!this._lock?(this._lock=1,e1(this,s,a-s._delay,1)._lock=0):l=a,a<0&&s._ts&&(o-=a,(!n&&!this._dp||n&&n.smoothChildTiming)&&(this._start+=eC(a/this._ts),this._time-=a,this._tTime-=a),this.shiftChildren(-a,!1,-1/0),l=0),s._end>o&&s._ts&&(o=s._end),s=r;e9(this,this===E&&this._time>o?this._time:o,1,1),this._dirty=0}return this._tDur},r.updateRoot=function(i){if(E._ts&&(ez(E,eK(i,E)),D=tR.frame),tR.frame>=eb){eb+=L.autoSleep||120;var r=E._first;if((!r||!r._ts)&&L.autoSleep&&tR._listeners.length<2){for(;r&&!r._ts;)r=r._next;r||tR.sleep()}}},r}(t$);eB(tZ.prototype,{_lock:0,_hasPause:0,_forcing:0});var tW,tX,tY,tK,tJ,tQ,t0=function(i,r,a,n,o,s,l){var h,u,c,d,f,p,m,_,g=new ig(this._pt,i,r,0,1,iu,null,o),y=0,x=0;for(g.b=a,g.e=n,a+="",n+="",(m=~n.indexOf("random("))&&(n=t_(n)),s&&(s(_=[a,n],i,r),a=_[0],n=_[1]),u=a.match(ei)||[];h=ei.exec(n);)d=h[0],f=n.substring(y,h.index),c?c=(c+1)%5:"rgba("===f.substr(-5)&&(c=1),d!==u[x++]&&(p=parseFloat(u[x-1])||0,g._pt={_next:g._pt,p:f||1===x?f:",",s:p,c:"="===d.charAt(1)?eD(p,d)-p:parseFloat(d)-p,m:c&&c<4?Math.round:0},y=ei.lastIndex);return g.c=y<n.length?n.substring(y,n.length):"",g.fp=l,(er.test(n)||m)&&(g.e=0),this._pt=g,g}
vendor: 17,075 bytes, line 1
1,t1=function(i,r,a,n,o,s,l,h,u,c){j(n)&&(n=n(o||0,i,s));var d,f=i[r],p="get"!==a?a:j(f)?u?i[r.indexOf("set")||!j(i["get"+r.substr(3)])?r:"get"+r.substr(3)](u):i[r]():f,m=j(f)?u?ia:ir:ii;if(V(n)&&(~n.indexOf("random(")&&(n=t_(n)),"="===n.charAt(1)&&((d=eD(p,n)+(tn(p)||0))||0===d)&&(n=d)),!c||p!==n||tQ)return isNaN(p*n)||""===n?(f||r in i||eh(r,n),t0.call(this,i,r,p,n,m,h||L.stringFilter,u)):(d=new ig(this._pt,i,r,+p||0,n-(p||0),"boolean"==typeof f?ih:il,0,m),u&&(d.fp=u),l&&d.modifier(l,this,i),this._pt=d)},t2=function(i,r,a,n,o){if(j(i)&&(i=t9(i,o,r,a,n)),!q(i)||i.style&&i.nodeType||Y(i)||X(i))return V(i)?t9(i,o,r,a,n):i;var s,l={};for(s in i)l[s]=t9(i[s],o,r,a,n);return l},t3=function(i,r,a,n,o,s){var l,h,u,c;if(ex[i]&&!1!==(l=new ex[i]).init(o,l.rawVars?r[i]:t2(r[i],n,o,s,a),a,n,s)&&(a._pt=h=new ig(a._pt,o,i,0,1,l.render,l,0,l.priority),a!==R))for(u=a._ptLookup[a._targets.indexOf(o)],c=l._props.length;c--;)u[l._props[c]]=h;return l},t4=function i(r,a,n){var o,s,l,h,u,c,d,f,p,m,_,g,y,x=r.vars,v=x.ease,b=x.startAt,S=x.immediateRender,I=x.lazy,A=x.onUpdate,M=x.runBackwards,C=x.yoyoEase,D=x.keyframes,R=x.autoRevert,P=r._dur,L=r._startAt,O=r._targets,F=r.parent,B=F&&"nested"===F.data?F.vars.targets:O,k="auto"===r._overwrite&&!w,N=r.timeline,U=x.easeReverse||C;if(!N||D&&v||(v="none"),r._ease=tU(v,z.ease),r._rEase=U&&(tU(U)||r._ease),r._from=!N&&!!x.runBackwards,r._from&&(r.ratio=1),!N||D&&!x.stagger){if(g=(f=O[0]?eE(O[0]).harness:0)&&x[f.prop],o=eU(x,e_),L&&(L._zTime<0&&L.progress(1),a<0&&M&&S&&!R?L.render(-1,!0):L.revert(M&&P?ep:ef),L._lazy=0),b){if(eq(r._startAt=it.set(O,eB({data:"isStart",overwrite:!1,parent:F,immediateRender:!0,lazy:!L&&$(I),startAt:null,delay:0,onUpdate:A&&function(){return tx(r,"onUpdate")},stagger:0},b))),r._startAt._dp=0,r._startAt._sat=r,a<0&&(T||!S&&!R)&&r._startAt.revert(ep),S&&P&&a<=0&&n<=0){a&&(r._zTime=a);return}}else if(M&&P&&!L)if(a&&(S=!1),l=eB({overwrite:!1,data:"isFromStart",lazy:S&&!L&&$(I),immediateRender:S,stagger:0,parent:F},o),g&&(l[f.prop]=g),eq(r._startAt=it.set(O,l)),r._startAt._dp=0,r._startAt._sat=r,a<0&&(T?r._startAt.revert(ep):r._startAt.render(-1,!0)),r._zTime=a,S){if(!a)return}else i(r._startAt,1e-8,1e-8);for(r._pt=r._ptCache=0,I=P&&$(I)||I&&!P,s=0;s<O.length;s++){if(d=(u=O[s])._gsap||eS(O)[s]._gsap,r._ptLookup[s]=m={},ey[d.id]&&eg.length&&eP(),_=B===O?s:B.indexOf(u),f&&!1!==(p=new f).init(u,g||o,r,_,B)&&(r._pt=h=new ig(r._pt,u,p.name,0,1,p.render,p,0,p.priority),p._props.forEach(function(i){m[i]=h}),p.priority&&(c=1)),!f||g)for(l in o)ex[l]&&(p=t3(l,o,r,_,u,B))?p.priority&&(c=1):m[l]=h=t1.call(r,u,l,"get",o[l],_,B,0,x.stringFilter);r._op&&r._op[s]&&r.kill(u,r._op[s]),k&&r._pt&&(tJ=r,E.killTweensOf(u,m,r.globalTime(a)),y=!r.parent,tJ=0),r._pt&&I&&(ey[d.id]=1)}c&&i_(r),r._onInit&&r._onInit(r)}r._onUpdate=A,r._initted=(!r._op||r._pt)&&!y,D&&a<=0&&N.render(1e8,!0,!0)},t5=function(i,r,a,n,o,s,l,h){var u,c,d,f,p=(i._pt&&i._ptCache||(i._ptCache={}))[r];if(!p)for(p=i._ptCache[r]=[],d=i._ptLookup,f=i._targets.length;f--;){if((u=d[f][r])&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==r&&u.fp!==r;)u=u._next;if(!u)return tQ=1,i.vars[r]="+=0",t4(i,l),tQ=0,h?eu(r+" not eligible for reset. Try splitting into individual properties"):1;p.push(u)}for(f=p.length;f--;)(u=(c=p[f])._pt||c).s=(n||0===n)&&!o?n:u.s+(n||0)+s*u.c,u.c=a-u.s,c.e&&(c.e=eM(a)+tn(c.e)),c.b&&(c.b=u.s+tn(c.b))},t6=function(i,r){var a,n,o,s,l=i[0]?eE(i[0]).harness:0,h=l&&l.aliases;if(!h)return r;for(n in a=ek({},r),h)if(n in a)for(o=(s=h[n].split(",")).length;o--;)a[s[o]]=a[n];return a},t8=function(i,r,a,n){var o,s,l=r.ease||n||"power1.inOut";if(Y(r))s=a[i]||(a[i]=[]),r.forEach(function(i,a){return s.push({t:a/(r.length-1)*100,v:i,e:l})});else for(o in r)s=a[o]||(a[o]=[]),"ease"===o||s.push({t:parseFloat(i),v:r[o],e:l})},t9=function(i,r,a,n,o){return j(i)?i.call(r,a,n,o):V(i)&&~i.indexOf("random(")?t_(i):i},t7=eT+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",ie={};eA(t7+",id,stagger,delay,duration,paused,scrollTrigger",function(i){return ie[i]=1});var it=function(i){function r(r,a,o,s){"number"==typeof a&&(o.duration=a,a=o,o=null);var l,h,u,c,d,f,p,m,_=i.call(this,s?a:eV(a))||this,g=_.vars,y=g.duration,x=g.delay,v=g.immediateRender,b=g.stagger,T=g.overwrite,S=g.keyframes,I=g.defaults,A=g.scrollTrigger,M=a.parent||E,C=(Y(r)||X(r)?G(r[0]):"length"in a)?[r]:tl(r);if(_._targets=C.length?eS(C):eu("GSAP target "+r+" not found. https://gsap.com",!L.nullTargetWarn)||[],_._ptLookup=[],_._overwrite=T,S||b||W(y)||W(x)){var D=(a=_.vars).easeReverse||a.yoyoEase;if((l=_.timeline=new tZ({data:"nested",defaults:I||{},targets:M&&"nested"===M.data?M.vars.targets:C})).kill(),l.parent=l._dp=n(_),l._start=0,b||W(y)||W(x)){if(c=C.length,p=b&&tc(b),q(b))for(d in b)~t7.indexOf(d)&&(m||(m={}),m[d]=b[d]);for(h=0;h<c;h++)(u=eU(a,ie)).stagger=0,D&&(u.easeReverse=D),m&&ek(u,m),f=C[h],u.duration=+t9(y,n(_),h,f,C),u.delay=(+t9(x,n(_),h,f,C)||0)-_._delay,!b&&1===c&&u.delay&&(_._delay=x=u.delay,_._start+=x,u.delay=0),l.to(f,u,p?p(h,f,C):0),l._ease=tL.none;l.duration()?y=x=0:_.timeline=0}else if(S){eV(eB(l.vars.defaults,{ease:"none"})),l._ease=tU(S.ease||a.ease||"none");var R,P,z,O=0;if(Y(S))S.forEach(function(i){return l.to(C,i,">")}),l.duration();else{for(d in u={},S)"ease"===d||"easeEach"===d||t8(d,S[d],u,S.easeEach);for(d in u)for(R=u[d].sort(function(i,r){return i.t-r.t}),O=0,h=0;h<R.length;h++)(z={ease:(P=R[h]).e,duration:(P.t-(h?R[h-1].t:0))/100*y})[d]=P.v,l.to(C,z,O),O+=z.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||_.duration(y=l.duration())}else _.timeline=0;return!0!==T||w||(tJ=n(_),E.killTweensOf(C),tJ=0),e1(M,n(_),o),a.reversed&&_.reverse(),a.paused&&_.paused(!0),(v||!y&&!S&&_._start===eC(M._time)&&$(v)&&function i(r){return!r||r._ts&&i(r.parent)}(n(_))&&"nested"!==M.data)&&(_._tTime=-1e-8,_.render(Math.max(0,-x)||0)),A&&e2(n(_),A),_}o(r,i);var a=r.prototype;return a.render=function(i,r,a){var n,o,s,l,h,u,c,d,f=this._time,p=this._tDur,m=this._dur,_=i<0,g=i>p-1e-8&&!_?p:i<1e-8?0:i;if(m){if(g!==this._tTime||!i||a||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==_||this._lazy){if(n=g,d=this.timeline,this._repeat){if(l=m+this._rDelay,this._repeat<-1&&_)return this.totalTime(100*l+i,r,a);if(n=eC(g%l),g===p?(s=this._repeat,n=m):(s=~~(h=eC(g/l)))&&s===h?(n=m,s--):n>m&&(n=m),(u=this._yoyo&&1&s)&&(n=m-n),h=eY(this._tTime,l),n===f&&!a&&this._initted&&s===h)return this._tTime=g,this;s!==h&&this.vars.repeatRefresh&&!u&&!this._lock&&n!==l&&this._initted&&(this._lock=a=1,this.render(eC(l*s),!0).invalidate()._lock=0)}if(!this._initted){if(e3(this,_?i:n,a,r,g))return this._tTime=0,this;if(f!==this._time&&!(a&&this.vars.repeatRefresh&&s!==h))return this;if(m!==this._dur)return this.render(i,r,a)}if(this._rEase){var y=n<f;if(y!==this._inv){var x=y?f:m-f;this._inv=y,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=f,this._invRecip=x?(y?-1:1)/x:0,this._invScale=y?-this.ratio:1-this.ratio,this._invEase=y?this._rEase:this._ease}this.ratio=c=this._invRatio+this._invScale*this._invEase((n-this._invTime)*this._invRecip)}else this.ratio=c=this._ease(n/m);if(this._from&&(this.ratio=c=1-c),this._tTime=g,this._time=n,!this._act&&this._ts&&(this._act=1,this._lazy=0),!f&&g&&!r&&!h&&(tx(this,"onStart"),this._tTime!==g))return this;for(o=this._pt;o;)o.r(c,o.d),o=o._next;d&&d.render(i<0?i:d._dur*d._ease(n/this._dur),r,a)||this._startAt&&(this._zTime=i),this._onUpdate&&!r&&(_&&eW(this,i,r,a),tx(this,"onUpdate")),this._repeat&&s!==h&&this.vars.onRepeat&&!r&&this.parent&&tx(this,"onRepeat"),(g===this._tDur||!g)&&this._tTime===g&&(_&&!this._onUpdate&&eW(this,i,!0,!0),(i||!m)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&eq(this,1),!r&&!(_&&!f)&&(g||f||u)&&(tx(this,g===p?"onComplete":"onReverseComplete",!0),this._prom&&!(g<p&&this.timeScale()>0)&&this._prom()))}}else e6(this,i,r,a);return this},a.targets=function(){return this._targets},a.invalidate=function(r){return r&&this.vars.runBackwards||(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),i.prototype.invalidate.call(this,r)},a.resetTo=function(i,r,a,n,o){P||tR.wake(),this._ts||this.play();var s=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return(this._initted||t4(this,s),t5(this,i,r,a,n,this._ease(s/this._dur),s,o))?this.resetTo(i,r,a,n,1):(eQ(this,0),this.parent||eG(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},a.kill=function(i,r){if(void 0===r&&(r="all"),!i&&(!r||"all"===r))return this._lazy=this._pt=0,this.parent?tv(this):this.scrollTrigger&&this.scrollTrigger.kill(!!T),this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(i,r,tJ&&!0!==tJ.vars.overwrite)._first||tv(this),this.parent&&a!==this.timeline.totalDuration()&&e9(this,this._dur*this.timeline._tDur/a,0,1),this}var n,o,s,l,h,u,c,d=this._targets,f=i?tl(i):d,p=this._ptLookup,m=this._pt;if((!r||"all"===r)&&ej(d,f))return"all"===r&&(this._pt=0),tv(this);for(n=this._op=this._op||[],"all"!==r&&(V(r)&&(h={},eA(r,function(i){return h[i]=1}),r=h),r=t6(d,r)),c=d.length;c--;)if(~f.indexOf(d[c]))for(h in o=p[c],"all"===r?(n[c]=r,l=o,s={}):(s=n[c]=n[c]||{},l=r),l)(u=o&&o[h])&&("kill"in u.d&&!0!==u.d.kill(h)||eH(this,u,"_pt"),delete o[h]),"all"!==s&&(s[h]=1);return this._initted&&!this._pt&&m&&tv(this),this},r.to=function(i,a){return new r(i,a,arguments[2])},r.from=function(i,r){return ti(1,arguments)},r.delayedCall=function(i,a,n,o){return new r(a,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:a,onReverseComplete:a,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:o})},r.fromTo=function(i,r,a){return ti(2,arguments)},r.set=function(i,a){return a.duration=0,a.repeatDelay||(a.repeat=0),new r(i,a)},r.killTweensOf=function(i,r,a){return E.killTweensOf(i,r,a)},r}(t$);eB(it.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),eA("staggerTo,staggerFrom,staggerFromTo",function(i){it[i]=function(){var r=new tZ,a=to.call(arguments,0);return a.splice("staggerFromTo"===i?5:4,0,0),r[i].apply(r,a)}});var ii=function(i,r,a){return i[r]=a},ir=function(i,r,a){return i[r](a)},ia=function(i,r,a,n){return i[r](n.fp,a)},io=function(i,r,a){return i.setAttribute(r,a)},is=function(i,r){return j(i[r])?ir:H(i[r])&&i.setAttribute?io:ii},il=function(i,r){return r.set(r.t,r.p,Math.round((r.s+r.c*i)*1e6)/1e6,r)},ih=function(i,r){return r.set(r.t,r.p,!!(r.s+r.c*i),r)},iu=function(i,r){var a=r._pt,n="";if(!i&&r.b)n=r.b;else if(1===i&&r.e)n=r.e;else{for(;a;)n=a.p+(a.m?a.m(a.s+a.c*i):Math.round((a.s+a.c*i)*1e4)/1e4)+n,a=a._next;n+=r.c}r.set(r.t,r.p,n,r)},ic=function(i,r){for(var a=r._pt;a;)a.r(i,a.d),a=a._next},id=function(i,r,a,n){for(var o,s=this._pt;s;)o=s._next,s.p===n&&s.modifier(i,r,a),s=o},ip=function(i){for(var r,a,n=this._pt;n;)a=n._next,(n.p!==i||n.op)&&n.op!==i?n.dep||(r=1):eH(this,n,"_pt"),n=a;return!r},im=function(i,r,a,n){n.mSet(i,r,n.m.call(n.tween,a,n.mt),n)},i_=function(i){for(var r,a,n,o,s=i._pt;s;){for(r=s._next,a=n;a&&a.pr>s.pr;)a=a._next;(s._prev=a?a._prev:o)?s._prev._next=s:n=s,(s._next=a)?a._prev=s:o=s,s=r}i._pt=n},ig=function(){function i(i,r,a,n,o,s,l,h,u){this.t=r,this.s=n,this.c=o,this.p=a,this.r=s||il,this.d=l||this,this.set=h||ii,this.pr=u||0,this._next=i,i&&(i._prev=this)}return i.prototype.modifier=function(i,r,a){this.mSet=this.mSet||this.set,this.set=im,this.m=i,this.mt=a,this.tween=r},i}();eA(eT+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(i){return e_[i]=1}),eo.TweenMax=eo.TweenLite=it,eo.TimelineLite=eo.TimelineMax=tZ,E=new tZ({sortChildren:!1,defaults:z,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),L.stringFilter=tD;var iy=[],ix={},iv=[],ib=0,iw=0,iT=function(i){return(ix[i]||iv).map(function(i){return i()})},iS=function(){var i=Date.now(),r=[];i-ib>2&&(iT("matchMediaInit"),iy.forEach(function(i){var a,n,o,s,l=i.queries,h=i.conditions;for(n in l)(a=I.matchMedia(l[n]).matches)&&(o=1),a!==h[n]&&(h[n]=a,s=1);s&&(i.revert(),o&&r.push(i))}),iT("matchMediaRevert"),r.forEach(function(i){return i.onMatch(i,function(r){return i.add(null,r)})}),ib=i,iT("matchMedia"))},iE=function(){function i(i,r){this.selector=r&&th(r),this.data=[],this._r=[],this.isReverted=!1,this.id=iw++,i&&this.add(i)}var r=i.prototype;return r.add=function(i,r,a){j(i)&&(a=r,r=i,i=j);var n=this,o=function(){var i,o=S,s=n.selector;return o&&o!==n&&o.data.push(n),a&&(n.selector=th(a)),S=n,i=r.apply(n,arguments),j(i)&&n._r.push(i),S=o,n.selector=s,n.isReverted=!1,i};return n.last=o,i===j?o(n,function(i){return n.add(null,i)}):i?n[i]=o:o},r.ignore=function(i){var r=S;S=null,i(this),S=r},r.getTweens=function(){var r=[];return this.data.forEach(function(a){return a instanceof i?r.push.apply(r,a.getTweens()):a instanceof it&&!(a.parent&&"nested"===a.parent.data)&&r.push(a)}),r},r.clear=function(){this._r.length=this.data.length=0},r.kill=function(i,r){var a=this;if(i){for(var n,o=a.getTweens(),s=a.data.length;s--;)"isFlip"===(n=a.data[s]).data&&(n.revert(),n.getChildren(!0,!0,!1).forEach(function(i){return o.splice(o.indexOf(i),1)}));for(o.map(function(i){return{g:i._dur||i._delay||i._sat&&!i._sat.vars.immediateRender?i.globalTime(0):-1/0,t:i}}).sort(function(i,r){return r.g-i.g||-1/0}).forEach(function(r){return r.t.revert(i)}),s=a.data.length;s--;)(n=a.data[s])instanceof tZ?"nested"!==n.data&&(n.scrollTrigger&&n.scrollTrigger.revert(),n.kill()):n instanceof it||!n.revert||n.revert(i);a._r.forEach(function(r){return r(i,a)}),a.isReverted=!0}else this.data.forEach(function(i){return i.kill&&i.kill()});if(this.clear(),r)for(var l=iy.length;l--;)iy[l].id===this.id&&iy.splice(l,1)},r.revert=function(i){this.kill(i||{})},i}(),iI=function(){function i(i){this.contexts=[],this.scope=i,S&&S.data.push(this)}var r=i.prototype;return r.add=function(i,r,a){q(i)||(i={matches:i});var n,o,s,l=new iE(0,a||this.scope),h=l.conditions={};for(o in S&&!l.selector&&(l.selector=S.selector),this.contexts.push(l),r=l.add("onMatch",r),l.queries=i,i)"all"===o?s=1:(n=I.matchMedia(i[o]))&&(0>iy.indexOf(l)&&iy.push(l),(h[o]=n.matches)&&(s=1),n.addListener?n.addListener(iS):n.addEventListener("change",iS));return s&&r(l,function(i){return l.add(null,i)}),this},r.revert=function(i){this.kill(i||{})},r.kill=function(i){this.contexts.forEach(function(r){return r.kill(i,!0)})},i}(),iA={registerPlugin:function(){for(var i=arguments.length,r=Array(i),a=0;a<i;a++)r[a]=arguments[a];r.forEach(function(i){return tw(i)})},timeline:function(i){return new tZ(i)},getTweensOf:function(i,r){return E.getTweensOf(i,r)},getProperty:function(i,r,a,n){V(i)&&(i=tl(i)[0]);var o=eE(i||{}).get,s=a?eF:eO;return"native"===a&&(a=""),i?r?s((ex[r]&&ex[r].get||o)(i,r,a,n)):function(r,a,n){return s((ex[r]&&ex[r].get||o)(i,r,a,n))}:i},quickSetter:function(i,r,a){if((i=tl(i)).length>1){var n=i.map(function(i){return iR.quickSetter(i,r,a)}),o=n.length;return function(i){for(var r=o;r--;)n[r](i)}}i=i[0]||{};var s=ex[r],l=eE(i),h=l.harness&&(l.harness.aliases||{})[r]||r,u=s?function(r){var n=new s;R._pt=0,n.init(i,a?r+a:r,R,0,[i]),n.render(1,n),R._pt&&ic(1,R)}:l.set(i,h);return s?u:function(r){return u(i,h,a?r+a:r,l,1)}},quickTo:function(i,r,a){var n,o=iR.to(i,eB(((n={})[r]="+=0.1",n.paused=!0,n.stagger=0,n),a||{})),s=function(i,a,n){return o.resetTo(r,i,a,n)};return s.tween=o,s},isTweening:function(i){return E.getTweensOf(i,!0).length>0},defaults:function(i){return i&&i.ease&&(i.ease=tU(i.ease,z.ease)),eN(z,i||{})},config:function(i){return eN(L,i||{})},registerEffect:function(i){var r=i.name,a=i.effect,n=i.plugins,o=i.defaults,s=i.extendTimeline;(n||"").split(",").forEach(function(i){return i&&!ex[i]&&!eo[i]&&eu(r+" effect requires "+i+" plugin.")}),ev[r]=function(i,r,n){return a(tl(i),eB(r||{},o),n)},s&&(tZ.prototype[r]=function(i,a,n){return this.add(ev[r](i,q(a)?a:(n=a)&&{},this),n)})},registerEase:function(i,r){tL[i]=tU(r)},parseEase:function(i,r){return arguments.length?tU(i,r):tL},getById:function(i){return E.getById(i)},exportRoot:function(i,r){void 0===i&&(i={});var a,n,o=new tZ(i);for(o.smoothChildTiming=$(i.smoothChildTiming),E.remove(o),o._dp=0,o._time=o._tTime=E._time,a=E._first;a;)n=a._next,(r||!(!a._dur&&a instanceof it&&a.vars.onComplete===a._targets[0]))&&e1(o,a,a._start-a._delay),a=n;return e1(E,o,0),o},context:function(i,r){return i?new iE(i,r):S},matchMedia:function(i){return new iI(i)},matchMediaRefresh:function(){return iy.forEach(function(i){var r,a,n=i.conditions;for(a in n)n[a]&&(n[a]=!1,r=1);r&&i.revert()})||iS()},addEventListener:function(i,r){var a=ix[i]||(ix[i]=[]);~a.indexOf(r)||a.push(r)},removeEventListener:function(i,r){var a=ix[i],n=a&&a.indexOf(r);n>=0&&a.splice(n,1)},utils:{wrap:function i(r,a,n){var o=a-r;return Y(r)?tm(r,i(0,r.length),a):tr(n,function(i){return(o+(i-r)%o)%o+r})},wrapYoyo:function i(r,a,n){var o=a-r,s=2*o;return Y(r)?tm(r,i(0,r.length-1),a):tr(n,function(i){return i=(s+(i-r)%s)%s||
10,r+(i>o?s-i:i)})},distribute:tc,random:tp,snap:tf,normalize:function(i,r,a){return tg(i,r,0,1,a)},getUnit:tn,clamp:function(i,r,a){return tr(a,function(a){return ta(i,r,a)})},splitColor:tE,toArray:tl,selector:th,mapRange:tg,pipe:function(){for(var i=arguments.length,r=Array(i),a=0;a<i;a++)r[a]=arguments[a];return function(i){return r.reduce(function(i,r){return r(i)},i)}},unitize:function(i,r){return function(a){return i(parseFloat(a))+(r||tn(a))}},interpolate:function i(r,a,n,o){var s=isNaN(r+a)?0:function(i){return(1-i)*r+i*a};if(!s){var l,h,u,c,d,f=V(r),p={};if(!0===n&&(o=1)&&(n=null),f)r={p:r},a={p:a};else if(Y(r)&&!Y(a)){for(u=[],d=(c=r.length)-2,h=1;h<c;h++)u.push(i(r[h-1],r[h]));c--,s=function(i){var r=Math.min(d,~~(i*=c));return u[r](i-r)},n=a}else o||(r=ek(Y(r)?[]:{},r));if(!u){for(l in a)t1.call(p,r,l,"get",a[l]);s=function(i){return ic(i,p)||(f?r.p:r)}}}return tr(n,s)},shuffle:tu},install:el,effects:ev,ticker:tR,updateRoot:tZ.updateRoot,plugins:ex,globalTimeline:E,core:{PropTween:ig,globals:ec,Tween:it,Timeline:tZ,Animation:t$,getCache:eE,_removeLinkedListItem:eH,reverting:function(){return T},context:function(i){return i&&S&&(S.data.push(i),i._ctx=S),S},suppressOverwrites:function(i){return w=i}}};eA("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return iA[i]=it[i]}),tR.add(tZ.updateRoot),R=iA.to({},{duration:0});var iM=function(i,r){for(var a=i._pt;a&&a.p!==r&&a.op!==r&&a.fp!==r;)a=a._next;return a},iC=function(i,r){var a,n,o,s=i._targets;for(a in r)for(n=s.length;n--;)(o=i._ptLookup[n][a])&&(o=o.d)&&(o._pt&&(o=iM(o,a)),o&&o.modifier&&o.modifier(r[a],i,s[n],a))},iD=function(i,r){return{name:i,headless:1,rawVars:1,init:function(i,a,n){n._onInit=function(i){var n,o;if(V(a)&&(n={},eA(a,function(i){return n[i]=1}),a=n),r){for(o in n={},a)n[o]=r(a[o]);a=n}iC(i,a)}}}},iR=iA.registerPlugin({name:"attr",init:function(i,r,a,n,o){var s,l,h;for(s in this.tween=a,r)h=i.getAttribute(s)||"",(l=this.add(i,"setAttribute",(h||0)+"",r[s],n,o,0,0,s)).op=s,l.b=h,this._props.push(s)},render:function(i,r){for(var a=r._pt;a;)T?a.set(a.t,a.p,a.b,a):a.r(i,a.d),a=a._next}},{name:"endArray",headless:1,init:function(i,r){for(var a=r.length;a--;)this.add(i,a,i[a]||0,r[a],0,0,0,0,0,1)}},iD("roundProps",td),iD("modifiers"),iD("snap",tf))||iA;it.version=tZ.version=iR.version="3.15.0",C=1,Z()&&tP(),tL.Power0,tL.Power1,tL.Power2,tL.Power3,tL.Power4,tL.Linear,tL.Quad,tL.Cubic,tL.Quart,tL.Quint,tL.Strong,tL.Elastic,tL.Back,tL.SteppedEase,tL.Bounce,tL.Sine,tL.Expo,tL.Circ}),l("f5sus",function(r,a){function n(i){i.setAttribute("aria-expanded","true"===i.getAttribute("aria-expanded")?"false":"true")}i(r.exports,"reverseAriaExpanded",()=>n),i(r.exports,"FocusTrap",()=>o);class o{constructor(i,r){this.element=i,this.focusableEls=r??this.constructor.getFocusableEls(i),this.firstFocusableEl=this.focusableEls[0],this.lastFocusableEl=this.focusableEls[this.focusableEls.length-1],this._handler=this._handleKeydown.bind(this)}static getFocusableEls(i){return i.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])')}enable(){document.addEventListener("keydown",this._handler)}disable(){document.removeEventListener("keydown",this._handler)}_handleKeydown(i){("Tab"===i.key||9===i.keyCode)&&(i.shiftKey?document.activeElement===this.firstFocusableEl&&(this.lastFocusableEl.focu
1s(),i.preventDefault()):document.activeElement===this.lastFocusableEl&&(this.firstFocusableEl.focus(),i.preventDefault()))}}}),l("gKp6f",function(a,n){i(a.exports,"createMap",()=>l),i(a.exports,"mapboxgl",()=>r(s("kMGLj")));var o=s("kMGLj");function l(i){return r(o).accessToken=mapboxSettings.accessToken,new(r(o)).Map({style:"mapbox://styles/eventconnectors/clwuexstn015i01qx6afg97vt",...i})}}),l("kMGLj",function(i,r){i.exports,i.exports=function(){"use strict";let i,r,a;function n(n,o){if(i)if(r){let n={};i(void 0,n),a=o(n);let s="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+i+")(undefined, sharedChunk); ("+r+")(undefined, sharedChunk); self.onerror = null;";"u">typeof window&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else r=o;else i=o}return n(["require","exports"],function(i,r){let a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P,L,z,O,F,B,k,N;var U="u">typeof Float32Array?Float32Array:Array;function V(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*s-o*n;return l?(i[0]=s*(l=1/l),i[1]=-n*l,i[2]=-o*l,i[3]=a*l,i):null}function j(){var i=new U(9);return U!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function G(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8];return i[0]=l*d-h*c,i[1]=o*c-n*d,i[2]=n*h-o*l,i[3]=h*u-s*d,i[4]=a*d-o*u,i[5]=o*s-a*h,i[6]=s*c-l*u,i[7]=n*u-a*c,i[8]=a*l-n*s,i}function H(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],f=r[8],p=a[0],m=a[1],_=a[2],g=a[3],y=a[4],x=a[5],v=a[6],b=a[7],w=a[8];return i[0]=p*n+m*l+_*c,i[1]=p*o+m*h+_*d,i[2]=p*s+m*u+_*f,i[3]=g*n+y*l+x*c,i[4]=g*o+y*h+x*d,i[5]=g*s+y*u+x*f,i[6]=v*n+b*l+w*c,i[7]=v*o+b*h+w*d,i[8]=v*s+b*u+w*f,i}function q(){var i=new U(16);return U!=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}function $(i){var r=new U(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r}function Z(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 W(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],f=r[9],p=r[10],m=r[11],_=r[12],g=r[13],y=r[14],x=r[15],v=a*h-n*l,b=a*u-o*l,w=a*c-s*l,T=n*u-o*h,S=n*c-s*h,E=o*c-s*u,I=d*g-f*_,A=d*y-p*_,M=d*x-m*_,C=f*y-p*g,D=f*x-m*g,R=p*x-m*y,P=v*R-b*D+w*C+T*M-S*A+E*I;return P?(i[0]=(h*R-u*D+c*C)*(P=1/P),i[1]=(o*D-n*R-s*C)*P,i[2]=(g*E-y*S+x*T)*P,i[3]=(p*S-f*E-m*T)*P,i[4]=(u*M-l*R-c*A)*P,i[5]=(a*R-o*M+s*A)*P,i[6]=(y*w-_*E-x*b)*P,i[7]=(d*E-p*w+m*b)*P,i[8]=(l*D-h*M+c*I)*P,i[9]=(n*M-a*D-s*I)*P,i[10]=(_*S-g*w+x*v)*P,i[11]=(f*w-d*S-m*v)*P,i[12]=(h*A-l*C-u*I)*P,i[13]=(a*C-n*A+o*I)*P,i[14]=(g*b-_*T-y*v)*P,i[15]=(d*T-f*b+p*v)*P,i):null}function X(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],f=r[8],p=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=a[0],w=a[1],T=a[2],S=a[3];return i[0]=b*n+w*h+T*f+S*g,i[1]=b*o+w*u+T*p+S*y,i[2]=b*s+w*c+T*m+S*x,i[3]=b*l+w*d+T*_+S*v,i[4]=(b=a[4])*n+(w=a[5])*h+(T=a[6])*f+(S=a[7])*g,i[5]=b*o+w*u+T*p+S*y,i[6]=b*s+w*c+T*m+S*x,i[7]=b*l+w*d+T*_+S*v,i[8]=(b=a[8])*n+(w=a[9])*h+(T=a[10])*f+(S=a[11])*g,i[9]=b*o+w*u+T*p+S*y,i[10]=b*s+w*c+T*m+S*x,i[11]=b*l+w*d+T*_+S*v,i[12]=(b=a[12])*n+(w=a[13])*h+(T=a[14])*f+(S=a[15])*g,i[13]=b*o+w*u+T*p+S*y,i[14]=b*s+w*c+T*m+S*x,i[15]=b*l+w*d+T*_+S*v,i}function Y(i,r,a){var n,o,s,l,h,u,c,d,f,p,m,_,g=a[0],y=a[1],x=a[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],f=r[8],p=r[9],m=r[10],_=r[11],i[0]=n=r[0],i[1]=o,i[2]=s,i[3]=l,i[4]=h,i[5]=u,i[6]=c,i[7]=d,i[8]=f,i[9]=p,i[10]=m,i[11]=_,i[12]=n*g+h*y+f*x+r[12],i[13]=o*g+u*y+p*x+r[13],i[14]=s*g+c*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function K(i,r,a){var n=a[0],o=a[1],s=a[2];return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=r[7]*o,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=r[11]*s,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function J(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],f=r[10],p=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=s*o+c*n,i[5]=l*o+d*n,i[6]=h*o+f*n,i[7]=u*o+p*n,i[8]=c*o-s*n,i[9]=d*o-l*n,i[10]=f*o-h*n,i[11]=p*o-u*n,i}function Q(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[8],d=r[9],f=r[10],p=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o-c*n,i[1]=l*o-d*n,i[2]=h*o-f*n,i[3]=u*o-p*n,i[8]=s*n+c*o,i[9]=l*n+d*o,i[10]=h*n+f*o,i[11]=u*n+p*o,i}function ee(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[4],d=r[5],f=r[6],p=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o+c*n,i[1]=l*o+d*n,i[2]=h*o+f*n,i[3]=u*o+p*n,i[4]=c*o-s*n,i[5]=d*o-l*n,i[6]=f*o-h*n,i[7]=p*o-u*n,i}function et(i,r){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]=r[0],i[13]=r[1],i[14]=r[2],i[15]=1,i}function ei(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function er(i,r,a){var n,o,s,l=a[0],h=a[1],u=a[2],c=Math.sqrt(l*l+h*h+u*u);return c<1e-6?null:(l*=c=1/c,h*=c,u*=c,n=Math.sin(r),o=Math.cos(r),i[0]=l*l*(s=1-o)+o,i[1]=h*l*s+u*n,i[2]=u*l*s-h*n,i[3]=0,i[4]=l*h*s-u*n,i[5]=h*h*s+o,i[6]=u*h*s+l*n,i[7]=0,i[8]=l*u*s+h*n,i[9]=h*u*s-l*n,i[10]=u*u*s+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function ea(i,r){var a=r[0],n=r[1],o=r[2],s=r[4],l=r[5],h=r[6],u=r[8],c=r[9],d=r[10];return i[0]=Math.sqrt(a*a+n*n+o*o),i[1]=Math.sqrt(s*s+l*l+h*h),i[2]=Math.sqrt(u*u+c*c+d*d),i}function en(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a+a,h=n+n,u=o+o,c=a*l,d=n*l,f=n*h,p=o*l,m=o*h,_=o*u,g=s*l,y=s*h,x=s*u;return i[0]=1-f-_,i[1]=d+x,i[2]=p-y,i[3]=0,i[4]=d-x,i[5]=1-c-_,i[6]=m+g,i[7]=0,i[8]=p+y,i[9]=m-g,i[10]=1-c-f,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function eo(){var i=new U(3);return U!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}
vendor: 4,270 bytes, line 1
1function es(i){var r=new U(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function el(i){var r=i[0],a=i[1],n=i[2];return Math.sqrt(r*r+a*a+n*n)}function eh(i,r,a){var n=new U(3);return n[0]=i,n[1]=r,n[2]=a,n}function eu(i,r,a,n){return i[0]=r,i[1]=a,i[2]=n,i}function ec(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i[2]=r[2]+a[2],i}function ed(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i[2]=r[2]-a[2],i}function ef(i,r,a){return i[0]=r[0]*a[0],i[1]=r[1]*a[1],i[2]=r[2]*a[2],i}function ep(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i}function em(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i}function e_(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function eg(i,r,a,n){return i[0]=r[0]+a[0]*n,i[1]=r[1]+a[1]*n,i[2]=r[2]+a[2]*n,i}function ey(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return Math.sqrt(a*a+n*n+o*o)}function ex(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return a*a+n*n+o*o}function ev(i){var r=i[0],a=i[1],n=i[2];return r*r+a*a+n*n}function eb(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i}function ew(i,r){var a=r[0],n=r[1],o=r[2],s=a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i}function eT(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function eS(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[0],h=a[1],u=a[2];return i[0]=o*u-s*h,i[1]=s*l-n*u,i[2]=n*h-o*l,i}function eE(i,r,a,n){var o=r[0],s=r[1],l=r[2];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i}function eI(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[3]*n+a[7]*o+a[11]*s+a[15];return i[0]=(a[0]*n+a[4]*o+a[8]*s+a[12])/(l=l||1),i[1]=(a[1]*n+a[5]*o+a[9]*s+a[13])/l,i[2]=(a[2]*n+a[6]*o+a[10]*s+a[14])/l,i}function eA(i,r,a){var n=r[0],o=r[1],s=r[2];return i[0]=n*a[0]+o*a[3]+s*a[6],i[1]=n*a[1]+o*a[4]+s*a[7],i[2]=n*a[2]+o*a[5]+s*a[8],i}function eM(i,r,a){var n=a[0],o=a[1],s=a[2],l=a[3],h=r[0],u=r[1],c=r[2],d=o*c-s*u,f=s*h-n*c,p=n*u-o*h;return i[0]=h+l*(d+=d)+o*(p+=p)-s*(f+=f),i[1]=u+l*f+s*d-n*p,i[2]=c+l*p+n*f-o*d,i}function eC(i){return i[0]=0,i[1]=0,i[2]=0,i}function eD(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]}function eR(){var i=new U(4);return U!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function eP(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a,i}function eL(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*a+n*n+o*o+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=a*l,i[1]=n*l,i[2]=o*l,i[3]=s*l,i}function ez(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3];return i[0]=a[0]*n+a[4]*o+a[8]*s+a[12]*l,i[1]=a[1]*n+a[5]*o+a[9]*s+a[13]*l,i[2]=a[2]*n+a[6]*o+a[10]*s+a[14]*l,i[3]=a[3]*n+a[7]*o+a[11]*s+a[15]*l,i}function eO(){var i=new U(4);return U!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function eF(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function eB(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+l*h,i[1]=o*u+s*h,i[2]=s*u-o*h,i[3]=l*u-n*h,i}function ek(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u-s*h,i[1]=o*u+l*h,i[2]=s*u+n*h,i[3]=l*u-o*h,i}eo(),eR();var eN,eU,eV,ej=(eN=eo(),eU=eh(1,0,0),eV=eh(0,1,0),function(i,r,a){var n,o,s=eT(r,a);return s<-.999999?(eS(eN,eU,r),1e-6>el(eN)&&eS(eN,eV,r),ew(eN,eN),o=Math.sin(n=.5*Math.PI),i[0]=o*eN[0],i[1]=o*eN[1],i[2]=o*eN[2],i[3]=Math.cos(n),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(eS(eN,r,a),i[0]=eN[0],i[1]=eN[1],i[2]=eN[2],i[3]=1+s,eL(i,i))});function eG(){var i=new U(2);return U!=Float32Array&&(i[0]=0,i[1]=0),i}function eH(i,r){var a=new U(2);return a[0]=i,a[1]=r,a}function eq(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i}function e$(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i}function eZ(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i}function eW(i){var r=i[0],a=i[1];return Math.sqrt(r*r+a*a)}function eX(i,r){var a=r[0],n=r[1],o=a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),i[0]=r[0]*o,i[1]=r[1]*o,i}function eY(i,r){return i[0]*r[0]+i[1]*r[1]}function eK(i,r,a,n){let o=3*i,s=3*(a-i)-o,l=1-o-s,h=3*r,u=3*(n-r)-h,c=1-h-u;return function(i,r=1e-6){if(i<=0)return 0;if(i>=1)return 1;let a=i;for(let n=0;n<8;n++){let n=((l*a+s)*a+o)*a-i;if(Math.abs(n)<r)return((c*a+u)*a+h)*a;let d=(3*l*a+2*s)*a+o;if(1e-6>Math.abs(d))break;a-=n/d}let n=0,d=1;a=i;for(let h=0;h<20;h++){let h=((l*a+s)*a+o)*a;if(Math.abs(h-i)<r)break;
1i>h?n=a:d=a,a=.5*(n+d)}return((c*a+u)*a+h)*a}}function eJ(i,r){this.x=i,this.y=r}function eQ(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(!eQ(i[a],r[a]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let a in i)if(!eQ(i[a],r[a]))return!1;return!0}return i===r}function e0(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}eO(),eO(),j();function e1(i,r){return r.area-i.area}function e2(i,r){let a,n,o=i.length;if(o<=1)return[i];let s=[];for(let r=0;r<o;r++){let o=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[r]);0!==o&&(i[r].area=Math.abs(o),void 0===n&&(n=o<0),n===o<0?(a&&s.push(a),a=[i[r]]):a.push(i[r]))}if(a&&s.push(a),r>1)for(let i=0;i<s.length;i++)s[i].length<=r||(function i(r,a,n=0,o=r.length-1,s=function(i,r){return i<r?-1:+(i>r)}){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}let l=r[a],h=n,u=o;for(e0(r,n,a),s(r[o],l)>0&&e0(r,n,o);h<u;){for(e0(r,h,u),h++,u--;0>s(r[h],l);)h++;for(;s(r[u],l)>0;)u--}0===s(r[n],l)?e0(r,n,u):e0(r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}}(s[i],r,1,s[i].length-1,e1),s[i]=s[i].slice(0,r));return s}function e3(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function e4(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function e5(i,r,a=!1){let n=!1;for(let o=0,s=r.length;o<s;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;l=r++){let o=s[l],h=s[r];if(function(i,r,a){let n=i[0]-r[0],o=i[1]-r[1],s=i[0]-a[0],l=i[1]-a[1];return n*l-s*o==0&&n*s<=0&&o*l<=0}(i,o,h))return a;o[1]>i[1]!=h[1]>i[1]&&i[0]<(h[0]-o[0])*(i[1]-o[1])/(h[1]-o[1])+o[0]&&(n=!n)}}return n}function e6(i,r,a,n){let o=n[0]-a[0],s=n[1]-a[1],l=(i[0]-a[0])*s-o*(i[1]-a[1]),h=(r[0]-a[0])*s-o*(r[1]-a[1]);return l>0&&h<0||l<0&&h>0}function e8(i,r,a,n){var o,s;return 0!=(o=[n[0]-a[0],n[1]-a[1]])[0]*(s=[r[0]-i[0],r[1]-i[1]])[1]-o[1]*s[0]&&!(!e6(i,r,a,n)||!e6(a,n,i,r))}function e9(i){let r=new eJ(1/0,1/0),a=new eJ(-1/0,-1/0);for(let n of i[0])r.x>n.x&&(r.x=n.x),r.y>n.y&&(r.y=n.y),a.x<n.x&&(a.x=n.x),a.y<n.y&&(a.y=n.y);return{min:r,max:a}}eG(),eJ.prototype={clone(){return new eJ(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)},rotateAround(i,r){return this.clone()._rotateAround(i,r)},matMult(i){return this.clone()._matMult(i)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){let r=i.x-this.x,a=i.y-this.y;return r*r+a*a},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult(i){let r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){let i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){let r=Math.cos(i),a=Math.sin(i),n=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=n,this},_rotateAround(i,r){let a=Math.cos(i),n=Math.sin(i),o=r.y+n*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-n*(this.y-r.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:eJ},eJ.convert=function(i){if(i instanceof eJ)return i;if(Array.isArray(i))return new eJ(+i[0],+i[1]);if(void 0!==i.x&&void 0!==i.y)return new eJ(+i.x,+i.y);throw Error("Expected [x, y] or {x, y} point format")};let e7=Math.PI/180,te=180/Math.PI,tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ti=/\b(iPad|iPhone|iPod)\b/,tr=/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/,ta=[[0,0],[1,0],[1,1],[0,1]];function tn(i){if(i<=0)return 0;if(i>=1)return 1;let r=i*i,a=r*i;return 4*(i<.5?a:3*(i-r)+a-.75)}let to=eK(.25,.1,.25,1);
1function ts(i,r,a){return Math.min(a,Math.max(r,i))}function tl(i,r,a){return(a=ts((a-i)/(r-i),0,1))*a*(3-2*a)}function th(i,r,a){let n=a-r,o=((i-r)%n+n)%n+r;return o===r?a:o}function tu(i,r,a){if(!i.length)return a(null,[]);let n=i.length,o=Array(i.length),s=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(s=i),o[l]=r,0==--n&&a(s,o)})})}function tc(i,r){let a={};for(let n=0;n<r.length;n++){let o=r[n];o in i&&(a[o]=i[o])}return a}let td=1;function tf(){return td++}function tp(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log2(i)))}function tm(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function t_(i,r,a){let n={};for(let a in i)n[a]=r.call(this,i[a],a,i);return n}function tg(i,r,a){let n={};for(let a in i)r.call(this,i[a],a,i)&&(n[a]=i[a]);return n}function ty(i){return Array.isArray(i)?i.map(ty):"object"==typeof i&&i?t_(i,ty):i}function tx(i,r){for(let a=0;a<i.length;a++)if(r.includes(i[a]))return!0;return!1}let tv={};function tb(i){tv[i]||("u">typeof console&&console.warn(i),tv[i]=!0)}function tw(i,r,a){return(a.y-i.y)*(r.x-i.x)>(r.y-i.y)*(a.x-i.x)}function tT([i,r,a]){let n=(r+90)*e7,o=a*e7;return{x:i*Math.cos(n)*Math.sin(o),y:i*Math.sin(n)*Math.sin(o),z:i*Math.cos(o),azimuthal:r,polar:a}}function tS(i){return("u">typeof self||void 0!==i)&&"u">typeof WorkerGlobalScope&&(void 0!==i?i:self)instanceof WorkerGlobalScope}function tE(i){let r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,a,n,o)=>{let s=n||o;return r[a]=!s||s.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let tI,tA,tM,tC,tD,tR,tP,tL=null;function tz(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}function tO(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<n?r=o+1:a=o}return r}function tF(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<=n?r=o+1:a=o}return r}function tB(i){return i>0?1/(1.001-i):1+i}function tk(i){return i>0?1-1/(1.001-i):-i}function tN(i,r,a){return(i-r.min)*(a.max-a.min)/(r.max-r.min)+a.min}function tU(){return null==tA&&(tA=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),tA}let tV={requestIdleCallback:i=>{if("u">typeof requestIdleCallback)return requestIdleCallback(i);setTimeout(()=>i({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>void 0!==tD?tD:performance.now(),setNow(i){tD=i},restoreNow(){tD=void 0},frame(i){let r=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(r)}},getImageData(i,r=0){let{width:a,height:n}=i;tR||(tR=document.createElement("canvas"));let o=tR.getContext("2d",{willReadFrequently:!0});if(!o)throw Error("failed to create canvas 2d context");return(a>tR.width||n>tR.height)&&(tR.width=a,tR.height=n),o.clearRect(-r,-r,a+2*r,n+2*r),o.drawImage(i,0,0,a,n),o.getImageData(-r,-r,a+2*r,n+2*r)},resolveURL:i=>(tM||(tM=document.createElement("a")),tM.href=i,tM.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==tC&&(tC=window.matchMedia("(prefers-reduced-motion: reduce)")),tC.matches)},hasCanvasFingerprintNoise(){if(void 0!==tP)return tP;if(!tU())return tP=!1,!1;let i=new OffscreenCanvas(85,1),r=i.getContext("2d",{willReadFrequently:!0}),a=0;for(let n=0;n<i.width;++n)r.fillStyle=`rgba(${a++},${a++},${a++}, 255)`,r.fillRect(n,0,1,1);let n=r.getImageData(0,0,i.width,i.height);a=0;for(let i=0;i<n.data.length;++i)if(i%4!=3&&a++!==n.data[i])return tP=!0,!0;return tP=!1,!1}},tj={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!tj.API_URL)return null;try{let i=new URL(tj.API_URL);return"api.mapbox.cn"===i.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===i.hostname?"https://events.mapbox.com/events/v2":null}catch(i){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
1HOPT_URL:"/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function tG(){return new URL(tj.DRACO_URL,tj.API_URL).href}function tH(){if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(!function(){if(void 0===tI){if("object"!=typeof WebAssembly)return!1;let i=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);tI=WebAssembly.validate(i)}return tI}()?tj.MESHOPT_URL:tj.MESHOPT_SIMD_URL,tj.API_URL).href}function tq(){return new URL(tj.BUILDING_GEN_URL,tj.API_URL).href}function t$(i){return tj.API_URL_REGEX.test(i)}function tZ(i){return tj.API_SPRITE_REGEX.test(i)}function tW(i,r){let a=i.indexOf("?");if(a<0)return`${i}?${new URLSearchParams(r).toString()}`;let n=new URLSearchParams(i.slice(a));for(let i in r)n.set(i,r[i]);return`${i.slice(0,a)}?${n.toString()}`}
1function tX(i,r={persistentParams:[]}){let a=i.indexOf("?");if(a<0)return i;let n=new URLSearchParams,o=new URLSearchParams(i.slice(a));for(let i of r.persistentParams){let r=o.get(i);r&&n.set(i,r)}let s=n.toString();return`${i.slice(0,a)}${s.length>0?`?${s}`:""}`}let tY="mapbox-tiles",tK=500,tJ=50,tQ=["language","worldview","jobid"];function t0(){try{return caches}catch(i){}}function t1(){let i=t0();i&&null==a&&(a=i.open(tY))}let t2=1/0,t3={supported:!1,testSupport:function(i){!t6&&t5&&(t8?t7(i):t4=i)}},t4,t5,t6=!1,t8=!1,t9="u">typeof self?self:{};function t7(i){let r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t5),i.isContextLost())return;t3.supported=!0}catch(i){}i.deleteTexture(r),t6=!0}t9.document&&((t5=t9.document.createElement("img")).onload=function(){t4&&t7(t4),t4=null,t8=!0},t5.onerror=function(){t6=!0,t4=null},t5.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let ie={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(ie);class it extends Error{constructor(i,r,a){401===r&&t$(a)&&(i+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=a}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function ii(i){return"object"==typeof i&&null!==i&&"status"in i&&404===i.status}let ir=tS()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,ia=/^\w+:/,io=/[\r\n]+/,is=function(i,r){var n,o;let s,l,h,u,c,d,f;return(n=i.url).startsWith("file:")||ir().startsWith("file:")&&!ia.test(n)?function(i,r){let a=new XMLHttpRequest;for(let r in a.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(a.responseType="arraybuffer"),i.headers)a.setRequestHeader(r,i.headers[r]);return"json"===i.type&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===i.credentials,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let n=a.response;if("json"===i.type)try{n=JSON.parse(a.response)}catch(i){return r(i)}let o=new Headers;a.getAllResponseHeaders().trim().split(io).forEach(i=>{let r=i.split(": "),a=r.shift(),n=r.join(": ");o.append(a,n)}),r(null,n,o)}else r(new it(a.statusText,a.status,i.url))},a.send(i.body),{cancel:()=>a.abort()}}(i,r):(s=new AbortController,l=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:ir(),referrerPolicy:i.referrerPolicy,signal:s.signal}
1),h=!1,u=!1,c=(o=l.url).indexOf("sku=")>0&&t$(o),"json"===i.type&&l.headers.set("Accept","application/json"),d=(a,n,o)=>{if(u)return;if(a&&"SecurityError"!==a.message&&tb(a.toString()),n&&o)return f(n);let s=Date.now();fetch(l).then(a=>{if(a.ok){let i=c?a.clone():null;return f(a,i,s)}return r(new it(a.statusText,a.status,i.url))}).catch(a=>{"AbortError"!==a.name&&r(Error(`${a.message} ${i.url}`))})},f=(n,o,s)=>{("arrayBuffer"===i.type?n.arrayBuffer():"json"===i.type?n.json():n.text()).then(i=>{u||(o&&s&&function(i,r,n){var o;if(t1(),null==a)return;let s=tE(r.headers.get("cache-control")||"");if(s["no-store"])return;let l={status:r.status,statusText:r.statusText,headers:new Headers};r.headers.forEach((i,r)=>l.headers.set(r,i)),s["max-age"]&&l.headers.set("Expires",new Date(n+1e3*s["max-age"]).toUTCString());let h=l.headers.get("expires");if(!h||new Date(h).getTime()-n<42e4)return;let u=tX(i.url,{persistentParams:tQ});if(206===r.status){let r=i.headers.get("Range");if(!r)return;l.status=200,u=tW(u,{range:r})}let c=new Response(200!==(o=r.status)&&404!==o&&[101,103,204,205,304].includes(o)?null:r.body,l);t1(),null!=a&&a.then(i=>i.put(u,c)).catch(i=>tb(i.message))}(l,o,s),h=!0,r(null,i,n.headers))}).catch(i=>{u||r(Error(i.message))})},c?function(i,r){if(t1(),null==a)return r(null);a.then(a=>
1{let n=tX(i.url,{persistentParams:tQ}),o=i.headers.get("Range");o&&(n=tW(n,{range:o})),a.match(n).then(i=>{let o=function(i){if(!i)return!1;let r=new Date(i.headers.get("expires")||0),a=tE(i.headers.get("cache-control")||"");return Number(r)>Date.now()&&!a["no-cache"]}(i);a.delete(n).catch(r),o&&a.put(n,i.clone()).catch(r),r(null,i,o)}).catch(r)}).catch(r)}(l,d):d(null,null),{cancel:()=>{u=!0,h||s.abort()}})},il=function(i,r){return is(Object.assign(i,{type:"json"}),r)},ih=function(i,r){return is(Object.assign(i,{type:"arrayBuffer"}),r)};n=[],o=0;let iu=function(i,r){if(t3.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),o>=tj.MAX_PARALLEL_IMAGE_REQUESTS){let a={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return n.push(a),a}o++;let a=!1,s=()=>{if(!a)for(a=!0,o--;n.length&&o<tj.MAX_PARALLEL_IMAGE_REQUESTS;){let i=n.shift(),{requestParameters:r,callback:a,cancelled:o}=i;o||(i.cancel=iu(r,a).cancel)}},l=ih(i,(i,a,n)=>{s(),i?r(i):a&&createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})).then(i=>{((i,a)=>r(i,a,n))(null,i)}).catch(i=>{((i,a)=>r(i,a,n))(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})});return{cancel:()=>{l.cancel(),s()}}};function ic(i,r=0){let a=i.length,n=a-(3&a),o,s=0|r,l=0;for(;l<n;)o=255&i.charCodeAt(l)|(255&i.charCodeAt(l+1))<<8|(255&i.charCodeAt(l+2))<<16|(255&i.charCodeAt(l+3))<<24,l+=4,s^=o=Math.imul(o=(o=Math.imul(o,0xcc9e2d51))<<15|o>>>17,0x1b873593),s=Math.imul(s=s<<13|s>>>19,5)+0xe6546b64|0;o=0;let h=3&a;return h>0&&(h>=3&&(o^=(255&i.charCodeAt(l+2))<<16),h>=2&&(o^=(255&i.charCodeAt(l+1))<<8),o^=255&i.charCodeAt(l),s^=o=Math.imul(o=(o=Math.imul(o,0xcc9e2d51))<<15|o>>>17,0x1b873593)),s^=a,s^=s>>>16,s=Math.imul(s,0x85ebca6b),s^=s>>>13,s=Math.imul(s,0xc2b2ae35),(s^=s>>>16)>>>0}
1class id{constructor(i,...r){Object.assign(this,r[0]||{}),this.type=i}}class ip extends id{constructor(i,r={}){super("error",Object.assign({error:i},r))}}function im(i,r,a){a[i]&&a[i].includes(r)||(a[i]=a[i]||[],a[i].push(r))}function i_(i,r,a){if(a&&a[i]){let n=a[i].indexOf(r);-1!==n&&a[i].splice(n,1)}}class ig{on(i,r){return this._listeners=this._listeners||{},im(i,r,this._listeners),this}off(i,r){return i_(i,r,this._listeners),i_(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},im(i,r,this._oneTimeListeners),this):new Promise(r=>{this.once(i,r)})}fire(i,r){let a="string"==typeof i?new id(i,r):i,n=a.type;if(this.listens(n)){for(let i of(a.target=this,this._listeners&&this._listeners[n]?this._listeners[n].slice():[]))i.call(this,a);for(let i of this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[])i_(n,i,this._oneTimeListeners),i.call(this,a);let i=this._eventedParent;i&&(Object.assign(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(a))}else a instanceof ip&&console.error(a.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}class iy{constructor(i){"string"==typeof i?this.name=i:(this.name=i.name,this.iconsetId=i.iconsetId)}static from(i){return new iy(i)}static toString(i){return i.iconsetId?`${i.name}�${i.iconsetId}`:i.name}static parse(i){let[r,a]=i.split("\x1f");return new iy({name:r,iconsetId:a})}static isEqual(i,r){return i.name===r.name&&i.iconsetId===r.iconsetId}toString(){return iy.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var ix,iv={},ib=function(){if(ix)return iv;ix=1;var i={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 r(i){return(i=Math.round(i))<0?0:i>255?255:i}function a(i){return r("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function n(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function o(i,r,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?i+(r-i)*a*6:2*a<1?r:3*a<2?i+(r-i)*(2/3-a)*6:i}try{iv.parseCSSColor=function(s){var l,h=s.replace(/ /g,"").toLowerCase();if(h in i)return i[h].slice();if("#"===h[0])return 4===h.length?(l=parseInt(h.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:7===h.length&&(l=parseInt(h.substr(1),16))>=0&&l<=0xffffff?[(0xff0000&l)>>16,(65280&l)>>8,255&l,1]:null;var u=h.indexOf("("),c=h.indexOf(")");if(-1!==u&&c+1===h.length){var d=h.substr(0,u),f=h.substr(u+1,c-(u+1)).split(","),p=1;switch(d){case"rgba":if(4!==f.length)break;p=n(f.pop());case"rgb":return 3!==f.length?null:[a(f[0]),a(f[1]),a(f[2]),p];case"hsla":if(4!==f.length)break;p=n(f.pop());case"hsl":if(3!==f.length)break;var m=(parseFloat(f[0])%360+360)%360/360,_=n(f[1]),g=n(f[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[r(255*o(x,y,m+1/3)),r(255*o(x,y,m)),r(255*o(x,y,m-1/3)),p]}}return null}}catch(i){}return iv}();function iw(i,r,a){return i*(1-a)+r*a}let iT=new Map;
1class iS{constructor(i,r,a,n=1){this.r=i,this.g=r,this.b=a,this.a=n}static parse(i){if(!i)return;if(i instanceof iS)return i;if("string"!=typeof i)return;let r=iT.get(i);if(r)return r;let a=ib.parseCSSColor(i);if(!a)return;let n=new iS(a[0]/255,a[1]/255,a[2]/255,a[3]);return iT.set(i,n),n}toString(){let{r:i,g:r,b:a,a:n}=this;return`rgba(${Math.round(255*i)},${Math.round(255*r)},${Math.round(255*a)},${n})`}toNonPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new iI(i,r,a,n,o)}toPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new iA(i,r*o,a*o,n*o,o)}clone(){return new iS(this.r,this.g,this.b,this.a)}}class iE{constructor(i,r,a,n,o,s=!1){if(this.premultiplied=!1,this.premultiplied=s,i){const s=i.image.height,l=s*s;this.premultiplied?(r=0===o?0:r/o*(s-1),a=0===o?0:a/o*(s-1),n=0===o?0:n/o*(s-1)):(r*=s-1,a*=s-1,n*=s-1),r=Math.max(0,Math.min(s-1,r)),a=Math.max(0,Math.min(s-1,a)),n=Math.max(0,Math.min(s-1,n));const h=Math.floor(r),u=Math.floor(a),c=Math.floor(n),d=Math.ceil(r),f=Math.ceil(a),p=Math.ceil(n),m=r-h,_=a-u,g=n-c,y=i.image.data,x=4*(h+u*l+c*s),v=4*(h+u*l+p*s),b=4*(h+f*l+c*s),w=4*(h+f*l+p*s),T=4*(d+u*l+c*s),S=4*(d+u*l+p*s),E=4*(d+f*l+c*s),I=4*(d+f*l+p*s);this.r=iw(iw(iw(y[x],y[v],g),iw(y[b],y[w],g),_),iw(iw(y[T],y[S],g),iw(y[E],y[I],g),_),m)/255*(this.premultiplied?o:1),this.g=iw(iw(iw(y[x+1],y[v+1],g),iw(y[b+1],y[w+1],g),_),iw(iw(y[T+1],y[S+1],g),iw(y[E+1],y[I+1],g),_),m)/255*(this.premultiplied?o:1),this.b=iw(iw(iw(y[x+2],y[v+2],g),iw(y[b+2],y[w+2],g),_),iw(iw(y[T+2],y[S+2],g),iw(y[E+2],y[I+2],g),_),m)/255*(this.premultiplied?o:1),this.a=o}else this.r=r,this.g=a,this.b=n,this.a=o}toArray(){let{r:i,g:r,b:a,a:n}=this;return[255*i,255*r,255*a,n]}toHslaArray(){let i,{r:r,g:a,b:n,a:o}=this;if(this.premultiplied){if(0===o)return[0,0,0,0];let i=1/o;r*=i,a*=i,n*=i}let s=Math.min(Math.max(r,0),1),l=Math.min(Math.max(a,0),1),h=Math.min(Math.max(n,0),1),u=Math.min(s,l,h),c=Math.max(s,l,h),d=c-u,f=.5*(u+c);if(0===d)return[0,0,100*f,o];switch(c){case s:i=60*((l-h)/d+6*(l<h));break;case l:i=60*((h-s)/d+2);break;default:i=60*((s-l)/d+4)}return[i,100*(f>.5?d/(2-c-u):d/(c+u)),100*f,o]}toArray01(){let{r:i,g:r,b:a,a:n}=this;return[i,r,a,n]}toArray01Scaled(i){let{r:r,g:a,b:n}=this;return[r*i,a*i,n*i]}toArray01Linear(){let{r:i,g:r,b:a,a:n}=this;return[Math.pow(i,2.2),Math.pow(r,2.2),Math.pow(a,2.2),n]}}class iI extends iE{constructor(i,r,a,n,o){super(i,r,a,n,o,!1)}}class iA extends iE{constructor(i,r,a,n,o){super(i,r,a,n,o,!0)}}function iM(i,r,a){return i.map((i,n)=>iw(i,r[n],a))}iS.black=new iS(0,0,0,1),iS.white=new iS(1,1,1,1),iS.transparent=new iS(0,0,0,0),iS.red=new iS(1,0,0,1),iS.blue=new iS(0,0,1,1);var iC=Object.freeze({__proto__:null,array:iM,color:function(i,r,a){return new iS(iw(i.r,r.r,a),iw(i.g,r.g,a),iw(i.b,r.b,a),iw(i.a,r.a,a))},number:iw});class iD extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class iR{constructor(i,r=[]){for(const[a,n]of(this.parent=i,this.bindings={},r))this.bindings[a]=n}concat(i){return new iR(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let iP={kind:"null"},iL={kind:"number"},iz={kind:"string"},iO={kind:"boolean"},iF={kind:"color"},iB={kind:"object"},ik={kind:"value"},iN={kind:"collator"},iU={kind:"formatted"},iV={kind:"resolvedImage"};function ij(i,r){return{kind:"array",itemType:i,N:r}}function iG(i){if("array"===i.kind){let r=iG(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let iH=[iP,iL,iz,iO,iF,iU,iB,ij(ik),iV];function iq(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!iq(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(let i of iH)if(!iq(i,r))return null}}return`Expected ${iG(i)} but found ${iG(r)} instead.`}function i$(i,r){return r.some(r=>r.kind===i.kind)}function iZ(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function iW(i,r){return"array"===i.kind&&"array"===r.kind?i.N===r.N&&iW(i.itemType,r.itemType):i.kind===r.kind}class iX{constructor(i,r,a){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class iY{constructor(i,r,a,n,o){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=a,this.fontStack=n,this.textColor=o}}class iK{constructor(i){this.sections=i}
1static fromString(i){return new iK([new iY(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||!!i.image&&i.image.hasPrimary())}static factory(i){return i instanceof iK?i:iK.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){let i=["format"];for(let r of this.sections){if(r.image){let a=r.image.getPrimary().id.toString();i.push(["image",a]);continue}i.push(r.text);let a={};r.fontStack&&(a["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(a["font-scale"]=r.scale),r.textColor&&(a["text-color"]=["rgba"].concat(r.textColor.toNonPremultipliedRenderColor(null).toArray())),i.push(a)}return i}}class iJ{constructor(i,r={}){this.id=iy.from(i),this.params=r.params,this.sx=r.sx||1,this.sy=r.sy||1}toString(){return JSON.stringify(this)}static parse(i){let r,a,n,o;try{({id:r,params:a,sx:n,sy:o}=JSON.parse(i)||{})}catch(i){return null}return r?new iJ(r,{params:a,sx:n,sy:o}):null}scaleSelf(i,r=i){return this.sx*=i,this.sy*=r,this}}class iQ{constructor(i,r,a,n,o=!1){this.primaryId=iy.from(i),this.primaryOptions=r,a&&(this.secondaryId=iy.from(a)),this.secondaryOptions=n,this.available=o}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new iJ(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new iJ(this.secondaryId,this.secondaryOptions):null}static from(i){return"string"==typeof i?iQ.build({name:i}):i}static build(i,r,a,n){return i&&("object"!=typeof i||"name"in i)?new iQ(i,a,r,n):null}}function i0(i,r,a,n){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof a&&a>=0&&a<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[i,r,a,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[i,r,a,n]:[i,r,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function i1(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof iS||i instanceof iX||i instanceof iK||i instanceof iQ)return!0;if(Array.isArray(i)){for(let r of i)if(!i1(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!i1(i[r]))return!1;return!0}return!1}function i2(i){if(null===i)return iP;if("string"==typeof i)return iz;if("boolean"==typeof i)return iO;if("number"==typeof i)return iL;if(i instanceof iS)return iF;if(i instanceof iX)return iN;if(i instanceof iK)return iU;if(i instanceof iQ)return iV;if(Array.isArray(i)){let r,a=i.length;for(let a of i){let i=i2(a);if(r){if(r===i)continue;r=ik;break}r=i}return ij(r||ik,a)}return iB}function i3(i){return null===i?"":"string"==typeof i||"number"==typeof i||"boolean"==typeof i?String(i):i instanceof iK||i instanceof iQ||i instanceof iS?i.toString():JSON.stringify(i)}class i4{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!i1(i[1]))return r.error("invalid value");let a=i[1],n=i2(a),o=r.expectedType;return"array"===n.kind&&0===n.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(n=o),new i4(n,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof iS?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof iK?this.value.serialize():this.value}}class i5{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let i6={string:iz,number:iL,boolean:iO,object:iB};class i8{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a,n=1,o=i[0];if("array"===o){let o,s;if(i.length>2){let a=i[1];if("string"!=typeof a||!(a in i6)||"object"===a)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=i6[a],n++}else o=ik;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);s=i[2],n++}a=ij(o,s)}else a=i6[o];let s=[];for(;n<i.length;n++){let a=r.parse(i[n],n,ik);if(!a)return null;s.push(a)}return new i8(a,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let a=this.args[r].evaluate(i);if(!iq(this.type,i2(a)))return a;
1if(r===this.args.length-1)throw new i5(`The expression ${JSON.stringify(this.args[r].serialize())} evaluated to ${iG(i2(a))} but was expected to be of type ${iG(this.type)}.`)}return null}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=this.type,r=[i.kind];if("array"===i.kind){let a=i.itemType;if("string"===a.kind||"number"===a.kind||"boolean"===a.kind){r.push(a.kind);let n=i.N;("number"==typeof n||this.args.length>1)&&r.push(n)}}return r.concat(this.args.map(i=>i.serialize()))}}class i9{constructor(i){this.type=iU,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[1];if(!Array.isArray(a)&&"object"==typeof a)return r.error("First argument must be an image or text section.");let n=[],o=!1;for(let a=1;a<=i.length-1;++a){let s=i[a];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let i=null;if(s["font-scale"]&&!(i=r.parseObjectValue(s["font-scale"],a,"font-scale",iL)))return null;let l=null;if(s["text-font"]&&!(l=r.parseObjectValue(s["text-font"],a,"text-font",ij(iz))))return null;let h=null;if(s["text-color"]&&!(h=r.parseObjectValue(s["text-color"],a,"text-color",iF)))return null;let u=n.at(-1);u.scale=i,u.font=l,u.textColor=h}else{let s=r.parse(i[a],a,ik);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new i9(n)}evaluate(i){return new iK(this.sections.map(r=>{let a=r.content.evaluate(i);return iW(i2(a),iV)?new iY("",a,null,null,null):new iY(i3(a),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(let r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){let i=["format"];for(let r of this.sections){i.push(r.content.serialize());let a={};r.scale&&(a["font-scale"]=r.scale.serialize()),r.font&&(a["text-font"]=r.font.serialize()),r.textColor&&(a["text-color"]=r.textColor.serialize()),i.push(a)}return i}}class i7{constructor(i,r,a,n){this._imageWarnHistory={},this.type=iV,this.namePrimary=i,this.nameSecondary=r,a&&(this.paramsPrimary=a.params,this.iconsetIdPrimary=a.iconset?a.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(i,r){if(i.length<2)return r.error("Expected two or more arguments.");let a=1,n=[];for(let o=0;o<2;o++)if(!function(){if(a<i.length){let o=r.parse(i[a],a++,iz);return o?(n.push({image:o,options:{}}),!0):(r.error(n.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}()||!function(){if(a<i.length){let o=i[a];if(null===o||"object"!=typeof o||Array.isArray(o))return!0;let s=o.params,l=o.iconset,h=r.concat(a);if(!s&&!l)return a++,!0;if(s){if("object"!=typeof s||s.constructor!==Object)return h.error('Image options "params" should be an object'),!1;let i={},r=h.concat(void 0,"params");for(let a in s){if(!a)return r.error("Image parameter name should be non-empty"),!1;let n=r.concat(void 0,a).parse(s[a],void 0,iF,void 0,{typeAnnotation:"coerce"});if(!n)return!1;i[a]=n}n.at(-1).options.params=i}if(l){if("object"!=typeof l||l.constructor!==Object)return h.error('Image options "iconset" should be an object'),!1;if(!l.id)return h.error('Image options "iconset" should have an "id" property'),!1;n.at(-1).options.iconset=l}return a++,!0}return!0}())return;return new i7(n[0].image,n[1]?n[1].image:void 0,n[0].options,n[1]?n[1].options:void 0)}evaluateParams(i,r){let a={};if(r){for(let n in r)if(r[n])try{a[n]=r[n].evaluate(i)}catch(i){continue}if(0!==Object.keys(a).length)return{params:a}}}evaluate(i){let r={name:this.namePrimary.evaluate(i),iconsetId:this.iconsetIdPrimary},a=this.nameSecondary?{name:this.nameSecondary.evaluate(i),iconsetId:this.iconsetIdSecondary}:void 0,n=iQ.build(r,a,this.paramsPrimary?this.evaluateParams(i,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(i,this.paramsSecondary):void 0);if(n&&i.availableImages){let r=n.getPrimary().id;if(n.available=i.availableImages.some(i=>iy.isEqual(i,r)),n.available){let r=n.getSecondary()?n.getSecondary().id:null;r&&(n.available=i.availableImages.some(i=>iy.isEqual(i,r)))}}return n}eachChild(i){if(i(this.namePrimary),this.paramsPrimary)for(let r in this.paramsPrimary)this.paramsPrimary[r]&&i(this.paramsPrimary[r]);if(this.nameSecondary&&(i(this.nameSecondary),this.paramsSecondary))for(let r in this.paramsSecondary)this.paramsSecondary[r]&&i(this.paramsSecondary[r])}outputDefined(){return!1}serializeOptions(i,r){let a={};
1if(r&&(a.iconset={id:r}),i)for(let r in a.params={},i)i[r]&&(a.params[r]=i[r].serialize());return Object.keys(a).length>0?a:void 0}serialize(){let i=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let r=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);r&&i.push(r)}if(this.nameSecondary&&(i.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let r=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);r&&i.push(r)}return i}}function re(i){return ri(i)?"string":rr(i)?"number":ra(i)?"boolean":Array.isArray(i)?"array":null===i?"null":rt(i)?"object":typeof i}function rt(i){return null!=i&&!Array.isArray(i)&&"function"!=typeof i&&!(i instanceof String||i instanceof Number||i instanceof Boolean)&&"object"==typeof i}function ri(i){return"string"==typeof i||i instanceof String}function rr(i){return"number"==typeof i||i instanceof Number}function ra(i){return"boolean"==typeof i||i instanceof Boolean}let rn={"to-boolean":iO,"to-color":iF,"to-number":iL,"to-string":iz};class ro{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[0],n=[],o=iP;if("to-array"===a){if(!Array.isArray(i[1]))return null;let a=i[1].length;if(r.expectedType){if("array"!==r.expectedType.kind)return r.error(`Expected ${r.expectedType.kind} but found array.`);o=ij(r.expectedType.itemType,a)}else{if(!(a>0&&i1(i[1][0])))return null;o=ij(i2(i[1][0]),a)}for(let s=0;s<a;s++){let a,l=i[1][s];if(Array.isArray(l))a=r.parse(l,void 0,o.itemType);else{let i=re(l);if(i!==o.itemType.kind)return r.error(`Expected ${o.itemType.kind} but found ${i}.`);a=r.registry.literal.parse(["literal",void 0===l?null:l],r)}if(!a)return null;n.push(a)}}else{if(("to-boolean"===a||"to-string"===a)&&2!==i.length)return r.error("Expected one argument.");o=rn[a];for(let a=1;a<i.length;a++){let o=r.parse(i[a],a,ik);if(!o)return null;n.push(o)}}return new ro(o,n)}evaluate(i){if("boolean"===this.type.kind)return!!this.args[0].evaluate(i);if("color"===this.type.kind){let r,a;for(let n of this.args){if(r=n.evaluate(i),a=null,r instanceof iS)return r;if("string"==typeof r){let a=i.parseColor(r);if(a)return a}else if(Array.isArray(r)&&!(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:i0(r[0],r[1],r[2],r[3])))return new iS(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new i5(a||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let r=null;for(let a of this.args){if(null===(r=a.evaluate(i)))return 0;let n=Number(r);if(!isNaN(n))return n}throw new i5(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?iK.fromString(i3(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?iQ.build(i3(this.args[0].evaluate(i))):"array"===this.type.kind?this.args.map(r=>r.evaluate(i)):i3(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new i9([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new i7(this.args[0]).serialize();let i="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}let rs=["Unknown","Point","LineString","Polygon"];class rl{constructor(i,r,a){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=i,this.options=r,this.iconImageUseTheme=a}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?rs[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(i){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:a,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(a*r-i[0])+this.featureDistanceData.bearing[1]*(n*r-i[1])}return 0}parseColor(i){return iS.parse(i)}getConfig(i){return this.options?this.options.get(i):null}}class rh{constructor(i,r,a,n,o){this.name=i,this.type=r,this._evaluate=a,this.args=n,this._overloadIndex=o}evaluate(i){if(!this._evaluate){let i=rh.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(i,this.args)}
1eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){let a=i[0],n=rh.definitions[a];if(!n)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,l=[],h=null,u=-1;for(let[n,c]of s){if(Array.isArray(n)&&n.length!==i.length-1)continue;l.push(n),u++,null===h?h=new r4(r.registry,r.path,null,r.scope,[],r._scope,r.options,r.iconImageUseTheme):h.errors.length=0;let s=[],d=!1;for(let r=1;r<i.length;r++){let a=i[r],o=Array.isArray(n)?n[r-1]:n.type,l=h.parse(a,1+s.length,o);if(!l){d=!0;break}s.push(l)}if(!d)if(Array.isArray(n)&&n.length!==s.length)h.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let i=0;i<s.length;i++){let r=Array.isArray(n)?n[i]:n.type;h.checkSubtype(r,s[i].type,i+1)}if(0===h.errors.length)return new rh(a,o,c,s,u)}}if(1===l.length)r.errors.push(...h.errors);else{let a=(l.length?l:s.map(([i])=>i)).map(ru).join(" | "),n=[];for(let a=1;a<i.length;a++){let o=r.parse(i[a],1+n.length);if(!o)return null;n.push(iG(o.type))}r.error(`Expected arguments of type ${a}, but found (${n.join(", ")}) instead.`)}return null}static register(i,r){for(let a in rh.definitions=r,r)i[a]=rh}}function ru(i){return Array.isArray(i)?`(${i.map(iG).join(", ")})`:`(${iG(i.type)}...)`}class rc{constructor(i,r,a){this.type=iN,this.locale=a,this.caseSensitive=i,this.diacriticSensitive=r}static parse(i,r){if(2!==i.length)return r.error("Expected one argument."),null;let a=i[1];if("object"!=typeof a||Array.isArray(a))return r.error("Collator options argument must be an object."),null;let n=void 0===a["case-sensitive"]?r.parse(!1,1,iO):r.parseObjectValue(a["case-sensitive"],1,"case-sensitive",iO);if(!n)return null;let o=void 0===a["diacritic-sensitive"]?r.parse(!1,1,iO):r.parseObjectValue(a["diacritic-sensitive"],1,"diacritic-sensitive",iO);if(!o)return null;let s=null;return!a.locale||(s=r.parseObjectValue(a.locale,1,"locale",iz))?new rc(n,o,s):null}evaluate(i){return new iX(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}serialize(){let i={};return i["case-sensitive"]=this.caseSensitive.serialize(),i["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(i.locale=this.locale.serialize()),["collator",i]}}function rd(i){return(180+i)/360}function rf(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function rp(i){return 360*i-180}function rm(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function r_(i,r){for(let a=0;a<i.length;++a)if(!e5(i[a],r))return!1;for(let a=0;a<i.length-1;++a)if(function(i,r,a){for(let n of a)for(let a=0,o=n.length,s=o-1;a<o;s=a++)if(e8(i,r,n[s],n[a]))return!0;return!1}(i[a],i[a+1],r))return!1;return!0}function rg(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=[];for(let n=0;n<i[o].length;n++){let l=function(i,r){let a=rd(i[0]),n=rf(i[1]),o=Math.pow(2,r.z);return[Math.round(a*o*8192),Math.round(n*o*8192)]}(i[o][n],a);e3(r,l),s.push(l)}n.push(s)}return n}function ry(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=rg(i[o],r,a);n.push(s)}return n}function rx(i,r,a,n){if(i[0]<a[0]||i[0]>a[2]){let r=.5*n,o=i[0]-a[0]>r?-n:a[0]-i[0]>r?n:0;0===o&&(o=i[0]-a[2]>r?-n:a[2]-i[0]>r?n:0),i[0]+=o}e3(r,i)}function rv(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];if(!i)return l;for(let n of i)for(let i of n){let n=[i.x+s[0],i.y+s[1]];rx(n,r,a,o),l.push(n)}return l}function rb(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];if(!i)return l;for(let a of i){let i=[];for(let n of a){let a=[n.x+s[0],n.y+s[1]];e3(r,a),i.push(a)}l.push(i)}if(r[2]-r[0]<=o/2)for(let i of(r[0]=r[1]=1/0,r[2]=r[3]=-1/0,l))for(let n of i)rx(n,r,a,o);return l}class rw{constructor(i,r){this.type=iO,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(i1(i[1])){let r=i[1];if("FeatureCollection"===r.type)for(let i=0;i<r.features.length;++i){let a=r.features[i].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new rw(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new rw(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new rw(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(null!=i.geometry()&&null!=i.canonicalID()){if("Point"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rg(r.coordinates,n,o),l=rv(i.geometry(),a,n,o);if(!e4(a,n))return!1;for(let i of l)if(!e5(i,s))return!1}if("MultiPolygon"===r.type){let s=ry(r.coordinates,n,o),l=rv(i.geometry(),a,n,o);if(!e4(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(e5(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries);if("LineString"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rg(r.coordinates,n,o),l=rb(i.geometry(),a,n,o);if(!e4(a,n))return!1;for(let i of l)if(!r_(i,s))return!1}if("MultiPolygon"===r.type){let s=ry(r.coordinates,n,o),l=rb(i.geometry(),a,n,o);if(!e4(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(r_(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let rT={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},rS=1/298.257223563*(2-1/298.257223563),rE=Math.PI/180;class rI{static fromTile(i,r,a){let n=Math.PI*(1-2*(i+.5)/Math.pow(2,r));
1return new rI(Math.atan(.5*(Math.exp(n)-Math.exp(-n)))/rE,a)}static get units(){return rT}constructor(i,r){if(void 0===i)throw Error("No latitude given.");if(r&&!rT[r])throw Error(`Unknown unit ${r}. Use one of: ${Object.keys(rT).join(", ")}`);const a=6378.137*rE*(r?rT[r]:1),n=Math.cos(i*rE),o=1/(1-rS*(1-n*n)),s=Math.sqrt(o);this.kx=a*s*n,this.ky=a*s*o*(1-rS)}distance(i,r){let a=rC(i[0]-r[0])*this.kx,n=(i[1]-r[1])*this.ky;return Math.sqrt(a*a+n*n)}bearing(i,r){return Math.atan2(rC(r[0]-i[0])*this.kx,(r[1]-i[1])*this.ky)/rE}destination(i,r,a){let n=a*rE;return this.offset(i,Math.sin(n)*r,Math.cos(n)*r)}offset(i,r,a){return[i[0]+r/this.kx,i[1]+a/this.ky]}lineDistance(i){let r=0;for(let a=0;a<i.length-1;a++)r+=this.distance(i[a],i[a+1]);return r}area(i){let r=0;for(let a=0;a<i.length;a++){let n=i[a];for(let i=0,o=n.length,s=o-1;i<o;s=i++)r+=rC(n[i][0]-n[s][0])*(n[i][1]+n[s][1])*(a?-1:1)}return Math.abs(r)/2*this.kx*this.ky}along(i,r){let a=0;if(r<=0)return i[0];for(let n=0;n<i.length-1;n++){let o=i[n],s=i[n+1],l=this.distance(o,s);if((a+=l)>r)return rM(o,s,(r-(a-l))/l)}return i[i.length-1]}pointToSegmentDistance(i,r,a){let[n,o]=r,s=rC(a[0]-n)*this.kx,l=(a[1]-o)*this.ky;if(0!==s||0!==l){let r=(rC(i[0]-n)*this.kx*s+(i[1]-o)*this.ky*l)/(s*s+l*l);r>1?(n=a[0],o=a[1]):r>0&&(n+=s/this.kx*r,o+=l/this.ky*r)}return Math.sqrt((s=rC(i[0]-n)*this.kx)*s+(l=(i[1]-o)*this.ky)*l)}pointOnLine(i,r){let a=1/0,n=i[0][0],o=i[0][1],s=0,l=0;for(let h=0;h<i.length-1;h++){let u=i[h][0],c=i[h][1],d=rC(i[h+1][0]-u)*this.kx,f=(i[h+1][1]-c)*this.ky,p=0;0===d&&0===f||((p=(rC(r[0]-u)*this.kx*d+(r[1]-c)*this.ky*f)/(d*d+f*f))>1?(u=i[h+1][0],c=i[h+1][1]):p>0&&(u+=d/this.kx*p,c+=f/this.ky*p));let m=(d=rC(r[0]-u)*this.kx)*d+(f=(r[1]-c)*this.ky)*f;m<a&&(a=m,n=u,o=c,s=h,l=p)}return{point:[n,o],index:s,t:Math.max(0,Math.min(1,l))}}lineSlice(i,r,a){let n=this.pointOnLine(a,i),o=this.pointOnLine(a,r);if(n.index>o.index||n.index===o.index&&n.t>o.t){let i=n;n=o,o=i}let s=[n.point],l=n.index+1,h=o.index;!rA(a[l],s[0])&&l<=h&&s.push(a[l]);for(let i=l+1;i<=h;i++)s.push(a[i]);return rA(a[h],o.point)||s.push(o.point),s}lineSliceAlong(i,r,a){let n=0,o=[];for(let s=0;s<a.length-1;s++){let l=a[s],h=a[s+1],u=this.distance(l,h);if((n+=u)>i&&0===o.length&&o.push(rM(l,h,(i-(n-u))/u)),n>=r)return o.push(rM(l,h,(r-(n-u))/u)),o;n>i&&o.push(h)}return o}bufferPoint(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[0]+n,i[1]+a]}bufferBBox(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[2]+n,i[3]+a]}insideBBox(i,r){return rC(i[0]-r[0])>=0&&0>=rC(i[0]-r[2])&&i[1]>=r[1]&&i[1]<=r[3]}}function rA(i,r){return i[0]===r[0]&&i[1]===r[1]}function rM(i,r,a){let n=rC(r[0]-i[0]);return[i[0]+n*a,i[1]+(r[1]-i[1])*a]}function rC(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}class rD{constructor(i=[],r=(i,r)=>i<r?-1:+(i>r)){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(0===this.length)return;let i=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:r,compare:a}=this,n=r[i];for(;i>0;){let o=i-1>>1,s=r[o];if(a(n,s)>=0)break;r[i]=s,i=o}r[i]=n}_down(i){let{data:r,compare:a}=this,n=this.length>>1,o=r[i];for(;i<n;){let n=1+(i<<1),s=n+1;if(s<this.length&&0>a(r[s],r[n])&&(n=s),a(r[n],o)>=0)break;r[i]=r[n],i=n}r[i]=o}}function rR(i,r){return r.dist-i.dist}function rP(i){let r=[1/0,1/0,-1/0,-1/0];if(r.length!==i.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0}function rL(i){return i[1]-i[0]+1}function rz(i,r){let a=i[1]>=i[0]&&i[1]<r;return a||console.warn("Distance Expression: Index is out of range"),a}function rO(i,r){if(i[0]>i[1])return[null,null];let a=rL(i);if(r){if(2===a)return[i,null];let r=Math.floor(a/2);return[[i[0],i[0]+r],[i[0]+r,i[1]]]}{if(1===a)return[i,null];let r=Math.floor(a/2)-1;return[[i[0],i[0]+r],[i[0]+r+1,i[1]]]}}function rF(i,r){let a=[1/0,1/0,-1/0,-1/0];if(!rz(r,i.length))return a;for(let n=r[0];n<=r[1];++n)e3(a,i[n]);return a}function rB(i){let r=[1/0,1/0,-1/0,-1/0];for(let a=0;a<i.length;++a)for(let n=0;n<i[a].length;++n)e3(r,i[a][n]);return r}function rk(i,r,a){if(rP(i)||rP(r))return NaN;let n=0,o=0;return i[2]<r[0]&&(n=r[0]-i[2]),i[0]>r[2]&&(n=i[0]-r[2]),i[1]>r[3]&&(o=i[1]-r[3]),i[3]<r[1]&&(o=r[1]-i[3]),a.distance([0,0],[n,o])}function rN(i,r,a=8192){let n=Math.pow(2,r.z),o=(i.y/a+r.y)/n;return[rp((i.x/a+r.x)/n),rm(o)]}function rU(i,r,a){let n=a.pointOnLine(r,i).point;return a.distance(i,n)}function rV(i,r,a,n,o){let s=a.slice(n[0],n[1]+1),l=1/0;for(let a=r[0];a<=r[1];++a)if(0===(l=Math.min(l,rU(i[a],s,o))))return 0;return l}function rj(i,r,a,n,o){return Math.min(Math.min(o.pointToSegmentDistance(i,a,n),o.pointToSegmentDistance(r,a,n)),Math.min(o.pointToSegmentDistance(a,i,r),o.pointToSegmentDistance(n,i,r)))}function rG(i,r){for(let a of i)for(let i=0;i<=a.length-1;++i)if(e5(a[i],r,!0))return!0;return!1}function rH(i,r,a,n,o,s,l){if(null===s||null===l)return;let h=rk(rF(n,s),rF(o,l),a);h<r&&i.push({dist:h,range1:s,range2:l})}function rq(i,r,a,n,o,s=1/0){let l=Math.min(s,o.distance(i[0],a[0]));if(0===l)return l;let h=new rD([{dist:0,range1:[0,i.length-1],range2:[0,a.length-1]}],rR),u=r?50:100,c=n?50:100;for(;h.length;){let s=h.pop();if(s.dist>=l)continue;let d=s.range1,f=s.range2;if(rL(d)<=u&&rL(f)<=c){if(!rz(d,i.length)||!rz(f,a.length))return NaN;if(r&&n?l=Math.min(l,function(i,r,a,n,o){if(!rz(r,i.length)||!rz(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<r[1];++l)for(let r=n[0];r<n[1];++r){if(e8(i[l],i[l+1],a[r],a[r+1]))return 0;s=Math.min(s,rj(i[l],i[l+1],a[r],a[r+1],o))}return s}(i,d,a,f,o)):r||n?r&&!n?l=Math.min(l,rV(a,f,i,d,o)):!r&&n&&(l=Math.min(l,rV(i,d,a,f,o))):l=Math.min(l,function(i,r,a,n,o){if(!rz(r,i.length)||!rz(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<=r[1];++l)for(let r=n[0];r<=n[1];++r)if(0===(s=Math.min(s,o.distance(i[l],a[r]))))return s;return s}(i,d,a,f,o)),0===l)break}else{let s=rO(d,r),u=rO(f,n);rH(h,l,o,i,a,s[0],u[0]),rH(h,l,o,i,a,s[0],u[1]),rH(h,l,o,i,a,s[1],u[0]),rH(h,l,o,i,a,s[1],u[1])}}return l}function r$(i,r,a,n,o=1/0){let s=o,l=rF(i,[0,i.length-1]);for(let o of a)if(!(s!==1/0&&rk(l,rF(o,[0,o.length-1]),n)>=s)&&0===(s=Math.min(s,rq(i,r,o,!0,n,s))))break;return s}function rZ(i,r,a,n,o=1/0){let s=o,l=rF(i,[0,i.length-1]);for(let o of a){if(s!==1/0&&rk(l,rB(o),n)>=s)continue;let a=function(i,r,a,n,o=1/0){let s=Math.min(n.distance(i[0],a[0][0]),o);if(0===s)return s;let l=new rD([{dist:0,range1:[0,i.length-1],range2:[0,0]}],rR),h=r?50:100,u=rB(a);for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1;if(rL(c)<=h){if(!rz(c,i.length))return NaN;if(r){if(0===(s=Math.min(s,function(i,r,a,n){if(!rz(r,i.length))return NaN;for(let n=r[0];n<=r[1];++n)if(e5(i[n],a,!0))return 0;let o=1/0;for(let s=r[0];s<r[1];++s)for(let r of a)for(let a=0,l=r.length,h=l-1;a<l;h=a++){if(e8(i[s],i[s+1],r[h],r[a]))return 0;o=Math.min(o,rj(i[s],i[s+1],r[h],r[a],n))}return o}(i,c,a,n))))break}else for(let r=c[0];r<=c[1];++r)if(0===(s=Math.min(s,function(i,r,a){if(e5(i,r,!0))return 0;let n=1/0;for(let o of r){let r=o.length;if(r<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[r-1]&&0===(n=Math.min(n,a.pointToSegmentDistance(i,o[r-1],o[0])))||0===(n=Math.min(n,rU(i,o,a))))break}return n}(i[r],a,n))))return s}else{let a=rO(c,r);if(null!==a[0]){let r=rk(rF(i,a[0]),u,n);r<s&&l.push({dist:r,range1:a[0],range2:[0,0]})}if(null!==a[1]){let r=rk(rF(i,a[1]),u,n);r<s&&l.push({dist:r,range1:a[1],range2:[0,0]})}}}return s}(i,r,o,n,s);if(isNaN(a))return a;
1if(0===(s=Math.min(s,a)))break}return s}function rW(i){return"Point"===i||"MultiPoint"===i||"LineString"===i||"MultiLineString"===i||"Polygon"===i||"MultiPolygon"===i}class rX{constructor(i,r){this.type=iL,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'distance' expression requires either one argument, but found ' ${i.length-1} instead.`);if(i1(i[1])){let r=i[1];if("FeatureCollection"===r.type){for(let i=0;i<r.features.length;++i)if(rW(r.features[i].geometry.type))return new rX(r,r.features[i].geometry)}else if("Feature"===r.type){if(rW(r.geometry.type))return new rX(r,r.geometry)}else if(rW(r.type))return new rX(r,r)}return r.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(i){let r=i.geometry(),a=i.canonicalID();if(null!=r&&null!=a){if("Point"===i.geometryType()){var n=this.geometries;let i=[];for(let n of r)for(let r of n)i.push(rN(r,a));let o=new rI(i[0][1],"meters");return"Point"===n.type||"MultiPoint"===n.type||"LineString"===n.type?rq(i,!1,"Point"===n.type?[n.coordinates]:n.coordinates,"LineString"===n.type,o):"MultiLineString"===n.type?r$(i,!1,n.coordinates,o):"Polygon"===n.type||"MultiPolygon"===n.type?rZ(i,!1,"Polygon"===n.type?[n.coordinates]:n.coordinates,o):null}if("LineString"===i.geometryType())return function(i,r,a){let n=[];for(let a of i){let i=[];for(let n of a)i.push(rN(n,r));n.push(i)}let o=new rI(n[0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return r$("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=r$(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}if("Polygon"===a.type||"MultiPolygon"===a.type){let i=1/0;for(let r=0;r<n.length;r++){let s=rZ(n[r],!0,"Polygon"===a.type?[a.coordinates]:a.coordinates,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return null}(r,a,this.geometries);if("Polygon"===i.geometryType())return function(i,r,a){let n=[];for(let a of e2(i,0)){let i=[];for(let n=0;n<a.length;++n)i.push(function(i,r){let a=[];for(let n=0;n<i.length;++n)a.push(rN(i[n],r));return a}(a[n],r));n.push(i)}let o=new rI(n[0][0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return rZ("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=rZ(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return"Polygon"===a.type||"MultiPolygon"===a.type?function(i,r,a){let n=1/0;for(let o of i)for(let i of r){let r=function(i,r,a,n=1/0){let o=rB(i),s=rB(r);if(n!==1/0&&rk(o,s,a)>=n)return n;if(e4(o,s)){if(rG(i,r))return 0}else if(rG(r,i))return 0;let l=n;for(let n of i)for(let i=0,o=n.length,s=o-1;i<o;s=i++)for(let o of r)for(let r=0,h=o.length,u=h-1;r<h;u=r++){if(e8(n[s],n[i],o[u],o[r]))return 0;l=Math.min(l,rj(n[s],n[i],o[u],o[r],a))}return l}(o,i,a,n);if(isNaN(r))return r;if(0===(n=Math.min(n,r)))return n}return n}("Polygon"===a.type?[a.coordinates]:a.coordinates,n,o):null}(r,a,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requires valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function rY(i){if(i instanceof rh&&("get"===i.name&&1===i.args.length||"feature-state"===i.name||"has"===i.name&&1===i.args.length||"properties"===i.name||"geometry-type"===i.name||"id"===i.name||i.name.startsWith("filter-"))||i instanceof rw||i instanceof rX)return!1;if(i instanceof r2)return i.featureConstant;let r=!0;return i.eachChild(i=>{r&&!rY(i)&&(r=!1)}),r}function rK(i){if(i instanceof rh&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!rK(i)&&(r=!1)}),r}function rJ(i,r){if(i instanceof rh&&r.includes(i.name))return!1;let a=!0;return i.eachChild(i=>{a&&!rJ(i,r)&&(a=!1)}),a}
1function rQ(i,r,a){return[i,r,a].filter(Boolean).join("\x1f")}function r0(i,r){switch(i){case"string":return i3(r);case"number":return+r;case"boolean":return!!r;case"color":return iS.parse(r);case"formatted":return iK.fromString(i3(r));case"resolvedImage":return iQ.build(i3(r))}return r}function r1(i,r,a,n){return void 0!==n&&(i=n*Math.round(i/n)),void 0!==r&&i<r&&(i=r),void 0!==a&&i>a&&(i=a),i}class r2{constructor(i,r,a,n=!1){this.type=i,this.key=r,this.scope=a,this.featureConstant=n}static parse(i,r){let a=r.expectedType;if(null==a&&(a=ik),i.length<2||i.length>3)return r.error("Invalid number of arguments for 'config' expression.");let n=r.parse(i[1],1);if(!(n instanceof i4))return r.error("Key name of 'config' expression must be a string literal.");let o,s=!0,l=i3(n.value);if(i.length>=3){let a=r.parse(i[2],2);if(!(a instanceof i4))return r.error("Scope of 'config' expression must be a string literal.");o=i3(a.value)}if(r.options){let i=rQ(l,o,r._scope),a=r.options.get(i);a&&(s=rY(a.value||a.default))}return new r2(a,l,o,s)}evaluate(i){let r=rQ(this.key,this.scope,i.scope),a=i.getConfig(r);if(!a)return null;let{type:n,value:o,values:s,minValue:l,maxValue:h,stepValue:u}=a,c=a.default.evaluate(i),d=c;if(o){let r=i.scope;i.scope=(r||"").split("\x1f").slice(1).join("\x1f"),d=o.evaluate(i),i.scope=r}return n&&(d=r0(n,d)),void 0===d||void 0===l&&void 0===h&&void 0===u||("number"==typeof d?d=r1(d,l,h,u):Array.isArray(d)&&(d=d.map(i=>"number"==typeof i?r1(i,l,h,u):i))),void 0!==o&&void 0!==d&&s&&!s.includes(d)&&(d=c,n&&(d=r0(n,d))),(n&&n!==this.type||void 0!==d&&!iW(i2(d),this.type))&&(d=r0(this.type.kind,d)),d}eachChild(){}outputDefined(){return!1}serialize(){let i=["config",this.key];return this.scope&&i.concat(this.scope),i}}class r3{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");let a=i[1];return r.scope.has(a)?new r3(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class r4{constructor(i,r=[],a,n=new iR,o=[],s,l,h){this.registry=i,this.path=r,this.scope=n,this.errors=o,this.expectedType=a,this._scope=s,this.options=l,this.iconImageUseTheme=h}get key(){if(void 0===this._key){let i=this.path,r="";for(let a=0;a<i.length;a++){let n=i[a];r+="string"==typeof n?`['${n}']`:`[${n}]`}this._key=r}return this._key}parse(i,r,a,n,o={}){return r||a?this.concat(r,null,a,n)._parse(i,o):this._parse(i,o)}parseObjectValue(i,r,a,n,o,s={}){return this.concat(r,a,n,o)._parse(i,s)}_parse(i,r){function a(i,r,a){return"assert"===a?new i8(r,[i]):"coerce"===a?new ro(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n="string"==typeof i[0]?this.registry[i[0]]:void 0;if(n){let o=n.parse(i,this);if(!o)return null;if(this.expectedType){let i=this.expectedType,n=o.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==n.kind)if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(i,n))return null}else o=a(o,i,r.typeAnnotation||"coerce");else o=a(o,i,r.typeAnnotation||"assert")}if(!(o instanceof i4)&&"resolvedImage"!==o.type.kind&&function i(r){if(r instanceof r3)return i(r.boundExpression);if(r instanceof rh&&"error"===r.name||r instanceof rc||r instanceof rw||r instanceof rX||r instanceof r2)return!1;let a=r instanceof ro||r instanceof i8,n=!0;return r.eachChild(r=>{n=a?n&&i(r):n&&r instanceof i4}),!!n&&rY(r)&&rJ(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"])}(o)){let i=new rl(this._scope,this.options,this.iconImageUseTheme);
1try{o=new i4(o.type,o.evaluate(i))}catch(i){return this.error(i.message),null}}return o}return ro.parse(["to-array",i],this)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,a,n){let o="number"==typeof i?this.path.concat(i):this.path;o="string"==typeof r?o.concat(r):o;let s=n?this.scope.concat(n):this.scope;return new r4(this.registry,o,a||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(i,...r){let a=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new iD(a,i))}checkSubtype(i,r,a){let n=iq(i,r);return n&&this.error(n,..."number"==typeof a?[a]:[]),n}}function r5(i,r){let a=i.length-1,n,o,s=0,l=a,h=0;for(;s<=l;)if(n=i[h=Math.floor((s+l)/2)],o=i[h+1],n<=r){if(h===a||r<o)return h;s=h+1}else{if(!(n>r))throw new i5("Input is not a number.");l=h-1}return 0}class r6{constructor(i,r,a){for(const[n,o]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],a))this.labels.push(n),this.outputs.push(o)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(i[1],1,iL);if(!a)return null;let n=[],o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let a=1;a<i.length;a+=2){let s=1===a?-1/0:i[a],l=i[a+1],h=a,u=a+1;if("number"!=typeof s)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(n.length&&n.at(-1)[0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=r.parse(l,u,o);if(!c)return null;o=o||c.type,n.push([s,c])}return new r6(o,a,n)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;return n>=r[o-1]?a[o-1].evaluate(i):a[r5(r,n)].evaluate(i)}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}let r8=4/29,r9=6/29,r7=6/29*3*(6/29),ae=6/29*(6/29)*(6/29),at=Math.PI/180,ai=180/Math.PI;function ar(i){return i>ae?Math.pow(i,1/3):i/r7+r8}function aa(i){return i>r9?i*i*i:r7*(i-r8)}function an(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ao(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function as(i){let r=ao(i.r),a=ao(i.g),n=ao(i.b),o=ar((.4124564*r+.3575761*a+.1804375*n)/.95047),s=ar((.2126729*r+.7151522*a+.072175*n)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-ar((.0193339*r+.119192*a+.9503041*n)/1.08883)),alpha:i.a}}function al(i){let r=(i.l+16)/116,a=isNaN(i.a)?r:r+i.a/500,n=isNaN(i.b)?r:r-i.b/200;return r=+aa(r),new iS(an(3.2404542*(a=.95047*aa(a))-1.5371385*r-.4985314*(n=1.08883*aa(n))),an(-.969266*a+1.8760108*r+.041556*n),an(.0556434*a-.2040259*r+1.0572252*n),i.alpha)}let ah={forward:as,reverse:al,interpolate:function(i,r,a){return{l:iw(i.l,r.l,a),a:iw(i.a,r.a,a),b:iw(i.b,r.b,a),alpha:iw(i.alpha,r.alpha,a)}}},au={forward:function(i){let{l:r,a:a,b:n}=as(i),o=Math.atan2(n,a)*ai;return{h:o<0?o+360:o,c:Math.sqrt(a*a+n*n),l:r,alpha:i.a}},reverse:function(i){let r=i.h*at,a=i.c;return al({l:i.l,a:Math.cos(r)*a,b:Math.sin(r)*a,alpha:i.alpha})},interpolate:function(i,r,a){var n,o;let s;return{h:(n=i.h,o=r.h,s=o-n,n+a*(s>180||s<-180?s-360*Math.round(s/360):s)),c:iw(i.c,r.c,a),l:iw(i.l,r.l,a),alpha:iw(i.alpha,r.alpha,a)}}};var ac=Object.freeze({__proto__:null,hcl:au,lab:ah});class ad{constructor(i,r,a,n,o){for(const[s,l]of(this.type=i,this.operator=r,this.interpolation=a,this.input=n,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(i,r,a,n){let o=0;if("exponential"===i.name)o=af(r,i.base,a,n);else if("linear"===i.name)o=af(r,1,a,n);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=eK(s[0],s[1],s[2],s[3])(af(r,1,a,n))}return o}static parse(i,r){let[a,n,o,...s]=i;if(!Array.isArray(n)||0===n.length)return r.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){let i=n[1];if("number"!=typeof i)return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:i}}else{if("cubic-bezier"!==n[0])return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);{let i=n.slice(1);if(4!==i.length||i.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:i}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length-1>3&&(i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(o=r.parse(o,2,iL)))return null;let l=[],h=null;"interpolate-hcl"===a||"interpolate-lab"===a?h=iF:r.expectedType&&"value"!==r.expectedType.kind&&(h=r.expectedType);for(let i=0;i<s.length;i+=2){let a=s[i],n=s[i+1],o=i+3,u=i+4;if("number"!=typeof a)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',o);if(l.length&&l.at(-1)[0]>=a)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);let c=r.parse(n,u,h);if(!c)return null;h=h||c.type,l.push([a,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new ad(h,a,n,o,l):r.error(`Type ${iG(h)} is not interpolatable.`)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;if(n>=r[o-1])return a[o-1].evaluate(i);let s=r5(r,n),l=ad.interpolationFactor(this.interpolation,n,r[s],r[s+1]),h=a[s].evaluate(i),u=a[s+1].evaluate(i);return"interpolate"===this.operator?iC[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?au.reverse(au.interpolate(au.forward(h),au.forward(u),l)):ah.reverse(ah.interpolate(ah.forward(h),ah.forward(u),l))}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let r=[this.operator,i,this.input.serialize()];for(let i=0;i<this.labels.length;i++)r.push(this.labels[i],this.outputs[i].serialize());return r}}function af(i,r,a,n){let o=n-a,s=i-a;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}class ap{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expectected at least one argument."),null;let a=null,n=r.expectedType;n&&"value"!==n.kind&&(a=n);let o=[];for(let n of i.slice(1)){let i=r.parse(n,1+o.length,a,void 0,{typeAnnotation:"omit"});if(!i)return null;a=a||i.type,o.push(i)}return new ap(n&&o.some(i=>iq(n,i.type))?ik:a,o)}evaluate(i){let r,a=null,n=0;for(let o of this.args){if(n++,(a=o.evaluate(i))&&a instanceof iQ&&!a.available&&(r||(r=a),a=null,n===this.args.length))return r;if(null!==a)break}return a}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}let am=/[^a-zA-Z0-9_]/;class a_{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let a=[];for(let n=1;n<i.length-1;n+=2){let o=i[n];if("string"!=typeof o)return r.error(`Expected string, but found ${typeof o} instead.`,n);if(am.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=r.parse(i[n+1],n+1);if(!s)return null;a.push([o,s])}let n=r.parse(i.at(-1),i.length-1,r.expectedType,a);return n?new a_(a,n):null}outputDefined(){return this.result.outputDefined()}serialize(){let i=["let"];for(let[r,a]of this.bindings)i.push(r,a.serialize());return i.push(this.result.serialize()),i}}function ag(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function ay(i,r,a,n){return 0===n.compare(r,a)}function ax(i,r,a){let n="=="!==i&&"!="!==i;return class o{constructor(i,r,a){this.type=iO,this.lhs=i,this.rhs=r,this.collator=a,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");let a=i[0],s=r.parse(i[1],1,ik);if(!s)return null;if(!ag(a,s.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${iG(s.type)}'.`);let l=r.parse(i[2],2,ik);if(!l)return null;if(!ag(a,l.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${iG(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${iG(s.type)}' and '${iG(l.type)}'.`);n&&("value"===s.type.kind&&"value"!==l.type.kind?s=new i8(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new i8(s.type,[l])));let h=null;if(4===i.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(h=r.parse(i[3],3,iN)))return null}return new o(s,l,h)}evaluate(o){let s=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let r=i2(s),a=i2(l);if(r.kind!==a.kind||"string"!==r.kind&&"number"!==r.kind)throw new i5(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${r.kind}, ${a.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let i=i2(s),a=i2(l);if("string"!==i.kind||"string"!==a.kind)return r(o,s,l)}return this.collator?a(o,s,l,this.collator.evaluate(o)):r(o,s,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){let r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}let av=ax("==",function(i,r,a){return r===a},ay),ab=ax("!=",function(i,r,a){return r!==a},function(i,r,a,n){return!ay(0,r,a,n)}),aw=ax("<",function(i,r,a){return r<a},function(i,r,a,n){return 0>n.compare(r,a)}),aT=ax(">",function(i,r,a){return r>a},function(i,r,a,n){return n.compare(r,a)>0}),aS=ax("<=",function(i,r,a){return r<=a},function(i,r,a,n){return 0>=n.compare(r,a)});function aE(i){return function(){let r=Math.imul((i=0x6d2b79f5+(i|=0)|0)^i>>>15,1|i);return(((r=r+Math.imul(r^r>>>7,61|r)^r)^r>>>14)>>>0)/0x100000000}}let aI={"==":av,"!=":ab,">":aT,"<":aw,">=":ax(">=",function(i,r,a){return r>=a},function(i,r,a,n){return n.compare(r,a)>=0}),"<=":aS,array:i8,at:class i{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(r,a){if(3!==r.length)return a.error(`Expected 2 arguments, but found ${r.length-1} instead.`);let n=a.parse(r[1],1,iL),o=a.parse(r[2],2,ij(a.expectedType||ik));return n&&o?new i(o.type.itemType,n,o):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new i5("Array index out of bounds: negative index");if(r>=a.length)throw new i5("Array index out of bounds: index exceeds array size");if(r!==Math.floor(r))throw new i5("Array index must be an integer. Use at-interpolated for fractional indices");return a[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}},"at-interpolated":class i{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(r,a){if(3!==r.length)return a.error(`Expected 2 arguments, but found ${r.length-1} instead.`);let n=a.parse(r[1],1,iL),o=a.parse(r[2],2,ij(a.expectedType||ik));return n&&o?new i(o.type.itemType,n,o):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new i5(`Array index out of bounds: ${r} < 0.`);if(r>a.length-1)throw new i5(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r===Math.floor(r))return a[r];let n=Math.floor(r),o=Math.ceil(r),s=a[n],l=a[o];if("number"!=typeof s||"number"!=typeof l)throw new i5(`Cannot interpolate between non-number values at index ${r}.`);return iw(s,l,r-n)}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}},boolean:i8,case:class i{constructor(i,r,a){this.type=i,this.branches=r,this.otherwise=a}static parse(r,a){let n;if(r.length<4)return a.error(`Expected at least 3 arguments, but found only ${r.length-1}.`),null;if(r.length%2!=0)return a.error("Expected an odd number of arguments."),null;a.expectedType&&"value"!==a.expectedType.kind&&(n=a.expectedType);let o=[];for(let i=1;i<r.length-1;i+=2){let s=a.parse(r[i],i,iO);if(!s)return null;let l=a.parse(r[i+1],i+1,n);if(!l)return null;o.push([s,l]),n=n||l.type}let s=a.parse(r.at(-1),r.length-1,n);return s?new i(n,o,s):null}evaluate(i){for(let[r,a]of this.branches)if(r.evaluate(i))return a.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[r,a]of this.branches)i(r),i(a);i(this.otherwise)}outputDefined(){return this.branches.every(([i,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}},coalesce:ap,collator:rc,format:i9,image:i7,in:class i{constructor(i,r){this.type=iO,this.needle=i,this.haystack=r}static parse(r,a){if(3!==r.length)return a.error(`Expected 2 arguments, but found ${r.length-1} instead.`),null;let n=a.parse(r[1],1,ik),o=a.parse(r[2],2,ik);
1return n&&o?i$(n.type,[iO,iz,iL,iP,ik])?new i(n,o):(a.error(`Expected first argument to be of type boolean, string, number or null, but found ${iG(n.type)} instead`),null):null}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(null==a)return!1;if(!iZ(r,["boolean","string","number","null"]))throw new i5(`Expected first argument to be of type boolean, string, number or null, but found ${iG(i2(r))} instead.`);if(!iZ(a,["string","array"]))throw new i5(`Expected second argument to be of type array or string, but found ${iG(i2(a))} instead.`);return a.includes(r)}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}},"index-of":class i{constructor(i,r,a){this.type=iL,this.needle=i,this.haystack=r,this.fromIndex=a}static parse(r,a){if(r.length<=2||r.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`),null;let n=a.parse(r[1],1,ik),o=a.parse(r[2],2,ik);if(!n||!o)return null;if(!i$(n.type,[iO,iz,iL,iP,ik]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${iG(n.type)} instead`),null;if(4===r.length){let s=a.parse(r[3],3,iL);return s?new i(n,o,s):null}return new i(n,o)}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(!iZ(r,["boolean","string","number","null"]))throw new i5(`Expected first argument to be of type boolean, string, number or null, but found ${iG(i2(r))} instead.`);if(!iZ(a,["string","array"]))throw new i5(`Expected second argument to be of type array or string, but found ${iG(i2(a))} instead.`);if(this.fromIndex){let n=this.fromIndex.evaluate(i);return a.indexOf(r,n)}return a.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}},interpolate:ad,"interpolate-hcl":ad,"interpolate-lab":ad,length:class i{constructor(i){this.type=iL,this.input=i}static parse(r,a){if(2!==r.length)return a.error(`Expected 1 argument, but found ${r.length-1} instead.`),null;let n=a.parse(r[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?(a.error(`Expected argument of type string or array, but found ${iG(n.type)} instead.`),null):new i(n):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new i5(`Expected value to be of type string or array, but found ${iG(i2(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}},let:a_,literal:i4,match:class i{constructor(i,r,a,n,o,s){this.inputType=i,this.type=r,this.input=a,this.cases=n,this.outputs=o,this.otherwise=s}static parse(r,a){let n,o;if(r.length<5)return a.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return a.error("Expected an even number of arguments.");a.expectedType&&"value"!==a.expectedType.kind&&(o=a.expectedType);let s={},l=[];for(let i=2;i<r.length-1;i+=2){let h=r[i],u=r[i+1];Array.isArray(h)||(h=[h]);let c=a.concat(i);if(0===h.length)return c.error("Expected at least one branch label.");for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return c.error("Branch labels must be numbers or strings.");if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof i&&Math.floor(i)!==i)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,i2(i)))return null}else n=i2(i);if(void 0!==s[String(i)])return c.error("Branch labels must be unique.");s[String(i)]=l.length}let d=a.parse(u,i,o);if(!d)return null;o=o||d.type,l.push(d)}let h=a.parse(r[1],1,ik);if(!h)return null;let u=a.parse(r.at(-1),r.length-1,o);return u?"value"!==h.type.kind&&a.concat(1).checkSubtype(n,h.type)?null:new i(n,o,h,s,l,u):null}evaluate(i){let r=this.input.evaluate(i);return(iW(i2(r),this.inputType)&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}
1eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),a=[],n={};for(let i of r){let r=n[this.cases[i]];void 0===r?(n[this.cases[i]]=a.length,a.push([this.cases[i],[i]])):a[r][1].push(i)}let o=i=>"number"===this.inputType.kind?Number(i):i;for(let[r,n]of a)i.push(1===n.length?o(n[0]):n.map(o)),i.push(this.outputs[r].serialize());return i.push(this.otherwise.serialize()),i}},number:i8,"number-format":class i{constructor(i,r,a,n,o,s){this.type=iz,this.number=i,this.locale=r,this.currency=a,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(r,a){if(3!==r.length)return a.error("Expected two arguments.");let n=a.parse(r[1],1,iL);if(!n)return null;let o=r[2];if("object"!=typeof o||Array.isArray(o))return a.error("NumberFormat options argument must be an object.");let s=null;if(o.locale&&!(s=a.parseObjectValue(o.locale,2,"locale",iz)))return null;let l=null;if(o.currency&&!(l=a.parseObjectValue(o.currency,2,"currency",iz)))return null;let h=null;if(o.unit&&!(h=a.parseObjectValue(o.unit,2,"unit",iz)))return null;let u=null;if(o["min-fraction-digits"]&&!(u=a.parseObjectValue(o["min-fraction-digits"],2,"min-fraction-digits",iL)))return null;let c=null;return!o["max-fraction-digits"]||(c=a.parseObjectValue(o["max-fraction-digits"],2,"max-fraction-digits",iL))?new i(n,s,l,h,u,c):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(i):void 0,unit:this.unit?this.unit.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.unit&&i(this.unit),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.unit&&(i.unit=this.unit.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}},object:i8,slice:class i{constructor(i,r,a,n){this.type=i,this.input=r,this.beginIndex=a,this.endIndex=n}static parse(r,a){if(r.length<=2||r.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`),null;let n=a.parse(r[1],1,ik),o=a.parse(r[2],2,iL);if(!n||!o)return null;if(!i$(n.type,[ij(ik),iz,ik]))return a.error(`Expected first argument to be of type array or string, but found ${iG(n.type)} instead`),null;if(4===r.length){let s=a.parse(r[3],3,iL);return s?new i(n.type,n,o,s):null}return new i(n.type,n,o)}evaluate(i){let r=this.input.evaluate(i),a=this.beginIndex.evaluate(i);if(!iZ(r,["string","array"]))throw new i5(`Expected first argument to be of type array or string, but found ${iG(i2(r))} instead.`);if(this.endIndex){let n=this.endIndex.evaluate(i);return r.slice(a,n)}return r.slice(a)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}},step:r6,string:i8,"to-boolean":ro,"to-color":ro,"to-number":ro,"to-string":ro,var:r3,within:rw,distance:rX,config:r2,split:class i{constructor(i,r){this.type=ij(iz),this.str=i,this.delimiter=r}static parse(r,a){if(3!==r.length)return a.error(`Expected 2 arguments, but found ${r.length-1} instead.`);let n=a.parse(r[1],1,iz),o=a.parse(r[2],2,iz);return n&&o?new i(n,o):void 0}evaluate(i){let r=this.str.evaluate(i),a=this.delimiter.evaluate(i);return r.split(a)}eachChild(i){i(this.str),i(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}};function aA(i,[r,a,n,o]){r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let s=o?o.evaluate(i):1,l=i0(r,a,n,s);if(l)throw new i5(l);return new iS(r/255,a/255,n/255,s)}function aM(i,[r,a,n,o]){var s,l,h;r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let u=o?o.evaluate(i):1,c=(s=r,l=a,h=n,"number"==typeof s&&s>=0&&s<=360?"number"==typeof l&&l>=0&&l<=100&&"number"==typeof h&&h>=0&&h<=100?void 0===u||"number"==typeof u&&u>=0&&u<=1?null:`Invalid hsla value [${[s,l,h,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 'h' must be between 0 and 360.`);if(c)throw new i5(c);let d=`hsla(${r}, ${a}%, ${n}%, ${u})`,f=iS.parse(d);if(!f)throw new i5(`Failed to parse HSLA color: ${d}`);return f}function aC(i,r){let a=r[i];return void 0===a?null:a}function aD(i){return{type:i}}
vendor: 6,483 bytes, line 1
1function aR(i){if(i instanceof r2)return new Set([i.key]);let r=new Set;return i.eachChild(i=>{r=new Set([...r,...aR(i)])}),r}function aP(i){if(i instanceof rh&&"is-active-floor"===i.name)return!0;let r=!1;return i.eachChild(i=>{!r&&aP(i)&&(r=!0)}),r}function aL(i){return{result:"success",value:i}}function az(i){return{result:"error",value:i}}function aO(i,r){return!!i&&!!i.parameters&&i.parameters.includes(r)}function aF(i){return"data-driven"===i["property-type"]}function aB(i){return aO(i.expression,"measure-light")}function ak(i){return aO(i.expression,"zoom")}function aN(i){return!!i.expression&&i.expression.interpolated}function aU(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function aV(i){return i}function aj(i,r,a){return void 0!==i?i:void 0!==r?r:void 0!==a?a:void 0}function aG(i,r,a,n,o){return aj(typeof a===o?n[a]:void 0,i.default,r.default)}function aH(i,r,a){if(!rr(a))return aj(i.default,r.default);let n=i.stops.length;if(1===n||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[n-1][0])return i.stops[n-1][1];let o=r5(i.stops.map(i=>i[0]),a);return i.stops[o][1]}function aq(i,r,a){var n;let o,s,l=void 0!==i.base?i.base:1;if(!rr(a))return aj(i.default,r.default);let h=i.stops.length;if(1===h||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[h-1][0])return i.stops[h-1][1];let u=r5(i.stops.map(i=>i[0]),a),c=(n=i.stops[u][0],o=i.stops[u+1][0]-n,s=a-n,0===o?0:1===l?s/o:(Math.pow(l,s)-1)/(Math.pow(l,o)-1)),d=i.stops[u][1],f=i.stops[u+1][1],p=iC[r.type]||aV;if(i.colorSpace&&"rgb"!==i.colorSpace){let r=ac[i.colorSpace];p=(i,a)=>r.reverse(r.interpolate(r.forward(i),r.forward(a),c))}return"function"==typeof d.evaluate?{evaluate(...i){let r=d.evaluate.apply(void 0,i),a=f.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==a)return p(r,a,c)}}:p(d,f,c)}function a$(i,r,a){return"color"===r.type?a=iS.parse(a):"formatted"===r.type?a=iK.fromString(a.toString()):"resolvedImage"===r.type?a=iQ.build(a.toString()):re(a)===r.type||"enum"===r.type&&r.values[a]||(a=void 0),aj(a,i.default,r.default)}rh.register(aI,{error:[{kind:"error"},[iz],(i,[r])=>{throw new i5(r.evaluate(i))}],typeof:[iz,[ik],(i,[r])=>iG(i2(r.evaluate(i)))],"to-rgba":[ij(iL,4),[iF],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[ij(iL,4),[iF],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[iF,[iL,iL,iL],aA],rgba:[iF,[iL,iL,iL,iL],aA],hsl:[iF,[iL,iL,iL],aM],hsla:[iF,[iL,iL,iL,iL],aM],has:{type:iO,overloads:[[[iz],(i,[r])=>r.evaluate(i)in i.properties()],[[iz,iB],(i,[r,a])=>r.evaluate(i)in a.evaluate(i)]]},get:{type:ik,overloads:[[[iz],(i,[r])=>aC(r.evaluate(i),i.properties())],[[iz,iB],(i,[r,a])=>aC(r.evaluate(i),a.evaluate(i))]]},"feature-state":[ik,[iz],(i,[r])=>aC(r.evaluate(i),i.featureState||{})],properties:[iB,[],i=>i.properties()],"geometry-type":[iz,[],i=>i.geometryType()],worldview:[iz,[],i=>i.globals.worldview||""],"is-active-floor":[iO,aD(iz),(i,r)=>{if(!(i.globals&&i.globals.activeFloors&&i.globals.activeFloors.size>0))return!1;if(0===r.length)return!0;let a=i.globals.activeFloors;return r.some(r=>{let n=r.evaluate(i);return a.has(n)})}],id:[ik,[],i=>i.id()],zoom:[iL,[],i=>i.globals.zoom],pitch:[iL,[],i=>i.globals.pitch||0],"distance-from-center":[iL,[],i=>i.distanceFromCenter()],"measure-light":[iL,[iz],(i,[r])=>i.measureLight(r.evaluate(i))],"heatmap-density":[iL,[],i=>i.globals.heatmapDensity||0],"line-progress":[iL,[],i=>i.globals.lineProgress||0],"raster-value":[iL,[],i=>i.globals.rasterValue||0],"raster-particle-speed":[iL,[],i=>i.globals.rasterParticleSpeed||0],"sky-radial-progress":[iL,[],i=>i.globals.skyRadialProgress||0],accumulated:[ik,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[iL,aD(iL),(i,r)=>{let a=0;for(let n of r)a+=n.evaluate(i);return a}],"*":[iL,aD(iL),(i,r)=>{let a=1;for(let n of r)a*=n.evaluate(i);return a}],"-":{type:iL,overloads:[[[iL,iL],(i,[r,a])=>r.evaluate(i)-a.evaluate(i)],[[iL],(i,[r])=>-r.evaluate(i)]]},"/":[iL,[iL,iL],(i,[r,a])=>r.evaluate(i)/a.evaluate(i)],"%":[iL,[iL,iL],(i,[r,a])=>r.evaluate(i)%a.evaluate(i)],ln2:[iL,[],()=>Math.LN2],pi:[iL,[],()=>Math.PI],e:[iL,[],()=>Math.E],"^":[iL,[iL,iL],(i,[r,a])=>Math.pow(r.evaluate(i),a.evaluate(i))],sqrt:[iL,[iL],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[iL,[iL],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[iL,[iL],(i,[r])=>Math.log(r.evaluate(i))],log2:[iL,[iL],(i,[r])=>Math.log2(r.evaluate(i))],sin:[iL,[iL],(i,[r])=>Math.sin(r.evaluate(i))],cos:[iL,[iL],(i,[r])=>Math.cos(r.evaluate(i))],tan:[iL,[iL],(i,[r])=>Math.tan(r.evaluate(i))],asin:[iL,[iL],(i,[r])=>Math.asin(r.evaluate(i))],acos:[iL,[iL],(i,[r])=>Math.acos(r.evaluate(i))],atan:[iL,[iL],(i,[r])=>Math.atan(r.evaluate(i))],min:[iL,aD(iL),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[iL,aD(iL),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[iL,[iL],(i,[r])=>Math.abs(r.evaluate(i))],round:[iL,[iL],(i,[r])=>{let a=r.evaluate(i);return a<0?-Math.round(-a):Math.round(a)}],floor:[iL,[iL],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[iL,[iL],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[iO,[iz,ik],(i,[r,a])=>i.properties()[r.value]===a.value],"filter-id-==":[iO,[ik],(i,[r])=>i.id()===r.value],"filter-type-==":[iO,[iz],(i,[r])=>i.geometryType()===r.value],"filter-<":[iO,[iz,ik],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<o}],"filter-id-<":[iO,[ik],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<n}],"filter->":[iO,[iz,ik],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>o}],"filter-id->":[iO,[ik],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>n}],"filter-<=":[iO,[iz,ik],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[iO,[ik],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<=n}],"filter->=":[iO,[iz,ik],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[iO,[ik],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>=n}],"filter-has":[iO,[ik],(i,[r])=>r.value in i.properties()],"filter-has-id":[iO,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[iO,[ij(iz)],(i,[r])=>r.value.includes(i.geometryType())],"filter-id-in":[iO,[ij(ik)],(i,[r])=>r.value.includes(i.id())],"filter-in-small":[iO,[iz,ij(ik)],(i,[r,a])=>a.value.includes(i.properties()[r.value])],"filter-in-large":[iO,[iz,ij(ik)],(i,[r,a])=>(function(i,r,a,n){for(;a<=n;){let o=a+n>>1;
1if(r[o]===i)return!0;r[o]>i?n=o-1:a=o+1}return!1})(i.properties()[r.value],a.value,0,a.value.length-1)],all:{type:iO,overloads:[[[iO,iO],(i,[r,a])=>r.evaluate(i)&&a.evaluate(i)],[aD(iO),(i,r)=>{for(let a of r)if(!a.evaluate(i))return!1;return!0}]]},any:{type:iO,overloads:[[[iO,iO],(i,[r,a])=>r.evaluate(i)||a.evaluate(i)],[aD(iO),(i,r)=>{for(let a of r)if(a.evaluate(i))return!0;return!1}]]},"!":[iO,[iO],(i,[r])=>!r.evaluate(i)],"is-supported-script":[iO,[iz],(i,[r])=>{let a=i.globals&&i.globals.isSupportedScript;return!a||a(r.evaluate(i))}],upcase:[iz,[iz],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[iz,[iz],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[iz,aD(ik),(i,r)=>r.map(r=>i3(r.evaluate(i))).join("")],"resolved-locale":[iz,[iN],(i,[r])=>r.evaluate(i).resolvedLocale()],random:[iL,[iL,iL,ik],(i,r)=>{let a,[n,o,s]=r.map(r=>r.evaluate(i));if(n>o||n===o)return n;if("string"==typeof s)a=function(i){let r=0;if(0===i.length)return r;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}(s);else{if("number"!=typeof s)throw new i5(`Invalid seed input: ${s}`);a=s}return n+aE(a)()*(o-n)}]});class aZ{constructor(i,r,a,n,o){this.expression=i,this._warningHistory={},this._scope=a,this._options=n,this._iconImageUseTheme=o,this._evaluator=new rl(a,n,o),this._defaultValue=r?function(i){return"color"===i.type&&(aU(i.default)||Array.isArray(i.default))?new iS(0,0,0,0):"color"===i.type?iS.parse(i.default)||null:void 0===i.default?null:i.default}(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this.configDependencies=aR(i),this.isIndoorDependent=aP(i)}evaluateWithoutErrorHandling(i,r,a,n,o,s,l,h){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,a,n,o,s,l,h,u){this._evaluator||(this._evaluator=new rl(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this._evaluator.iconImageUseTheme=u||null;try{let i=this.expression.evaluate(this._evaluator);if(null==i||"number"==typeof i&&i!=i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new i5(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(i)} instead.`);return i}catch(i){return this._warningHistory[i.message]||(this._warningHistory[i.message]=!0,"u">typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${i.message}`)),this._defaultValue}}}function aW(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in aI}function aX(i,r,a,n,o){let s,l=new r4(aI,[],r?(s={color:iF,string:iz,number:iL,enum:iz,boolean:iO,formatted:iU,resolvedImage:iV},"array"===r.type?ij(s[r.value]||ik,r.length):s[r.type]):void 0,void 0,void 0,a,n,o),h=l.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return h?aL(new aZ(h,r,a,n,o)):az(l.errors)}class aY{constructor(i,r,a,n){this.kind=i,this._styleExpression=r,this.isLightConstant=a,this.isLineProgressConstant=n,this.isStateDependent="constant"!==i&&!rK(r.expression),this.configDependencies=aR(r.expression),this.isIndoorDependent=aP(r.expression)}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s,l){return this._styleExpression.evaluate(i,r,a,n,o,s,void 0,void 0,l)}}class aK{constructor(i,r,a,n,o,s){this.kind=i,this.zoomStops=a,this._styleExpression=r,this.isStateDependent="camera"!==i&&!rK(r.expression),this.isIndoorDependent=aP(r.expression),this.isLightConstant=o,this.isLineProgressConstant=s,this.configDependencies=aR(r.expression),this.interpolationType=n}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s){return this._styleExpression.evaluate(i,r,a,n,o,s)}interpolationFactor(i,r,a){return this.interpolationType?ad.interpolationFactor(this.interpolationType,i,r,a):0}}function aJ(i,r,a,n,o){if("error"===(i=aX(i,r,a,n,o)).result)return i;let s=i.value.expression,l=rY(s);if(!l&&!aF(r))return az([new iD("","data expressions not supported")]);let h=rJ(s,["zoom","pitch","distance-from-center"]);if(!h&&!ak(r))return az([new iD("","zoom expressions not supported")]);let u=rJ(s,["measure-light"]);if(!u&&!aB(r))return az([new iD("","measure-light expression not supported")]);let c=rJ(s,["line-progress"]);if(!c&&!aO(r.expression,"line-progress"))return az([new iD("","line-progress expression not supported")]);let d=r.expression&&r.expression.relaxZoomRestriction,f=function i(r){let a=null;if(r instanceof a_)a=i(r.result);else if(r instanceof ap){for(let n of r.args)if(a=i(n))break}else(r instanceof r6||r instanceof ad)&&r.input instanceof rh&&"zoom"===r.input.name&&(a=r);return a instanceof iD||r.eachChild(r=>{let n=i(r);n instanceof iD?a=n:a&&n&&a!==n&&(a=new iD("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}(s);return f||h||d?f instanceof iD?az([f]):f instanceof ad&&!aN(r)?az([new iD("",'"interpolate" expressions cannot be used with this property')]):aL(f?new aK(l&&c?"camera":"composite",i.value,f.labels,f instanceof ad?f.interpolation:void 0,u,c):new aY(l&&c?"constant":"source",i.value,u,c)):az([new iD("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class aQ{constructor(i,r){this._parameters=i,this._specification=r,Object.assign(this,function i(r,a){let n,o,s,l="color"===a.type,h=r.stops&&"object"==typeof r.stops[0][0],u=h||
1!(h||void 0!==r.property),c=r.type||(aN(a)?"exponential":"interval");if(l&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],iS.parse(i[1])])),r.default=iS.parse(r.default?r.default:a.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!ac[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)n=aq;else if("interval"===c)n=aH;else if("categorical"===c){for(let i of(n=aG,o=Object.create(null),r.stops))o[i[0]]=i[1];s=typeof r.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);n=a$}if(h){let n={},o=[];for(let i=0;i<r.stops.length;i++){let a=r.stops[i],s=a[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:r.type,property:r.property,default:r.default,stops:[]},o.push(s)),n[s].stops.push([a[0].value,a[1]])}let s=[];for(let r of o)s.push([n[r].zoom,i(n[r],a)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:ad.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},n)=>aq({stops:s,base:r.base},a,i).evaluate(i,n)}}if(u){let i="exponential"===c?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ad.interpolationFactor.bind(void 0,i),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>n(r,a,i,o,s)}}return{kind:"source",evaluate(i,l){let h=l&&l.properties?l.properties[r.property]:void 0;return void 0===h?aj(r.default,a.default):n(r,a,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new aQ(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}class a0{constructor(i,r,a){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,i instanceof ArrayBuffer){const r=new Int32Array(i);this.width=r[0],this.height=r[1],this.xCellCount=r[2],this.yCellCount=r[3],this.boxUid=r[4],this.circleUid=r[5];const a=this.xCellCount*this.yCellCount,n=[];for(let i=0;i<a;i++){const a=r[6+i],o=r[6+i+1];n.push(a===o?null:r.subarray(a,o))}const o=r[6+a],s=[];for(let i=0;i<a;i++){const a=r[o+i],n=r[o+i+1];s.push(a===n?null:r.subarray(a,n))}let l=r[o+a];this.boxCells=n,this.circleCells=s,this.boxKeys=r.subarray(l,l+this.boxUid),l+=this.boxUid,this.circleKeys=r.subarray(l,l+this.circleUid),l+=this.circleUid,this.bboxes=r.subarray(l,l+4*this.boxUid),l+=4*this.boxUid,this.circles=r.subarray(l,l+3*this.circleUid)}else{this.width=i,this.height=r,this.xCellCount=Math.ceil(i/a),this.yCellCount=Math.ceil(r/a);const n=this.xCellCount*this.yCellCount,o=[],s=[];for(let i=0;i<n;i++)o.push([]),s.push([]);this.boxCells=o,this.circleCells=s,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}clear(){for(let i of this.boxCells)i&&(i.length=0);for(let i of this.circleCells)i&&(i.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(i,r,a,n,o){let s=this.boxUid++,l=this._xCell(r),h=this._yCell(a),u=this._xCell(n),c=this._yCell(o);for(let i=l;i<=u;i++)for(let r=h;r<=c;r++)this.boxCells[this.xCellCount*r+i].push(s);this.boxKeys.push(i),this.bboxes.push(r,a,n,o)}insertCircle(i,r,a,n){let o=this.circleUid++,s=this._xCell(r-n),l=this._yCell(a-n),h=this._xCell(r+n),u=this._yCell(a+n);for(let i=s;i<=h;i++)for(let r=l;r<=u;r++)this.circleCells[this.xCellCount*r+i].push(o);this.circleKeys.push(i),this.circles.push(r,a,n)}query(i,r,a,n,o){let s=[];if(a<0||i>this.width||n<0||r>this.height)return s;let l=this._nextGen(),{boxCells:h,circleCells:u,boxKeys:c,circleKeys:d,bboxes:f,circles:p,boxSeen:m,circleSeen:_,xCellCount:g}=this,y=this._xCell(i),x=this._yCell(r),v=this._xCell(a),b=this._yCell(n);for(let w=y;w<=v;w++)for(let y=x;y<=b;y++){let x=g*y+w,v=h[x];if(v)for(let h=0;h<v.length;h++){let u=v[h];if(m[u]===l)continue;m[u]=l;let d=4*u,p=f[d],_=f[d+1],g=f[d+2],y=f[d+3];i<=g&&r<=y&&a>=p&&n>=_&&(!o||o(c[u]))&&s.push({key:c[u],x1:p,y1:_,x2:g,y2:y})}let b=u[x];if(b)for(let h=0;h<b.length;h++){let u=b[h];if(_[u]===l)continue;_[u]=l;let c=3*u,f=p[c],m=p[c+1],g=p[c+2];this._circleAndRectCollide(f,m,g,i,r,a,n)&&(!o||o(d[u]))&&s.push({key:d[u],x1:f-g,y1:m-g,x2:f+g,y2:m+g})}}return s}queryKeys(i,r,a,n,o){let s=[];if(a<0||i>this.width||n<0||r>this.height)return s;let l=this._nextGen(),{boxCells:h,boxKeys:u,bboxes:c,boxSeen:d,xCellCount:f,xScale:p,yScale:m}=this,_=this._xCell(i),g=this._yCell(r),y=this._xCell(a),x=this._yCell(n);for(let v=_;v<=y;v++)for(let _=g;_<=x;_++){if(o&&!o(v/p,_/m,(v+1)/p,(_+1)/m))continue;let g=h[f*_+v];if(g)for(let h=0;h<g.length;h++){let f=g[h];if(d[f]===l)continue;d[f]=l;let p=4*f,m=c[p],_=c[p+1],y=c[p+2],x=c[p+3];(o?o(m,_,y,x):i<=y&&r<=x&&a>=m&&n>=_)&&s.push(u[f])}}return s}
1hitTest(i,r,a,n,o){if(a<0||i>this.width||n<0||r>this.height)return!1;let s=this._nextGen(),{boxCells:l,circleCells:h,boxKeys:u,circleKeys:c,bboxes:d,circles:f,boxSeen:p,circleSeen:m,xCellCount:_}=this,g=this._xCell(i),y=this._yCell(r),x=this._xCell(a),v=this._yCell(n);for(let b=g;b<=x;b++)for(let g=y;g<=v;g++){let y=_*g+b,x=l[y];if(x)for(let l=0;l<x.length;l++){let h=x[l];if(p[h]===s)continue;p[h]=s;let c=4*h;if(i<=d[c+2]&&r<=d[c+3]&&a>=d[c]&&n>=d[c+1]&&(!o||o(u[h])))return!0}let v=h[y];if(v)for(let l=0;l<v.length;l++){let h=v[l];if(m[h]===s)continue;m[h]=s;let u=3*h;if(this._circleAndRectCollide(f[u],f[u+1],f[u+2],i,r,a,n)&&(!o||o(c[h])))return!0}}return!1}hitTestCircle(i,r,a,n){let o=i-a,s=r-a,l=i+a,h=r+a;if(l<0||o>this.width||h<0||s>this.height)return!1;let u=this._nextGen(),{boxCells:c,circleCells:d,boxKeys:f,circleKeys:p,bboxes:m,circles:_,boxSeen:g,circleSeen:y,xCellCount:x}=this,v=this._xCell(o),b=this._yCell(s),w=this._xCell(l),T=this._yCell(h);for(let o=v;o<=w;o++)for(let s=b;s<=T;s++){let l=x*s+o,h=c[l];if(h)for(let o=0;o<h.length;o++){let s=h[o];if(g[s]===u)continue;g[s]=u;let l=4*s;if(this._circleAndRectCollide(i,r,a,m[l],m[l+1],m[l+2],m[l+3])&&(!n||n(f[s])))return!0}let v=d[l];if(v)for(let o=0;o<v.length;o++){let s=v[o];if(y[s]===u)continue;y[s]=u;let l=3*s;if(this._circlesCollide(_[l],_[l+1],_[l+2],i,r,a)&&(!n||n(p[s])))return!0}}return!1}static serialize(i,r){let a=i.toArrayBuffer();return r&&r.add(a),{buffer:a}}static deserialize(i){return new a0(i.buffer)}toArrayBuffer(){let i=this.xCellCount*this.yCellCount,r=0,a=0;for(let n=0;n<i;n++)r+=this.boxCells[n].length,a+=this.circleCells[n].length;let n=new Int32Array(6+(i+1)+r+(i+1)+a+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);n[0]=this.width,n[1]=this.height,n[2]=this.xCellCount,n[3]=this.yCellCount,n[4]=this.boxUid,n[5]=this.circleUid;let o=6+(i+1);for(let r=0;r<i;r++){n[6+r]=o;let i=this.boxCells[r];n.set(i,o),o+=i.length}n[6+i]=o;let s=o;o+=i+1;for(let r=0;r<i;r++){n[s+r]=o;let i=this.circleCells[r];n.set(i,o),o+=i.length}return n[s+i]=o,n.set(this.boxKeys,o),o+=this.boxUid,n.set(this.circleKeys,o),o+=this.circleUid,n.set(this.bboxes,o),o+=4*this.boxUid,n.set(this.circles,o),n.buffer}_xCell(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_yCell(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,0===this.generation&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(i,r,a,n,o,s){let l=n-i,h=o-r,u=a+s;return u*u>l*l+h*h}_circleAndRectCollide(i,r,a,n,o,s,l){let h=(s-n)/2,u=Math.abs(i-(n+h));if(u>h+a)return!1;let c=(l-o)/2,d=Math.abs(r-(o+c));if(d>c+a)return!1;if(u<=h||d<=c)return!0;let f=u-h,p=d-c;return f*f+p*p<=a*a}}let a1={};function a2(i,r,a={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writable:!1}),a1[r]={klass:i,omit:a.omit||[]}}for(let i in a2(Object,"Object"),a2(a0,"Grid"),delete eJ.prototype.constructor,a2(iS,"Color"),a2(Error,"Error"),a2(iK,"Formatted"),a2(iY,"FormattedSection"),a2(it,"AJAXError"),a2(iQ,"ResolvedImage"),a2(aQ,"StylePropertyFunction"),a2(aZ,"StyleExpression",{omit:["_evaluator"]}),a2(iy,"ImageId"),a2(iJ,"ImageVariant"),a2(aK,"ZoomDependentExpression"),a2(aY,"ZoomConstantExpression"),a2(rh,"CompoundExpression",{omit:["_evaluate"]}),aI)a1[aI[i]._classRegistryKey]||a2(aI[i],`Expression${i}`);function a3(i){return i&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}function a4(i,r){if(null===i)return null;let a=typeof i;if("object"!==a)return"bigint"===a?{$name:"BigInt",value:i.toString()}:i;if(Array.isArray(i)){let a=i.length,n=[];n.length=a;for(let o=0;o<a;o++)n[o]=a4(i[o],r);return n}if(ArrayBuffer.isView(i))return r&&r.add(i.buffer),i;if(a3(i)||i instanceof ImageBitmap)return r&&r.add(i),i;if(i instanceof ImageData)return r&&r.add(i.data.buffer),i;if(i instanceof Map){let a={$name:"Map",entries:[]};
1for(let[n,o]of i.entries())a.entries.push(a4(n),a4(o,r));return a}if(i instanceof Set){let r={$name:"Set"},a=0;for(let n of i.values())r[++a]=a4(n);return r}if(i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;let n=i.constructor||Object,o=n._classRegistryKey;if(!o)throw Error(`Can't serialize object of unregistered class "${n.name}".`);let s=n.serialize?n.serialize(i,r):{};if(!n.serialize){let a=a1[o].omit;for(let n in i)Object.hasOwn(i,n)&&(a.includes(n)||(s[n]=a4(i[n],r)));i instanceof Error&&(s.message=i.message)}if(s.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==o&&(s.$name=o),s}function a5(i){if(null===i||"object"!=typeof i)return i;if(Array.isArray(i)){for(let r=0;r<i.length;r++)i[r]=a5(i[r]);return i}if(ArrayBuffer.isView(i)||a3(i)||i instanceof ImageBitmap||i instanceof ImageData||i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;let r=i.$name||"Object";if("Map"===r){let r=i.entries||[],a=new Map;for(let i=0;i<r.length;i+=2)a.set(a5(r[i]),a5(r[i+1]));return a}if("Set"===r){let r=new Set;for(let a in i)"$name"!==a&&r.add(a5(i[a]));return r}if("BigInt"===r)return BigInt(i.value);let{klass:a}=a1[r];if(!a)throw Error(`Can't deserialize unregistered class "${r}".`);if(a.deserialize)return a.deserialize(i);let n=Object.create(a.prototype);for(let r in i)"$name"!==r&&(n[r]=a5(i[r]));return n}let a6=i=>i>=1536&&i<=1791,a8=i=>i>=1872&&i<=1919,a9=i=>i>=2208&&i<=2303,a7=i=>i>=11904&&i<=12031,ne=i=>i>=12032&&i<=12255,nt=i=>i>=12272&&i<=12287,ni=i=>i>=12288&&i<=12351,nr=i=>i>=12352&&i<=12447,na=i=>i>=12448&&i<=12543,nn=i=>i>=12544&&i<=12591,no=i=>i>=12704&&i<=12735,ns=i=>i>=12736&&i<=12783,nl=i=>i>=12784&&i<=12799,nh=i=>i>=12800&&i<=13055,nu=i=>i>=13056&&i<=13311,nc=i=>i>=13312&&i<=19903,nd=i=>i>=19968&&i<=40959,nf=i=>i>=40960&&i<=42127,np=i=>i>=42128&&i<=42191,nm=i=>i>=44032&&i<=55215,n_=i=>i>=63744&&i<=64255,ng=i=>i>=64336&&i<=65023,ny=i=>i>=65040&&i<=65055,nx=i=>i>=65072&&i<=65103,nv=i=>i>=65104&&i<=65135,nb=i=>i>=65136&&i<=65279,nw=i=>i>=65280&&i<=65519;function nT(i){for(let r of i)if(nS(r.charCodeAt(0)))return!0;return!1}function nS(i){return!(746!==i&&747!==i&&(i<4352||!(no(i)||nn(i)||nx(i)&&!(i>=65097&&i<=65103)||n_(i)||nu(i)||a7(i)||ns(i)||!(!ni(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||nc(i)||nd(i)||nh(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||nm(i)||nr(i)||nt(i)||i>=12688&&i<=12703||ne(i)||nl(i)||na(i)&&12540!==i||!(!nw(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nv(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||ny(i)||i>=19904&&i<=19967||nf(i)||np(i))))}function nE(i){return!(nS(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||ni(i)||na(i)||i>=57344&&i<=63743||nx(i)||nv(i)||nw(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function nI(i){return i>=1424&&i<=2303||ng(i)||nb(i)}let nA={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},nM=null,nC=nA.unavailable,nD=null,nR=function(i){i&&(nC=nA.error),nM&&nM(i)};function nP(){nL.fire(new id("pluginStateChange",{pluginStatus:nC,pluginURL:nD}))}let nL=new ig,nz=function(){return nC},nO=function(){if(nC!==nA.deferred||!nD)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nC=nA.loading,nP(),nD&&ih({url:nD},i=>{i?nR(i):(nC=nA.loaded,nP())})},nF={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nC===nA.loaded||null!=nF.applyArabicShaping,isLoading:()=>nC===nA.loading,setState(i){nC=i.pluginStatus,nD=i.pluginURL},isParsing:()=>nC===nA.parsing,isParsed:()=>nC===nA.parsed,getPluginURL:()=>nD},nB=function(){nF.isLoading()||nF.isLoaded()||"deferred"!==nz()||nO()};
1class nk{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.transition=r.transition,this.pitch=r.pitch,this.brightness=r.brightness,this.worldview=r.worldview,this.activeFloors=r.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(i){var r=nF.isLoaded();for(let a of i)if(!function(i,r){return!(!r&&nI(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||i>=6016&&i<=6143)}(a.charCodeAt(0),r))return!1;return!0}}class nN{constructor(i,r,a,n,o){this.property=i,this.value=r,this.expression=function(i,r,a,n,o){if(aU(i))return new aQ(i,r);if(aW(i)||Array.isArray(i)&&i.length>0){let s=aJ(i,r,a,n,o);if("error"===s.result)throw Error(s.value.map(i=>`${i.key}: ${i.message}`).join(", "));return s.value}{let a=i;return"string"==typeof i&&"color"===r.type&&(a=iS.parse(i)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>a}}}(void 0===r?i.specification.default:r,i.specification,a,n,o)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,a,n){return this.property.possiblyEvaluate(this,i,r,a,n)}}class nU{constructor(i,r,a,n){this.property=i,this.value=new nN(i,void 0,r,a,n)}transitioned(i,r){return new nj(this.property,this.value,r,Object.assign({},i.transition,this.transition),i.now)}untransitioned(){return new nj(this.property,this.value,null,{},0)}}class nV{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return ty(this._values[i].value.value)}setValue(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new nU(this._values[i].property,this._scope,this._options,this._iconImageUseTheme)),this._values[i].value=new nN(this._values[i].property,null===r?void 0:ty(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].value.isIndoorDependent())}setTransitionOrValue(i,r){r&&(this._options=r);let a=this._properties.properties;if(i)for(let r in i){let n=i[r];if(r.endsWith("-transition")){let i=r.slice(0,-11);a[i]&&this.setTransition(i,n)}else Object.hasOwn(a,r)&&this.setValue(r,n)}}getTransition(i){return ty(this._values[i].transition)}setTransition(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new nU(this._values[i].property)),this._values[i].transition=ty(r)||void 0}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a);let n=this.getTransition(r);void 0!==n&&(i[`${r}-transition`]=n)}return i}transitioned(i,r){let a=new nG(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].transitioned(i,r._values[n]);return a}untransitioned(){let i=new nG(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}isIndoorDependent(){return this._isIndoorDependent}}class nj{constructor(i,r,a,n,o){const s=n.delay||0,l=n.duration||0;o=o||0,this.property=i,this.value=r,this.begin=o+s,this.end=this.begin+l,i.specification.transition&&(n.delay||n.duration)&&(this.prior=a)}possiblyEvaluate(i,r,a){let n=i.now||0,o=this.value.possiblyEvaluate(i,r,a),s=this.prior;if(s){if(n>this.end||this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return s.possiblyEvaluate(i,r,a);{let l=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(i,r,a),o,tn(l))}}return o}}class nG{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,a){let n=new n$(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(i,r,a);return n}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class nH{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultPropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return ty(this._values[i].value)}setValue(i,r){this._values[i]=new nN(this._values[i].property,null===r?void 0:ty(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].isIndoorDependent())}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a)}return i}possiblyEvaluate(i,r,a,n){let o=new n$(this._properties);for(let s of Object.keys(this._values))o._values[s]=this._values[s].possiblyEvaluate(i,r,a,n);return o}isIndoorDependent(){return this._isIndoorDependent}}class nq{constructor(i,r,a,n){this.property=i,this.value=r,this.parameters=a,this.iconImageUseTheme=n}isConstant(){return"constant"===this.value.kind}constantOr(i){return"constant"===this.value.kind?this.value.value:i}evaluate(i,r,a,n,o){return this.property.evaluate(this.value,this.parameters,i,r,a,n,this.iconImageUseTheme,o)}}class n${constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class nZ{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,a){let n=iC[this.specification.type];return n?n(i,r,a):i}}class nW{constructor(i,r){this.specification=i,this.overrides=r}possiblyEvaluate(i,r,a,n,o){return"constant"===i.expression.kind||"camera"===i.expression.kind?new nq(this,{kind:"constant",value:i.expression.evaluate(r,null,{},a,n,void 0,o)},r):new nq(this,i.expression,r,o)}interpolate(i,r,a){if("constant"!==i.value.kind||"constant"!==r.value.kind)return i;if(void 0===i.value.value||void 0===r.value.value)return new nq(this,{kind:"constant",value:void 0},i.parameters);let n=iC[this.specification.type];return n?new nq(this,{kind:"constant",value:n(i.value.value,r.value.value,a)},i.parameters):i}evaluate(i,r,a,n,o,s,l,h){return"constant"===i.kind?i.value:i.evaluate(r,a,n,o,s,h,l)}}class nX{constructor(i){this.specification=i}possiblyEvaluate(i,r,a,n){return!!i.expression.evaluate(r,null,{},a,n)}interpolate(){return!1}}class nY{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const r=new nk(0,{});for(const a in i){const n=i[a],o=n.specification;o&&o.overridable&&this.overridableProperties.push(a);const s=this.defaultPropertyValues[a]=new nN(n,void 0),l=this.defaultTransitionablePropertyValues[a]=new nU(n);this.defaultTransitioningPropertyValues[a]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=s.possiblyEvaluate(r)}}}a2(nW,"DataDrivenProperty"),a2(nZ,"DataConstantProperty"),a2(nX,"ColorRampProperty");var nK=JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}}
1,"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"minimum":0,"maximum":512},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"id":{"type":"string"},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","values":{"center":1,"left"
1:1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","default":"center","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1},"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"colorTheme":{"data":{"type":"string","expression":1}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transiti
1on":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},
1"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');function nJ(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function nQ(i){if(Array.isArray(i))return i.map(nQ);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let a in i)r[a]=nQ(i[a]);return r}return nJ(i)}function n0(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let r of i.slice(1))if(!n0(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function n1(i,r="",a=null,n="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};n0(i)||(i=function i(r){if(!r)return!0;let a=r[0];return r.length<=1?"any"!==a:"=="===a?n5(r[1],r[2],"=="):"!="===a?n9(n5(r[1],r[2],"==")):"<"===a||">"===a||"<="===a||">="===a?n5(r[1],r[2],a):"any"===a?["any"].concat(r.slice(1).map(i)):"all"===a?["all"].concat(r.slice(1).map(i)):"none"===a?["all"].concat(r.slice(1).map(i).map(n9)):"in"===a?n6(r[1],r.slice(2)):"!in"===a?n9(n6(r[1],r.slice(2))):"has"===a?n8(r[1]):"!has"!==a||n9(n8(r[1]))}(i));let o=i,s=!0;try{s=function(i){if(!n2(i))return i;let r=nQ(i);return function i(r){let a=!1,n=[];if("case"===r[0]){for(let i=1;i<r.length-1;i+=2)a=a||n2(r[i]),n.push(r[i+1]);n.push(r.at(-1))}else if("match"===r[0]){a=a||n2(r[1]);for(let i=2;i<r.length-1;i+=2)n.push(r[i+1]);n.push(r.at(-1))}else if("step"===r[0]){a=a||n2(r[1]);for(let i=1;i<r.length-1;i+=2)n.push(r[i+1])}a&&(r.length=0,r.push("any",...n));for(let a=1;a<r.length;a++)i(r[a])}(r),r=function i(r){if(!Array.isArray(r))return r;let a=function(i){if(n3.has(i[0])){for(let r=1;r<i.length;r++)if(n2(i[r]))return!0}return i}(r);return!0===a?a:a.map(r=>i(r))}(r)}(o)}catch(i){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(o,null,2)} 7 `)}let l=null,h=null;if("background"!==n&&"sky"!==n&&"slot"!==n){let i=aX(s,h=nK[`filter_${n}`],r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));l=(r,a,n)=>i.value.evaluate(r,a,{},n)}let u=null,c=null;if(s!==o){let i=aX(o,h,r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));u=(r,a,n,o,s)=>i.value.evaluate(r,a,{},n,void 0,void 0,o,s),c=!rY(i.value.expression)}return{filter:l,dynamicFilter:u||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0]||"distance"===r[0])return!0;for(let a=1;a<r.length;a++)if(i(r[a]))return!0;return!1}(s),needFeature:!!c}}function n2(i){var r;if(!Array.isArray(i))return!1;if("pitch"===(r=i[0])||"distance-from-center"===r)return!0;for(let r=1;r<i.length;r++)if(n2(i[r]))return!0;return!1}let n3=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function n4(i,r){return i<r?-1:+(i>r)}function n5(i,r,a){switch(i){case"$type":return[`filter-type-${a}`,r];case"$id":return[`filter-id-${a}`,r];default:return[`filter-${a}`,i,r]}}function n6(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(n4)]]:["filter-in-small",i,["literal",r]]}}function n8(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function n9(i){return["!",i]}function n7(i,r){return r?`${i}�${r}`:i}function oe(i){let r=i.indexOf("\x1f");return r>=0?i.slice(r+1):""}let ot=()=>s||(s=new nY({"icon-size":new nW(nK.layout_symbol["icon-size"]),"icon-image":new nW(nK.layout_symbol["icon-image"]),"icon-rotate":new nW(nK.layout_symbol["icon-rotate"]),"icon-offset":new nW(nK.layout_symbol["icon-offset"]),"text-size":new nW(nK.layout_symbol["text-size"]),"text-rotate":new nW(nK.layout_symbol["text-rotate"]),"text-offset":new nW(nK.layout_symbol["text-offset"])})),oi=()=>l||(l=new nY({"icon-opacity":new nW(nK.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new nW(nK.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new nW(nK.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new nW(nK.paint_symbol["text-emissive-strength"]),"icon-color":new nW(nK.paint_symbol["icon-color"]),"icon-halo-color":new nW(nK.paint_symbol["icon-halo-color"]),"icon-halo-width":new nW(nK.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nW(nK.paint_symbol["icon-halo-blur"]),"icon-translate":new nW(nK.paint_symbol["icon-translate"]),"text-opacity":new nW(nK.paint_symbol["text-opacity"]),"text-occlusion-opacity":new nW(nK.paint_symbol["text-occlusion-opacity"]),"text-color":new nW(nK.paint_symbol["text-color"],{runtimeType:iF,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new nW(nK.paint_symbol["text-halo-color"]),"text-halo-width":new nW(nK.paint_symbol["text-halo-width"]),"text-halo-blur":new nW(nK.paint_symbol["text-halo-blur"]),"text-translate":new nW(nK.paint_symbol["text-translate"]),"symbol-z-offset":new nW(nK.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}));class or{constructor(i,r,a,n,o,s){this._conditionSpec=i,this._propertiesSpec=a;const l=aX(i,nK.appearance.condition);if("success"===l.result&&(this.condition=l.value),this.name=r,a)for(const i in this.layoutProperties=new n$(ot()),this.unevaluatedLayout=new nH(ot
7(),n,o,s),this.paintProperties=new n$(oi()),this.unevaluatedPaint=new nH(oi(),n,o,""),a)i in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(i,a[i]):i in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(i,a[i])}isActive(i){return!(this.condition||!i.isHidden||"hidden"!==this.name)||this.condition.evaluate(i.globals,i.feature,i.featureState,i.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(i){return this.layoutProperties.get(i)}getPaintProperty(i){return this.paintProperties.get(i)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(i){return this.unevaluatedLayout._values[i]}getUnevaluatedPaintProperty(i){return this.unevaluatedPaint._values[i]}recalculate(i,r,a){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(i,void 0,r,a)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(i,void 0,r,""))}serialize(){let i={};i.condition=this.condition.expression.serialize(),this.name&&(i.name=this.name);let r=Object.assign({},this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},this.unevaluatedPaint?this.unevaluatedPaint.serialize():{});return Object.keys(r).length>0&&(i.properties=r),i}hasIconLayoutProperties(){let i=this.hasLayoutProperty("icon-image"),r=this.hasLayoutProperty("icon-size"),a=this.hasLayoutProperty("icon-offset"),n=this.hasLayoutProperty("icon-rotate");return i||r||a||n}hasTextLayoutProperties(){let i=this.hasLayoutProperty("text-size"),r=this.hasLayoutProperty("text-offset"),a=this.hasLayoutProperty("text-rotate");return i||r||a}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("icon-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("text-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasLayoutProperty(i){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[i].value}hasPaintProperty(i){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[i].value}}let oa="-transition",on=new Set(["fill","line","background","hillshade","raster"]);class oo extends ig{constructor(i,r,a,n,o,s){if(super(),this.id=i.id,this.fqid=n7(this.id,a),this.type=i.type,this.scope=a,this.lut=n,this.options=o,this.iconImageUseTheme=s,this.appearances=[],this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==i.type){if(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type&&"background"!==i.type&&"sky"!==i.type&&"slot"!==i.type){this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter;const r=aX(this.filter,nK[`filter_${i.type}`]);"error"!==r.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.value.isIndoorDependent)}if(i.slot&&(this.slot=i.slot),i.appearances&&this.setAppearances(i.appearances),r.layout&&(this._unevaluatedLayout=new nH(r.layout,this.scope,o,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),r.paint){for(const a in this._transitionablePaint=new nV(r.paint,this.scope,o),i.paint)this.setPaintProperty(a,i.paint[a]);for(const r in i.layout)this.setLayoutProperty(r,i.layout[r]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new n$(r.paint)}}}onAdd(i){}onRemove(i){}isDraped(i){return!this.is3D(!0)&&on.has(this.type)}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r){if("custom"===this.type&&"visibility"===i)return void(this.visibility=r);let a=this._unevaluatedLayout;a._properties.properties[i]&&(a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndo
7orDependent(),"visibility"===i&&this.possiblyEvaluateVisibility())}setAppearances(i){this.appearances=[],i.forEach(i=>{this.appearances.push(new or(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(i){return i.endsWith(oa)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}isPaintProperty(i){return!!this._transitionablePaint._properties.properties[i]}setPaintProperty(i,r){let a=this._transitionablePaint,n=a._properties.properties;if(i.endsWith(oa)){let o=i.slice(0,-11);return n[o]&&a.setTransition(o,r||void 0),!1}if(!n[i])return!1;let o=a._values[i],s=o.value.isDataDriven(),l=o.value;a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(i);let h=a._values[i].value,u=h.isDataDriven(),c=i.endsWith("pattern")||"line-dasharray"===i;return u||s||c||this._handleOverridablePaintPropertyUpdate(i,l,h)}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getDefaultProgramParams(i,r,a){return null}_handleOverridablePaintPropertyUpdate(i,r,a){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}
7serialize(){let i={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(i.appearances=this.appearances.map(i=>i.serialize())),tg(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}is3D(i){return!1}hasElevation(){return!1}mayUse(i){return!1}prepare(){return Promise.resolve()}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof nq&&aF(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}for(let i of this.appearances)if(!rK(i.condition.expression))return!0;return!1}compileFilter(i){this._filterCompiled||(this._featureFilter=n1(this.filter,this.scope,i),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(i){this._stats&&("shadow"===i.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(i,r,a){return{}}queryRadius(i){}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){}}function os(i,r,a){if(!i._unevaluatedLayout)return!1;let n=i._unevaluatedLayout.getValue(r);return void 0!==n&&("string"!=typeof n||a(n))}function ol(i,r,a=2){let n,o,s,l=r&&r.length,h=l?r[0]*a:i.length,u=oh(i,0,h,a,!0),c=[];if(!u||u.next===u.prev)return c;if(l&&(u=function(i,r,a,n){let o=[];for(let a=0,s=r.length;a<s;a++){let l=oh(i,r[a]*n,a<s-1?r[a+1]*n:i.length,n,!1);l===l.next&&(l.steiner=!0),o.push(function(i){let r=i,a=i;do(r.x<a.x||r.x===a.x&&r.y<a.y)&&(a=r),r=r.next;while(r!==i)return a}(l))}o.sort(oc);for(let i=0;i<o.length;i++)a=function(i,r){let a=function(i,r){let a=r,n=i.x,o=i.y,s,l=-1/0;if(o_(i,a))return a;do{if(o_(i,a.next))return a.next;if(o<=a.y&&o>=a.next.y&&a.next.y!==a.y){let i=a.x+(o-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(i<=n&&i>l&&(l=i,s=a.x<a.next.x?a:a.next,i===n))return s}a=a.next}while(a!==r)if(!s)return null;let h=s,u=s.x,c=s.y,d=1/0;a=s;do{if(n>=a.x&&a.x>=u&&n!==a.x&&of(o<c?n:l,o,u,c,o<c?l:n,o,a.x,a.y)){var f,p;let r=Math.abs(o-a.y)/(n-a.x);ov(a,i)&&(r<d||r===d&&(a.x>s.x||a.x===s.x&&(f=s,p=a,0>om(f.prev,f,p.prev)&&0>om(p.next,f,f.next))))&&(s=a,d=r)}a=a.next}while(a!==h)return s}(i,r);if(!a)return r;let n=ob(a,i);return ou(n,n.next),ou(a,a.next)}(o[i],a);return a}(i,r,u,a)),i.length>80*a){n=i[0],o=i[1];let r=n,l=o;for(let s=a;s<h;s+=a){let a=i[s],h=i[s+1];a<n&&(n=a),h<o&&(o=h),a>r&&(r=a),h>l&&(l=h)}s=0!==(s=Math.max(r-n,l-o))?32767/s:0}return function i(r,a,n,o,s,l,h){if(!r)return;!h&&l&&function(i,r,a,n){let o=i;do 0===o.z&&(o.z=od(o.x,o.y,r,a,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==i)o.prevZ.nextZ=null,o.prevZ=null,function(i){let r,a=1;do{let n,o=i;i=null;let s=null;for(r=0;o;){r++;let l=o,h=0;for(let i=0;i<a&&(h++,l=l.nextZ);i++);let u=a;for(;h>0||u>0&&l;)0!==h&&(0===u||!l||o.z<=l.z)?(n=o,o=o.nextZ,h--):(n=l,l=l.nextZ,u--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;o=l}s.nextZ=null,a*=2}while(r>1)}(o)}(r,o,s,l);let u=r;for(;r.prev!==r.next;){let c=r.prev,d=r.next;if(l?function(i,r,a,n){let o=i.prev,s=i.next;if(om(o,i,s)>=0)return!1;let l=o.x,h=i.x,u=s.x,c=o.y,d=i.y,f=s.y,p=Math.min(l,h,u),m=Math.min(c,d,f),_=Math.max(l,h,u),g=Math.max(c,d,f),y=od(p,m,r,a,n),x=od(_,g,r,a,n),v=i.prevZ,b=i.nextZ;for(;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=p&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&op(l,c,h,d,u,f,v.x,v.y)&&om(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=p&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&op(l,c,h,d,u,f,b.x,b.y)&&om(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&op(l,c,h,d,u,f,v.x,v.y)&&om(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=p&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&op(l,c,h,d,u,f,b.x,b.y)&&om(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,o,s,l):function(i){let r=i.prev,a=i.next;if(om(r,i,a)>=0)return!1;let n=r.x,o=i.x,s=a.x,l=r.y,h=i.y,u=a.y,c=Math.min(n,o,s),d=Math.min(l,h,u),f=Math.max(n,o,s),p=Math.max(l,h,u),m=a.next;for(;m!==r;){if(m.x>=c&&m.x<=f&&m.y>=d&&m.y<=p&&op(n,l,o,h,s,u,m.x,m.y)&&om(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))a.push(c.i,r.i,d.i),oT(r),r=d.next,u=d.next;else if((r=d)===u){h?1===h?i(r=function(i,r){let a=i;do{let n=a.prev,o=a.next.next;!o_(n,o)&&og(n,a,a.next,o)&&ov(n,o)&&ov(o,n)&&(r.push(n.i,a.i,o.i),oT(a),oT(a.next),a=i=o),a=a.next}while(a!==i)return ou(a)}(ou(r),a),a,n,o,s,l,2):2===h&&function(r,a,n,o,s,l){let h=r;do{let r=h.next.next;for(;r!==h.prev;){var u,c;
7if(h.i!==r.i&&(u=h,c=r,u.next.i!==c.i&&u.prev.i!==c.i&&!function(i,r){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==r.i&&a.next.i!==r.i&&og(a,a.next,i,r))return!0;a=a.next}while(a!==i)return!1}(u,c)&&(ov(u,c)&&ov(c,u)&&function(i,r){let a=i,n=!1,o=(i.x+r.x)/2,s=(i.y+r.y)/2;do a.y>s!=a.next.y>s&&a.next.y!==a.y&&o<(a.next.x-a.x)*(s-a.y)/(a.next.y-a.y)+a.x&&(n=!n),a=a.next;while(a!==i)return n}(u,c)&&(om(u.prev,u,c.prev)||om(u,c.prev,c))||o_(u,c)&&om(u.prev,u,u.next)>0&&om(c.prev,c,c.next)>0))){let u=ob(h,r);return h=ou(h,h.next),u=ou(u,u.next),i(h,a,n,o,s,l,0),void i(u,a,n,o,s,l,0)}r=r.next}h=h.next}while(h!==r)}(r,a,n,o,s,l):i(ou(r),a,n,o,s,l,1);break}}}(u,c,a,n,o,s,0),c}function oh(i,r,a,n,o){let s;if(o===function(i,r,a,n){let o=0;for(let s=r,l=a-n;s<a;s+=n)o+=(i[l]-i[s])*(i[s+1]+i[l+1]),l=s;return o}(i,r,a,n)>0)for(let o=r;o<a;o+=n)s=ow(o/n|0,i[o],i[o+1],s);else for(let o=a-n;o>=r;o-=n)s=ow(o/n|0,i[o],i[o+1],s);return s&&o_(s,s.next)&&(oT(s),s=s.next),s}function ou(i,r){if(!i)return i;r||(r=i);let a,n=i;do if(a=!1,n.steiner||!o_(n,n.next)&&0!==om(n.prev,n,n.next))n=n.next;else{if(oT(n),(n=r=n.prev)===n.next)break;a=!0}while(a||n!==r)return r}function oc(i,r){let a=i.x-r.x;return 0===a&&0==(a=i.y-r.y)&&(a=(i.next.y-i.y)/(i.next.x-i.x)-(r.next.y-r.y
7)/(r.next.x-r.x)),a}function od(i,r,a,n,o){return(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=0x55555555&((r=0x33333333&((r=0xf0f0f0f&((r=0xff00ff&((r=(r-n)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function of(i,r,a,n,o,s,l,h){return(o-l)*(r-h)>=(i-l)*(s-h)&&(i-l)*(n-h)>=(a-l)*(r-h)&&(a-l)*(s-h)>=(o-l)*(n-h)}function op(i,r,a,n,o,s,l,h){return(i!==l||r!==h)&&of(i,r,a,n,o,s,l,h)}function om(i,r,a){return(r.y-i.y)*(a.x-r.x)-(r.x-i.x)*(a.y-r.y)}function o_(i,r){return i.x===r.x&&i.y===r.y}function og(i,r,a,n){let o=ox(om(i,r,a)),s=ox(om(i,r,n)),l=ox(om(a,n,i)),h=ox(om(a,n,r));return o!==s&&l!==h||!(0!==o||!oy(i,a,r))||!(0!==s||!oy(i,n,r))||!(0!==l||!oy(a,i,n))||!(0!==h||!oy(a,r,n))}function oy(i,r,a){return r.x<=Math.max(i.x,a.x)&&r.x>=Math.min(i.x,a.x)&&r.y<=Math.max(i.y,a.y)&&r.y>=Math.min(i.y,a.y)}function ox(i){return i>0?1:i<0?-1:0}function ov(i,r){return 0>om(i.prev,i,i.next)?om(i,r,i.next)>=0&&om(i,i.prev,r)>=0:0>om(i,r,i.prev)||0>om(i,i.next,r)}function ob(i,r){let a=oS(i.i,i.x,i.y),n=oS(r.i,r.x,r.y),o=i.next,s=r.prev;return i.next=r,r.prev=i,a.next=o,o.prev=a,n.next=a,a.prev=n,s.next=n,n.prev=s,n}function ow(i,r,a,n){let o=oS(i,r,a);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function oT(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 oS(i,r,a){return{i:i,x:r,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function oE(i,r,a=1){if(!i)return null;let n="string"==typeof i?iQ.from(i).getPrimary():i.getPrimary(),o="string"==typeof i?null:i.getSecondary();for(let i of[n,o]){if(!i)continue;let n=i.id.toString();r.has(n)||r.set(n,[]),i.scaleSelf(a),r.get(n).push(i)}return{primary:n.toString(),secondary:o?o.toString():null}}function oI(i,r,a,n){let o=n.patternDependencies,s=!1;for(let n of r){let r=n.paint.get(`${i}-pattern`);r.isConstant()||(s=!0),oE(r.constantOr(null),o,a)&&(s=!0)}return s}function oA(i,r,a,n,o,s){let l=s.patternDependencies;for(let h of r){let r=h.paint.get(`${i}-pattern`).value;if("constant"!==r.kind){let i=oE(r.evaluate({zoom:n},a,{},void 0,s.availableImages),l,o);if(!i)continue;let{primary:u,secondary:c}=i;u&&(a.patterns[h.id]=[u,c].filter(Boolean))}}return a}let oM=8192/Math.PI/2,oC=[64,32,16],oD=-oM;function oR(i,r,a,n=oM){return[i*Math.sin(a*=e7)*n,-r*n,i*Math.cos(a)*n]}function oP(i,r,a){return oR(Math.cos(i*e7),Math.sin(i*e7),r,a)}let oL=2*Math.PI*6371008.8;class oz{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oz(th(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let r=Math.PI/180,a=this.lat*r,n=i.lat*r;return 6371008.8*Math.acos(Math.min(Math.sin(a)*Math.sin(n)+Math.cos(a)*Math.cos(n)*Math.cos((i.lng-this.lng)*r),1))}toBounds(i=0){let r=360*i/0x2637f09,a=r/Math.cos(Math.PI/180*this.lat);return new oO({lng:this.lng-a,lat:this.lat-r},{lng:this.lng+a,lat:this.lat+r})}toEcef(i){return oP(this.lat,this.lng,oM+i*oM/6371008.8)}static convert(i){if(i instanceof oz)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new oz(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new oz(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw 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 oO{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):Array.isArray(i)&&4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof oz?new oz(i.lng,i.lat):oz.convert(i),this}setSouthWest(i){return this._sw=i instanceof oz?new oz(i.lng,i.lat):oz.convert(i),this}extend(i){let r,a,n=this._sw,o=this._ne;if(i instanceof oz)r=i,a=i;else{if(!(i instanceof oO))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(oO.convert(i)):this.extend(oz.convert(i)):"object"==typeof i&&null!==i&&Object.hasOwn(i,"lat")&&(Object.hasOwn(i,"lon")||Object.hasOwn(i,"lng"))?this.extend(oz.convert(i)):this;if(r=i._sw,a=i._ne,!r||!a)return this}return n||o?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),o.lng=Math.max(a.lng,o.lng),o.lat=Math.max(a.lat,o.lat)):(this._sw=new oz(r.lng,r.lat),this._ne=new oz(a.lng,a.lat)),this}getCenter(){return new oz((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
7getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new oz(this.getWest(),this.getNorth())}getSouthEast(){return new oz(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(i){let{lng:r,lat:a}=oz.convert(i),n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&n}static convert(i){if(i)return i instanceof oO?i:new oO(i)}}function oF(i){return oL*Math.cos(i*Math.PI/180)}function oB(i,r){return i*oF(rm(r))}function ok(i){return Math.cos(ts(i,-85.051129,85.051129)*e7)}function oN(i,r){let a=Math.pow(2,ts(r,0,25.5));return ok(i)*oL/(512*a)}function oU(i){return 1/Math.cos(i*Math.PI/180)}function oV(i,r=0){let a=Math.exp(Math.PI*(1-(i.y+r/8192)/(1<<i.z)*2));return 0x4c6fe12*a/(a*a+1)/8192/(1<<i.z)}class oj{constructor(i,r,a=0){this.x=+i,this.y=+r,this.z=+a}static fromLngLat(i,r=0){let a=oz.convert(i);return new oj(rd(a.lng),rf(a.lat),r/oF(a.lat))}toLngLat(){return new oz(rp(this.x),rm(this.y))}toAltitude(){return oB(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/oL*oU(rm(this.y))}}function oG(i,r,a){let n=i[0],o=n.x,s=n.y;r(n);let l=[n];for(let h=1;h<i.length;h++){let u=i[h],{x:c,y:d}=u;r(u),function i(r,a,n,o,s,l,h,u,c){var d,f,p,m,_,g;let y,x,v=(a+o)/2,b=(n+s)/2,w=new eJ(v,b);u(w),(d=w.x,f=w.y,p=l.x,m=l.y,_=h.x,g=h.y,y=p-_,x=m-g,Math.abs((m-f)*y-(p-d)*x)/Math.hypot(y,x)>=c)?(i(r,a,n,v,b,l,w,u,c),i(r,v,b,o,s,w,h,u,c)):r.push(h)}(l,o,s,c,d,n,u,r,a),o=c,s=d,n=u}return l}let oH=-16383-1;function oq(i,r,a){let n=i.loadGeometry(),o=i.extent,s=8192/o;if(r&&a&&a.projection.isReprojectedInTileSpace){let s=1<<r.z,{scale:l,x:h,y:u,projection:c}=a,d=i=>{let a=rp((r.x+i.x/o)/s),n=rm((r.y+i.y/o)/s),d=c.project(a,n);i.x=(d.x*l-h)*o,i.y=(d.y*l-u)*o};for(let r=0;r<n.length;r++)if(1!==i.type)n[r]=oG(n[r],d,1);else{let i=[];for(let a of n[r])a.x<0||a.x>=o||a.y<0||a.y>=o||(d(a),i.push(a));n[r]=i}}for(let i of n)for(let r of i)!function(i,r){let a=Math.round(i.x*r),n=Math.round(i.y*r);i.x=ts(a,oH,16383),i.y=ts(n,oH,16383),(a<i.x||a>i.x+1||n<i.y||n>i.y+1)&&tb("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(r,s);return n}function o$(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?oq(i):[]}}let oZ={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oW{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}let oX=new ArrayBuffer(0);class oY{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(i,r){return i._trim(),r&&i.arrayBuffer&&r.add(i.arrayBuffer),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,i.arrayBuffer?r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement:(r.capacity=0,r.arrayBuffer=oX),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(i){this.reserve(i),this.length=i}resizeExact(i){this.reserveExact(i),this.length=i}reserve(i){i>this.capacity&&this._allocate(Math.max(i,Math.floor(5*this.capacity),128))}reserveExact(i){(i>this.capacity||!this.arrayBuffer)&&this._allocate(i)}_allocate(i){this._reallocCount++,this.capacity=i,this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}reserveForAdditional(i){this.reserve(this.length+i)}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(){throw Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function oK(i,r=1){let a=0,n=0;return{members:i.map(i=>{let o=oZ[i.type].BYTES_PER_ELEMENT,s=a=oJ(a,Math.max(r,o)),l=i.components||1;return n=Math.max(n,o),a+=o*l,{name:i.name,type:i.type,components:l,offset:s}}),size:oJ(a,Math.max(n,r)),alignment:r}}function oJ(i,r){return Math.ceil(i/r)*r}class oQ extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.int16[n+0]=r,this.int16[n+1]=a,i}}oQ.prototype.bytesPerElement=4,a2(oQ,"StructArrayLayout2i4");class o0 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}o0.prototype.bytesPerElement=6,a2(o0,"StructArrayLayout3i6");class o1 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}o1.prototype.bytesPerElement=8,a2(o1,"StructArrayLayout2i2ui8");class o2 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[+i+0]=r,i}}o2.prototype.bytesPerElement=4,a2(o2,"StructArrayLayout1f4");class o3 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.float32[2*i+1]=n,i}}o3.prototype.bytesPerElement=8,a2(o3,"StructArrayLayout2i1f8");class o4 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}o4.prototype.bytesPerElement=8,a2(o4,"StructArrayLayout3i8");class o5 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.int16[s+2]=n,this.int16[s+3]=o,i}}o5.prototype.bytesPerElement=8,a2(o5,"StructArrayLayout4i8");class o6 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.int16[l+0]=r,this.int16[l+1]=a,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=s,i}}
vendor: 16,022 bytes, line 7
7o6.prototype.bytesPerElement=10,a2(o6,"StructArrayLayout5i10");class o8 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=6*i,c=12*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.uint8[c+4]=n,this.uint8[c+5]=o,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*i+2]=h,i}}o8.prototype.bytesPerElement=12,a2(o8,"StructArrayLayout2i4ub1f12");class o9 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.float32[o+0]=r,this.float32[o+1]=a,this.float32[o+2]=n,i}}o9.prototype.bytesPerElement=12,a2(o9,"StructArrayLayout3f12");class o7 extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=6*i;return this.uint16[l+0]=r,this.uint16[l+1]=a,this.uint16[l+2]=n,this.uint16[l+3]=o,this.float32[3*i+2]=s,i}}o7.prototype.bytesPerElement=12,a2(o7,"StructArrayLayout4ui1f12");class se extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.uint16[s+0]=r,this.uint16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}se.prototype.bytesPerElement=8,a2(se,"StructArrayLayout4ui8");class st extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.int16[h+3]=o,this.int16[h+4]=s,this.int16[h+5]=l,i}}st.prototype.bytesPerElement=12,a2(st,"StructArrayLayout6i12");class si extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,f){let p=this.length;return this.resize(p+1),this.emplace(p,i,r,a,n,o,s,l,h,u,c,d,f)}emplace(i,r,a,n,o,s,l,h,u,c,d,f,p){let m=12*i;return this.int16[m+0]=r,this.int16[m+1]=a,this.int16[m+2]=n,this.int16[m+3]=o,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=d,this.int16[m+10]=f,this.int16[m+11]=p,i}}si.prototype.bytesPerElement=24,a2(si,"StructArrayLayout4i4ui4i24");class sr extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=10*i,u=5*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}sr.prototype.bytesPerElement=20,a2(sr,"StructArrayLayout3i3f20");class sa extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.float32[s+0]=r,this.float32[s+1]=a,this.float32[s+2]=n,this.float32[s+3]=o,i}}sa.prototype.bytesPerElement=16,a2(sa,"StructArrayLayout4f16");class sn extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[+i+0]=r,i}}sn.prototype.bytesPerElement=4,a2(sn,"StructArrayLayout1ul4");class so extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.uint16[n+0]=r,this.uint16[n+1]=a,i}}so.prototype.bytesPerElement=4,a2(so,"StructArrayLayout2ui4");class ss extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,f,p){let m=this.length;return this.resize(m+1),this.emplace(m,i,r,a,n,o,s,l,h,u,c,d,f,p)}emplace(i,r,a,n,o,s,l,h,u,c,d,f,p,m){let _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=n,this.int16[_+3]=o,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=d,this.uint32[g+8]=f,this.uint16[_+18]=p,this.uint16[_+19]=m,i}}ss.prototype.bytesPerElement=40,a2(ss,"StructArrayLayout5i4f1i1ul2ui40");class sl extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=8*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,i}}sl.prototype.bytesPerElement=16,a2(sl,"StructArrayLayout3i2i2i16");class sh extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=4*i,h=8*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.int16[h+6]=o,this.int16[h+7]=s,i}}sh.prototype.bytesPerElement=16,a2(sh,"StructArrayLayout2f1f2i16");class su extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=20*i,u=5*i;return this.uint8[h+0]=r,this.uint8[h+1]=a,this.float32[u+1]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}su.prototype.bytesPerElement=20,a2(su,"StructArrayLayout2ub4f20");class sc extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.uint16[o+0]=r,this.uint16[o+1]=a,this.uint16[o+2]=n,i}}sc.prototype.bytesPerElement=6,a2(sc,"StructArrayLayout3ui6");class sd extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w)}emplace(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T){let S=30*i,E=15*i,I=60*i;return this.int16[S+0]=r,this.int16[S+1]=a,this.int16[S+2]=n,this.float32[E+2]=o,this.float32[E+3]=s,this.uint16[S+8]=l,this.uint16[S+9]=h,this.uint32[E+5]=u,this.uint32[E+6]=c,this.uint32[E+7]=d,this.uint16[S+16]=f,this.uint16[S+17]=p,this.uint16[S+18]=m,this.float32[E+10]=_,this.float32[E+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[E+13]=b,this.int16[S+28]=w,this.uint8[I+58]=T,i}}sd.prototype.bytesPerElement=60,a2(sd,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class sf extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P,L,z){let O=this.length;return this.resize(O+1),this.emplace(O,i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P,L,z)}emplace(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P,L,z,O){let F=20*i,B=40*i;return this.float32[F+0]=r,this.float32[F+1]=a,this.int16[B+4]=n,this.int16[B+5]=o,this.int16[B+6]=s,this.int16[B+7]=l,this.int16[B+8]=h,this.int16[B+9]=u,this.int16[B+10]=c,this.int16[B+11]=d,this.int16[B+12]=f,this.uint16[B+13]=p,this.uint16[B+14]=m,this.uint16[B+15]=_,this.uint16[B+16]=g,this.uint16[B+17]=y,this.uint16[B+18]=x,this.uint16[B+19]=v,this.uint16[B+20]=b,this.uint16[B+21]=w,this.uint16[B+22]=T,this.uint16[B+23]=S,this.uint16[B+24]=E,this.uint16[B+25]=I,this.uint16[B+26]=A,this.uint16[B+27]=M,this.uint32[F+14]=C,this.float32[F+15]=D,this.float32[F+16]=R,this.float32[F+17]=P,this.float32[F+18]=L,this.uint8[80*i+76]=z,this.uint16[B+39]=O,i}}sf.prototype.bytesPerElement=80,a2(sf,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class sp extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,this.float32[h+5]=l,i}}sp.prototype.bytesPerElement=24,a2(sp,"StructArrayLayout6f24");class sm extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,i}}sm.prototype.bytesPerElement=20,a2(sm,"StructArrayLayout5f20");class s_ extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=7*i;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=n,this.float32[u+3]=o,this.float32[u+4]=s,this.float32[u+5]=l,this.float32[u+6]=h,i}}s_.prototype.bytesPerElement=28,a2(s_,"StructArrayLayout7f28");class sg extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d){let f=this.length;return this.resize(f+1),this.emplace(f,i,r,a,n,o,s,l,h,u,c,d)}emplace(i,r,a,n,o,s,l,h,u,c,d,f){let p=11*i;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=n,this.float32[p+3]=o,this.float32[p+4]=s,this.float32[p+5]=l,this.float32[p+6]=h,this.float32[p+7]=u,this.float32[p+8]=c,this.float32[p+9]=d,this.float32[p+10]=f,i}}sg.prototype.bytesPerElement=44,a2(sg,"StructArrayLayout11f44");class sy extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,i,r,a,n,o,s,l,h,u)}emplace(i,r,a,n,o,s,l,h,u,c){let d=9*i;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=n,this.float32[d+3]=o,this.float32[d+4]=s,this.float32[d+5]=l,this.float32[d+6]=h,this.float32[d+7]=u,this.float32[d+8]=c,i}}sy.prototype.bytesPerElement=36,a2(sy,"StructArrayLayout9f36");class sx extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.float32[n+0]=r,this.float32[n+1]=a,i}}sx.prototype.bytesPerElement=8,a2(sx,"StructArrayLayout2f8");class sv extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=6*i;return this.uint32[3*i+0]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.uint16[s+4]=o,i}}sv.prototype.bytesPerElement=12,a2(sv,"StructArrayLayout1ul3ui12");class sb extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[+i+0]=r,i}}sb.prototype.bytesPerElement=2,a2(sb,"StructArrayLayout1ui2");class sw extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g)}emplace(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y){let x=16*i;return this.float32[x+0]=r,this.float32[x+1]=a,this.float32[x+2]=n,this.float32[x+3]=o,this.float32[x+4]=s,this.float32[x+5]=l,this.float32[x+6]=h,this.float32[x+7]=u,this.float32[x+8]=c,this.float32[x+9]=d,this.float32[x+10]=f,this.float32[x+11]=p,this.float32[x+12]=m,this.float32[x+13]=_,this.float32[x+14]=g,this.float32[x+15]=y,i}}sw.prototype.bytesPerElement=64,a2(sw,"StructArrayLayout16f64");class sT extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=10*i,c=5*i;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=n,this.uint16[u+3]=o,this.float32[c+2]=s,this.float32[c+3]=l,this.float32[c+4]=h,i}}sT.prototype.bytesPerElement=20,a2(sT,"StructArrayLayout4ui3f20");class sS extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.int16[+i+0]=r,i}}sS.prototype.bytesPerElement=2,a2(sS,"StructArrayLayout1i2");class sE extends oY{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint8[+i+0]=r,i}}sE.prototype.bytesPerElement=1,a2(sE,"StructArrayLayout1ub1");class sI extends oW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}sI.prototype.size=40;class sA extends ss{get(i){return new sI(this,i)}}a2(sA,"CollisionBoxArray");class sM extends oW{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}
vendor: 6,507 bytes, line 7
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}sM.prototype.size=60;class sC extends sd{get(i){return new sM(this,i)}}a2(sC,"PlacedSymbolArray");class sD extends oW{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(i){this._structArray.uint32[this._pos4+14]=i}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(i){this._structArray.float32[this._pos4+18]=i}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}sD.prototype.size=80;class sR extends sf{get(i){return new sD(this,i)}}a2(sR,"SymbolInstanceArray");class sP extends o2{getoffsetX(i){return this.float32[+i+0]}}a2(sP,"GlyphOffsetArray");class sL extends oQ{getx(i){return this.int16[2*i+0]}gety(i){return this.int16[2*i+1]}}a2(sL,"SymbolLineVertexArray");class sz extends oW{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}sz.prototype.size=12;class sO extends sv{get(i){return new sz(this,i)}}a2(sO,"FeatureIndexArray");class sF extends so{geta_centroid_pos0(i){return this.uint16[2*i+0]}geta_centroid_pos1(i){return this.uint16[2*i+1]}}a2(sF,"FillExtrusionCentroidArray");class sB extends oW{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}sB.prototype.size=6;class sk extends o0{get(i){return new sB(this,i)}}a2(sk,"FillExtrusionWallArray");let sN=oK([{name:"a_pos",components:2,type:"Int16"}],4),sU=oK([{name:"a_road_z_offset",components:1,type:"Float32"}],4),sV=oK([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),sj=oK([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class sG{constructor(i=[]){this.segments=i}_prepareSegment(i,r,a,n,o){let s=this.segments.at(-1);return i>sG.MAX_VERTEX_ARRAY_LENGTH&&tb(`Max vertices per segment is ${sG.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>sG.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n||void 0!==o&&s&&void 0!==s.batchIndex&&s.batchIndex!==o)&&(s={vertexOffset:r,primitiveOffset:a,vertexLength:0,primitiveLength:0},void 0!==n&&(s.sortKey=n),void 0!==o&&(s.batchIndex=o),this.segments.push(s)),s}prepareSegment(i,r,a,n,o){return this._prepareSegment(i,r.length,a.length,n,o)}get(){return this.segments}destroy(){for(let i of this.segments)for(let r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,a,n){return new sG([{vertexOffset:i,primitiveOffset:r,vertexLength:a,primitiveLength:n,vaos:{},sortKey:0}])}}function sH(i,r){return 256*(i=ts(Math.floor(i),0,255))+ts(Math.floor(r),0,255)}sG.MAX_VERTEX_ARRAY_LENGTH=65535,a2(sG,"SegmentVector");let sq=oK([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),s$=oK([{name:"a_pattern_b",components:4,type:"Uint16"}]),sZ=oK([{name:"a_dash",components:4,type:"Uint16"}]);class sW{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(i,r,a,n){this.ids.push(sX(i)),this.positions.push(r,a,n)}eachPosition(i,r){let a=sX(i),n=0,o=this.ids.length-1;for(;n<o;){let i=n+o>>1;this.ids[i]>=a?o=i:n=i+1}for(;this.ids[n]===a;)r(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(i,r){let a=new Float64Array(i.ids),n=new Uint32Array(i.positions);return function i(r,a,n,o){for(;n<o;){let s=r[n+o>>1],l=n-1,h=o+1;while(!0){do l++;while(r[l]<s)do h--;while(r[h]>s)if(l>=h)break;sY(r,l,h),sY(a,3*l,3*h),sY(a,3*l+1,3*h+1),sY(a,3*l+2,3*h+2)}h-n<o-h?(i(r,a,n,h),n=h+1):(i(r,a,h+1,o),o=h)}}(a,n,0,a.length-1),r&&(r.add(a.buffer),r.add(n.buffer)),{ids:a,positions:n}}static deserialize(i){let r,a=new sW;for(let n of(a.ids=i.ids,a.positions=i.positions,a.ids))n!==r&&a.uniqueIds.push(n),r=n;return a.indexed=!0,a}}function sX(i){let r=+i;return Number.isSafeInteger(r)?r:ic(String(i))}function sY(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}a2(sW,"FeaturePositionMap");class sK{constructor(i){this.gl=i.gl,this.initialized=!1}fetchUniformLocation(i,r){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(i,r),this.initialized=!0),!!this.location}set(i,r,a){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class sJ extends sK{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}}class sQ extends sK{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1f(this.location,a))}}class s0 extends sK{constructor(i){super(i),this.current=[0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1])))}}class s1 extends sK{constructor(i){super(i),this.current=[0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2])))}}class s2 extends sK{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4ui(this.location,a[0],a[1],a[2],a[3])))}}class s3 extends sK{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4f(this.location,a[0],a[1],a[2],a[3])))}}class s4 extends sK{constructor(i){super(i),this.current=iS.transparent.toPremultipliedRenderColor(null)}set(i,r,a){this.fetchUniformLocation(i,r)&&(a.r===this.current.r&&a.g===this.current.g&&a.b===this.current.b&&a.a===this.current.a||(this.current=a,this.gl.uniform4f(this.location,a.r,a.g,a.b,a.a)))}}class s5 extends sK{constructor(i){super(i),this.current=new Float32Array(16)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;if(a[12]!==n[12]||a[0]!==n[0])return n.set(a),void this.gl.uniformMatrix4fv(this.location,!1,n);for(let i=1;i<16;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix4fv(this.location,!1,n);break}}}class s6 extends sK{constructor(i){super(i),this.current=new Float32Array(4)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;for(let i=0;i<4;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix2fv(this.location,!1,n);break}}}function s8(i){return[sH(255*i.r,255*i.g),sH(255*i.b,255*i.a)]}function s9(i,r,a,n,o,s,l,h){return!!i&&("composite"===i.kind||"source"===i.kind?"none"===i.evaluate(new nk(0,{brightness:s,worldview:h}),r,a,o,n,l):"none"===i.value)}class s7{constructor(i,r,a,n){this.value=i,this.uniformNames=r.map(i=>`u_${i}`),this.type=a,this.context=n}setUniform(i,r,a,n,o){let s=n.constantOr(this.value);r.set(i,o,s instanceof iS?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(i,r){return"color"===this.type?new s4(i):new sQ(i)}}class le{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(i,r){this.pixelRatio=i.pixelRatio||1,this.pattern=i.tl.concat(i.br),this.patternTransition=r?r.tl.concat(r.br):this.pattern}setUniform(i,r,a,n,o){let s=null;"u_pattern"!==o&&"u_dash"!==o||(s=this.pattern),"u_pattern_b"===o&&(s=this.patternTransition),"u_pixel_ratio"===o&&(s=this.pixelRatio),s&&r.set(i,o,s)}getBinding(i,r){return"u_pattern"===r||"u_pattern_b"===r||"u_dash"===r?new s2(i):new sQ(i)}}class lt{constructor(i,r,a,n){this.expression=i,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new nk(0,{brightness:s,worldview:h}),r,{},o,n,l):"constant"===this.expression.kind&&this.expression.value,d=s9(this.lutExpression,r,{},n,o,s,l,h);this.paintVertexArray.resize(i),this._setPaintValue(u,i,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:l,worldview:h},a,n,void 0,o):"constant"===this.expression.kind&&this.expression.value,c=s9(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c?null:this.context.lut)}_setPaintValue(i,r,a,n){if("color"===this.type){let o=s8(a.toPremultipliedRenderColor(n));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,o[0],o[1])}else{for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,a);
vendor: 4,259 bytes, line 7
7this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class li{constructor(i,r,a,n,o,s){this.expression=i,this.uniformNames=r.map(i=>`u_${i}_t`),this.type=a,this.useIntegerZoom=n,this.context=o,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate(new nk(this.context.zoom,{brightness:s,worldview:h}),r,{},o,n,l),c=this.expression.evaluate(new nk(this.context.zoom+1,{brightness:s,worldview:h}),r,{},o,n,l),d=s9(this.lutExpression,r,{},n,o,s,l,h),f=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(f,i,u,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate({zoom:this.context.zoom,brightness:l,worldview:h},a,n,void 0,o),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:l,worldview:h},a,n,void 0,o),d=s9(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c,d?null:this.context.lut)}_setPaintValue(i,r,a,n,o){if("color"===this.type){let s=s8(a.toPremultipliedRenderColor(o)),l=s8(n.toPremultipliedRenderColor(o));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,s[0],s[1],l[0],l[1])}else{for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a,n);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(n))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,r,a,n,o){let s=this.useIntegerZoom?Math.floor(a.zoom):a.zoom,l=ts(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new sQ(i)}}class lr{constructor(i,r,a,n,o){this.expression=i,this.layerId=o,this.paintVertexAttributes=("array"===a?sZ:sq).members;for(let i=0;i<r.length;++i);this.paintVertexArray=new n,this.paintTransitionVertexArray=new se}populatePaintArray(i,r,a,n){let o=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValues(o,i,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(i,r,a,n,o,s,l){this._setPaintValues(i,r,a.patterns&&a.patterns[this.layerId],s)}_setPaintValues(i,r,a,n){if(!n||!a)return;let o=n[a[0]],s=n[a[1]];if(o){if(o){let{tl:a,br:n,pixelRatio:s}=o;for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a[0],a[1],n[0],n[1],s)}if(s){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);let{tl:a,br:n}=s;for(let o=i;o<r;o++)this.paintTransitionVertexArray.emplace(o,a[0],a[1],n[0],n[1])}}}upload(i){let r=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,r)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=i.createVertexBuffer(this.paintTransitionVertexArray,s$.members,r))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class la{constructor(i,r,a=()=>!0){this.binders={},this._buffers=[],this.context=r;const n=[];for(const o in i.paint._values){const s=i.paint.get(o);if(o.endsWith("-use-theme")||!a(o)||!(s instanceof nq&&aF(s.property.specification)))continue;const l=function(i,r){return lo[i]||[i.replace(`${r}
7-`,"").replace(/-/g,"_")]}(o,i.type),h=s.value,u=s.property.specification.type,c=!!s.property.useIntegerZoom,d="line-dasharray"===o||o.endsWith("pattern"),f=i.paint.get(`${o}-use-theme`),p="line-dasharray"===o&&"constant"!==i.layout.get("line-cap").value.kind||f&&"constant"!==f.value.kind;if("constant"!==h.kind||p)if("source"===h.kind||p||d){const r=lh(o,u,"source");this.binders[o]=d?new lr(h,l,u,r,i.id):new lt(h,l,u,r),n.push(`/a_${o}`)}else{const i=lh(o,u,"composite");this.binders[o]=new li(h,l,u,c,r,i),n.push(`/z_${o}`)}else this.binders[o]=d?new le(h.value,l):new s7(h.value,l,u,r),n.push(`/u_${o}`);f&&(this.binders[o].lutExpression=f.value)}this.cacheKey=n.sort().join("")}updateExpressions(i){for(let r in this.binders){let a=this.binders[r];(a instanceof lt||a instanceof li||a instanceof lr)&&(a.expression=i.paint.get(r).value)}}getMaxValue(i){let r=this.binders[i];return r instanceof lt||r instanceof li?r.maxValue:0}populatePaintArrays(i,r,a,n,o,s,l,h){for(let u in this.binders){let c=this.binders[u];c.context=this.context,(c instanceof lt||c instanceof li||c instanceof lr)&&c.populatePaintArray(i,r,a,n,o,s,l,h)}}setConstantPatternPositions(i,r){for(let a in this.binders){let n=this.binders[a];n instanceof le&&n.setConstantPatternPositions(i,r)}}getPatternTransitionVertexBuffer(i){let r=this.binders[i];return r instanceof lr?r.paintTransitionVertexBuffer:null}updatePaintArrays(i,r,a,n,o,s,l,h,u,c){let d=!1,f=Object.keys(i),p=0!==f.length&&!h,m=p?f:r.uniqueIds;for(let h in this.context.lut=o.lut,this.binders){let f=this.binders[h];if(f.context=this.context,(f instanceof lt||f instanceof li||f instanceof lr)&&f.expression&&f.expression.kind&&"constant"!==f.expression.kind&&(!0===f.expression.isStateDependent||!1===f.expression.isLightConstant)){for(let a of(f.expression=o.paint.get(h).value,m)){let o=i[a.toString()];r.eachPosition(a,(i,r,a)=>{let h=n.feature(i);f.updatePaintArray(r,a,h,o,s,l,u,c)})}if(!p)for(let r of a.uniqueIds){let o=i[r.toString()];a.eachPosition(r,(i,r,a)=>{let h=n.feature(i);f.updatePaintArray(r,a,h,o,s,l,u,c)})}d=!0}}return d}defines(){let i=[];for(let r in this.binders){let a=this.binders[r];(a instanceof s7||a instanceof le)&&i.push(...a.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof s7||n instanceof le||n instanceof li)for(let o of n.uniformNames)r.push({name:o,property:a,binding:n.getBinding(i,o)})}return r}setUniforms(i,r,a,n,o){for(let{name:r,property:s,binding:l}of a)this.binders[s].setUniform(i,l,o,n.get(s),r)}updatePaintBuffers(){for(let i in this._buffers=[],this.binders){let r=this.binders[i];(r instanceof lt||r instanceof li||r instanceof lr)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer),r instanceof lr&&r.paintTransitionVertexBuffer&&this._buffers.push(r.paintTransitionVertexBuffer)}}upload(i){for(let r in this.binders){let a=this.binders[r];(a instanceof lt||a instanceof li||a instanceof lr)&&a.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof lt||r instanceof li||r instanceof lr)&&r.destroy()}}}class ln{constructor(i,r,a=()=>!0){for(const n of(this.programConfigurations={},i))this.programConfigurations[n.id]=new la(n,r,a);this.needsUpload=!1,this._featureMap=new sW,this._featureMapWithoutIds=new sW,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(i,r,a,n,o,s,l,h,u){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(i,r,n,o,s,l,h,u);void 0!==r.id?this._featureMap.add(r.id,a,this._bufferOffset,i):(this._featureMapWithoutIds.add(this._idlessCounter,a,this._bufferOffset,i),this._idlessCounter+=1),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,a,n,o,s,l,h){for(let u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(i,this._featureMap,this._featureMapWithoutIds,r,u,n,o,s,l||0,h)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}updateExpressions(i){let r=new Set;for(let a of i){let i=this.programConfigurations[a.id];i&&(i.updateExpressions(a),r.add(a.id))}for(let i in this.programConfigurations)r.has(i)||delete this.programConfigurations[i]}}let lo={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]},ls={"line-pattern":{source:o7,composite:o7},"fill-pattern":{source:o7,composite:o7},"fill-extrusion-pattern":{source:o7,composite:o7},"line-dasharray":{source:se,composite:se}},ll={color:{source:sx,composite:sa},number:{source:o2,composite:sx}};function lh(i,r,a){let n=ls[i];return n&&n[a]||ll[r][a]}a2(s7,"ConstantBinder"),a2(le,"PatternConstantBinder"),a2(lt,"SourceExpressionBinder",{omit:["expression"]}),a2(lr,"PatternCompositeBinder",{omit:["expression"]}),a2(li,"CompositeExpressionBinder",{omit:["expression"]}),a2(la,"ProgramConfiguration",{omit:["_buffers"]}),a2(ln,"ProgramConfigurationSet");class lu{constructor(i,r,a){this.layoutVertexArray=new oQ,this.indexArray=new sc,this.lineIndexArray=new so,this.triangleSegments=new sG,this.lineSegments=new sG,this.programConfigurations=new ln(i,{zoom:r,lut:a}),this.uploaded=!1}update(i,r,a,n,o,s,l,h){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sN.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.lineIndexBuffer=i.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(i,r,a,n,o,s,l){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,r,a,n,o,s,void 0,l)}}a2(lu,"FillBufferData");class lc{constructor(i){this.zoom=i.zoom,this.pixelRatio=i.pixelRatio,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=i.lut,this.bufferData=new lu(i.layers,i.zoom,i.lut),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.sourceLayerIndex=i.sourceLayerIndex,this.sourceLayerName=i.sourceLayerName||"",this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.hasPattern=oI("fill",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=o$(l,i);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let f=o?o.evaluate(d,{},a,r.availableImages):void 0,p={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:oq(l,a,n),patterns:{},sortKey:f};s.push(p)}for(let n of(o&&s.sort((i,r)=>i.sortKey-r.sortKey),s)){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(this.hasPattern){let i=oA("fill",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,{},r.availableImages,r.brightness,r.elevationFeatures);r.featureIndex.insert(i[s].feature,o,s,l,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(i,r,a,n,o,s,l){this.bufferData.update(i,r,a,n,o,s,l,this.worldview),this.hdExt&&this.hdExt.update(i,r,a,n,o,s,l,this.worldview)}updateExpressions(i){this.bufferData.programConfigurations.updateExpressions(i),this.hdExt&&this.hdExt.updateExpressions(i)}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||null!=this.hdExt&&this.hdExt.needsUpload()}upload(i){this.bufferData.upload(i),this.hdExt&&this.hdExt.upload(i)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}
7addFeature(i,r,a,n,o,s=[],l,h){let u=this.hdExt?this.hdExt.trackFeatureFrc(i.properties):null,c=this.bufferData.indexArray.length,d=e2(r,500);null!=this.hdExt&&this.hdExt.handleFeature(i,d,a,n,h,this)||this.addGeometry(d,this.bufferData),this.bufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,c,this.bufferData.indexArray.length,u)}addGeometry(i,r,a,n){let o=1/0,s=-1/0,l=null;a&&null!=(l=a.elevationSampler.constantElevation(a.elevation,a.bias))&&(o=l,s=l);let h=a?r:null,u=(i,r,n)=>{if(null!=a)if(r.push(i),null!=l)h.elevatedLayoutVertexArray.emplaceBack(l),n.push(l);else{let r=a.elevationSampler.pointElevation(i,a.elevation,a.bias);h.elevatedLayoutVertexArray.emplaceBack(r),n.push(r),o=Math.min(o,r),s=Math.max(s,r)}};for(let o of i){let i=0;for(let r of o)i+=r.length;let s=r.triangleSegments.prepareSegment(i,r.layoutVertexArray,r.indexArray),l=s.vertexLength,h=[],c=[],d=[],f=[],p=[],m=r.layoutVertexArray.length;for(let i of o){if(0===i.length)continue;i!==o[0]&&c.push(h.length/2);let n=r.lineSegments.prepareSegment(i.length,r.layoutVertexArray,r.lineIndexArray),s=n.vertexLength;a&&p.push(r.layoutVertexArray.length-m),u(i[0],d,f),r.layoutVertexArray.emplaceBack(i[0].x,i[0].y),r.lineIndexArray.emplaceBack(s+i.length-1,s),h.push(i[0].x),h.push(i[0].y);for(let a=1;a<i.length;a++)u(i[a],d,f),r.layoutVertexArray.emplaceBack(i[a].x,i[a].y),r.lineIndexArray.emplaceBack(s+a-1,s+a),h.push(i[a].x),h.push(i[a].y);n.vertexLength+=i.length,n.primitiveLength+=i.length}let _=ol(h,c);for(let i=0;i<_.length;i+=3)r.indexArray.emplaceBack(l+_[i],l+_[i+1],l+_[i+2]);if(_.length>0&&a&&n){let i=a.elevation.isTunnel(),r=a.elevation.safeArea,o=n.addVertices(d,f);n.addTriangles(_,o,i);let s=p.length;if(s>0){for(let l=0;l<s-1;l++)n.addRenderableRing(a.index,p[l]+o,p[l+1]-p[l],i,r,a.featureInfo);n.addRenderableRing(a.index,p[s-1]+o,d.length-p[s-1],i,r,a.featureInfo)}}s.vertexLength+=i,s.primitiveLength+=_.length/3}return[o,s]}}a2(lc,"FillBucket",{omit:["layers","patternFeatures"]});let ld=oK([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),lf=oK([{name:"a_z_offset_width",components:4,type:"Float32"}],4),lp=oK([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),lm=oK([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:l_}=ld,{members:lg}=oK([{name:"a_packed",components:3,type:"Float32"}]),{members:ly}=oK([{name:"a_pattern_data",components:3,type:"Float32"}]);class lx{constructor(i,r,a,n,o){for(this.properties=Object.create(null),this.extent=a,this.type=0,this.id=void 0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=o;i.pos<r;){const r=i.readVarint();if(8===r)this.id=i.readVarint();else if(18===r){const r=i.readVarint()+i.pos;for(;i.pos<r;){const r=n[i.readVarint()],a=o[i.readVarint()];this.properties[r]=a}}else 24===r?this.type=i.readVarint():(34===r&&(this._geometry=i.pos),i.skip(r))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=[],n,o=1,s=0,l=0,h=0;for(;i.pos<r;){if(s<=0){let r=i.readVarint();if(o=7&r,0==(s=r>>3))continue}if(s--,1===o)l+=i.readSVarint(),h+=i.readSVarint(),n&&a.push(n),n=[new eJ(l,h)];else if(2===o)l+=i.readSVarint(),h+=i.readSVarint(),n&&n.push(new eJ(l,h));else{if(7!==o)throw Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&a.push(n),a}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=1,n=0,o=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;for(;i.pos<r;){if(n<=0){let r=i.readVarint();if(a=7&r,0==(n=r>>3))continue}if(n--,1===a||2===a)o+=i.readSVarint(),s+=i.readSVarint(),o<l&&(l=o),o>h&&(h=o),s<u&&(u=s),s>c&&(c=s);else if(7!==a)throw Error(`unknown command ${a}`)}return[l,u,h,c]}toGeoJSON(i,r,a){let n,o=this.extent*Math.pow(2,a),s=this.extent*i,l=this.extent*r,h=this.loadGeometry();function u(i){return[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(i.y+l)/o)*Math.PI))-90]}function c(i){return i.map(u)}if(1===this.type){let i=[];for(let r of h)i.push(r[0]);let r=c(i);n=1===i.length?{type:"Point",coordinates:r[0]}:{type:"MultiPoint",coordinates:r}}else if(2===this.type){let i=h.map(c);n=1===i.length?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}}else{if(3!==this.type)throw Error("unknown feature type");{let i=function(i){let r,a,n=i.length;if(n<=1)return[i];let o=[];for(let s=0;s<n;s++){let n=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[s]);0!==n&&(void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[i[s]]):r&&r.push(i[s]))}return r&&o.push(r),o}(h),r=[];for(let a of i)r.push(a.map(c));n=1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}}let d={type:"Feature",geometry:n,properties:this.properties};return null!=this.id&&(d.id=this.id),d}}lx.types=["Unknown","Point","LineString","Polygon"];class lv{constructor(i,r){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],void 0===r&&(r=i.length);i.pos<r;){const r=i.readVarint();10===r?this.name=i.readString():18===r?(this._features.push(i.pos),i.skip(r)):26===r?this._keys.push(i.readString()):34===r?this._values.push(function(i){let r=null,a=i.readVarint()+i.pos;for(;i.pos<a;){let a=i.readVarint();r=10===a?i.readString():21===a?i.readFloat():25===a?i.readDouble():32===a?i.readVarint(!0):40===a?i.readVarint():48===a?i.readSVarint():56===a?i.readBoolean():(i.skip(a),null)}if(null==r)throw Error("unknown feature value");return r}(i)):40===r?this.extent=i.readVarint():120===r?this.version=i.readVarint():i.skip(r)}this.length=this._features.length}feature(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];let r=this._pbf.readVarint()+this._pbf.pos;return new lx(this._pbf,r,this.extent,this._keys,this._values)}}class lb{constructor(i,r=i.length){const a=Object.create(null);for(;i.pos<r;){const r=i.readVarint();if(26===r){const r=new lv(i,i.readVarint()+i.pos);r.length&&(a[r.name]=r)}else i.skip(r)}this.layers=a}}function lw(i,r){for(let a=0;a<i.length;a++)if(lC(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lC(i,r[a]))return!0;return!!lS(i,r)}function lT(i,r){if(1===i.length)return lM(r,i[0]);for(let a=0;a<r.length;a++){let n=r[a];for(let r=0;r<n.length;r++)if(lC(i,n[r]))return!0}for(let a=0;a<i.length;a++)if(lM(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lS(i,r[a]))return!0;return!1}function lS(i,r){if(0===i.length||0===r.length)return!1;for(let l=0;l<i.length-1;l++){let h=i[l],u=i[l+1];for(let i=0;i<r.length-1;i++){var a,n,o,s;if(a=h,n=u,o=r[i],tw(a,o,s=r[i+1])!==tw(n,o,s)&&tw(a,n,o)!==tw(a,n,s))return!0}}return!1}function lE(i,r,a){return(i.x-a.x)*(r.y-a.y)-(i.y-a.y)*(r.x-a.x)}function lI(i,r,a){let n=a*a;if(1===r.length)return i.distSqr(r[0])<n;for(let a=1;a<r.length;a++)if(lA(i,r[a-1],r[a])<n)return!0;return!1}function lA(i,r,a){let n=r.distSqr(a);if(0===n)return i.distSqr(r);let o=((i.x-r.x)*(a.x-r.x)+(i.y-r.y)*(a.y-r.y))/n;return i.distSqr(o<0?r:o>1?a:a.sub(r)._mult(o)._add(r))}function lM(i,r){let a,n,o,s=!1;for(let l=0;l<i.length;l++){a=i[l];for(let i=0,l=a.length-1;i<a.length;l=i++)n=a[i],o=a[l],n.y>r.y!=o.y>r.y&&r.x<(o.x-n.x)*(r.y-n.y)/(o.y-n.y)+n.x&&(s=!s)}return s}function lC(i,r){let a=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){let s=i[n],l=i[o];s.y>r.y!=l.y>r.y&&r.x<(l.x-s.x)*(r.y-s.y)/(l.y-s.y)+s.x&&(a=!a)}return a}function lD(i,r,a,n,o){for(let s of i)if(r<=s.x&&a<=s.y&&n>=s.x&&o>=s.y)return!0;let s=[new eJ(r,a),new eJ(r,o),new eJ(n,o),new eJ(n,a)];if(i.length>2){for(let r of s)if(lC(i,r))return!0}for(let r=0;r<i.length-1;r++)if(lR(i[r],i[r+1],s))return!0;return!1}function lR(i,r,a){let n=a[0],o=a[2];if(i.x<n.x&&r.x<n.x||i.x>o.x&&r.x>o.x||i.y<n.y&&r.y<n.y||i.y>o.y&&r.y>o.y)return!1;let s=tw(i,r,a[0]);return s!==tw(i,r,a[1])||s!==tw(i,r,a[2])||s!==tw(i,r,a[3])}function lP(i,r,a,n,o,s){let l=r.y-i.y,h=i.x-r.x;if(s=s||0){let i=l*l+h*h;if(0===i)return!0;let r=Math.sqrt(i);l/=r,h/=r}return!((a.x-i.x)*l+(a.y-i.y)*h-s<0||(n.x-i.x)*l+(n.y-i.y)*h-s<0||(o.x-i.x)*l+(o.y-i.y)*h-s<0)}function lL(i,r,a,n,o,s,l){return!(lP(i,r,n,o,s,l)||lP(r,a,n,o,s,l)||lP(a,i,n,o,s,l)||lP(n,o,i,r,a,l)||lP(o,s,i,r,a,l)||lP(s,n,i,r,a,l))}class lz extends eJ{constructor(i,r,a){super(i,r),this.z=a}}class lO extends lz{constructor(i,r,a,n){super(i,r,a),this.w=n}}function lF(i,r,a,n){let o="x"===a?"y":"x",s=(n-i[a])/(r[a]-i[a]);i[o]=Math.round(i[o]+(r[o]-i[o])*s),i[a]=n,Object.hasOwn(i,"z")&&(i.z=iw(i.z,r.z,s)),Object.hasOwn(i,"w")&&(i.w=iw(i.w,r.w,s))}function lB(i,r,a,n){for(let o of["x","y"]){let s=i,l=r;s[o]>=l[o]&&(s=r,l=i),s[o]<a&&l[o]>a&&lF(s,l,o,a),s[o]<n&&l[o]>n&&lF(l,s,o,n)}}function lk(i,r,a,n,o,s){let l=[];for(let h=0;h<i.length;h++){let u,c=i[h],d=l.length,f=0;for(let i=0;i<c.length-1;i++){let d,p,m=c[i],_=c[i+1],g=0,y=f;s&&(f+=g=Math.hypot(_.x-m.x,_.y-m.y),d=m,p=_),m.x<r&&_.x<r||(m.x<r?m=new eJ(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.
7y))._round():_.x<r&&(_=new eJ(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y<a&&_.y<a||(m.y<a?m=new eJ(m.x+(a-m.y)/(_.y-m.y)*(_.x-m.x),a)._round():_.y<a&&(_=new eJ(m.x+(a-m.y)/(_.y-m.y)*(_.x-m.x),a)._round()),m.x>=n&&_.x>=n||(m.x>=n?m=new eJ(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x>=n&&(_=new eJ(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y>=o&&_.y>=o||(m.y>=o?m=new eJ(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round():_.y>=o&&(_=new eJ(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round()),u&&m.equals(u.at(-1))||(u=[m],l.push(u),s&&s.push({progress:{min:y+lN(d,p,m)*g,max:1},parentIndex:h,prevPoint:d,nextPoint:p})),u.push(_),s&&(s.at(-1).progress.max=y+lN(d,p,_)*g,s.at(-1).nextPoint=p)))))}if(s&&f>0)for(let i=d;i<l.length;i++)s[i].progress.min/=f,s[i].progress.max/=f}return l}function lN(i,r,a){return i.x!==r.x?(a.x-i.x)/(r.x-i.x):i.y!==r.y?(a.y-i.y)/(r.y-i.y):0}function lU(i,{width:r,height:a},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==r*a*n)throw RangeError("mismatched image size")}else o=new Uint8Array(r*a*n);return i.width=r,i.height=a,i.data=o,i}function lV(i,r,a){let{width:n,height:o}=r;n===i.width&&o===i.height||(lj(i,r,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,n),height:Math.min(i.height,o)},a,null),i.width=n,i.height=o,i.data=r.data)}function lj(i,r,a,n,o,s,l,h){if(0===o.width||0===o.height)return r;if(o.width>i.width||o.height>i.height||a.x>i.width-o.width||a.y>i.height-o.height)throw RangeError("out of range source coordinates for image copy");if(o.width>r.width||o.height>r.height||n.x>r.width-o.width||n.y>r.height-o.height)throw RangeError("out of range destination coordinates for image copy");let u=i.data,c=r.data,d=4===s&&h;for(let h=0;h<o.height;h++){let f=((a.y+h)*i.width+a.x)*s,p=((n.y+h)*r.width+n.x)*s;if(d)for(let i=0;i<o.width;i++){let r=f+i*s+3,a=p+i*s;c[a+0]=255,c[a+1]=255,c[a+2]=255,c[a+3]=u[r]}else if(l)for(let i=0;i<o.width;i++){let r=f+i*s,a=p+i*s,n=new iS(u[r+0]/255,u[r+1]/255,u[r+2]/255,u[r+3]).toNonPremultipliedRenderColor(l).toArray();c[a+0]=n[0],c[a+1]=n[1],c[a+2]=n[2],c[a+3]=n[3]}else for(let i=0;i<o.width*s;i++)c[p+i]=u[f+i]}return r}class lG{constructor(i,r){lU(this,i,1,r)}resize(i){lV(this,new lG(i),1)}clone(){return new lG({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o){lj(i,r,a,n,o,1,null)}}class lH{constructor(i,r){lU(this,i,4,r)}resize(i){lV(this,new lH(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new lH({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o,s,l){lj(i,r,a,n,o,4,s,l)}}class lq{constructor(i,r){this.width=i.width,this.height=i.height,this.data=r instanceof Uint8Array?new Float32Array(r.buffer):r}}a2(lG,"AlphaImage"),a2(lH,"RGBAImage");class l${constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new lG({width:i,height:r}),this.positions={},this.uploaded=!1}getDash(i,r){let a=this.getKey(i,r);return this.positions[a]}trim(){let i=this.width,r=this.height=tp(this.nextRow);this.image.resize({width:i,height:r})}getKey(i,r){return i.join(",")+r}getDashRanges(i,r,a){let n=[],o=i.length%2==1?-i.at(-1)*a:0,s=i[0]*a,l=!0;n.push({left:o,right:s,isDash:l,zeroLength:0===i[0]});let h=i[0];for(let r=1;r<i.length;r++){l=!l;let u=i[r];o=h*a,h+=u,s=h*a,n.push({left:o,right:s,isDash:l,zeroLength:0===u})}return n}addRoundDash(i,r,a){let n=r/2;for(let r=-a;r<=a;r++){let o=this.width*(this.nextRow+a+r),s=0,l=i[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=i[++s]);let c=Math.min(Math.abs(h-l.left),Math.abs(h-l.right)),d=r/a*(n+1);if(l.isDash){let i=n-Math.abs(d);u=Math.sqrt(c*c+i*i)}else u=n-Math.sqrt(c*c+d*d);this.image.data[o+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let r=i.length-1;r>=0;--r){let a=i[r],n=i[r+1];a.zeroLength?i.splice(r,1):n&&n.isDash===a.isDash&&(n.left=a.left,i.splice(r,1))}let a=i[0],n=i.at(-1);a.isDash===n.isDash&&(a.left=n.left-this.width,n.right=a.right+this.width);let o=this.width*this.nextRow,s=0,l=i[0];for(let a=0;a<this.width;a++){a/l.right>1&&(l=i[++s]);let n=Math.min(Math.abs(a-l.left),Math.abs(a-l.right));this.image.data[o+a]=Math.max(0,Math.min(255,(l.isDash?n:-n)+r+128))}}
7addDash(i,r){let a=this.getKey(i,r);if(this.positions[a])return this.positions[a];let n="round"===r,o=7*!!n,s=2*o+1;if(this.nextRow+s>this.height)return tb("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let r=0;r<i.length;r++)i[r]<0&&(tb("Negative value is found in line dasharray, replacing values with 0"),i[r]=0),l+=i[r];if(0!==l){let a=this.width/l,s=this.getDashRanges(i,this.width,a);n?this.addRoundDash(s,a,o):this.addRegularDash(s,"square"===r?.5*a:0)}let h=this.nextRow+o;this.nextRow+=s;let u=Math.floor(l),c={tl:[h,o],br:[u,Math.round(65535*(l-u))]};return this.positions[a]=c,c}}a2(l$,"LineAtlas");let lZ="3d_elevation_id",lW="level",lX=lx.types,lY=Math.cos(Math.PI/180*37.5),lK=Math.cos(Math.PI/180*5);class lJ{constructor(i){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.zoom=i.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=i.overscaling,this.pixelRatio=i.pixelRatio,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.projection=i.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new o8,this.layoutVertexArray2=new o9,this.patternVertexArray=new o9,this.indexArray=new sc,this.programConfigurations=new ln(i.layers,{zoom:i.zoom,lut:i.lut}),this.segments=new sG,this.sourceLayerName=i.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new sa,this.elevationIdColVertexArray=new o9,this.elevationGroundScaleVertexArray=new o2,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=i.tessellationStep?i.tessellationStep:128,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.showElevationIdDebug=r.showElevationIdDebug,this.hasPattern=oI("line",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("line-sort-key");this.tileToMeter=oV(a);let s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{let i=this.layers[0].layout.get("line-z-offset"),r=i.isConstant()&&!i.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&r?"none":"offset","offset"===this.elevationType&&"none"===s&&tb(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===s}let l=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==l;let h=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=o$(s,i);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let f=o?o.evaluate(d,{},a):void 0,p={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:oq(s,a,n),patterns:{},sortKey:f};h.push(p)}o&&h.sort((i,r)=>i.sortKey-r.sortKey);let{lineAtlas:u,featureIndex:c}=r,d=this.addConstantDashes(u);for(let n of h){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(d&&this.addFeatureDashes(n,u),this.hasPattern){let i=oA("line",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,u.positions,r.availableImages,r.brightness,r.elevationFeatures);c.insert(i[s].feature,o,s,l,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}addConstantDashes(i){let r=!1;for(let a of this.layers){let n=a.paint.get("line-dasharray").value,o=a.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==o.kind)r=!0;else{let r=o.value,a=n.value;if(!a)continue;i.addDash(a,r)}}return r}addFeatureDashes(i,r){let a=this.zoom;for(let n of this.layers){let o,s,l=n.paint.get("line-dasharray").value,h=n.layout.get("line-cap").value;if("constant"!==l.kind||"constant"!==h.kind){if("constant"===l.kind){if(!(o=l.value))continue}else o=l.evaluate({zoom:a},i);s="constant"===h.kind?h.value:h.evaluate({zoom:a},i),r.addDash(o,s),i.patterns[n.id]=[r.getKey(o,s)]}}}update(i,r,a,n,o,s,l,h,u){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,u)}updateExpressions(i){this.programConfigurations.updateExpressions(i)}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,lg)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=i.createVertexBuffer(this.patternVertexArray,ly)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,lf.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=i.createVertexBuffer(this.elevationIdColVertexArray,lp.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=i.createVertexBuffer(this.elevationGroundScaleVertexArray,lm.members,!0)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,l_),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i,r){let a,n;if(r&&r>0?(a=`mapbox_clip_start_${r}`,n=`mapbox_clip_end_${r}`):(a="mapbox_clip_start",n="mapbox_clip_end"),i.properties&&Object.hasOwn(i.properties,a)&&Object.hasOwn(i.properties,n))return{start:+i.properties[a],end:+i.properties[n]}}addFeature(i,r,a,n,o,s,l,h){let u=this.layers[0].layout,c=this.hdExt?this.hdExt.trackFeatureFrc(i.properties):null,d=this.indexArray.length,f=u.get("line-join").evaluate(i,{}),p=u.get("line-cap").evaluate(i,{}),m=u.get("line-miter-limit"),_=u.get("line-round-limit");this.lineClips=this.lineFeatureClips(i),this.lineFeature=i;let g=!(!i.properties||!Object.hasOwn(i.properties,"mapbox_line_metrics"))&&i.properties.mapbox_line_metrics;this.zOffsetValue=u.get("line-z-offset").value;let y=this.layers[0].paint,x=y.get("line-width").value;"constant"!==x.kind&&!1===x.isLineProgressConstant&&(this.variableWidthValue=x);let v=y.get("line-emissive-strength").value;if("constant"!==v.kind&&!1===v.isLineProgressConstant&&(this.variableEmissiveStrengthValue=v),this.isSeaLevelReference){let i=u.get("line-elevation-ground-scale").value;"constant"===i.kind&&0===i.value||(this.elevationGroundScaleValue=i)}
7if(null==this.hdExt||!this.hdExt.handleFeature(i,r,n,h,f,p,m,_,this))for(let a=0;a<r.length;a++)this.addLine(r[a],i,n,f,p,m,_,void 0,g&&a>0?a:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,o,s,n,l,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,d,this.indexArray.length,c)}fillNonElevatedRoadSegment(i){for(let r=i;r<this.layoutVertexArray.length;r++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(i,r,a,n,o,s,l,h,u){let c,d,f,p,m,_,g,y;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=u?this.lineFeatureClips(r,u):this.lineClips;let x="none"===n;this.patternJoinNone=this.hasPattern&&x,this.currentLineJoinType=n,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];let v=h&&h.progress.min>0,b=h&&h.progress.max<1;if(this.lineClips){let a={min:this.lineClips.start,max:this.lineClips.end},n=1;if(h){var w,T,S;let i=this.lineClips.end-this.lineClips.start;w=h.progress,T={min:0,max:1},S=a,a={min:tN(w.min,T,S),max:tN(w.max,T,S)},i>0&&(n=(a.max-a.min)/i)}let o=+r.properties.mapbox_clip_feature_len,s=+r.properties.mapbox_clip_seg_len;if(Number.isNaN(o)||Number.isNaN(s)){for(let r=0;r<i.length-1;r++)this.totalDistance+=i[r].dist(i[r+1]);let r=this.totalDistance/(a.max-a.min);this.totalFeatureLength=Number.isFinite(r)?r:0,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=o,this.distance=s*n,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}let E="Polygon"===lX[r.type],I=i.length;for(;I>=2&&i[I-1].equals(i[I-2]);)I--;let A=0;for(;A<I-1&&i[A].equals(i[A+1]);)A++;if(I<(E?3:2))return;"bevel"===n&&(s=1.05);let M=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);h&&h.prevDir&&(_=h.prevDir.perp()),h&&h.nextDir&&(g=h.nextDir.perp()),this.e1=this.e2=-1,E&&(c=i[I-2],m=i[A].sub(c)._unit()._perp());for(let r=A;r<I;r++){if((f=r===I-1?E?i[A+1]:void 0:i[r+1])&&i[r].equals(f))continue;m&&(p=m),c&&(d=c),c=i[r],y=this.evaluateLineProgressFeatures(d?d.dist(c):0),m=f?f.sub(c)._unit()._perp():p,p=p||m;let a=d&&f,h=a?n:E||x?"butt":o,u=p.x*m.x+p.y*m.y;if(x){let i=function(i){if(i.patternJoinNone){let r=i.segmentPoints.length/2,a=i.lineSoFar-i.segmentStart;for(let n=0;n<r;++n){let r=i.segmentPoints[2*n+1],o=Math.round(i.segmentPoints[2*n])+.5+.25*r;i.patternVertexArray.emplaceBack(o,a,i.segmentStart),i.patternVertexArray.emplaceBack(o,a,i.segmentStart)}i.segmentPoints.length=0}i.e1=i.e2=-1};if(a&&u<lK){this.updateDistance(d,c),this.addCurrentVertex(c,p,1,1,M,y),i(this),this.addCurrentVertex(c,m,-1,-1,M,y);continue}if(d){if(!f){this.updateDistance(d,c),this.addCurrentVertex(c,p,1,1,M,y),i(this);continue}h="miter"}}let w=p.add(m);0===w.x&&0===w.y||w._unit();let T=w.x*m.x+w.y*m.y,S=0!==T?1/T:1/0,C=2*Math.sqrt(2-2*T),D=T<lY&&d&&f,R=p.x*m.y-p.y*m.x>0,P=this.overscaling<=16?122880/(512*this.overscaling):0;if(a&&"round"===h){if(S<l)h="miter";else if(S<=2){let i=lQ(c,-10,8202);h="offset"===this.elevationType&&(i||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===h&&S>s&&(h="bevel"),"bevel"===h&&(S>2&&(h="flipbevel"),S<s&&(h="miter")),d&&!("miter"===h&&D)&&this.updateDistance(d,c),"miter"
7===h)if(D){let i=c.dist(d);if(i>2*P){let r=c.sub(c.sub(d)._mult(P/i)._round());this.updateDistance(d,r),this.addCurrentVertex(r,p,0,0,M,y),d=r}this.updateDistance(d,c),w._mult(S),this.addCurrentVertex(c,w,0,0,M,y);let r=c.dist(f);if(r>2*P){let i=c.add(f.sub(c)._mult(P/r)._round());this.updateDistance(c,i),this.addCurrentVertex(i,m,0,0,M,y),c=i}}else w._mult(S),this.addCurrentVertex(c,w,0,0,M,y);else if("flipbevel"===h){if(S>100)w=m.mult(-1);else{let i=S*p.add(m).mag()/p.sub(m).mag();w._perp()._mult(i*(R?-1:1))}this.addCurrentVertex(c,w,0,0,M,y),this.addCurrentVertex(c,w.mult(-1),0,0,M,y)}else if("bevel"===h||"fakeround"===h){let i=c.dist(d),r=1;if("offset"===this.elevationType&&"bevel"===h&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=y&&d&&f){let a=4*P;i<a&&(r=Math.max(0,i/a))}null!=y&&d&&this.addCurrentVertex(c,g||p,-r,-r,M,y);let a=i<=2*P&&"bevel"!==h,n=w.mult(R?1:-1);n._mult(S);let o=m.mult(R?-1:1),s=p.mult(R?-1:1),l=this.evaluateLineProgressFeatures(this.distance);if(null==y&&(this.addHalfVertex(c,n.x,n.y,!1,!R,0,M,l),a||this.addHalfVertex(c,n.x+2*s.x,n.y+2*s.y,!1,R,0,M,l)),"fakeround"===h){let i=Math.round(180*C/Math.PI/20);this.addHalfVertex(c,s.x,s.y,!1,R,0,M,l);for(let r=0;r<i;r++){let a=r/i;if(.5!==a){let i=a-.5;a+=a*i*(a-1)*((1.0904+u*(u*(3.55645-1.43519*u)-3.2452))*i*i+(.848013+u*(.215638*u-1.06021)))}let n=o.sub(s)._mult(a)._add(s)._unit();this.addHalfVertex(c,n.x,n.y,!1,R,0,M,l)}this.addHalfVertex(c,o.x,o.y,!1,R,0,M,l)}a||null!=y||this.addHalfVertex(c,n.x+2*o.x,n.y+2*o.y,!1,R,0,M,l),null!=y&&f&&this.addCurrentVertex(c,_||m,r,r,M,y)}else if("butt"===h)this.addCurrentVertex(c,w,0,0,M,y);else if("square"===h){if(!d){let i=v?0:-1;this.addCurrentVertex(c,w,i,i,M,y)}if(this.addCurrentVertex(c,w,0,0,M,y),d){let i=+!b;this.addCurrentVertex(c,w,i,i,M,y)}}else if("round"===h){if(d){let i=!a&&g?g:p;this.addCurrentVertex(c,i,0,0,M,y),!a&&b||this.addCurrentVertex(c,i,1,1,M,y,!0)}if(f){let i=!a&&_?_:m;!a&&v||this.addCurrentVertex(c,i,-1,-1,M,y,!0),this.addCurrentVertex(c,i,0,0,M,y)}}}}addVerticesTo(i,r,a,n,o,s,l,h,u,c){let d=(r.w-i.w)/this.tessellationStep|0,f=0,p=this.scaledDistance;if(d>1){this.lineSoFar=i.w;let a=(r.x-i.x)/d,n=(r.y-i.y)/d,o=(r.z-i.z)/d,s=(r.w-i.w)/d,l=r.x-i.x,h=r.y-i.y,p=Math.sqrt(l*l+h*h);if(0===p)return;let m=-h/p,_=l/p,g=-m,y=-_;for(let r=1;r<d;++r){i.x+=a,i.y+=n,i.z+=o,this.lineSoFar+=s,f+=s;let r=this.evaluateLineProgressFeatures(this.prevDistance+f);this.scaledDistance=(this.prevDistance+f)/this.totalDistance,this.addHalfVertex(i,m,_,c,!1,0,u,r),this.addHalfVertex(i,g,y,c,!0,0,u,r)}}this.lineSoFar=r.w,this.scaledDistance=p;let m=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(r,a,n,c,!1,l,u,m),this.addHalfVertex(r,o,s,c,!0,-h,u,m)}evaluateLineProgressFeatures(i){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+i)/this.totalFeatureLength):tb(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let r=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(r=.5*(this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0));let a=0;this.variableEmissiveStrengthValue&&"constant"!==this.variableEmissiveStrengthValue.kind&&(a=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);let n=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength:a}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength:a}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength:a}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(i,r,a,n,o,s,l=!1){let h=r.x+r.y*a,u=r.y-r.x*a,c=r.y*n-r.x,d=-r.y-r.x*n;if(null!=s){let r="offset"===this.elevationType,f="offset"===this.elevationType?2:10,p=-f,m=8192+f,_=s.zOffset,g=new lO(i.x,i.y,_,this.lineS
7oFar),y=!!r&&lQ(i,p,m),x=this.lineSoFar,v=this.distance;if(this.currentVertex)if(y){let r=this.currentVertexIsOutside,s=this.currentVertex,f=new lO(i.x,i.y,_,this.lineSoFar);if(lB(s,f,p,m),!lQ(f,p,m)){if(r){this.e1=this.e2=-1,this.distance-=s.dist(g),this.lineSoFar=s.w;let i=this.evaluateLineProgressFeatures(s.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(s,h,u,l,!1,a,o,i),this.addHalfVertex(s,c,d,l,!0,-n,o,i),this.prevDistance=this.distance}this.distance=this.prevDistance+s.dist(f),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(s,f,h,u,c,d,a,n,o,l),this.distance=v,this.scaledDistance=this.distance/this.totalDistance}}else{let i=this.currentVertex;if(this.currentVertexIsOutside){lB(i,g,p,m),this.e1=this.e2=-1,this.distance-=i.dist(g),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i.w;let r=this.evaluateLineProgressFeatures(i.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(i,h,u,l,!1,a,o,r),this.addHalfVertex(i,c,d,l,!0,-n,o,r),this.prevDistance=this.distance,this.distance=v,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(i,g,h,u,c,d,a,n,o,l)}else y||(this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s));this.currentVertex=g,this.currentVertexIsOutside=y,this.lineSoFar=x}else this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s)}addHalfVertex({x:i,y:r},a,n,o,s,l,h,u){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,l)),this.layoutVertexArray.emplaceBack((i<<1)+ +!!o,(r<<1)+ +!!s,Math.round(63*a)+128,Math.round(63*n)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){let i=iw(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,i)}let c=h.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),h.primitiveLength++),s?this.e2=c:this.e1=c,null!=u&&(this.zOffsetVertexArray.emplaceBack(u.zOffset,u.variableWidth,u.variableWidth,u.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){let i=u?u.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(i)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(i,r){this.prevDistance=this.distance,this.distance+=i.dist(r),this.updateScaledDistance()}}function lQ(i,r,a){return i.x<r||i.x>a||i.y<r||i.y>a}a2(lJ,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let l0=oK([{name:"a_pos",components:2,type:"Int16"}],4),l1=oK([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),l2=oK([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class l3{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.projection=i.projection,this.layoutVertexArray=new oQ,this.indexArray=new sc,this.segments=new sG,this.programConfigurations=new ln(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=this.layers[0],s=[],l=null;for(let{feature:h,id:u,index:c,sourceLayerIndex:d}of("circle"===o.type&&(l=o.layout.get("circle-sort-key")),i)){let i=this.layers[0]._featureFilter.needGeometry,o=o$(h,i);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),o,a))continue;let f=l?l.evaluate(o,{},a):void 0,p={id:u,properties:h.properties,type:h.type,sourceLayerIndex:d,index:c,geometry:i?o.geometry:oq(h,a,n),patterns:{},sortKey:f};s.push(p)}l&&s.sort((i,r)=>i.sortKey-r.sortKey);let h=null;for(let o of("globe"===n.projection.name&&(this.globeExtVertexArray=new st,h=n.projection),s)){let{geometry:n,index:s,sourceLayerIndex:l}=o,u=i[s].feature;this.addFeature(o,n,s,r.availableImages,a,h,r.brightness,r.elevationFeatures),r.featureIndex.insert(u,n,s,l,this.index)}this.hdExt&&this.hdExt.finalize()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview)}updateExpressions(i){this.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,l0.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,l2.members)),this.hdExt&&this.hdExt.upload(i)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.hdExt&&this.hdExt.destroy())}addFeature(i,r,a,n,o,s,l,h){for(let a of(this.hdExt&&this.hdExt.beginFeature(i,h),r))for(let r of a){let a=r.x,n=r.y;if(a<0||a>=8192||n<0||n>=8192)continue;if(s){let i=s.projectTilePoint(a,n,o),r=s.upVector(o,a,n);this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),h=l.vertexLength;this.addCircleVertex(a,n,-1,-1),this.addCircleVertex(a,n,1,-1),this.addCircleVertex(a,n,1,1),this.addCircleVertex(a,n,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(a,n),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,{},n,o,l,void 0,this.worldview)}addCircleVertex(i,r,a,n){this.layoutVertexArray.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}addGlobeExtVertex(i,r){this.globeExtVertexArray.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}}a2(l3,"CircleBucket",{omit:["layers"]});let l4=oK([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),l5=oK([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),l6=oK([{name:"a_projected_pos",components:4,type:"Float32"}],4);oK([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let l8=oK([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),l9=oK([{name:"a_feature_index",components:1,type:"Float32"}],4),l7=oK([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),he=oK([{name:"a_texb",components:2,type:"Uint16"}]),ht=oK([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),hi=oK([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);oK([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let hr=oK([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ha=oK([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);oK([{name:"triangle",components:3,type:"Uint16"}]),oK([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),oK([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
7]),oK([{type:"Float32",name:"offsetX"}]),oK([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);let hn=class i{static getBlockIndices(r){let a=i._blockIndicesTemplate;if(!a){a=i._blockIndicesTemplate=new Uint32Array(r);for(let i=0;i<r;i++)a[i]=i}return a}constructor(i,r,a,n){this.batchIndex=r,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=i||null,this.propsDwords=a,this.totalBytes=4*this.propsDwords,this.headerData=n,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,i&&this._initBuffers(i)}_initBuffers(r){let a=r.gl;if(this.totalBytes>r.maxUniformBlockSize)throw Error(`UBO size ${this.totalBytes} exceeds device limit ${r.maxUniformBlockSize}`);if(this.headerBuffer=a.createBuffer(),!this.headerBuffer)throw Error("Failed to create header UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferData(a.UNIFORM_BUFFER,i.HEADER_BYTES,a.DYNAMIC_DRAW),this.propertiesBuffer=a.createBuffer(),!this.propertiesBuffer)throw Error("Failed to create properties UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),this.blockIndicesBuffer=a.createBuffer(),!this.blockIndicesBuffer)throw Error("Failed to create block-indices UBO buffer");a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),a.bindBuffer(a.UNIFORM_BUFFER,null)}writeDataDrivenBlock(r,a){let n=this.headerData,o=4*n[2];if(0===o)return;let s=a*o;if(s+o>this.propertiesData.length)throw Error(`UBO write out of bounds: feature index ${a} exceeds propertiesData capacity`);let l=n[0],h=n[1];for(let a=0;a<9;a++)l&1<<a&&this._copyFromFlat(s+n[3+a],a,r,i.EVAL_FLAT_OFFSETS[a],h);(-1===this._propsDirtyMin||s<this._propsDirtyMin)&&(this._propsDirtyMin=s);let u=s+o;u>this._propsDirtyMax&&(this._propsDirtyMax=u)}rightSizeForTransfer(){let i=-1===this._propsDirtyMax?0:this._propsDirtyMax;i<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,i))}_copyFromFlat(i,r,a,n,o){let s=8===r,l=!!(o&1<<r),h=r<2||s&&l?4:s||l?2:1;for(let r=0;r<h;r++)this.propertiesData[i+r]=a[n+r]}upload(r){this.context||(this.context=r);let a=r.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(r);let n=!1;if(this._headerDirty&&(a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferSubData(a.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,n=!0),-1!==this._propsDirtyMin){let i=this._propsDirtyMin,r=this._propsDirtyMax;a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferSubData(a.UNIFORM_BUFFER,4*i,this.propertiesData,i,r-i),this._propsDirtyMin=-1,this._propsDirtyMax=-1,n=!0}this._blockIndicesDirty&&(a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferSubData(a.UNIFORM_BUFFER,0,i.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,n=!0),n&&a.bindBuffer(a.UNIFORM_BUFFER,null)}bind(i,r){let a=i.gl,n=(i,n,o)=>{if(!n)return;let s=a.getUniformBlockIndex(r,i);s!==a.INVALID_INDEX&&(a.uniformBlockBinding(r,s,o),a.bindBufferBase(a.UNIFORM_BUFFER,o,n))},o=3*this.batchIndex;n("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,o),n("SymbolPaintPropertiesUniform",this.propertiesBuffer,o+1),n("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,o+2)}destroy(){if(this.context){let i=this.context.gl;this.headerBuffer&&(i.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(i.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(i.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};function ho(i,r,a,n,o,s,l,h){return!!i&&("constant"===i.kind?"none"===i.value:"none"===i.evaluate({zoom:0,brightness:s,worldview:h},r,a,o,n,l))}function hs(i){if(!(i instanceof nq))return!1;let r=i.value;return("source"===r.kind||"composite"===r.kind)&&r.isStateDependent}hn.HEADER_DWORDS=12,hn.HEADER_BYTES=48,hn.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],hn.EVAL_FLAT_TOTAL=24,hn._blockIndicesTemplate=null,a2(hn,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});let hl=["icon","text"].map(i=>[`${i}-color`,`${i}-halo-color`,`${i}-opacity`,`${i}-halo-width`,`${i}-halo-blur`,`${i}-emissive-strength`,`${i}-occlusion-opacity`,"symbol-z-offset",`${i}
7-translate`]),hh=new Float32Array(hn.EVAL_FLAT_TOTAL),hu=[0,0];class hc{constructor(i,r,a,n,o="",s,l){this.layer=i,this.zoom=r,this.lut=a,this.isText=n,this.worldview=o,this.maxUniformBufferBindings=s||24,this.uboSizeDwords=l||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=null,this.sharedZoomRanges=new Float32Array(18),this.header=new Uint32Array(hn.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=0===this.header[0];const h=4*this.header[2];this.maxFeaturesPerBatch=0===h?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/h)}updateHeader(){let i=this.layer.paint,r=0,a=0,n=0,o=0,s=!0,l=hl[+this.isText];for(let h=0;h<9;h++){let u=l[h],c=h<2,d=8===h,f=i.get(u),p=!(!f||"function"!=typeof f.isConstant||f.isConstant()),m=this._appearancesHavePaintProperties(u),_=!(!f||!f.value||"composite"!==f.value.kind);if(!p&&!m){let i=this.layer._transitionablePaint._values[u];"camera"===(i&&i.value&&i.value.expression&&i.value.expression.kind)&&(n|=1<<h);continue}r|=1<<h,_&&(a|=1<<h);let g=f&&f.value;g&&!1===g.isLightConstant&&(s=!1);let y=c||d&&_,x=y?4:d||_?2:1;y&&o%4!=0?o=o+3&-4:d&&o%4==3&&o++,this.header[3+h]=o,o+=x,_&&f&&this._computeZoomRange(f,Math.floor(this.zoom),2*h)}let h=0===o?0:o+3&-4;this.header[0]=r,this.header[1]=a,this.header[2]=h/4,this.isLightConstant=s,this.cameraMask=n}evaluateAllProperties(i,r,a,n,o,s,l){let h={brightness:o,worldview:this.worldview},u={feature:i,featureState:r,canonical:a,availableImages:n,params:new nk(this.zoom,h),paramsNext:new nk(this.zoom+1,h),formattedSection:s,activeAppearance:l},c=this.header,d=hl[+this.isText];for(let i=0;i<9;i++){let r=d[i],a=8===i,n=!!(c[1]&1<<i),o=hn.EVAL_FLAT_OFFSETS[i];i<2?this._evaluateColorValue(r,n,u,o):a?this._evaluateTranslateValue(r,n,u,o):this._evaluateFloatValue(r,n,u,o)}return hh}_resolveProp(i,r){return r&&r.hasPaintProperty(i)?r.paintProperties.get(i):this.layer.paint.get(i)}_evalAt(i,r,a){return i.property.evaluate(i.value,r,a.feature,a.featureState,a.canonical,a.availableImages,i.iconImageUseTheme,a.formattedSection)}_evaluateColorValue(i,r,a,n){let o=this._resolveProp(i,a.activeAppearance);if(!o)return hh[n]=0,hh[n+1]=0,hh[n+2]=0,void(hh[n+3]=1);let s=this._resolveProp(`${i}-use-theme`,a.activeAppearance),l=ho(s&&"string"!=typeof s?s.value:void 0,a.feature,a.featureState,a.availableImages,a.canonical,a.params.brightness,a.formattedSection,this.worldview)?null:this.lut,h=(o.isConstant()?o.constantOr(iS.transparent):this._evalAt(o,a.params,a)||iS.transparent).toNonPremultipliedRenderColor(l);if(hh[n]=sH(255*h.r,255*h.g),hh[n+1]=sH(255*h.b,255*h.a),r){let i=(this._evalAt(o,a.paramsNext,a)||iS.transparent).toNonPremultipliedRenderColor(l);hh[n+2]=sH(255*i.r,255*i.g),hh[n+3]=sH(255*i.b,255*i.a)}else hh[n+2]=0,hh[n+3]=0}_computeZoomRange(i,r,a){let n=0,o=1,s=i&&i.value,l=s&&"composite"===s.kind?s.zoomStops:null;if(l&&l.length>0)if(null==s.interpolationType){for(let i of(n=o=1,l))if(i>r&&i<r+1){n=o=i-r;break}}else l[0]>r&&l[0]<r+1&&(n=l[0]-r);this.sharedZoomRanges[a]=n,this.sharedZoomRanges[a+1]=o}_evaluateFloatValue(i,r,a,n){let o=+!!i.endsWith("opacity"),s=this._resolveProp(i,a.activeAppearance),l=s?s.isConstant()?s.constantOr(o):this._evalAt(s,a.params,a):o;if(hh[n]=null!=l?l:o,r){let i=this._evalAt(s,a.paramsNext,a);hh[n+1]=null!=i?i:o}else hh[n+1]=0}_evaluateTranslateValue(i,r,a,n){let o=this._resolveProp(i,a.activeAppearance),s=o?"function"!=typeof o.isConstant?o:o.isConstant()?o.constantOr(hu):this._evalAt(o,a.params,a):void 0;if(hh[n]=s?s[0]:0,hh[n+1]=s?s[1]:0,r){let i=this._evalAt(o,a.paramsNext,a);hh[n+2]=i?i[0]:0,hh[n+3]=i?i[1]:0}else hh[n+2]=0,hh[n+3]=0}_appearancesHavePaintProperties(i){return this.layer.getAppearances().some(r=>r.hasPaintProperty(i))}hasStateDependentPaint(i){let r=i.paint,a=hl[+this.isText];for(let i of a)if(hs(r.get(i)))return!0;for(let r of i.getAppearances()||[])for(let i of a)if(r.hasPaintProperty(i)&&hs(r.paintProperties.get(i)))return!0;return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return 0===this.maxFeaturesPerBatch?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(i,r){let a=this.isAllConstant?0:i,n=Math.floor(a/this.maxFeaturesPerBatch),o=a%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(n)&&(n=0,o=0);let s=this.ubos[n];return!!s&&(s.writeDataDrivenBlock(r,o),!0)}_batchExceedsDeviceLimit(i){return 3*i+2>=this.maxUniformBufferBindings}
7_reevaluateAt(i,r,a,n,o,s){if(!r)return;let l=this.allFeatureVtIndices[i],h=r.feature(l);if(!h)return;let u=this.allFeatureIds[i],c=null!=u&&o[u]||{},d={type:h.type,id:u,properties:h.properties||{},geometry:[]},f=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(l):void 0,p=this.evaluateAllProperties(d,c,a,n,s,void 0,f);this._writeFeatureBlock(i,p)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let i=0;i<this.allFeatureVtIndices.length;i++){let r=this.allFeatureIds[i];if(null!=r){let a=this.featureVertexRangesFromId.get(r);a||this.featureVertexRangesFromId.set(r,a=[]),a.push(i)}let a=this.allFeatureVtIndices[i],n=this.featureVertexRangesFromVtIndex.get(a);n||this.featureVertexRangesFromVtIndex.set(a,n=[]),n.push(i)}}}populateUBO(i,r,a,n,o,s){let l,h,u=i.id,c=this.header,d=this.evaluateAllProperties(i,{},a,n,o,s);this.isAllConstant?(l=0,(h=0===this.featureCount)&&(this.featureCount=1)):(l=this.featureCount++,h=!0);let f=Math.floor(l/this.maxFeaturesPerBatch),p=l%this.maxFeaturesPerBatch;return h&&(this._batchExceedsDeviceLimit(f)?(tb(`Too many symbol features: batch ${f} requires binding points up to ${3*f+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),f=0,p=0):(this.ubos[f]||(this.ubos[f]=new hn(null,f,this.uboSizeDwords,c)),this.ubos[f].writeDataDrivenBlock(d,p))),this.allFeatureVtIndices.push(r),this.allFeatureIds.push(u),p}updateFeatures(i,r,a,n,o,s,l){for(let h of(this.layer=r,this.cachedConstantUniforms=null,this._ensureRangeMaps(),i)){let i=this.featureVertexRangesFromId.get(h);if(i)for(let r of i)this._reevaluateAt(r,a,n,o,s,l)}}updateDynamicExpressions(i,r,a,n,o,s){if(this.layer=i,this.cachedConstantUniforms=null,0!==this.header[0])for(let i=0;i<this.allFeatureVtIndices.length;i++)this._reevaluateAt(i,r,a,n,o,s)}updateFeaturePaintForAppearance(i,r,a,n,o,s,l){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(i,l||null),0===this.header[0]))return!1;this._ensureRangeMaps();let h=this.featureVertexRangesFromVtIndex.get(i);if(!h)return!1;let u=this.evaluateAllProperties(r,a,n,o,s,void 0,l),c=!1;for(let i of h)c=this._writeFeatureBlock(i,u)||c;return c}getConstantUniformValues(i,r){let a=this.header,n=!!this.cameraMask,o=!!a[1];if(this.cachedConstantUniforms&&this.cachedConstantBrightness===r&&(!n&&!o||this.cachedConstantRenderZoom===i))return this.cachedConstantUniforms;let s=this.layer.paint,l=n?new nk(i,{brightness:r,worldview:this.worldview}):null,h={type:1,id:void 0,properties:{},geometry:[]},u=hl[+this.isText],c=i=>{let a=u[i],n=s.get(a);if(!n)return[0,0,0,1];let o=s.get(`${a}-use-theme`),c=ho(o&&"string"!=typeof o?o.value:void 0,h,{},[],void 0,r,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<i&&l?n.property.evaluate(n.value,l,h,{},void 0,[])||iS.transparent:n.constantOr(iS.transparent)).toNonPremultipliedRenderColor(c).toArray01()},d=(i,r)=>{let a=s.get(u[i]);if(!a)return r;if(this.cameraMask&1<<i&&l){let i=a.property.evaluate(a.value,l,h,{},void 0,[]);return null!=i?i:r}return a.constantOr(r)},f=new Float32Array(9);if(o){let r=i-Math.floor(i);for(let i=0;i<9;i++){if(!(a[1]&1<<i))continue;let n=this.sharedZoomRanges[2*i],o=this.sharedZoomRanges[2*i+1];f[i]=n===o?+(r>=n):Math.max(0,Math.min(1,(r-n)/(o-n)))}}let p={fill_np_color:c(0),halo_np_color:c(1),opacity:d(2,1),halo_width:d(3,0),halo_blur:d(4,0),emissive_strength:d(5,0),occlusion_opacity:d(6,1),z_offset:d(7,0),zoomFactors:f};return this.cachedConstantUniforms=p,this.cachedConstantRenderZoom=i,this.cachedConstantBrightness=r,p}finalize(){for(let i of this.ubos)i.rightSizeForTransfer()}upload(i){for(let r of this.ubos)r.upload(i)}bind(i,r,a=0){this.ubos[a]&&this.ubos[a].bind(i,r)}destroy(){for(let i of this.ubos)i.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}a2(hc,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});let hd={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"},hf="u"<typeof TextDecoder?null:new TextDecoder("utf-8");class hp{constructor(i){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(i,r,a=this.length){let n;for(;n=this.nextField(a);)i(n,r,this);return r}readMessage(i,r){return this.readFields(i,r,this.readVarint()+this.pos)}readFixed32(){let i=this.dataView.getUint32(this.pos,!0);return this.pos+=4,i}readSFixed32(){let i=this.dataView.getInt32(this.pos,!0);return this.pos+=4,i}readFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,i}readSFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,i}readFloat(){let i=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,i}readDouble(){let i=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,i}readVarint(i){let r=this.buf,a=r[this.pos++];if(a<128)return a;let n,o=127&a;return o|=(127&(n=r[this.pos++]))<<7,n<128?o:(o|=(127&(n=r[this.pos++]))<<14,n<128?o:(o|=(127&(n=r[this.pos++]))<<21,n<128?o:function(i,r,a){let n,o,s=a.buf;if(n=(112&(o=s[a.pos++]))>>4,o<128||(n|=(127&(o=s[a.pos++]))<<3,o<128)||(n|=(127&(o=s[a.pos++]))<<10,o<128)||(n|=(127&(o=s[a.pos++]))<<17,o<128)||(n|=(127&(o=s[a.pos++]))<<24,o<128)||(n|=(1&(o=s[a.pos++]))<<31,o<128))return function(i,r,a){return a?0x100000000*r+(i>>>0):0x100000000*(r>>>0)+(i>>>0)}(i,n,r);throw Error("Expected varint not more than 10 bytes")}(o|=(15&(n=r[this.pos]))<<28,i,this)))}readSVarint(){let i=this.readVarint();return i%2==1?-((i+1)/2):i/2}readBoolean(){return!!this.readVarint()}readString(){let i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&hf?hf.decode(this.buf.subarray(r,i)):function(i,r,a){let n="",o=r;for(;o<a;){let r=i[o],s,l,h,u=null,c=r>239?4:r>223?3:r>191?2:1;if(o+c>a)break;1===c?r<128&&(u=r):2===c?128==(192&(s=i[o+1]))&&(u=(31&r)<<6|63&s)<=127&&(u=null):3===c?(s=i[o+1],l=i[o+2],128==(192&s)&&128==(192&l)&&((u=(15&r)<<12|(63&s)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=i[o+1],l=i[o+2],h=i[o+3],128==(192&s)&&128==(192&l)&&128==(192&h)&&((u=(15&r)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),o+=c}return n}(this.buf,r,i)}readBytes(){let i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r}readPackedVarint(i=[],r){let a=this.readPackedEnd();for(;this.pos<a;)i.push(this.readVarint(r));return i}readPackedSVarint(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSVarint());return i}readPackedBoolean(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readBoolean());return i}readPackedFloat(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFloat());return i}readPackedDouble(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readDouble());return i}readPackedFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed32());return i}readPackedSFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed32());return i}readPackedFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed64());return i}readPackedSFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed64());return i}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(i=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=i)return 0;let r=this.readVarint();return this.type=7&r,this._valueStart=this.pos,r>>>3}skip(i){let r=7&i;if(0===r)for(;this.buf[this.pos++]>127;);else if(2===r)this.pos=this.readVarint()+this.pos;else if(5===r)this.pos+=4;else{if(1!==r)throw Error(`Unimplemented type: ${r}`);this.pos+=8}}}function hm(i,r,a){let n=r<=16383?1:r<=2097151?2:r<=0xfffffff?3:Math.floor(Math.log(r)/(7*Math.LN2));a.realloc(n),a.buf.copyWithin(i+n,i,a.pos)}function h_(i,r){for(let a=0;a<i.length;a++)r.writeVarint(i[a])}function hg(i,r){for(let a=0;a<i.length;a++)r.writeSVarint(i[a])}function hy(i,r){for(let a=0;a<i.length;a++)r.writeFloat(i[a])}function hx(i,r){for(let a=0;a<i.length;
7a++)r.writeDouble(i[a])}function hv(i,r){for(let a=0;a<i.length;a++)r.writeBoolean(i[a])}function hb(i,r){for(let a=0;a<i.length;a++)r.writeFixed32(i[a])}function hw(i,r){for(let a=0;a<i.length;a++)r.writeSFixed32(i[a])}function hT(i,r){for(let a=0;a<i.length;a++)r.writeFixed64(i[a])}function hS(i,r){for(let a=0;a<i.length;a++)r.writeSFixed64(i[a])}let hE={horizontal:1,vertical:2,horizontalOnly:3};class hI{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(i,r){let a=new hI;return a.scale=i||1,a.fontStack=r,a}static forImage(i){let r=new hI;return r.image=i,r}}class hA{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r,a,n=1){let o=new hA;for(let s=0;s<i.sections.length;s++){let l=i.sections[s];l.image?o.addImageSection(l,a,n):o.addTextSection(l,r)}return o}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSections(){return this.sections}getSectionIndex(i){return this.sectionIndex[i]}getCodePoint(i){return this.text.codePointAt(i)}verticalizePunctuation(i){this.text=function(i,r){let a="";for(let n=0;n<i.length;n++){let o=i.charCodeAt(n+1)||null,s=i.charCodeAt(n-1)||null;a+=!r&&(o&&nE(o)&&!hd[i[n+1]]||s&&nE(s)&&!hd[i[n-1]])||!hd[i[n]]?i[n]:hd[i[n]]}return a}(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&hC[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=i&&hC[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(i,r),this.sectionIndex=this.sectionIndex.slice(i,r)}substring(i,r){let a=new hA;return a.text=this.text.substring(i,r),a.sectionIndex=this.sectionIndex.slice(i,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(hI.forText(i.scale,i.fontStack||r));let a=this.sections.length-1;for(let r=0;r<i.text.length;++r)this.sectionIndex.push(a)}addImageSection(i,r,a=1){let n=i.image?i.image.getPrimary():null;if(!n)return void tb("Can't add FormattedSection with an empty image.");n.scaleSelf(r*a);let o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCodePoint(o),this.sections.push(hI.forImage(n)),this.sectionIndex.push(this.sections.length-1)):tb("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hM(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g=1,y=1){let x=hA.fromFeature(i,o,g,y);f===hE.vertical&&x.verticalizePunctuation(p);let v=[],b=function(i,r,a,n,o,s,l=1){if(!i)return[];let h=[],u=function(i,r,a,n,o,s,l=1){let h=0;for(let a=0;a<i.length();a++){let u=i.getSection(a);h+=hR(i.getCodePoint(a),u,n,o,r,s,l)}return h/Math.max(1,Math.ceil(h/a))}(i,r,a,n,o,s,l),c=i.text.includes("â"),d=0;for(let a=0;a<i.length();a++){let f=i.getSection(a),p=i.getCodePoint(a);if(hC[p]||(d+=hR(p,f,n,o,r,s,l)),a<i.length()-1){let r=!(p<11904||!(no(p)||nn(p)||nx(p)||n_(p)||nu(p)||a7(p)||ns(p)||ni(p)||nc(p)||nd(p)||nh(p)||nw(p)||nr(p)||nt(p)||ne(p)||nl(p)||na(p)||ny(p)||np(p)||nf(p)));(hD[p]||r||f.image)&&h.push(hL(a+1,d,u,h,function(i,r,a){let n=0;return 10===i&&(n-=1e4),a&&(n+=150),40!==i&&65288!==i||(n+=50),41!==r&&65289!==r||(n+=50),n}(p,i.getCodePoint(a+1),r&&c),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(hL(i.length(),d,u,h,0,!0))}(x,c,s,r,n,m,y),{processBidirectionalText:w,processStyledBidirectionalText:T}=nF;if(w&&1===x.sections.length)for(let i of w(x.toString(),b)){let r=new hA;r.text=i,r.sections=x.sections;for(let a=0;a<i.length;a++)r.sectionIndex.push(0);v.push(r)}else if(T)for(let i of T(x.text,x.sectionIndex,b)){let r=new hA;r.text=i[0],r.sectionIndex=i[1],r.sections=x.sections,v.push(r)}else v=function(i,r){let a=[],n=i.text,o=0;for(let n of r)a.push(i.substring(o,n)),o=n;return o<n.length&&a.push(i.substring(o,n.length)),a}(x,b);let S=[],E={positionedLines:S,text:x.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(i,r,a,n,o,s,l,h,u,c,d,f,p=1){let m=0,_=0,g=0,y="right"===h?1:.5*("left"!==h),x=!1;for(let i of o){for(let a of i.getSections()){if(a.image)continue;let i=r[a.fontStack];if(i&&!(x=void 0!==i.ascender&&void 0!==i.descender))break}if(!x)break}let v=0;for(let l of o){l.trim();let o=l.getMaxScale(),h=(o-1)*24,w={positionedGlyphs:[],lineOffset:0};i.positionedLines[v]=w;let T=w.positionedGlyphs,S=0;if(!l.length()){_+=s,++v;continue}let E=0,I=0;for(let s=0;s<l.length();s++){var b;let h=l.getSection(s),g=l.getSectionIndex(s),y=l.getCodePoint(s),v=h.scale,w=null,A=null,M=null,C=24,D=0,R=u;R===hE.vertical&&(12312===y||12313===y||12316===y||12540===y||12448===y)&&(R=hE.horizontal);let P=!(R===hE.horizontal||!d&&!nS(y)||d&&(hC[y]||a6(b=y)||a8(b)||a9(b)||ng(b)||nb(b)));if(h.image){let r=n.get(h.image.toString());if(!r)continue;M=h.image,i.iconsInText=i.iconsInText||!0,A=r.paddedRect;let a=r.displaySize,s=a[0]*p,l=a[1]*p;v=24*v/f,w={width:s,height:l,left:0,top:-3,advance:P?l:s,localGlyph:!1},D=x?-w.height*v:24*o-17-l*v,C=w.advance;let u=(P?s:l)*v-24*o;u>0&&u>S&&(S=u)}else{let i=a[h.fontStack];if(!i)continue;i[y]&&(A=i[y]);let n=r[h.fontStack];if(!n)continue;let s=n.glyphs[y];if(!s)continue;if(w=s.metrics,C=24*(8203!==y),x){let i=void 0!==n.ascender?Math.abs(n.ascender):0,r=void 0!==n.descender?Math.abs(n.descender):0,a=(i+r)*v;E<a&&(E=a,I=(i-r)/2*v),D=-i*v}else D=(o-v)*24-17}P?(i.verticalizable=!0,T.push({glyph:y,image:M,x:m,y:_+D,vertical:P,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=C*v+c):(T.push({glyph:y,image:M,x:m,y:_+D,vertical:P,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=w.advance*v+c)}0!==T.length&&(g=Math.max(m-c,g),x?hO(T,y,S,I,s*o/2):hO(T,y,S,0,s/2)),m=0;let A=s*o+S;w.lineOffset=Math.max(S,h),_+=A,++v}let w=_,{horizontalAlign:T,verticalAlign:S}=hz(l);(function(i,r,a,n,o,s){let l=(r-a)*o,h=-s*n;for(let r of i)for(let i of r.positionedGlyphs)i.x+=l,i.y+=h}
7)(i.positionedLines,y,T,S,g,w),i.top+=-S*w,i.bottom=i.top+w,i.left+=-T*g,i.right=i.left+g,i.hasBaseline=x}(E,r,a,n,v,l,h,u,f,c,p,_,y),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(S))return E}let hC={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},hD={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 hR(i,r,a,n,o,s,l=1){if(r.image){let i=n.get(r.image.toString());return i?i.displaySize[0]*l*r.scale*24/s+o:0}{let n=a[r.fontStack],s=n&&n.glyphs[i];return s?s.metrics.advance*r.scale+o:0}}function hP(i,r,a,n){let o=Math.pow(i-r,2);return n?i<r?o/2:2*o:o+Math.abs(a)*a}function hL(i,r,a,n,o,s){let l=null,h=hP(r,a,o,s);for(let i of n){let n=hP(r-i.x,a,o,s)+i.badness;n<=h&&(l=i,h=n)}return{index:i,x:r,priorBreak:l,badness:h}}function hz(i){let r=.5,a=.5;switch(i){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":a=1;break;case"top":case"top-right":case"top-left":a=0}return{horizontalAlign:r,verticalAlign:a}}function hO(i,r,a,n,o){if(!(r||a||n||o))return;let s=i.length-1,l=i[s],h=(l.x+l.metrics.advance*l.scale)*r;for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=a+n+o}function hF(i){return void 0!==i.imagePrimary&&void 0!==i.top&&void 0!==i.bottom&&void 0!==i.left&&void 0!==i.right}function hB(i,r,a,n){let{horizontalAlign:o,verticalAlign:s}=hz(n),l=a[0]-i.displaySize[0]*o,h=a[1]-i.displaySize[1]*s;return{imagePrimary:i,imageSecondary:r,top:h,bottom:h+i.displaySize[1],left:l,right:l+i.displaySize[0]}}function hk(i,r,a,n,o,s){let l,h,u,c,d,f=i.imagePrimary;if(f.content){let i=f.content,r=f.pixelRatio||1;l=[i[0]/r,i[1]/r,f.displaySize[0]-i[2]/r,f.displaySize[1]-i[3]/r]}let p=r.left*s,m=r.right*s;"width"===a||"both"===a?(d=o[0]+p-n[3],u=o[0]+m+n[1]):u=(d=o[0]+(p+m-f.displaySize[0])/2)+f.displaySize[0];let _=r.top*s,g=r.bottom*s;return"height"===a||"both"===a?(h=o[1]+_-n[0],c=o[1]+g+n[2]):c=(h=o[1]+(_+g-f.displaySize[1])/2)+f.displaySize[1],{imagePrimary:f,imageSecondary:void 0,top:h,right:u,bottom:c,left:d,collisionPadding:l}}function hN(i){return!i.imagePrimary.stretchX}function hU(i){return!i.imagePrimary.stretchY}function hV(i){return{width:i.right-i.left,height:i.bottom-i.top}}function hj(i,r,a,n){let{expression:o}=r;if("constant"===o.kind)return{kind:"constant",layoutSize:o.evaluate(new nk(i+1,{worldview:a}),void 0,void 0,void 0,n)};if("source"===o.kind)return{kind:"source"};{let{zoomStops:r,interpolationType:s}=o,l=0;for(;l<r.length&&r[l]<=i;)l++;let h=l=Math.max(0,l-1);for(;h<r.length&&r[h]<i+1;)h++;h=Math.min(r.length-1,h);let u=r[l],c=r[h];return"composite"===o.kind?{kind:"composite",minZoom:u,maxZoom:c,interpolationType:s}:{kind:"camera",minZoom:u,maxZoom:c,minSize:o.evaluate(new nk(u,{worldview:a}),void 0,void 0,void 0,n),maxSize:o.evaluate(new nk(c,{worldview:a}),void 0,void 0,void 0,n),interpolationType:s}}}function hG(i,{uSize:r,uSizeT:a},{lowerSize:n,upperSize:o}){return"source"===i.kind?n/128:"composite"===i.kind?iw(n/128,o/128,a):r}function hH(i,r,a=1){let n=0,o=0;if("constant"===i.kind)o=i.layoutSize*a;else if("source"!==i.kind){let{interpolationType:s,minZoom:l,maxZoom:h}=i,u=s?ts(ad.interpolationFactor(s,r,l,h),0,1):0;"camera"===i.kind?o=iw(i.minSize,i.maxSize,u)*a:n=u*a}return{uSizeT:n,uSize:o}}class hq extends eJ{constructor(i,r,a,n,o){super(i,r),this.angle=n,this.z=a,void 0!==o&&(this.segment=o)}clone(){return new hq(this.x,this.y,this.z,this.angle,this.segment)}}function h$(i,r,a,n,o){if(void 0===r.segment)return!0;let s=r,l=r.segment+1,h=0;for(;h>-a/2;){if(--l<0)return!1;h-=i[l].dist(s),s=i[l]}h+=i[l].dist(i[l+1]),l++;let u=[],c=0;for(;h<a/2;){let r=i[l],a=i[l+1];if(!a)return!1;let s=i[l-1].angleTo(r)-r.angleTo(a);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>n;)c-=u.shift().angleDelta;if(c>o)return!1;l++,h+=r.dist(a)}return!0}function hZ(i){let r=0;for(let a=0;a<i.length-1;a++)r+=i[a].dist(i[a+1]);return r}function hW(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}function hX(i){let r=0,a=0;for(let n of i)r+=n.w*n.h,a=Math.max(a,n.w);i.sort((i,r)=>r.h-i.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),a),h:1/0}],o=0,s=0;for(let r of i)for(let i=n.length-1;i>=0;i--){let a=n[i];if(!(r.w>a.w||r.h>a.h)){if(r.x=a.x,r.y=a.y,s=Math.max(s,r.y+r.h),o=Math.max(o,r.x+r.w),r.w===a.w&&r.h===a.h){let r=n.pop();r&&i<n.length&&(n[i]=r)}else r.h===a.h?(a.x+=r.w,a.w-=r.w):(r.w===a.w||n.push({x:a.x+r.w,y:a.y,w:a.w-r.w,h:r.h}),a.y+=r.h,a.h-=r.h);break}}return{w:o,h:s,fill:r/(o*s)||0}}function hY(i,r){return i.id<r.id?-1:i.id>r.id?1:i.version<r.version?-1:i.version>r.version?1:i.sx<r.sx?-1:i.sx>r.sx?1:i.sy<r.sy?-1:+(i.sy>r.sy)}function hK(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}function hJ(i,r){return(i<<5)-i+r}function hQ(i,r,a,n){for(let[o]of i.entries()){let i=n&&n.get(o)||iJ.parse(o),s=i.id.toString(),l=r.get(s)||0;a.push({id:o,version:l,sx:i.sx,sy:i.sy})}}a2(hq,"Anchor");class h0{constructor(i,r,a,n,o){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=r.size>0,hQ(i,a,this.iconDescriptors,o),hQ(r,a,this.patternDescriptors,o),this.iconDescriptors.sort(hY),this.patternDescriptors.sort(hY);let s=0;const l=n?n.data:"";for(const i of(l&&(s=hJ(s,hK(l))),s=hJ(s,1),this.iconDescriptors))s=hJ(s,hK(i.id)),s=hJ(s,i.version),s=hJ(s,i.sx),s=hJ(s,i.sy);for(const i of(s=hJ(s,1),this.patternDescriptors))s=hJ(s,hK(i.id)),s=hJ(s,i.version),s=hJ(s,i.sx),s=hJ(s,i.sy);this.hash=s}subsetOf(i){return this.isSubsetArray(this.iconDescriptors,i.iconDescriptors,hY)&&this.isSubsetArray(this.patternDescriptors,i.patternDescriptors,hY)}isSubsetArray(i,r,a){let n=0,o=0;if(i.length>r.length)return!1;for(;n<i.length&&o<r.length;){let s=a(i[n],r[o]);if(0===s)n++,o++;else{if(s<0)return!1;o++}}return n===i.length}}function h1(i){switch(i){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function h2(i){switch(i){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}a2(h0,"AtlasContentDescriptor");class h3{constructor(i,r,a,n){this.context=i,this.format=a,this.useMipmap=n&&n.useMipmap,this.texture=i.gl.createTexture(),this.update(r,{premultiply:n&&n.premultiply})}update(i,r){let a=i&&i instanceof HTMLVideoElement&&0===i.width?i.videoWidth:i.width,n=i&&i instanceof HTMLVideoElement&&0===i.height?i.videoHeight:i.height,{context:o}=this,{gl:s}=o,{x:l,y:h}=r&&r.position?r.position:{x:0,y:0},u=l+a,c=h+n;this.size&&(this.size[0]!==u||this.size[1]!==c)&&(!r||void 0===r.recreateWhenResize||r.recreateWhenResize)&&(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!r||!1!==r.premultiply));let d=i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||ImageBitmap&&i instanceof ImageBitmap;if(!this.size&&u>0&&c>0){let i=this.useMipmap?Math.floor(Math.log2(Math.max(u,c)))+1:1;s.texStorage2D(s.TEXTURE_2D,i,this.format,u,c),this.size=[u,c]}this.size&&(d?s.texSubImage2D(s.TEXTURE_2D,0,l,h,h1(this.format),h2(this.format),i):"data"in i&&i.data&&s.texSubImage2D(s.TEXTURE_2D,0,l,h,a,n,h1(this.format),h2(this.format),i.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(i,r,a=!1){let{context:n}=this,{gl:o}=n;
vendor: 4,218 bytes, line 7
7o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap&&!a?i===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapS=r)}bindExtraParam(i,r,a,n,o){let{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),r!==this.magFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,r),this.magFilter=r),i!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap?i===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),a!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,a),this.wrapS=a),n!==this.wrapT&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,n),this.wrapT=n),o!==this.compareMode&&(o?(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_FUNC,o)):l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.NONE),this.compareMode=o)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}class h4{constructor(i,r){this.context=i,this.texture=r}bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}}class h5{static getImagePositionScale(i,r,a){if(r&&i){let{sx:r,sy:a}=i;return{x:r,y:a}}return{x:a,y:a}}constructor(i,r,a,n){this.paddedRect=i;const{pixelRatio:o,version:s,stretchX:l,stretchY:h,content:u,sdf:c,usvg:d}=r;this.pixelRatio=o,this.stretchX=l,this.stretchY=h,this.content=u,this.version=s,this.padding=a,this.sdf=c,this.usvg=d,this.scale=h5.getImagePositionScale(n,d,o)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function h6(i,r,a){let n=iJ.parse(i),o=function(i,r,a=[1,1]){return{x:0,y:0,w:(i.data?i.data.width:i.width*a[0])+2*r,h:(i.data?i.data.height:i.height*a[1])+2*r}}(r,a,[n.sx,n.sy]);return{bin:o,imagePosition:new h5(o,r,a,n),imageVariant:n}}function h8(i,r){let a=[];for(let[n,o]of i.entries()){let i=iJ.parse(n);i&&(a.push({key:n,value:o,variant:i}),r&&r.set(n,i))}a.sort((i,r)=>{let a=i.variant.id.toString().localeCompare(r.variant.id.toString());return 0!==a?a:i.variant.sx!==r.variant.sx?i.variant.sx-r.variant.sx:i.variant.sy!==r.variant.sy?i.variant.sy-r.variant.sy:0});let n=new Map;for(let i of a)n.set(i.key,i.value);return n}class h9{constructor(i){this.sourceAtlasHash=i}}class h7{constructor(i,r,a,n){const o=new Map,s=new Map;this.haveRenderCallbacks=[];const l=[],h=void 0!==n,u=h?new Map:void 0,c=h?h8(i,u):i,d=h?h8(r,u):r;this.addImages(c,o,1,l),this.addImages(d,s,2,l);const{w:f,h:p}=hX(l),m=new lH({width:f||1,height:p||1});for(const[i,r]of c.entries()){const a=o.get(i).paddedRect;lH.copy(r.data,m,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data,null,r.sdf)}for(const[i,r]of d.entries()){const n=s.get(i),o=n.paddedRect;let l=n.padding;const h=o.x+l,u=o.y+l,c=r.data.width,d=r.data.height;l=l>1?l-1:l,lH.copy(r.data,m,{x:0,y:0},{x:h,y:u},r.data,a),lH.copy(r.data,m,{x:0,y:d-l},{x:h,y:u-l},{width:c,height:l},a),lH.copy(r.data,m,{x:0,y:0},{x:h,y:u+d},{width:c,height:l},a),lH.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u},{width:l,height:d},a),lH.copy(r.data,m,{x:0,y:0},{x:h+c,y:u},{width:l,height:d},a),lH.copy(r.data,m,{x:c-l,y:d-l},{x:h-l,y:u-l},{width:l,height:l},a),lH.copy(r.data,m,{x:0,y:d-l},{x:h+c,y:u-l},{width:l,height:l},a),lH.copy(r.data,m,{x:0,y:0},{x:h+c,y:u+d},{width:l,height:l},a),lH.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u+d},{width:l,height:l},a)}this.lut=a,this.image=m,this.iconPositions=o,this.patternPositions=s,h&&(this.contentDescriptor=new h0(c,d,n,a,u))}
7addImages(i,r,a,n){for(let[o,s]of i.entries()){let{bin:i,imagePosition:l,imageVariant:h}=h6(o,s,a);r.set(o,l),n.push(i),s.hasRenderCallback&&this.haveRenderCallbacks.push(h.id)}}patchUpdatedImages(i,r,a,n){for(let o of(this.haveRenderCallbacks=this.haveRenderCallbacks.filter(r=>i.hasImage(r,a)),i.dispatchRenderCallbacks(this.haveRenderCallbacks,a),i.getUpdatedImages(a))){for(let n of this.iconPositions.keys()){let s=iJ.parse(n);if(iy.isEqual(s.id,o)){let s=i.getImage(o,a);this.patchUpdatedImage(this.iconPositions.get(n),s,r,null)}}for(let s of this.patternPositions.keys()){let l=iJ.parse(s);if(iy.isEqual(l.id,o)){let l=i.getImage(o,a);this.patchUpdatedImage(this.patternPositions.get(s),l,r,n||this.lut)}}}}patchUpdatedImage(i,r,a,n=null){if(!i||!r||i.version===r.version)return;i.version=r.version;let[o,s]=i.tl,l=i.sdf;if(this.lut||l){let i={width:r.data.width,height:r.data.height},h=new lH(i);lH.copy(r.data,h,{x:0,y:0},{x:0,y:0},i,n,l),a.update(h,{position:{x:o,y:s},recreateWhenResize:!1})}else a.update(r.data,{position:{x:o,y:s},recreateWhenResize:!1})}}a2(h5,"ImagePosition"),a2(h7,"ImageAtlas",{omit:["lut"]}),a2(h9,"ImageAtlasReference");class ue{constructor(i){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=i&&i.fontstackCompositing||"client"}loadGlyphRange(i,r,a,n,o){if("server"===this.fontstackCompositing)return void ue.loadGlyphRange(i,r,a,n,o);let s=i.split(",").map(i=>i.trim()).filter(i=>i.length>0);0!==s.length?1!==s.length?this._loadMultipleFonts(s,r,a,n,o):this._loadFont(s[0],r,a,n,o):o(Error("Empty fontstack"))}_loadMultipleFonts(i,r,a,n,o){let s=i.map(()=>null),l={completed:0,firstError:null,callbackCalled:!1},h=(r,a,n)=>{if(!l.callbackCalled&&(a&&!l.firstError&&(l.firstError=a),n&&(s[r]=n),l.completed++,l.completed===i.length)){l.callbackCalled=!0;let i=s.filter(i=>null!==i);if(0===i.length)return void o(l.firstError||Error("All fonts failed to load"));o(null,this._composeGlyphs(i))}};for(let o=0;o<i.length;o++)this._loadFont(i[o],r,a,n,(i,r)=>{h(o,i,r)})}_loadFont(i,r,a,n,o){let s=`${i}:${r}`;if(this.cachedRanges.has(s)){let i=this.cachedRanges.get(s);return void tV.frame(()=>o(null,i))}let l=this.pendingRequests.get(s);l?l.push(o):(this.pendingRequests.set(s,[o]),ue.loadGlyphRange(i,r,a,n,(i,r)=>{i||this.cachedRanges.set(s,r||null);let a=this.pendingRequests.get(s);if(this.pendingRequests.delete(s),a)for(let n of a)n(i,r)}))}_composeGlyphs(i){let r,a,n={};for(let o of i)if(void 0===r&&void 0!==o.ascender&&(r=o.ascender),void 0===a&&void 0!==o.descender&&(a=o.descender),o.glyphs)for(let i in o.glyphs)void 0===n[i]&&(n[i]=o.glyphs[i]);return{glyphs:n,ascender:r,descender:a}}}ue.loadGlyphRange=function(i,r,a,n,o){let s=256*r;ih(n.transformRequest(n.normalizeGlyphsURL(a).replace("{fontstack}",i).replace("{range}",`${s}-${s+255}`),ie.Glyphs),(i,r)=>{if(i)o(i);else if(r){let i={},a=function(i){let r;var a=new hp(i);let n={glyphs:[]};for(;r=a.nextField();)1===r&&function(i,r,a){let n;for(;n=i.nextField(r);)3===n?a.glyphs.push(function(i,r){let a,n,o=0,s=0,l=0,h=0,u=0,c=0;for(;n=i.nextField(r);)1===n?o=i.readVarint():2===n?a=i.readBytes():3===n?s=i.readVarint():4===n?l=i.readVarint():5===n?h=i.readSVarint():6===n?u=i.readSVarint():7===n&&(c=i.readVarint());return{id:o,bitmap:new lG({width:s+6,height:l+6},a),metrics:{width:s,height:l,left:h,top:u,advance:c}}}(i,i.readVarint()+i.pos)):4===n?a.ascender=i.readSVarint():5===n&&(a.descender=i.readSVarint())}(a,a.readVarint()+a.pos,n);return n}(r);for(let r of a.glyphs)i[r.id]=r;o(null,{glyphs:i,ascender:a.ascender,descender:a.descender})}})};let ut=new Float64Array(256);for(let i=0;i<256;i++){let r=.5-Math.pow(i/255,1/2.2);ut[i]=r*Math.abs(r)}function ui(i,r,a,n,o,s,l,h,u){for(let c=r;c<r+n;c++)ur(i,a*s+c,s,o,l,h,u);for(let c=a;c<a+o;c++)ur(i,c*s+r,1,n,l,h,u)}function ur(i,r,a,n,o,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,o[0]=i[r];for(let h=1,u=0,c=0;h<n;h++){o[h]=i[r+h*a];let n=h*h;do{let i=s[u];c=(o[h]-o[i]+n-i*i)/(h-i)/2}while(c<=l[u]&&--u>-1)s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<n;h++){for(;l[u+1]<h;)u++;let n=s[u],c=h-n;i[r+h*a]=o[n]+c*c}}ut[255]=-1e20;let ua=/bold/i,un=/medium/i,uo=/light/i,us={none:0,ideographs:1,all:2};class ul{constructor(i,r,a,n){this.requestManager=i,this.localGlyphMode=r,this.localFontFamily=a,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new ue({fontstackCompositing:n})}setURL(i){this.url=i}prefetchRange(i,r){let a=this.url||tj.GLYPHS_URL;if(!a)return;let n=this.entries[i];n||(n=this.entries[i]={glyphs:{},requests:{},ranges:{}}),n.ranges[r]||n.requests[r]||(n.requests[r]=[],this.glyphLoader.loadGlyphRange(i,r,a,this.requestManager,(i,a)=>
7{if(a){for(let i in n.ascender=a.ascender,n.descender=a.descender,a.glyphs)this._doesCharSupportLocalGlyph(+i)||(n.glyphs[+i]=a.glyphs[+i]);n.ranges[r]=!0}for(let o of n.requests[r]||[])o(i,a);delete n.requests[r]}))}getGlyphs(i,r){let a=[],n=this.url||tj.GLYPHS_URL;for(let r in i)for(let n of i[r])a.push({stack:r,id:n});tu(a,({stack:i,id:r},a)=>{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void a(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void a(null,{stack:i,id:r,glyph:s});let l=Math.floor(r/256);if(256*l>65535)return tb("glyphs > 65535 not supported"),void a(null,{stack:i,id:r,glyph:s});if(o.ranges[l])return void a(null,{stack:i,id:r,glyph:s});let h=o.requests[l];h||(h=o.requests[l]=[],this.glyphLoader.loadGlyphRange(i,l,n,this.requestManager,(i,r)=>{if(r){for(let i in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=r.glyphs[+i]);o.ranges[l]=!0}for(let a of h)a(i,r);delete o.requests[l]})),h.push((n,o)=>{n?a(n):o&&a(null,{stack:i,id:r,glyph:o.glyphs[r]||null})})},(i,a)=>{if(i)r(i);else if(a){let i={};for(let{stack:r,id:n,glyph:o}of a)void 0===i[r]&&(i[r]={}),void 0===i[r].glyphs&&(i[r].glyphs={}),i[r].glyphs[n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},i[r].ascender=this.entries[r].ascender,i[r].descender=this.entries[r].descender;r(null,i)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==us.none&&(this.localGlyphMode===us.all?!!this.localFontFamily:!!this.localFontFamily&&(nd(i)||nm(i)||nr(i)||na(i)||ni(i)||nc(i)||i>=131072&&i<=173791||i>=66736&&i<=66815))}_tinySDF(i,r,a){let n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(a))return;let o=i.tinySDF;if(!o){let a="400";ua.test(r)?a="900":un.test(r)?a="500":uo.test(r)&&(a="200"),(o=i.tinySDF=new ul.TinySDF({fontFamily:n,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}let s=o.fontWeight;if(this.localGlyphs[s][a])return this.localGlyphs[s][a];let l=String.fromCodePoint(a),{data:h,width:u,height:c,glyphWidth:d,glyphHeight:f,glyphLeft:p,glyphTop:m,glyphAdvance:_}=o.draw(l);return this.localGlyphs[s][a]={id:a,bitmap:new lG({width:u,height:c},h),metrics:{width:d/2,height:f/2,left:p/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function uh(i,r){return i+r[1]-r[0]}function uu(i,r,a,n,o=1){let s=[],l=i.imagePrimary,h=l.pixelRatio,u=l.paddedRect.w-2,c=l.paddedRect.h-2,d=(i.right-i.left)*o,f=(i.bottom-i.top)*o,p=l.stretchX||[[0,u]],m=l.stretchY||[[0,c]],_=p.reduce(uh,0),g=m.reduce(uh,0),y=u-_,x=c-g,v=0,b=_,w=0,T=g,S=0,E=y,I=0,A=x;if(l.content&&n){let i=l.content;v=uc(p,0,i[0]),w=uc(m,0,i[1]),b=uc(p,i[0],i[2]),T=uc(m,i[1],i[3]),S=i[0]-v,I=i[1]-w,E=i[2]-i[0]-b,A=i[3]-i[1]-T}let M=(n,s,u,c)=>{var p,m,y,x,M,C,D,R,P,L,z,O,F,B,k,N;let U=(p=n.stretch-v,p/b*d+i.left*o),V=(m=n.fixed-S,y=E,x=n.stretch,m-y*x/_),j=(M=s.stretch-w,M/T*f+i.top*o),G=(C=s.fixed-I,D=A,R=s.stretch,C-D*R/g),H=(P=u.stretch-v,P/b*d+i.left*o),q=(L=u.fixed-S,z=E,O=u.stretch,L-z*O/_),$=(F=c.stretch-w,F/T*f+i.top*o),Z=(B=c.fixed-I,k=A,N=c.stretch,B-k*N/g),W=new eJ(U,j),X=new eJ(H,j),Y=new eJ(H,$),K=new eJ(U,$),J=new eJ(V/h,G/h),Q=new eJ(q/h,Z/h),ee=r*Math.PI/180;if(ee){let i=Math.sin(ee),r=Math.cos(ee),a=[r,-i,i,r];W._matMult(a),X._matMult(a),K._matMult(a),Y._matMult(a)}let et=n.stretch+n.fixed,ei=u.stretch+u.fixed,er=s.stretch+s.fixed,ea=c.stretch+c.fixed,en=i.imageSecondary;return{tl:W,tr:X,bl:K,br:Y,texPrimary:{x:l.paddedRect.x+1+et,y:l.paddedRect.y+1+er,w:ei-et,h:ea-er},texSecondary:en?{x:en.paddedRect.x+1+et,y:en.paddedRect.y+1+er,w:ei-et,h:ea-er}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:Q,minFontScaleX:E/h/d,minFontScaleY:A/h/f,isSDF:a}};if(l.stretchX||l.stretchY){let i=ud(p,y,_),r=ud(m,x,g);for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1];for(let i=0;i<r.length-1;i++)s.push(M(n,r[i],o,r[i+1]))}}else s.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:c+1}));return s}function uc(i,r,a){let n=0;for(let o of i)n+=Math.max(r,Math.min(a,o[1]))-Math.max(r,Math.min(a,o[0]));return n}function ud(i,r,a){let n=[{fixed:-1,stretch:0}];for(let[r,a]of i){let i=n.at(-1);
7n.push({fixed:r-i.stretch,stretch:i.stretch}),n.push({fixed:r-i.stretch,stretch:i.stretch+(a-r)})}return n.push({fixed:r+1,stretch:a}),n}function uf(i){return 2*i.length+1}function up(i,r,a,n,o,s,l,h,u,c=1){let d,f,p,m=[];if(0===r.positionedLines.length)return m;let _=(void 0!==u?u:n.layout.get("text-rotate").evaluate(s,{}))*Math.PI/180,g=(d=a[0],(p=d*(f=a[1]))>0?[d,-f]:p<0?[-d,f]:0===d?[f,d]:[f,-d]),y=Math.abs(r.top-r.bottom);for(let i of r.positionedLines)y-=i.lineOffset;let x=r.positionedLines.length,v=y/x,b=r.top-a[1];for(let i=0;i<x;++i){let n=r.positionedLines[i];for(let s of(b=function(i,r,a,n){let o=r+i.positionedLines[n].lineOffset;return 0===n?a+o/2:a+(o+(r+i.positionedLines[n-1].lineOffset))/2}(r,v,b,i),n.positionedGlyphs)){let i,n,u,d;if(!s.rect)continue;let f=s.rect||{},p=4,y=!0,x=1,v=0;if(s.image){let i=l.get(s.image.toString());if(!i)continue;if(i.sdf){tb("SDF images are not supported in formatted text and will be ignored.");continue}y=!1,p=1/(x=i.pixelRatio),i.usvg||(x/=c)}let w=(o||h)&&s.vertical,T=s.metrics.advance*s.scale/2,S=s.metrics,E=s.rect;if(null===E)continue;h&&r.verticalizable&&(v=s.image?T-s.metrics.width*s.scale/2:0);let I=o?[s.x+T,s.y]:[0,0],A=[0,0],M=[0,0],C=!1;o||(w?(M=[s.x+T+g[0],s.y+g[1]-v],C=!0):A=[s.x+T+a[0],s.y+a[1]-v]);let D=E.w*s.scale/(x*(s.localGlyph?2:1)),R=E.h*s.scale/(x*(s.localGlyph?2:1));if(w){let r=s.y-b,a=new eJ(-T,T-r),o=-Math.PI/2,l=new eJ(...M);(i=new eJ(-T+A[0],A[1]))._rotateAround(o,a)._add(l),i.x+=-r+T,i.y-=(S.left-p)*s.scale;let h=s.image?S.advance*s.scale:24*s.scale,c=String.fromCodePoint(s.glyph);"︶"===c||"ï¹"===c||"︸"===c||"ï¹"===c||"ï¹"===c||"︾"===c||"︼"===c||"︺"===c||"ï¸"===c||"ï¹"===c||"ï¸"===c||"ï¸"===c||"ï¸"===c||"ï½"===c||"ï¿£"===c||"ï¸"===c||"ï¸"===c?i.x+=(1-p)*s.scale:"︵"===c||"ï¹"===c||"︷"===c||"ï¹"===c||"ï¹"===c||"︽"===c||"︻"===c||"︹"===c||"ï¸"===c||"︿"===c?i.x+=h-S.height*s.scale+(-p-1)*s.scale:i.x+=s.image||S.width+2*p===E.w&&S.height+2*p===E.h?(h-R)/2:(h-(S.height+2*p)*s.scale)/2,n=new eJ(i.x,i.y-D),u=new eJ(i.x+R,i.y),d=new eJ(i.x+R,i.y-D)}else{let r=(S.left-p)*s.scale-T+A[0],a=(-S.top-p)*s.scale+A[1],o=r+D,l=a+R;i=new eJ(r,a),n=new eJ(o,a),u=new eJ(r,l),d=new eJ(o,l)}if(_){let r;r=o?new eJ(0,0):C?new eJ(g[0],g[1]):new eJ(a[0],a[1]),i._rotateAround(_,r),n._rotateAround(_,r),u._rotateAround(_,r),d._rotateAround(_,r)}let P=new eJ(0,0),L=new eJ(0,0);m.push({tl:i,tr:n,bl:u,br:d,texPrimary:f,texSecondary:void 0,writingMode:r.writingMode,glyphOffset:I,sectionIndex:s.sectionIndex,isSDF:y,pixelOffsetTL:P,pixelOffsetBR:L,minFontScaleX:0,minFontScaleY:0})}}return m}function um(i,r){return r.max-i.max}ul.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:a=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal",lang:h=null}={}){this.buffer=r,this.radius=a,this.cutoff=n,this.lang=h;const u=this.size=i+4*r,c=this._createCanvas(u),d=this.ctx=c.getContext("2d",{willReadFrequently:!0});d.font=`${l} ${s} ${i}px ${o}`,d.textBaseline="alphabetic",d.textAlign="left",d.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(i){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(i,i);let r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){let{width:r,actualBoundingBoxAscent:a,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(i),l=Math.ceil(a),h=Math.floor(-o),u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-h)),c=Math.max(0,Math.min(this.size-this.buffer,l+Math.ceil(n))),d=u+2*this.buffer,f=c+2*this.buffer,p=Math.max(d*f,0),m=new Uint8ClampedArray(p),_={data:m,width:d,height:f,glyphWidth:u,glyphHeight:c,glyphTop:l,glyphLeft:h,glyphAdvance:r};if(0===u||0===c)return _;let{ctx:g,buffer:y,gridInner:x,gridOuter:v}=this;this.lang&&(g.lang=this.lang),g.clearRect(y,y,u,c),g.fillText(i,y-h,y+l);let b=g.getImageData(y,y,u,c);v.fill(1e20,0,p),x.fill(0,0,p);let w=3;for(let i=0;i<c;i++){let r=(i+y)*d+y;for(let i=0;i<u;i++,w+=4,r++){let i=b.data[w];if(0===i)continue;let a=ut[i];v[r]=Math.max(0,a),x[r]=Math.max(0,-a)}}ui(v,0,0,d,f,d,this.f,this.v,this.z);let T=Math.min(y,1);ui(x,y-T,y-T,u+2*T,c+2*T,d,this.f,this.v,this.z);let S=255/this.radius,E=255*(1-this.cutoff);for(let i=0;i<p;i++){let r=Math.sqrt(v[i])-Math.sqrt(x[i]);m[i]=Math.round(E-S*r)}return _}};class u_{constructor(i,r,a,n){this.p=new eJ(i,r),this.h=a,this.d=function(i,r){let a=!1,n=1/0;for(let o=0;o<r.length;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;
7l=r++){let o=s[r],h=s[l];o.y>i.y!=h.y>i.y&&i.x<(h.x-o.x)*(i.y-o.y)/(h.y-o.y)+o.x&&(a=!a),n=Math.min(n,lA(i,o,h))}}return(a?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}let ug=Object.keys,uy=1/0,ux=Math.sqrt(2);function uv(i,r,a,n,o,s){let l=hF(i)&&i.collisionPadding?i.collisionPadding:[0,0,0,0],h={top:i.top-l[1],bottom:i.bottom+l[3],left:i.left-l[0],right:i.right+l[2],scaled:!1};return void 0!==n&&(h.top*=n,h.bottom*=n,h.left*=n,h.right*=n,h.scaled=!0),s&&(h.left+=s[0],h.right+=s[0],h.top+=s[1],h.bottom+=s[1]),a&&function(i,r,a){if(!r)return;let n=r*e7,o=new eJ(a?a[0]:0,a?a[1]:0),s=new eJ(i.left,i.top),l=new eJ(i.right,i.top),h=new eJ(i.left,i.bottom),u=new eJ(i.right,i.bottom);s._rotateAround(n,o),l._rotateAround(n,o),h._rotateAround(n,o),u._rotateAround(n,o),i.left=Math.min(s.x,l.x,h.x,u.x),i.right=Math.max(s.x,l.x,h.x,u.x),i.top=Math.min(s.y,l.y,h.y,u.y),i.bottom=Math.max(s.y,l.y,h.y,u.y)}(h,a,o),r?{top:Math.min(r.top,h.top),bottom:Math.max(r.bottom,h.bottom),left:Math.min(r.left,h.left),right:Math.max(r.right,h.right),scaled:r.scaled||h.scaled}:h}function ub(i,[r,a]){let n=0,o=0;if(a===uy){r<0&&(r=0);let a=r/ux;switch(i){case"top-right":case"top-left":o=a-7;break;case"bottom-right":case"bottom-left":o=7-a;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-a;break;case"top-left":case"bottom-left":n=a;break;case"left":n=r;break;case"right":n=-r}}else{switch(r=Math.abs(r),a=Math.abs(a),i){case"top-right":case"top-left":case"top":o=a-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-a}switch(i){case"top-right":case"bottom-right":case"right":n=-r;break;case"top-left":case"bottom-left":case"left":n=r}}return[n,o]}function uw(i,r,a,n,o,s,l,h){let u=i.hasLayoutProperty("icon-offset")?r.getAppearanceValueAndResolveTokens(i,"icon-offset",a,n,[]):null,c=u&&Array.isArray(u)?u:o,d=i.hasLayoutProperty("icon-rotate")?r.getAppearanceValueAndResolveTokens(i,"icon-rotate",a,n,[]):null,f=i.hasLayoutProperty("icon-size")?r.getAppearanceValueAndResolveTokens(i,"icon-size",a,n,[]):null;return{appearanceIconOffset:c,appearanceIconRotate:"number"==typeof d?d:s,appearanceIconSize:"number"==typeof f?f*h:l}}function uT(i,r,a,n,o,s,l){let h=i.hasLayoutProperty("text-offset")?r.getAppearanceValueAndResolveTokens(i,"text-offset",a,n,[]):null,u=h&&Array.isArray(h)?[24*h[0],24*h[1]]:o,c=i.hasLayoutProperty("text-rotate")?r.getAppearanceValueAndResolveTokens(i,"text-rotate",a,n,[]):null,d=i.hasLayoutProperty("text-size")?r.getAppearanceValueAndResolveTokens(i,"text-size",a,n,[]):null;return{appearanceTextOffset:u,appearanceTextRotate:"number"==typeof c?c:s,appearanceTextSize:"number"==typeof d?d:l}}function uS(i,r,a,n,o,s,l,h,u){if(!r||!r.usvg)return;let c=hV(n),d=hV(o),f=("both"===s||"width"===s)&&hN(n)?d.width/c.width:1,p=("both"===s||"height"===s)&&hU(n)?d.height/c.height:1;a.scaleSelf(f,p);let m=a.toString();l.set(m,a),h.set(m,r);let{imagePosition:_}=h6(m,r,1);u.set(m,_)}function uE(i,r,a,n,o,s,l,h,u,c){var d,f,p,m,_,g,y;if(!i)return;let x=(d=r,f=a,p=n,m=o,_=s,g=u,y=c,"camera"===d.kind?d.maxSize:"composite"===d.kind?Math.max(f.possiblyEvaluate(new nk(d.maxZoom,{worldview:g}),p,y).evaluate(_,{},p,y),f.possiblyEvaluate(new nk(d.minZoom,{worldview:g}),p,y).evaluate(_,{},p,y)):f.possiblyEvaluate(new nk(m,{worldview:g}),p,y).evaluate(_,{},p,y));return i.scaleSelf(x*h*l)}function uI(i,r,a,n,o,s,l,h,u,c){return{iconPrimary:uE(i.getPrimary(),r,a,n,o,s,l,h,u,c),iconSecondary:uE(i.getSecondary(),r,a,n,o,s,l,h,u,c)}}function uA(i,r,a,n){if(!i)return;let o=r.get(a.toString());o&&(i.imagePrimary=o),n&&(i.imageSecondary=r.get(n.toString()))}function uM(i,r){if(i){for(let a of i.positionedLines)for(let i of a.positionedGlyphs)if(null!==i.image){let a=i.image.toString();i.rect=r.get(a).paddedRect}}}function uC(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 uD(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v){let b=up(0,n,u,s,l,h,o,i.allowVerticalPlacement,void 0,_.textScaleFactor),w=s.layout.get("text-size").evaluate(h,{},y),T=_.compositeTextSizes?_.compositeTextSizes[0].evaluate(h,{},y):0,S=_.compositeTextSizes?_.compositeTextSizes[1].evaluate(h,{},y):0,E=uR(i.layerIds[0],i.textSizeData,w,_.textScaleFactor,T,S);for(let n of(i.addSymbols(i.text,b,E,u,l,h,d,r,a,c.lineStartIndex,c.lineLength,m,g,y,v,!1,x,b.length),f))p[n]=i.text.placedSymbolArray.length-1;return 4*b.length}function uR(i,r,a,n,o,s){let l=null;return"source"===r.kind?(l=[128*a*n])[0]>32640&&tb(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`):"composite"===r.kind&&((l=[128*o*n,128*s*n])[0]>32640||l[1]>32640)&&tb(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`),l}function uP(i){for(let r in i)return i[r];return null}function uL(i,r,a,n,o,s,l,h,u,c,d){let f,p,m,_;if(f=d?d.top:l.top,p=d?d.bottom:l.bottom,m=d?d.left:l.left,_=d?d.right:l.right,hF(l)&&l.collisionPadding){let i=l.collisionPadding;m-=i[0],f-=i[1],_+=i[2],p+=i[3]}if(u){let i=new eJ(m,f),r=new eJ(_,f),a=new eJ(m,p),n=new eJ(_,p),o=u*e7,s=new eJ(0,0);
7c&&(s=new eJ(c[0],c[1])),i._rotateAround(o,s),r._rotateAround(o,s),a._rotateAround(o,s),n._rotateAround(o,s),m=Math.min(i.x,r.x,a.x,n.x),_=Math.max(i.x,r.x,a.x,n.x),f=Math.min(i.y,r.y,a.y,n.y),p=Math.max(i.y,r.y,a.y,n.y)}return i.emplaceBack(r.x,r.y,r.z,a.x,a.y,m,f,_,p,h,n,o,s),i.length-1}function uz(i){hF(i)&&i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);let r=i.bottom-i.top;return r>0?Math.max(10,r):null}let{members:uO}=oK([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),uF=oK([{name:"a_pos_3",components:3,type:"Int16"}]);var uB=oK([{name:"a_pos",type:"Int16",components:2}]);class uk{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=eY(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,!0}}class uN{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=eT(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,a[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,a){var n,o,s,l,h,u,c;if(n=this.pos,o=n[0],s=n[1],l=n[2],h=i[0],u=i[1],c=i[2],Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(l-c)<=1e-6*Math.max(1,Math.abs(l),Math.abs(c))||0===r)return a[0]=a[1]=a[2]=0,!1;let[d,f,p]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+f*f+p*p,x=2*(m*d+_*f+g*p),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){let i=Math.max(-x/2,0),n=m+d*i,o=_+f*i,s=g+p*i,l=Math.hypot(n,o,s);return a[0]=n*r/l,a[1]=o*r/l,a[2]=s*r/l,!1}{let i=(-x-Math.sqrt(v))/(2*y);if(i<0){let i=Math.hypot(m,_,g);return a[0]=m*r/i,a[1]=_*r/i,a[2]=g*r/i,!1}return a[0]=m+d*i,a[1]=_+f*i,a[2]=g+p*i,!0}}}function uU(i,r,a,n){let o=r[0],s=r[1],l=r[2],h=a[0],u=a[1],c=a[2],d=1/0,f=-1/0;for(let r=0;r<i.length;r++){let a=i[r],n=(a[0]-o)*h+(a[1]-s)*u+(a[2]-l)*c;n<d&&(d=n),n>f&&(f=n)}return n[0]=d,n[1]=f,n}function uV(i,r){let a=!0;for(let n=0;n<i.planes.length;n++){let o=i.planes[n],s=0;for(let i=0;i<r.length;i++)s+=+(eT(o,r[i])+o[3]>=0);if(0===s)return 0;s!==r.length&&(a=!1)}return a?2:1}let uj=[0,0];function uG(i,r){for(let a of i.projections){let n=uU(r,i.points[0],a.axis,uj);if(a.projection[1]<n[0]||a.projection[0]>n[1])return 0}return 1}function uH(i,r){let a=r[0],n=r[1],o=r[2],s=r[3];for(let r=0;r<i.length;r++){let l=i[r];if(a*l[0]+n*l[1]+o*l[2]+s>=0)return!0}return!1}class uq{static fromPoints(i){let r=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let n of i)ep(r,r,n),em(a,a,n);return new uq(r,a)}static fromTileIdAndHeight(i,r,a){let n=1<<i.canonical.z,o=i.canonical.x,s=i.canonical.y;return new uq([o/n,s/n,r],[(o+1)/n,(s+1)/n,a])}static applyTransform(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eI(a[i],a[i],r);return uq.fromPoints(a)}static applyTransformFast(i,r){let a=[r[12],r[13],r[14]],n=[...a];for(let o=0;o<3;o++)for(let s=0;s<3;s++){let l=r[4*s+o],h=l*i.min[s],u=l*i.max[s];a[o]+=Math.min(h,u),n[o]+=Math.max(h,u)}return new uq(a,n)}static projectAabbCorners(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eI(a[i],a[i],r);return a}constructor(i,r){this.min=i,this.max=r,this.center=e_([],ec([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=es(this.min),n=es(this.max);for(let i=0;i<r.length;i++)a[i]=r[i]?this.min[i]:this.center[i],n[i]=r[i]?this.center[i]:this.max[i];return n[2]=this.max[2],new uq(a,n)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}distanceZ(i){return Math.max(Math.min(this.max[2],i[2]),this.min[2])-i[2]}getCorners(){let i=this.min,r=this.max;return[[i[0],i[1],i[2]],[r[0],i[1],i[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],r[2]],[i[0],r[1],r[2]]]}intersects(i){return this.intersectsAabb(i.bounds)?uV(i,this.getCorners()):0}intersectsFlat(i){return this.intersectsAabb(i.bounds)?uV(i,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(i,r){return r||this.intersects(i)?uG(i,this.getCorners()):0}intersectsPreciseFlat(i,r){return r||this.intersectsFlat(i)?uG(i,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(i){for(let r=0;r<3;++r)if(this.min[r]>i.max[r]||i.min[r]>this.max[r])return!1;return!0}intersectsAabbXY(i){return!(this.min[0]>i.max[0]||i.min[0]>this.max[0]||this.min[1]>i.max[1]||i.min[1]>this.max[1])}encapsulate(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i.min[r]),this.max[r]=Math.max(this.max[r],i.max[r])}encapsulatePoint(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i[r]),this.max[r]=Math.max(this.max[r],i[r])}closestPoint(i){return[Math.max(Math.min(this.max[0],i[0]),this.min[0]),Math.max(Math.min(this.max[1],i[1]),this.min[1]),Math.max(Math.min(this.max[2],i[2]),this.min[2])]}}function u$(i){return i*oM/6371008.8}a2(uq,"Aabb");let uZ=[new uq([oD,oD,oD],[oM,oM,oM]),new uq([oD,oD,oD],[0,0,oM]),new uq([0,oD,oD],[oM,0,oM]),new uq([oD,0,oD],[0,oM,oM]),new uq([0,0,oD],[oM,oM,oM])];function uW(i,r,a,n=!0){let o,s=e_([],i._camera.position,i.worldSize),l=[r,a,1,1];ez(l,l,i.pixelMatrixInverse),eP(l,l,1/l[3]);
7let h=ew([],ed([],l,s)),u=i.globeMatrix,c=[u[12],u[13],u[14]],d=ed([],c,s),f=el(d),p=ew([],d),m=i.worldSize/(2*Math.PI),_=eT(p,h),g=Math.asin(m/f);if(g<Math.acos(_)){if(!n)return null;let i=[],r=[];e_(i,h,f/_),ew(r,ed(r,i,d)),ew(h,ec(h,d,e_(h,r,Math.tan(g)*f)))}let y=[];new uN(s,h).closestPointOnSphere(c,m,y);let x=ew([],tz(u,0)),v=ew([],tz(u,1)),b=ew([],tz(u,2)),w=eT(x,y),T=eT(v,y),S=eT(b,y),E=Math.asin(-T/m)*te,I=Math.atan2(w,S)*te;return new oj(rd(I=i.center.lng+((o=(I-i.center.lng+180)%360-180)<-180?o+360:o)),ts(rf(E),0,1))}class uX{constructor(i,r,a){this.a=ed([],i,a),this.b=ed([],r,a),this.center=a;const n=ew([],this.a),o=ew([],this.b);this.angle=Math.acos(eT(n,o))}}function uY(i,r){var a,n,o,s;let l,h;return 0===i.angle?null:(l=0===i.a[r]?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[r]/i.a[r]/Math.sin(i.angle)-1/Math.tan(i.angle)))<0||l>1?null:(a=i.a[r],n=i.b[r],o=i.angle,s=ts(l,0,1),h=Math.sin(o),Math.sin((1-s)*o)/h*a+Math.sin(s*o)/h*n+i.center[r])}function uK(i){if(i.z<=1)return uZ[i.z+2*i.y+i.x];let r=u3(u2(i));return uq.fromPoints(r)}function uJ(i,r,a){return e_(i,i,1-a),eg(i,i,r,a)}function uQ(i,r){let a=ci(r.zoom);if(0===a)return uK(i);let n=u2(i),o=u3(n),s=rd(n.getWest())*r.worldSize,l=rd(n.getEast())*r.worldSize,h=rf(n.getNorth())*r.worldSize,u=rf(n.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],f=[s,u,0],p=[l,u,0],m=W([],r.globeMatrix);return eI(c,c,m),eI(d,d,m),eI(f,f,m),eI(p,p,m),o[0]=uJ(o[0],f,a),o[1]=uJ(o[1],p,a),o[2]=uJ(o[2],d,a),o[3]=uJ(o[3],c,a),uq.fromPoints(o)}function u0(i,r,a){for(let n of i)eI(n,n,r),e_(n,n,a)}function u1(i,r,a,n){let o=r/i.worldSize,s=i.globeMatrix;if(a.z<=1){let i=uK(a).getCorners();return u0(i,s,o),uq.fromPoints(i)}let l=u2(a,n),h=u3(l,oM+u$(i._tileCoverLift));u0(h,s,o);let u=Number.MAX_VALUE,c=[-u,-u,-u],d=[u,u,u];if(l.contains(i.center)){for(let i of h)ep(d,d,i),em(c,c,i);c[2]=0;let r=i.point,a=[r.x*o,r.y*o,0];return ep(d,d,a),em(c,c,a),new uq(d,c)}if(i._tileCoverLift>0){for(let i of h)ep(d,d,i),em(c,c,i);return new uq(d,c)}let f=[s[12]*o,s[13]*o,s[14]*o],p=l.getCenter(),m=ts(i.center.lat,-85.051129,85.051129),_=ts(p.lat,-85.051129,85.051129),g=rd(i.center.lng),y=rf(m),x=g-rd(p.lng),v=y-rf(_);x>.5?x-=1:x<-.5&&(x+=1);let b=0;Math.abs(x)>Math.abs(v)?b=x>=0?1:3:(b=v>=0?0:2,eg(f,f,[s[4]*o,s[5]*o,s[6]*o],-Math.sin((v>=0?l.getSouth():l.getNorth())*e7)*oM));let w=h[b],T=h[(b+1)%4],S=new uX(w,T,f),E=[uY(S,0)||w[0],uY(S,1)||w[1],uY(S,2)||w[2]],I=ci(i.zoom);if(I>0){let n=function({x:i,y:r,z:a},n,o,s,l){let h=1/(1<<a),u=i*h,c=u+h,d=r*h,f=d+h,p=0,m=(u+c)/2-s;return m>.5?p=-1:m<-.5&&(p=1),u=((u+p)*n-(s*=n))*o+s,c=((c+p)*n-s)*o+s,d=(d*n-(l*=n))*o+l,[[u,f=(f*n-l)*o+l,0],[c,f,0],[c,d,0],[u,d,0]]}(a,r,i._pixelsPerMercatorPixel,g,y);for(let i=0;i<h.length;i++)uJ(h[i],n[i],I);let o=ec([],n[b],n[(b+1)%4]);e_(o,o,.5),uJ(E,o,I)}for(let i of h)ep(d,d,i),em(c,c,i);return d[2]=Math.min(w[2],T[2]),ep(d,d,E),em(c,c,E),new uq(d,c)}function u2({x:i,y:r,z:a},n=!1){let o=1/(1<<a);return new oO(new oz(rp(i*o),r===(1<<a)-1&&n?-90:rm((r+1)*o)),new oz(rp((i+1)*o),0===r&&n?90:rm(r*o)))}function u3(i,r=oM){let a=i.getNorth()*e7,n=i.getSouth()*e7,o=Math.cos(a),s=Math.cos(n),l=Math.sin(a),h=Math.sin(n),u=i.getWest(),c=i.getEast();return[oR(s,h,u,r),oR(s,h,c,r),oR(o,l,c,r),oR(o,l,u,r)]}function u4(i,r,a,n){let o=1<<a.z,s=(i/8192+a.x)/o;return oP(rm((r/8192+a.y)/o),rp(s),n)}function u5({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let u6=new Float64Array(16);function u8(i){let r=u5(i),a=ei(u6,[r,r,r]);return Y(a,a,eb([],i.min))}function u9(i){let r=1/u5(i);return et(u6,i.min),K(u6,u6,[r,r,r])}function u7(i){return i/(2*Math.PI)/(8192/(2*Math.PI))}function ce(i,r){return 8192/(512*Math.pow(2,i))*u5(uK(r))}function ct(i,r,a,n,o){let s=u7(a),l=[i,r,-a/(2*Math.PI)],h=Z(new Float64Array(16));return Y(h,h,l),K(h,h,[s,s,s]),J(h,h,-o*e7),Q(h,h,-n*e7),h}function ci(i){return tl(5,6,i)}function cr(i,r){var a,n,o,s,l,h,u,c;let d,f,p,m,_=oP(r.lat,r.lng);return n=(a=ed([],(d=oP(i._center.lat,i._center.lng),f=eS([],eh(0,1,0),d),f=eI(f,f,p=er([],-i.angle,d)),er(p,-i._pitch,f),e_(m=ew([],d),m,u$(i.cameraToCenterDistance/i.pixelsPerMeter)),eI(m,m,p),ec([],d,m)),_))[0],o=a[1],s=a[2],l=_[0],Math.acos(Math.min(Math.max((c=Math.sqrt((n*n+o*o+s*s)*(l*l+(h=_[1])*h+(u=_[2])*u)))&&eT(a,_)/c,-1),1))}function ca(i,r){return cr(i,r)>Math.PI/2*1.01}let cn=85*e7,co=Math.cos(cn),cs=Math.sin(cn);function cl(i,r){let a=i.fovAboveCenter,n=Math.min(i.elevation?i.elevation.getMinElevationBelowMSL()*r:0,i.isOrthographic?-10*r:0),o=(i._camera.position[2]*i.worldSize-n)/Math.cos(i._pitch),s=Math.sin(a)*o/Math.sin(Math.max(Math.PI/2-i._pitch-a,.01)),l=Math.sin(i._pitch)*s+o,h=o*(1/i._horizonShift);if(!i.elevation||0===i.elevation.exaggeration()){let r=Math.max(i.zoom-17,0);i.isOrthographic&&(r/=10),l*=1+r}return Math.min(1.01*l,h)}class ch{constructor(i,r,a){this.z=i,this.x=r,this.y=a,this.key=cd(0,i,i,r,a)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}isChildOf(i){let r=this.z-i.z;return 0===i.z||i.z<this.z&&i.x===this.x>>r&&i.y===this.y>>r}url(i,r){var a,n,o;let s,l,h,u,c=(a=this.x,n=this.y,o=this.z,s=2**o,h=(l=2*Math.PI*6378137)*(a/s-.5),u=l*(.5-(n+1)/s),`${h},${u},${h+l/s},${u+l/s}`),d=function(i,r,a){let n,o="";for(let s=i;s>0;s--)o+=(r&(n=1<<s-1)?1:0)+(a&n?2:0);return o}(this.z,this.x,this.y);return i[(this.x+this.y)%i.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",d).replace("{bbox-epsg-3857}",c)}toString(){return`${this.z}/${this.x}/${this.y}`}}class cu{constructor(i,r){this.wrap=i,this.canonical=r,this.key=cd(i,r.z,r.z,r.x,r.y)}}class cc{constructor(i,r,a,n,o){this.overscaledZ=i,this.wrap=r,this.canonical=new ch(a,+n,+
7o),this.key=0===r&&i===a?this.canonical.key:cd(r,i,a,n,o)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){let r=this.canonical.z-i;return i>this.canonical.z?new cc(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cc(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return cd(this.wrap*r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let a=this.canonical.z-i;return cd(this.wrap*r,i,i,this.canonical.x>>a,this.canonical.y>>a)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;let r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ<this.overscaledZ&&i.canonical.z<this.canonical.z&&i.canonical.x===this.canonical.x>>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new cc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,n=2*this.canonical.y;return[new cc(r,this.wrap,r,a,n),new cc(r,this.wrap,r,a+1,n),new cc(r,this.wrap,r,a,n+1),new cc(r,this.wrap,r,a+1,n+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new cc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new cc(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new cu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function cd(i,r,a,n,o){let s=1<<Math.min(a,22),l=o%s*s+n%s;return i&&a<22&&(l+=s*s*((i<0?-2*i-1:2*i)%(1<<2*(22-a)))),16*(32*l+a)+(r-a)}let cf=[i=>{let r=i.canonical.x-1,a=i.wrap;return r<0&&(r=(1<<i.canonical.z)-1,a--),new cc(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>{let r=i.canonical.x+1,a=i.wrap;return r===1<<i.canonical.z&&(r=0,a++),new cc(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>new cc(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,(0===i.canonical.y?1<<i.canonical.z:i.canonical.y)-1),i=>new cc(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y===(1<<i.canonical.z)-1?0:i.canonical.y+1)];function cp(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:r};let a=Math.pow(2,-i.z),n=i.x*a,o=(i.x+1)*a,s=i.y*a,l=(i.y+1)*a,h=rp(n),u=rp(o),c=rm(s),d=rm(l),f=r.project(h,c),p=r.project(u,c),m=r.project(u,d),_=r.project(h,d),g=Math.min(f.x,p.x,m.x,_.x),y=Math.min(f.y,p.y,m.y,_.y),x=Math.max(f.x,p.x,m.x,_.x),v=Math.max(f.y,p.y,m.y,_.y),b=a/16;function w(i,a,n,o,s,l){let h=(n+s)/2,u=(o+l)/2,c=r.project(rp(h),rm(u)),d=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),d>b&&(w(i,c,n,o,h,u),w(c,a,h,u,s,l))}w(f,p,n,s,o,s),w(p,m,o,s,o,l),w(m,_,o,l,n,l),w(_,f,n,l,n,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}function cm(i,{x:r,y:a},n=0){return new eJ(((r-n)*i.scale-i.x)*8192,(a*i.scale-i.y)*8192)}a2(ch,"CanonicalTileID"),a2(cc,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let c_=Z(new Float32Array(16));class cg{constructor(i){this.spec=i,this.name=i.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(i,r){return{x:0,y:0,z:0}}unproject(i,r){return new oz(0,0)}projectTilePoint(i,r,a){return{x:i,y:r,z:0}}locationPoint(i,r,a,n=!0){return i._coordinatePoint(i.locationCoordinate(r,a),n)}pixelsPerMeter(i,r){return 1/oF(i)*r}pixelSpaceConversion(i,r,a){return 1}farthestPixelDistance(i){return cl(i,i.pixelsPerMeter)}pointCoordinate(i,r,a,n){let o=new eJ(r,Math.max(i.horizonLineFromTop(!1),a));return i.rayIntersectionCoordinate(i.pointRayIntersection(o,n))}pointCoordinate3D(i,r,a){let n=new eJ(r,a);if(i.elevation)return i.elevation.pointCoordinate(n);{let r=this.pointCoordinate(i,n.x,n.y,0);return[r.x,r.y,r.z]}}isPointAboveHorizon(i,r){if(i.elevation&&i.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(i,r.x,r.y);let a=i.horizonLineFromTop();return r.y<a}createInversionMatrix(i,r){return c_}createTileMatrix(i,r,a){let n,o,s,l=a.canonical,h=Z(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=cp(l,this);n=1,o=u.x+a.wrap*u.scale,s=u.y,K(h,h,[n/u.scale,n/u.scale,i.pixelsPerMeter/r])}else n=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*a.wrap)*n,s=l.y*n;return Y(h,h,[o,s,0]),K(h,h,[n/8192,n/8192,1]),h}upVector(i,r,a){return[0,0,1]}upVectorScale(i,r,a){return{metersToTile:1}}}class cy extends cg{constructor(i){super(i),this.range=[4,7],this.center=i.center||[-96,37.5];const[r,a]=this.parallels=i.parallels||[29.5,45.5],n=Math.sin(r*e7);this.n=(n+Math.sin(a*e7))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(i,r){let{n:a,c:n,r0:o}=this,s=(i-this.center[0])*e7,l=Math.sqrt(n-2*a*Math.sin(r*e7))/a;return{x:l*Math.sin(s*a),y:l*Math.cos(s*a)-o,z:0}}unproject(i,r){let{n:a,c:n,r0:o}=this,s=o+r,l=Math.atan2(i,Math.abs(s))*Math.sign(s);s*a<0&&(l-=Math.PI*Math.sign(i)*Math.sign(s));let h=this.center[0]*e7*a,u=ts((l=th(l,-Math.PI-h,Math.PI-h))/a*te+this.center[0],-180,180),c=Math.asin(ts((n-(i*i+s*s)*a*a)/(2*a),-1,1));return new oz(u,ts(c*te,-85.051129,85.051129))}}let cx=Math.sqrt(3)/2;class cv extends cg{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let a=Math.asin(cx*Math.sin(r)),n=a*a,o=n*n*n;return{x:.5*(i*Math.cos(a)/(cx*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))
7)/Math.PI+.5),y:1-.5*(a*(1.340264+-.081106*n+o*(893e-6+.003796*n))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=a*a,o=n*n*n;for(let i,s,l=0;l<12&&(s=a*(1.340264+-.081106*n+o*(893e-6+.003796*n))-r,o=(n=(a=ts(a-(i=s/(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))),-Math.PI/3,Math.PI/3))*a)*n*n,!(1e-12>Math.abs(i)));++l);let s=cx*i*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))/Math.cos(a),l=Math.asin(Math.sin(a)/cx);return new oz(ts(180*s/Math.PI,-180,180),ts(180*l/Math.PI,-85.051129,85.051129))}}class cb extends cg{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){return{x:.5+i/360,y:.5-r/360,z:0}}unproject(i,r){return new oz(360*(i-.5),ts(360*(.5-r),-85.051129,85.051129))}}let cw=Math.PI/2;function cT(i){return Math.tan((cw+i)/2)}class cS extends cg{constructor(i){super(i),this.center=i.center||[0,30];const[r,a]=this.parallels=i.parallels||[30,30];let n=r*e7,o=a*e7;this.southernCenter=n+o<0,this.southernCenter&&(n=-n,o=-o);const s=Math.cos(n),l=cT(n);this.n=n===o?Math.sin(n):Math.log(s/Math.cos(o))/Math.log(cT(o)/l),this.f=s*Math.pow(cT(n),this.n)/this.n}project(i,r){r*=e7,this.southernCenter&&(r=-r),i=(i-this.center[0])*e7;let{n:a,f:n}=this;n>0?r<-cw+1e-6&&(r=-cw+1e-6):r>cw-1e-6&&(r=cw-1e-6);let o=n/Math.pow(cT(r),a),s=o*Math.sin(a*i),l=n-o*Math.cos(a*i);return s=.5*(s/Math.PI+.5),l=.5*(l/Math.PI+.5),{x:s,y:this.southernCenter?l:1-l,z:0}}unproject(i,r){i=(2*i-.5)*Math.PI,this.southernCenter&&(r=1-r);let{n:a,f:n}=this,o=n-(r=(2*(1-r)-.5)*Math.PI),s=Math.sign(o),l=Math.sign(a)*Math.sqrt(i*i+o*o),h=Math.atan2(i,Math.abs(o))*s;o*a<0&&(h-=Math.PI*Math.sign(i)*s);let u=ts(h/a*te+this.center[0],-180,180),c=ts((2*Math.atan(Math.pow(n/l,1/a))-cw)*te,-85.051129,85.051129);return new oz(u,this.southernCenter?-c:c)}}class cE extends cg{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(i,r){return{x:rd(i),y:rf(r),z:0}}unproject(i,r){return new oz(rp(i),rm(r))}}let cI=85.051129*e7;class cA extends cg{project(i,r){let a=(r*=e7)*r,n=a*a;return{x:.5*((i*=e7)*(.8707-.131979*a+n*(n*(.003971*a-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+a*(.015085+n*(.028874*a-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=25,o=0,s=a*a;do{let i=(s=a*a)*s;o=(a*(1.007226+s*(.015085+i*(.028874*s-.044475-.005916*i)))-r)/(1.007226+s*(.045255+i*(.259866*s-.311325-.005916*11*i))),a=ts(a-o,-cI,cI)}while(Math.abs(o)>1e-6&&--n>0)return new oz(ts(i/(.8707+(s=a*a)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*te,-180,180),a*te)}}let cM=85.051129*e7;class cC extends cg{project(i,r){r*=e7,i*=e7;let a=Math.cos(r),n=Math.acos(a*Math.cos(i/2)),o=Math.sin(n)/n;return{x:.5*((.5*(2/Math.PI*i+2*a*Math.sin(i/2)/o)||0)/Math.PI+.5),y:1-.5*((.5*(r+Math.sin(r)/o)||0)/Math.PI+1),z:0}}unproject(i,r){let a=i=(2*i-.5)*Math.PI,n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,l=0;do{let o=Math.cos(n),h=Math.sin(n),u=2*h*o,c=h*h,d=o*o,f=Math.cos(a/2),p=Math.sin(a/2),m=2*f*p,_=p*p,g=1-d*f*f,y=g?1/g:0,x=g?Math.acos(o*f)*Math.sqrt(1/g):0,v=.5*(2*x*o*p+2*a/Math.PI)-i,b=.5*(x*h+n)-r,w=.5*y*(d*_+x*o*f*c)+1/Math.PI,T=y*(m*u/4-x*h*p),S=.125*y*(u*p-x*h*d*m),E=.5*y*(c*f+x*_*o)+.5,I=T*S-E*w;s=(b*T-v*E)/I,l=(v*S-b*w)/I,a=ts(a-s,-Math.PI,Math.PI),n=ts(n-l,-cM,cM)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0)return new oz(a*te,n*te)}}class cD extends cg{constructor(i){super(i),this.center=i.center||[0,0],this.parallels=i.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*e7)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){let{scale:a,cosPhi:n}=this;return{x:i*e7*n*a+.5,y:-Math.sin(r*e7)/n*a+.5,z:0}}unproject(i,r){let{scale:a,cosPhi:n}=this,o=ts((i-.5)/a*te/n,-180,180),s=Math.asin(ts(-(r-.5)/a*n,-1,1));return new oz(o,ts(s*te,-85.051129,85.051129))}}class cR extends cE{constructor(i){super(i),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(i,r,a){let n=u4(i,r,a);return eI(n,n,u8(uK(a))),{x:n[0],y:n[1],z:n[2]}}locationPoint(i,r,a){let n=oP(r.lat,r.lng),o=ew([],n),s=a?i._centerAltitude+a:i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;eg(n,n,o,1/oF(0)*8192*s);let l=Z(new Float64Array(16));return X(l,i.pixelMatrix,i.globeMatrix),eI(n,n,l),new eJ(n[0],n[1])}pixelsPerMeter(i,r){return 1/oF(0)*r}pixelSpaceConversion(i,r,a){let n=1/oF(i)*r,o=iw(1/oF(45)*r,n,a);return this.pixelsPerMeter(i,r)/o}createTileMatrix(i,r,a){let n=u9(uK(a.canonical));return X(new Float64Array(16),i.globeMatrix,n)}createInversionMatrix(i,r){let{center:a}=i,n=u8(uK(r));return Q(n,n,a.lng*e7),J(n,n,a.lat*e7),K(n,n,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(i,r,a,n){return uW(i,r,a,!0)||new oj(0,0)}pointCoordinate3D(i,r,a){let n=this.pointCoordinate(i,r,a,0);return[n.x,n.y,n.z]}isPointAboveHorizon(i,r){return!uW(i,r.x,r.y,!1)}farthestPixelDistance(i){let r=function(i,r){let a,n=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=ec([],e_([],l,-n),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],d=i.width/i.height,f=Math.tan(i.fovAboveCenter),p=e_([],s.up(),f),m=e_([],s.right(),f*d),_=ew([],ec([],ec([],l,p),m)),g=[];if(new uN(h,_).closestPointOnSphere(c,u,g)){let r=ed([],ec([],g,c),h);a=Math.cos(i.fovAboveCenter)*el(r)}else{let i=ed([],h,c),r=ed([],c,h);ew(r,r);let n=el(i)-u,o=Math.acos((a=Math.sqrt(n*(n+2*u)))/(u+n))-Math.acos(eT(l,r));a*=Math.cos(o)}return 1.01*a}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),a=ci(i.zoom);return a>0?iw(r,cl(i,1/oF(i.center.lat)*i.worldSize)+i.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(i.width,i.height)/i.worldSize*Math.PI)),Math.pow(a,10)):r}upVector(i,r,a){return u4(r,a,i,1)}upVectorScale(i){return{metersToTile:u$(u5(uK(i)))}}}function cP(i){let r=i.parallels,a=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new cE(i);case"equirectangular":return new cb(i);case"naturalEarth":return new cA(i);case"equalEarth":return new cv(i);case"winkelTripel":return new cC(i);case"albers":return a?new cD(i):new cy(i);case"lambertConformalConic":return a?new cD(i):new cS(i);case"globe":return new cR(i)}throw Error(`Invalid projection name: ${i.name}`)}let cL=Number.MAX_SAFE_INTEGER;function cz(i,r,a,n){return i.order<r||i.order===cL||!(i.clipMask&a)||function(i,r){if(0===r.length)return!1;let a=i;for(;""!==a;){if(r.includes(a))return!1;a=oe(a)}return!0}(n,i.clipScope)}function cO(i,r){return i.x-r.x||i.y-r.y}function cF(i,r){return 0===cO(i.min,r.min)&&0===cO(i.max,r.max)}function cB(i,r){return!(i.min.x>r.max.x||i.max.x<r.min.x||i.min.y>r.max.y||i.max.y<r.min.y)}function ck(i,r){if(i.length!==r.length)return!1;for(let a=0;a<i.length;
7a++)if(i[a].sourceId!==r[a].sourceId||!cF(i[a],r[a])||i[a].order!==r[a].order||i[a].clipMask!==r[a].clipMask||!eQ(i[a].clipScope,r[a].clipScope))return!1;return!0}function cN(i,r,a){let n=1/(1<<a.canonical.z),o=(1220703125e-13*r.x+a.canonical.x)*n+a.wrap,s=(1220703125e-13*r.y+a.canonical.y)*n;return{min:new eJ((1220703125e-13*i.x+a.canonical.x)*n+a.wrap,(1220703125e-13*i.y+a.canonical.y)*n),max:new eJ(o,s)}}function cU(i,r,a,n,o,s,l){let h=i.indices,u=i.vertices,c=[];for(let d=n;d<n+o;d+=3){let n=r[a[d+0]+s],o=r[a[d+1]+s],f=r[a[d+2]+s],p=Math.min(n.x,o.x,f.x),m=Math.max(n.x,o.x,f.x),_=Math.min(n.y,o.y,f.y),g=Math.max(n.y,o.y,f.y);c.length=0,i.grid.query(new eJ(p,_),new eJ(m,g),c);for(let i=0;i<c.length;i++){let r=c[i];if(lL(u[h[3*r+0]],u[h[3*r+1]],u[h[3*r+2]],n,o,f,l))return!0}}return!1}function cV(i,r,a,n){let o=Math.pow(2,n.z-a.z);return new eJ((i+8192*a.x)*o-8192*n.x,(r+8192*a.y)*o-8192*n.y)}function cj(i,r){let a=[];r.grid.queryPoint(i,a);let n=r.indices,o=r.vertices;for(let r=0;r<a.length;r++){let s=a[r];if(lC([o[n[3*s+0]],o[n[3*s+1]],o[n[3*s+2]]],i))return!0}return!1}class cG{constructor(i,r){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=r,this.appearances=i;const a=i.map(i=>(function(i){if(!i.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};let r=i.condition.expression;return{featureDependent:!rY(r),stateDependent:!rK(r),zoomDependent:!rJ(r,["zoom"]),pitchDependent:!rJ(r,["pitch"]),brightnessDependent:!rJ(r,["brightness","measure-light"]),worldviewDependent:!rJ(r,["worldview"])}})(i));this.anyFeatureDependent=a.some(i=>i.featureDependent),this.anyStateDependent=a.some(i=>i.stateDependent)}update(i,r){let a=this.lastParams,n=!a||a.zoom!==i.zoom||a.pitch!==(i.pitch||0)||a.brightness!==(i.brightness||0)||a.worldview!==i.worldview;this.lastParams={zoom:i.zoom,pitch:i.pitch||0,brightness:i.brightness||0,worldview:i.worldview};let o=r&&this.anyStateDependent;if(!n&&!o&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!o){let r=this.evaluateAllFeatures(i);return r===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=r,{kind:"all-features",appearanceIndex:r})}return{kind:"per-feature"}}evaluateAllFeatures(i){for(let r=0;r<this.appearances.length;r++){let a=this.appearances[r];if(a.condition&&a.condition.evaluate(i,void 0,void 0,void 0))return r}return-1}}let cH=lx.types,cq=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function c$(i,r,a,n,o,s,l,h,u,c,d,f,p){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;i.emplaceBack(r,a,Math.round(32*n),Math.round(32*o),s,l,(m<<1)+ +!!u,0+(_<<1),16*c,16*d,256*f,256*p)}function cZ(i,r,a){i.emplaceBack(r,a)}function cW(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,l)}function cX(i,r,a,n,o){i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o)}class cY{constructor(i){this.layoutVertexArray=new si,this.indexArray=new sc,this.programConfigurations=i,this.segments=new sG,this.dynamicLayoutVertexArray=new sa,this.opacityVertexArray=new sn,this.placedSymbolArray=new sC,this.iconTransitioningVertexArray=new so,this.globeExtVertexArray=new sr,this.zOffsetVertexArray=new o2,this.orientationVertexArray=new sp,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new o2,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(i){let r=i.get().length===this.segments.get().length;if(r&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};let a=new Map;for(let r of i.get()){let i=void 0!==r.batchIndex?r.batchIndex:0;a.has(i)||a.set(i,[]),a.get(i).push(r)}let n=Array.from(a.keys()).sort((i,r)=>i-r),o=new Map;for(let i of n){let r=a.get(i);o.set(i,new sG(r))}return r&&(this.cachedBatchIndices=n,this.cachedBatchSegments=o),{batchIndices:n,batchSegments:o}}
vendor: 3,037 bytes, line 7
7snapshotSymbolVertexData(i,r){let a=12*i;return this.layoutVertexArray.uint16.slice(a,a+12*r)}restoreSymbolVertexData(i,r){this.layoutVertexArray.uint16.set(r,12*i)}updateSymbolVertexData(i,r,a,n,o,s,l,h,u,c,d,f,p){let m=this.layoutVertexArray.uint16,_=12*i;m[_]=r,m[_+1]=a,m[_+2]=n,m[_+3]=o,m[_+4]=s,m[_+5]=l,m[_+6]=h,m[_+7]=u,m[_+8]=c,m[_+9]=d,m[_+10]=f,m[_+11]=p}upload(i,r,a,n,o,s){this.isEmpty()||(a&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,l4.members,!!s),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,l6.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,cq,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=i.createVertexBuffer(this.iconTransitioningVertexArray,he.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,l5.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||o)&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,l8.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=i.createVertexBuffer(this.orientationVertexArray,l7.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=i.createVertexBuffer(this.featureIdArray,l9.members,!1))),(a||n)&&(this.programConfigurations.upload(i),this.uboBinder&&this.uboBinder.upload(i)))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}a2(cY,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class cK{constructor(i,r,a){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new a,this.segments=new sG,this.collisionVertexArray=new su,this.collisionVertexArrayExt=new sa}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,ht.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,hi.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}a2(cK,"CollisionBuffers");class cJ{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Z([]),this.placementViewportMatrix=Z([]);const r=this.layers[0]._unevaluatedLayout._values;this.worldview=i.worldview,this.localizable=i.localizable,this.maxUniformBufferBindings=i.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=i.maxUniformBlockSizeDwords,this.disableSymbolUBO=i.disableSymbolUBO,this.textSizeData=hj(this.zoom,r["text-size"],this.worldview,i.availableImages),this.iconSizeData=hj(this.zoom,r["icon-size"],this.worldview,i.availableImages);const a=this.layers[0].layout,n=a.get("symbol-sort-key"),o=a.get("symbol-z-order");this.lut=i.lut,this.canOverlap=a.get("text-allow-overlap")||a.get("icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=a.get("text-writing-mode").map(i=>hE[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID,this.projection=i.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(i){let r=this.layers[0].getAppearances();if(!r||0===r.length)return!1;let a=Array.isArray(i)?i:[i];return r.some(i=>a.some(r=>i.hasLayoutProperty(r)))}getAppearanceFeatureData(i){return this.featureAppearanceData.get(i)}createArrays(){this.text=new cY(new ln(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("text")||i.startsWith("symbol"))),this.icon=new cY(new ln(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("icon")||i.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new hc(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new hc(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new sP,this.lineVertexArray=new sL,this.symbolInstances=new sR}calculateGlyphDependencies(i,r,a,n,o){for(let a of i){let i=a.codePointAt(0);if(void 0===i)break;if(r[i]=!0,n&&o&&i<=65535){let i=hd[a];i&&(r[i.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(i,r,a,n,o,s,l){if(!i.hasLayoutProperty("icon-size"))return l*s;let h=1,u=i.getUnevaluatedLayoutProperty("icon-size"),c=hj(this.zoom,u,this.worldview,o),d=hH(c,r);if("constant"!==c.kind&&"camera"!==c.kind||(h=d.uSize),"composite"===c.kind){let{minZoom:i,maxZoom:r}=c,s=u.possiblyEvaluate(new nk(i,{worldview:this.worldview}),n),l=u.possiblyEvaluate(new nk(r,{worldview:this.worldview}),n),f=s.evaluate(a,{},n,o);h=f+(l.evaluate(a,{},n,o)-f)*d.uSizeT}return"source"===c.kind&&(h=u.possiblyEvaluate(new nk(this.zoom,{worldview:this.worldview}),n).evaluate(a,{},n,o)),h*s}updateFootprints(i,r){}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);return!ck(this.activeReplacements,a)&&(this.activeReplacements=a,!0)}getResolvedImageFromTokens(i){return"string"==typeof i?iQ.build(i):i}populate(i,r,a,n){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),[d,f]=s.get("icon-size-scale-range"),p=ts(r.scaleFactor||1,d,f),[m,_]=s.get("text-size-scale-range"),g=ts(r.scaleFactor||1,m,_),y=("constant"!==u.value.kind||u.value.value instanceof iK&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),x="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,v=this.hasAnyAppearanceLayoutProperty("icon-image"),b=s.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!y&&!x&&!v)return;let w=r.iconDependencies,T=r.glyphDependencies,S=r.availableImages,E=new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),I=i=>{let r=i.id.toString();w.has(r)?w.get(r).push(i):w.set(r,[i])};for(let r of i){let i,u,{feature:c,id:d,index:f,sourceLayerIndex:m}=r,_=o._featureFilter.needGeometry,A=o$(c,_);if(!o._featureFilter.filter(E,A,a))continue;if(_||(A.geometry=oq(c,a,n)),l&&1!==c.type&&a.z<=5){let i=A.geometry,r=(i,r)=>.98078528056>eT(u4(i.x,i.y,a,1),u4(r.x,r.y,a,1));for(let a=0;a<i.length;a++)i[a]=function(i,r){let a=i[0],n=[a];for(let o=1;o<i.length;o++){let s=i[o];
7(function i(r,a,n,o){if(o(a,n)){let s=a.add(n)._mult(.5);i(r,a,s,o),i(r,s,n,o)}else r.push(n)})(n,a,s,r),a=s}return n}(i[a],r)}if(y){let r=o.getValueAndResolveTokens("text-field",A,a,S),n=iK.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(nI(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(n)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nz()||this.hasRTLText&&nF.isParsed())&&(i=function(i,r,a){return i.sections.forEach(i=>{var n;let o;n=i.text,"uppercase"===(o=r.layout.get("text-transform").evaluate(a,{}))?n=n.toLocaleUpperCase():"lowercase"===o&&(n=n.toLocaleLowerCase()),nF.applyArabicShaping&&(n=nF.applyArabicShaping(n)),i.text=n}),i}(n,o,A))}if(x){let i=o.getValueAndResolveTokens("icon-image",A,a,S);u=this.getResolvedImageFromTokens(i)}let M=this.layers[0],C=!1;if(!u&&v){for(let i of M.getAppearances())if(i.getLayoutProperty("icon-image")){let r=M.getAppearanceValueAndResolveTokens(i,"icon-image",A,a,S);if(r){u=this.getResolvedImageFromTokens(r),C=!0;break}}}if(!i&&!u)continue;let D=this.sortFeaturesByKey?b.evaluate(A,{},a):void 0,R={id:d,text:i,icon:u,index:f,sourceLayerIndex:m,geometry:A.geometry,properties:c.properties,type:cH[c.type],sortKey:D};if(this.features.push(R),this.featureAppearanceData.set(f,{id:d,properties:c.properties,usesAppearanceIconAsPlaceholder:C}),u){let i=M._unevaluatedLayout._values,{iconPrimary:r,iconSecondary:n}=uI(u,this.iconSizeData,i["icon-size"],a,this.zoom,R,this.pixelRatio,p,this.worldview,S);I(r),n&&(this.hasAnySecondaryIcon=!0,I(n))}let P=M.getAppearances();if(0!==P.length&&P.forEach(i=>{if(!i.getLayoutProperty("icon-image"))return;let r=this.getCombinedIconPrimary(i,M,A,a,S,R,p);r&&I(r)}),i){let r=h.evaluate(A,{},a).join(","),n="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let a of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(hE.vertical),i.sections))if(a.image){let i=a.image.getPrimary().scaleSelf(this.pixelRatio*g),r=i.id.toString(),n=w.get(r)||[];n.push(i),w.set(r,n)}else{let o=nT(i.toString()),s=a.fontStack||r,l=T[s]=T[s]||{};this.calculateGlyphDependencies(a.text,l,n,this.allowVerticalPlacement,o)}}}"line"===s.get("symbol-placement")&&(this.features=function(i){let r={},a={},n=[],o=0;function s(r){n.push(i[r]),o++}function l(i,r,o){let s=a[i];return delete a[i],a[r]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(o[0]),s}function h(i,a,o){let s=r[a];return delete r[a],r[i]=s,n[s].geometry[0].shift(),n[s].geometry[0]=o[0].concat(n[s].geometry[0]),s}function u(i,r,a){let n=a?r[0].at(-1):r[0][0];return`${i}:${n.x}:${n.y}`}for(let c=0;c<i.length;c++){let d=i[c],f=d.geometry,p=d.text?d.text.toString():null;if(!p){s(c);continue}let m=u(p,f),_=u(p,f,!0);if(m in a&&_ in r&&a[m]!==r[_]){let i=h(m,_,f),o=l(m,_,n[i].geometry);delete r[m],delete a[_],a[u(p,n[o].geometry,!0)]=o,n[i].geometry=null}else m in a?l(m,_,f):_ in r?h(m,_,f):(s(c),r[m]=o-1,a[_]=o-1)}return n.filter(i=>i.geometry)}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")?(this.elevationType="road",this.hdExt&&r.elevationFeatures&&r.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(r.elevationFeatures)):s.get("symbol-z-elevate")&&(this.elevationType="offset"),"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}getCombinedIconPrimary(i,r,a,n,o,s,l){let h,u;if(i.hasLayoutProperty("icon-image")){let s=r.getAppearanceValueAndResolveTokens(i,"icon-image",a,n,o);h=this.getResolvedImageFromTokens(s)}else{let i=r.getValueAndResolveTokens("icon-image",a,n,o);h=this.getResolvedImageFromTokens(i)}if(h){let a=i.hasLayoutProperty("icon-size")?i.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"];u=uI(h,hj(this.zoom,a,this.worldview,o),a,n,this.zoom,s,this.pixelRatio,l,this.worldview,o).iconPrimary}return u}updateSymbolInstanceIconVertices(i,r,a,n,o,s){let{canonical:l,availableImages:h,globalProperties:u,layer:c,iconScaleFactor:d,featureState:f,layoutIconOffset:p,layoutIconSize:m,layoutIconRotate:_}=s;if(i.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1};let g=a>=0?c.appearances[a]:null;if(g){let a=this.getCombinedIconPrimary(g,c,n,l,h,{sortKey:void 0,text:void 0,icon:null,index:i.featureIndex,sourceLayerIndex:i.featureIndex,geometry:[],properties:r.properties,type:"Point",id:r.id},d);if(!a)return{vertexOffsetDelta:0,hasChanges:!1};let s=a.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(s);if(y){let{appearanceIconOffset:a,appearanceIconRotate:s}=uw(g,c,n,l,p,_,m,d),x=hB(y,void 0,a,c.layout.get("icon-anchor").evaluate(n,f,l)),v=y.sdf,b=c.layout.get("icon-text-fit").constantOr("none");"none"!==b&&r.textShaping&&r.iconTextFitPadding&&r.fontScale&&(x=hk(x,r.textShaping,b,r.iconTextFitPadding,a,r.fontScale));
7let w=1+(Math.min(32640,Math.round(128*this.calculateEffectiveAppearanceIconSize(g,u.zoom,n,l,h,d,m)))<<1),T=uu(x,s,v,"none"!==b,d);r.isUsingAppearanceIconVertexData||(r.isUsingAppearanceIconVertexData=!0,r.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(o,i.numIconVertices));let S=Math.floor(i.numIconVertices/4),E=Math.min(T.length,S),I=o;for(let a=0;a<E;++a){let n=T[a],o=r.layoutBasedIconVertexData[0]||i.tileAnchorX,s=r.layoutBasedIconVertexData[1]||i.tileAnchorY,l=16*n.pixelOffsetTL.x,h=16*n.pixelOffsetTL.y,u=16*n.pixelOffsetBR.x,c=16*n.pixelOffsetBR.y,d=16*n.minFontScaleX,f=16*n.minFontScaleY;this.icon.updateSymbolVertexData(I,o,s,Math.round(32*n.tl.x),Math.round(32*n.tl.y),n.texPrimary.x,n.texPrimary.y,0,w,l,h,d,f),this.icon.updateSymbolVertexData(I+1,o,s,Math.round(32*n.tr.x),Math.round(32*n.tr.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y,0,w,u,h,d,f),this.icon.updateSymbolVertexData(I+2,o,s,Math.round(32*n.bl.x),Math.round(32*n.bl.y),n.texPrimary.x,n.texPrimary.y+n.texPrimary.h,0,w,l,c,d,f),this.icon.updateSymbolVertexData(I+3,o,s,Math.round(32*n.br.x),Math.round(32*n.br.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y+n.texPrimary.h,0,w,u,c,d,f),I+=4}let A=i.numIconVertices-4*E;for(let i=0;i<A;++i)this.icon.updateSymbolVertexData(I+i,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:i.numIconVertices,hasChanges:!0}}}else{if(r.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(o,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:i.numIconVertices,hasChanges:!0};if(r.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(o,r.layoutBasedIconVertexData),r.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:r.layoutBasedIconVertexData.length/12,hasChanges:!0}}return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(i,r,a,n,o,s){let{canonical:l,layer:h,textScaleFactor:u,imageMap:c,featureState:d,layoutTextOffset:f,layoutTextSize:p,layoutTextRotate:m,layoutMinZoomSize:_,layoutMaxZoomSize:g,layoutTextSizeMinZoom:y,layoutTextSizeMaxZoom:x,availableImages:v}=s,b=i.numHorizontalGlyphVertices>0||i.numVerticalGlyphVertices>0;if(!b)return{vertexOffsetDelta:b?i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1};let w=a>=0?h.appearances[a]:null;if(w&&r.textShaping){let{appearanceTextOffset:a,appearanceTextRotate:s,appearanceTextSize:b}=uT(w,h,n,l,f,m,p);r.fontScale=b*r.textScaleFactor/24;let T=w.getUnevaluatedLayoutProperty("text-size"),S=this.textSizeData,E=y,I=x;w.hasLayoutProperty("text-size")&&(S=hj(this.zoom,T,this.worldview,v),E="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,I="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);let A=r.textShaping.bottom-f[1],M=r.textShaping.left-f[0],C=r.textShaping.right-f[0];r.textShaping.top=a[1]+(r.textShaping.top-f[1]),r.textShaping.bottom=a[1]+A,r.textShaping.left=a[0]+M,r.textShaping.right=a[0]+C;let D=up(0,r.textShaping,a,h,!1,n,c,this.allowVerticalPlacement,s),R=b&&"composite"===S.kind?T.possiblyEvaluate(new nk(E,{}),l).evaluate(n,d,l):_,P=b&&"composite"===S.kind?T.possiblyEvaluate(new nk(I,{}),l).evaluate(n,d,l):g,L=uR(w.name,S,b,u,R,P),z=1+(Math.min(32640,Math.round((Array.isArray(L)?L[1]:b)*128))<<1);r.isUsingAppearanceTextVertexData||(r.isUsingAppearanceTextVertexData=!0,r.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(o,i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices));for(let r=0;r<D.length&&r<(i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices)/4;++r){let a=D[r],n=a.glyphOffset[1],s=i.tileAnchorX,l=i.tileAnchorY,h=o+4*r;this.text.updateSymbolVertexData(h,s,l,Math.round(32*a.tl.x),Math.round(32*(n+a.tl.y)),a.texPrimary.x,a.texPrimary.y,0,z,a.pixelOffsetTL.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+1,s,l,Math.round(32*a.tr.x),Math.round(32*(n+a.tr.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y,0,z,a.pixelOffsetBR.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+2,s,l,Math.round(32*a.bl.x),Math.round(32*(n+a.bl.y)),a.texPrimary.x,a.texPrimary.y+a.texPrimary.h,0,z,a.pixelOffsetTL.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+3,s,l,Math.round(32*a.br.x),Math.round(32*(n+a.br.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y+a.texPrimary.h,0,z,a.pixelOffsetBR.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY)}return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!0}}return r.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(o,r.layoutBasedTextVertexData),r.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:r.layoutBasedTextVertexData.length/12,hasChanges:!0}):{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(i){this.text&&this.text.programConfigurations.updateExpressions(i),this.icon&&this.icon.programConfigurations.updateExpressions(i)}update(i,r,a,n,o,s,l,h){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),h){if(s)for(let n of[this.text.uboBinder,this.icon.uboBinder])n&&!n.isLightConstant&&n.updateDynamicExpressions(o[0],r,h,a,i,l);else if(Object.keys(i).length>0){let n=o[0],s=[this.text.uboBinder,this.icon.uboBinder].filter(i=>i&&i.hasStateDependentPaint(n));if(s.length>0){let o=new Set(Object.keys(i).map(i=>{let r=Number(i);return!isNaN(r)&&Number.isSafeInteger(r)&&String(r)===i?r:i}));for(let u of s)u.updateFeatures(o,n,r,h,a,i,l)}}}}updateZOffset(){let i=(i,r,n)=>{(a+=r)>i.length&&i.resize(a);for(let o=-r;o<0;o++)i.emplace(o+a,n)},r=(i,r,a)=>{(n+=r)>i.length&&i.resize(n);for(let o=-r;o<0;o++)i.emplace(o+n,a)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let a=0,n=0;for(let a=0;a<this.symbolInstances.length;a++){let n=this.symbolInstances.get(a),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,numIconVertices:l}=n,h=n.zOffset,u=l>0;if((o>0||s>0)&&(i(this.text.zOffsetVertexArray,o,h),i(this.text.zOffsetVertexArray,s,h)),u){let{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:a}=n;i>=0&&r(this.icon.zOffsetVertexArray,l,h),a>=0&&r(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,h)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i,r,a,n,o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(i=>i.appearances&&i.appearances.length>0)),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(i,r,a,n,o,s=!1){let l={hasLayoutChanges:!1,hasUboChanges:!1};if(!i||!a||!this.featureAppearanceData)return l;let h=r||{},u=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,c=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!u&&!c)return l;let d=this.layers[0],f=d.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===d.appearancesVersion||(this.featureAppearances=new cG(d.appearances,d.appearancesVersion));let p=this.featureAppearances.update(n,s);if("no-changes"===p.kind)return l;let m=1,_=0,g=!1,y=!1;if(u){let[i,r]=f.get("icon-size-scale-range");m=ts(1,i,r)}let x=1,v=0,b=!1;
7if(c){let[i,r]=f.get("text-size-scale-range");x=ts(1,i,r)}let w=new Map;if(o&&a)for(let i of a){let r=o.getImage(i,d.scope);if(r){let a=new iJ(i.toString());w.set(a.toString(),r)}}let T=[this.text.uboBinder,this.icon.uboBinder];for(let r=0;r<this.symbolInstances.length;r++){let o,s=this.symbolInstances.get(r),l=this.getAppearanceFeatureData(s.featureIndex);if(!l)continue;let S=l.id,E=void 0!==S?h[String(S)]:void 0,I={type:"Point",id:l.id,properties:l.properties,geometry:[]};if("all-features"===p.kind)o=p.appearanceIndex;else{let r=d.appearances?d.appearances.findIndex(r=>r.isActive({globals:n,feature:I,canonical:i,featureState:E})):-1;o=r>=0?r:-1}let A=l.activeAppearanceIndex!==o;if(c){let r=f.get("text-size"),n="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,h="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,u={canonical:i,layer:d,featureState:E,availableImages:a,textScaleFactor:x,imageMap:w,layoutTextOffset:f.get("text-offset").evaluate(I,E,i).map(i=>24*i),layoutTextSize:r.evaluate(I,E,i),layoutTextRotate:f.get("text-rotate").evaluate(I,E,i),layoutMinZoomSize:r.evaluate(I,{zoom:n},i),layoutMaxZoomSize:r.evaluate(I,{zoom:h},i),layoutTextSizeMinZoom:n,layoutTextSizeMaxZoom:h},c=this.updateSymbolInstanceTextVertices(s,l,o,I,v,u);v+=c.vertexOffsetDelta,b=b||c.hasChanges}if(u){let r={canonical:i,layer:d,featureState:E,availableImages:a,globalProperties:n,iconScaleFactor:m,layoutIconOffset:f.get("icon-offset").evaluate(I,E,i),layoutIconSize:f.get("icon-size").evaluate(I,E,i,a),layoutIconRotate:f.get("icon-rotate").evaluate(I,E,i)},h=this.updateSymbolInstanceIconVertices(s,l,o,I,_,r);_+=h.vertexOffsetDelta,g=g||h.hasChanges}if(A){let r=s.featureIndex,l=n?n.brightness:null,h=E||{},u=o>=0?d.appearances[o]:null;for(let n of T)n&&(n.layer=d,y=n.updateFeaturePaintForAppearance(r,I,h,i,a,l,u)||y)}l.activeAppearanceIndex=o}return g&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),b&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:g||b,hasUboChanges:y}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=cP(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){let a=this.lineVertexArray.length;if(void 0!==i.segment)for(let{x:i,y:a}of r)this.lineVertexArray.emplaceBack(i,a);return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x){let v=i.indexArray,b=i.layoutVertexArray,w=i.globeExtVertexArray,T=i.uboBinder?i.uboBinder.getCurrentBatchIndex():void 0,S=i.segments.prepareSegment(4*x,b,v,this.canOverlap?s.sortKey:void 0,T),E=this.glyphOffsetArray.length,I=S.vertexLength,A=this.allowVerticalPlacement&&l===hE.vertical?Math.PI/2:0,M=s.text&&s.text.sections,C=b.length,D=-1;for(let n=0;n<r.length;n++){let{tl:o,tr:l,bl:c,br:d,texPrimary:f,texSecondary:y,pixelOffsetTL:x,pixelOffsetBR:T,minFontScaleX:E,minFontScaleY:I,glyphOffset:R,isSDF:P,sectionIndex:L}=r[n],z=S.vertexLength,O=R[1];if(c$(b,u.x,u.y,o.x,O+o.y,f.x,f.y,a,P,x.x,x.y,E,I),c$(b,u.x,u.y,l.x,O+l.y,f.x+f.w,f.y,a,P,T.x,x.y,E,I),c$(b,u.x,u.y,c.x,O+c.y,f.x,f.y+f.h,a,P,x.x,T.y,E,I),c$(b,u.x,u.y,d.x,O+d.y,f.x+f.w,f.y+f.h,a,P,T.x,T.y,E,I),h){let{x:r,y:a,z:n}=h.anchor,[o,s,l]=h.up;cW(w,r,a,n,o,s,l),cW(w,r,a,n,o,s,l),cW(w,r,a,n,o,s,l),cW(w,r,a,n,o,s,l),cX(i.dynamicLayoutVertexArray,r,a,n,A)}else cX(i.dynamicLayoutVertexArray,u.x,u.y,u.z,A);if(g){let r=y||f;cZ(i.iconTransitioningVertexArray,r.x,r.y),cZ(i.iconTransitioningVertexArray,r.x+r.w,r.y),cZ(i.iconTransitioningVertexArray,r.x,r.y+r.h),cZ(i.iconTransitioningVertexArray,r.x+r.w,r.y+r.h)}if(v.emplaceBack(z,z+1,z+2),v.emplaceBack(z+1,z+2,z+3),S.vertexLength+=4,S.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(R[0]),(n===r.length-1||L!==r[n+1].sectionIndex)&&(i.uboBinder||i.programConfigurations.populatePaintArrays(b.length,s,s.index,{},p,m,_,M&&M[L],this.worldview),i.uboBinder)){let r=i.uboBinder.populateUBO(s,s.index,m,p,_,M&&M[L]);D=r;let a=b.length-C;for(let n=0;n<a;n++)i.featureIdArray.emplaceBack(r);C=b.length}}let R=x-r.length;if(0!==R&&(this._addNullVertices(R,b,a,h,w,i,g,S,v),i.uboBinder&&D>=0)){let r=4*R;for(let a=0;a<r;a++)i.featureIdArray.emplaceBack(D)}
vendor: 7,179 bytes, line 7
7let P=h?h.anchor:u;i.placedSymbolArray.emplaceBack(P.x,P.y,P.z,u.x,u.y,E,this.glyphOffsetArray.length-E,I,c,d,u.segment,a?a[0]:0,a?a[1]:0,n[0],n[1],l,0,0,0,f,0),i.symbolInstanceIndices.push(y)}_addNullVertices(i,r,a,n,o,s,l,h,u){for(let c=0;c<i;c++){for(let i=0;i<4;i++)c$(r,0,0,0,0,0,0,a,!1,0,0,0,0),n&&cW(o,0,0,0,0,0,0),cX(s.dynamicLayoutVertexArray,0,0,0,0),l&&cZ(s.iconTransitioningVertexArray,0,0);let i=h.vertexLength;u.emplaceBack(i,i+1,i+2),u.emplaceBack(i+1,i+2,i+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(i,r,a,n,o,s,l){let h=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),u=h.vertexLength,c=l.tileAnchorX,d=l.tileAnchorY;for(let i=0;i<4;i++)a.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(a.collisionVertexArrayExt,r,i.padding,l.zOffset),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new eJ(i.x1,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new eJ(i.x2,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new eJ(i.x2,i.y2)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new eJ(i.x1,i.y2)),h.vertexLength+=4;let f=a.indexArray;f.emplaceBack(u,u+1),f.emplaceBack(u+1,u+2),f.emplaceBack(u+2,u+3),f.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._addCollisionDebugVertices(n,o,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,o,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(i,r,a){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new cK(sl,hr.members,so),this.iconCollisionBox=new cK(sl,hr.members,so);let n=hH(this.iconSizeData,i),o=hH(this.textSizeData,i,a);for(let a=0;a<this.symbolInstances.length;a++){let s=this.symbolInstances.get(a);this._addTextDebugCollisionBoxes(o,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(o,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(i,r,a,n){let o=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:n),s=hG(this.textSizeData,i,o)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(i,r,a){let n=this.icon.placedSymbolArray.get(a),o=hG(this.iconSizeData,i,n);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(i,r,a,n){i.emplaceBack(r,-a,-a,n),i.emplaceBack(r,a,-a,n),i.emplaceBack(r,a,a,n),i.emplaceBack(r,-a,a,n)}_updateTextDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}updateCollisionDebugBuffers(i,r,a,n){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let o=hH(this.iconSizeData,i,n),s=hH(this.textSizeData,i,a);for(let l=0;l<this.symbolInstances.length;l++){let h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(s,i,r,h.textBoxStartIndex,h.textBoxEndIndex,h,a),this._updateTextDebugCollisionBoxes(s,i,r,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,a),this._updateIconDebugCollisionBoxes(o,i,r,h.iconBoxStartIndex,h.iconBoxEndIndex,h,n),this._updateIconDebugCollisionBoxes(o,i,r,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,n)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(i,r,a,n,o,s,l,h,u){let c={};if(r<a){let{x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p,featureIndex:m}=i.get(r);c.textBox={x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p},c.textFeatureIndex=m}if(n<o){let{x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p,featureIndex:m}=i.get(n);c.verticalTextBox={x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p},c.verticalTextFeatureIndex=m}if(s<l){let{x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p,featureIndex:m}=i.get(s);c.iconBox={x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p},c.iconFeatureIndex=m}if(h<u){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p,featureIndex:m}=i.get(h);c.verticalIconBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:f,tileAnchorY:p},c.verticalIconFeatureIndex=m}return c}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(i,r){let a=i.placedSymbolArray.get(r),n=a.vertexStartIndex+4*a.numGlyphs;for(let r=a.vertexStartIndex;r<n;r+=4)i.indexArray.emplaceBack(r,r+1,r+2),i.indexArray.emplaceBack(r+1,r+2,r+3)}
7getSortedSymbolIndexes(i){if(this.sortedAngle===i&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(i),a=Math.cos(i),n=[],o=[],s=[];for(let i=0;i<this.symbolInstances.length;++i){s.push(i);let l=this.symbolInstances.get(i);n.push(0|Math.round(r*l.tileAnchorX+a*l.tileAnchorY)),o.push(l.featureIndex)}return s.sort((i,r)=>n[i]-n[r]||o[r]-o[i]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let i=0;i<this.symbolInstances.length;++i)this.symbolInstanceIndexesSortedZOffset.push(i)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((i,r)=>this.symbolInstances.get(r).zOffset-this.symbolInstances.get(i).zOffset)}addToSortKeyRanges(i,r){let a=this.sortKeyRanges.at(-1);a&&a.sortKey===r?a.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex);let{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:l,verticalPlacedIconSymbolIndex:h}=i;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&o!==n&&o!==a&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(i,r){let a=(this.text.uboBinder&&this.text.uboBinder.maxFeaturesPerBatch>0?this.text.uboBinder:this.icon.uboBinder&&this.icon.uboBinder.maxFeaturesPerBatch>0?this.icon.uboBinder:null).maxFeaturesPerBatch;if(this.symbolsByBatch)for(let a of this.symbolsByBatch.values())for(let n of a){let a=this.symbolInstances.get(n.index);n.rotatedY=0|Math.round(i*a.tileAnchorX+r*a.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n),s=Math.floor(n/a),l=0|Math.round(i*o.tileAnchorX+r*o.tileAnchorY);this.symbolsByBatch.has(s)||this.symbolsByBatch.set(s,[]),this.symbolsByBatch.get(s).push({index:n,rotatedY:l,featureIndex:o.featureIndex})}}for(let i of this.symbolsByBatch.values())i.sort((i,r)=>i.rotatedY-r.rotatedY||r.featureIndex-i.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.text.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.text.indexArray.length;let o=this.text.indexArray.length;for(let{index:i}of n){let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o)}a.primitiveLength=this.text.indexArray.length-o}}rebuildIconSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.icon.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.icon.indexArray.length;let o=this.icon.indexArray.length;for(let{index:i}of n){let{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.icon,r),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}a.primitiveLength=this.icon.indexArray.length-o}}sortFeaturesWithinSegments(){this.featureSortOrder=[];let i=Math.sin(this.sortedAngle),r=Math.cos(this.sortedAngle),a=this.getOrCreateSortedSymbolsByBatch(i,r);for(let i of Array.from(a.keys()).sort((i,r)=>i-r))for(let{index:r}of a.get(i)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex)}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),a),this.rebuildIconSegmentIndices(this.icon.segments.get(),a),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}a2(cJ,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),cJ.addDynamicAttributes=cX;class cQ extends lu{constructor(i,r,a){super(i,r,a),this.elevatedLayoutVertexArray=new o2}upload(i){let r=this.uploaded;super.upload(i),!r&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,sU.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}a2(cQ,"ElevatedFillBufferData");class c0{constructor(){this.portals=[]}static isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}static evaluate(i){if(0===i.length)return new c0;let r=[];for(let a of i)r.push(...a.portals);if(0===r.length)return new c0;for(let i of r){let r=i.va,a=i.vb;(c0.isOnBorder(r.x,a.x)||c0.isOnBorder(r.y,a.y))&&(i.type="border")}let a=r.filter(i=>"unevaluated"!==i.type),n=r.filter(i=>
7"unevaluated"===i.type);if(0===n.length)return new c0;n.sort((i,r)=>i.hash===r.hash?i.isTunnel===r.isTunnel?0:i.isTunnel?-1:1:i.hash<r.hash?1:-1),r=a.concat(n);let o=a.length,s=o,l=o;do if(++s===r.length||r[o].hash!==r[s].hash){if(s-o==2){l<o&&(r[l]=r[o],r[o]=null);let i=r[l],a=r[s-1];i.type=i.isTunnel!==a.isTunnel?"tunnel":"polygon",i.connection={a:i.connection.a,b:a.connection.a},l++}o=s}while(o!==r.length)return r.splice(l),r.sort((i,r)=>i.hash<r.hash?1:-1),{portals:r}}}a2(c0,"ElevationPortalGraph");class c1{constructor(i,r,a){this.outPositions=i,this.outNormals=r,this.outIndices=a,this.vertexLookup=new Map}addVertex(i,r,a){let n=i[2];null!=a&&(n*=a);let o=`${i[0]},${i[1]},${i[2]},${r[0]},${r[1]},${r[2]}`,s=this.vertexLookup.get(o);if(null!=s)return s;let l=this.outPositions.length;this.vertexLookup.set(o,l);let h=Math.trunc(16384*r[0]),u=Math.trunc(16384*r[1]),c=Math.trunc(16384*r[2]);return this.outPositions.emplaceBack(i[0],i[1],n),this.outNormals.emplaceBack(h,u,c),l}addTriangle(i,r,a){this.outIndices.emplaceBack(i,r,a)}addTriangles(i,r,a,n=0){if(0===i.length)return;let o=eo(),s=eo();for(let l=0;l<i.length;l+=3){let h=r[i[l+0]],u=r[i[l+1]],c=r[i[l+2]],d=a[i[l+1]]+n,f=a[i[l+2]]+n;eu(o,h.x,h.y,a[i[l+0]]+n);let p=this.addVertex(o,s);eu(o,u.x,u.y,d);let m=this.addVertex(o,s);eu(o,c.x,c.y,f);let _=this.addVertex(o,s);this.outIndices.emplaceBack(p,m,_)}}addQuad(i,r,a,n,o,s){let l=this.addVertex(i,o,s),h=this.addVertex(r,o,s),u=this.addVertex(a,o,s),c=this.addVertex(n,o,s);this.addTriangle(l,h,u),this.addTriangle(u,c,l)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class c2{constructor(i,r,a,n){this.unevaluatedPortals=new c0,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new o3,this.vertexNormals=new o4,this.indexArray=new sc,this.tileToMeters=oV(i),this.bridgeProgramConfigurations=new ln(r,{zoom:a,lut:n},i=>"fill-tunnel-structure-color"!==i),this.tunnelProgramConfigurations=new ln(r,{zoom:a,lut:n},i=>"fill-bridge-guard-rail-color"!==i)}addVertices(i,r){let a=this.unevalVertices.length;for(let a=0;a<i.length;a++)this.unevalVertices.push(i[a]),this.unevalHeights.push(r[a]);return a}addTriangles(i,r,a){let n=a?this.unevalTunnelTriangles:this.unevalTriangles;for(let a of i)n.push(a+r)}addRenderableRing(i,r,a,n,o,s){let l=[new eJ(o.min.x,o.min.y),new eJ(o.max.x,o.min.y),new eJ(o.max.x,o.max.y),new eJ(o.min.x,o.max.y)];for(let h=0;h<a-1;h++){let a=r+h,u=a+1,c=this.unevalVertices[a],d=this.unevalVertices[u];if(!(c.x>=o.min.x&&c.x<=o.max.x&&c.y>=o.min.y&&c.y<=o.max.y||d.x>=o.min.x&&d.x<=o.max.x&&d.y>=o.min.y&&d.y<=o.max.y||lR(c,d,l))||this.isOnBorder(c.x,d.x)||this.isOnBorder(c.y,d.y))continue;let f=c2.computeEdgeHash(this.unevalVertices[a],this.unevalVertices[u]),p,m=this.vertexHashLookup.get(c2.computePosHash(c));p=null!=m?m.next:null!=(m=this.vertexHashLookup.get(c2.computePosHash(d)))?m.prev:f,this.unevalEdges.push({polygonIdx:i,a:a,b:u,hash:f,portalHash:p,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(i,r,a,n,o){if(0!==r.length)for(let o of(this.vertexHashLookup.clear(),r)){if(0===o.length)continue;let r=o[0],s=c2.computeEdgeHash(r[r.length-2],r.at(-1));for(let o=0;o<r.length-1;o++){let l=r[o+0],h=r[o+1],u=eH(h.x-l.x,h.y-l.y),c=eW(u);if(0===c)continue;let d="unevaluated",f=n.pointElevation(l),p=n.pointElevation(h);.01>Math.abs(f)&&.01>Math.abs(p)?d="entrance":(this.isOnBorder(l.x,h.x)||this.isOnBorder(l.y,h.y))&&(d="border");let m=c2.computeEdgeHash(l,h);this.unevaluatedPortals.portals.push({connection:{a:i,b:void 0},va:l,vb:h,vab:u,length:c,hash:m,isTunnel:a,type:d});let _=c2.computePosHash(l);this.vertexHashLookup.set(_,{prev:s,next:m}),s=m}}}construct(i){if(0===this.unevalVertices.length)return;let r=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),a=i=>{i.primitiveLength=this.indexArray.length-i.primitiveOffset},n=new c1(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(i.portals,this.unevalEdges);
7let o=r(),s=r(),l=r(),h=(i,r)=>{i.sort((i,a)=>i.type===r&&a.type!==r?-1:+(i.type!==r&&a.type===r));let a=i.findIndex(i=>i.type!==r);return a>=0?a:i.length},u=0;this.unevalEdges.length>0&&(u=h(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},this.tileToMeters)),a(l);let c=r(),d=r();if(this.unevalEdges.length>0){let i=this.unevalEdges.splice(u),r=h(i,"tunnel")+u;this.unevalEdges.push(...i),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},{min:u,max:r})}a(c),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),a(d),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),a(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),a(o),this.maskSegments=sG.simpleSegment(0,d.primitiveOffset,0,d.primitiveLength),this.depthSegments=sG.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=sG.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength),this.renderableTunnelSegments=sG.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=sG.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength)}update(i,r,a,n,o,s,l,h){this.bridgeProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h),this.tunnelProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}upload(i){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=i.createVertexBuffer(this.vertexPositions,sV.members),this.vertexBufferNormal=i.createVertexBuffer(this.vertexNormals,sj.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(i),this.tunnelProgramConfigurations.upload(i))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(i,r,a,n,o){let s=(s,l)=>{for(let h=0;h<l.length-1;h++){let u=l[h].featureIndex,c=l[h+1].vertexStart,d=i.feature(u);s.populatePaintArrays(c,d,u,{},a,r,n,void 0,o)}};s(this.bridgeProgramConfigurations,this.bridgeFeatureSections),s(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(i,r,a,n,o){let s=new Map;for(let l=n;l<o;l++){let n=a[l],o=n.a,h=n.b,u=c2.computePosHash(i[o]),c=c2.computePosHash(i[h]),d=s.get(u);d||(d={},s.set(u,d));let f=s.get(c);f||(f={},s.set(c,f)),r[o]<=0&&r[h]<=0||(d.to=h,f.from=o)}return s}isTerminalVertex(i,r){let a=c2.computePosHash(this.unevalVertices[i]),n=r.get(a);return!n||!n.from||!n.to}constructBridgeStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=this.computeVertexConnections(r,a,n,o.min,o.max),h=1/s,u=.5*h,c=(i,n)=>eu(i,r[n].x,r[n].y,a[n]*h),d=eo(),f=eo(),p=eo(),m=eo(),_=eo(),g=(i,a)=>{let n=l.get(c2.computePosHash(r[a])),o=n.from,s=n.to;if(!o||!s)return;c(d,o),c(f,a),c(p,s),eC(m),eD(d,f)||(ed(_,f,d),ew(m,_)),eD(p,f)||(ed(_,p,f),ec(m,m,ew(_,_)));let h=el(m);return h>0?e_(i,m,1/h):void 0},y=1/0;this.sortSubarray(n,o.min,o.max,(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex);let x=eo(),v=eo(),b=eo(),w=eo(),T=eo(),S=eo(),E=eo(),I=eo(),A=eo(),M=[eo(),eo(),eo(),eo()],C=[eo(),eo(),eo(),eo()],D=[{coord:new eJ(0,0),height:0},{coord:new eJ(0,0),height:0}],R=(i,r)=>i>r;for(let c=o.min;c<o.max;c++){let o=n[c];if(!o.featureInfo.guardRailEnabled||!this.prepareEdgePoints(D,r,a,o,R))continue;let[d,f]=D;if(eu(x,d.coord.x,d.coord.y,h*d.height),eu(v,f.coord.x,f.coord.y,h*f.height),eD(x,v))continue;ed(b,v,x),ew(b,b);let p=g(I,o.a)||b,m=g(A,o.b)||b;eu(w,p[1],-p[0],0),ew(w,w),eu(T,m[1],-m[0],0),ew(T,T),eS(I,w,p),ew(S,I),eS(I,T,m),ew(E,I),ec(M[0],x,e_(I,ed(I,w,S),u)),ec(M[1],x,e_(I,ec(I,w,S),u)),ec(M[2],x,e_(I,S,u)),M[3]=x,ec(C[0],v,e_(I,ed(I,T,E),u)),ec(C[1],v,e_(I,ec(I,T,E),u)),ec(C[2],v,e_(I,E,u)),C[3]=v,y=this.addFeatureSection(o.featureInfo.featureIndex,y,this.bridgeFeatureSections,i);let _=i.addVertex(M[0],w,s),P=i.addVertex(M[1],w,s),L=i.addVertex(C[0],T,s),z=i.addVertex(C[1],T,s);i.addTriangle(_,P,L),i.addTriangle(P,z,L);let O=i.addVertex(M[1],S,s),F=i.addVertex(M[2],S,s),B=i.addVertex(C[1],E,s),k=i.addVertex(C[2],E,s);i.addTriangle(O,F,B),i.addTriangle(F,k,B),eb(w,w),eb(T,T);let N=i.addVertex(M[2],w,s),U=i.addVertex(M[3],w,s),V=i.addVertex(C[2],T,s),j=i.addVertex(C[3],T,s);i.addTriangle(N,U,V),i.addTriangle(U,j,V);let G=this.isTerminalVertex(o.a,l),H=this.isTerminalVertex(o.b,l);d.height<.01&&G&&i.addQuad(M[3],M[2],M[1],M[0],eb(p,p),s),f.height<.01&&H&&i.addQuad(C[0],C[1],C[2],C[3],m,s)}this.bridgeFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}constructTunnelStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=1/0,h=(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex;this.sortSubarray(n,o.min,o.max,h),this.sortSubarray(n,s.min,s.max,h);let u=i=>ew(i,i),c=[{coord:new eJ(0,0),height:0},{coord:new eJ(0,0),height:0}],d=(i,r)=>i<r,f=eo(),p=eo(),m=eo(),_=eo(),g=eo();for(let s=o.min;s<o.max;s++){if(!this.prepareEdgePoints(c,r,a,n[s],d))continue;let[o,h]=c,y=u(eu(g,-(h.coord.y-o.coord.y),h.coord.x-o.coord.x,0));l=this.addFeatureSection(n[s].featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(eu(f,o.coord.x,o.coord.y,o.height),eu(p,h.coord.x,h.coord.y,h.height),eu(m,h.coord.x,h.coord.y,n[s].isTunnel?h.height+4:0),eu(_,o.coord.x,o.coord.y,n[s].isTunnel?o.height+4:0),y)}for(let o=s.min;o<s.max;o++){let s=n[o];s.isTunnel&&([s.a,s.b]=[s.b,s.a]);let h=r[s.a],c=r[s.b],d=u(eu(g,-(c.y-h.y),c.x-h.x,0));l=this.addFeatureSection(s.featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(eu(f,c.x,c.y,0),eu(p,h.x,h.y,0),eu(m,h.x,h.y,a[s.a]+4),eu(_,c.x,c.y,a[s.b]+4),d),i.addQuad(eu(f,h.x,h.y,0),eu(p,c.x,c.y,0),eu(m,c.x,c.y,a[s.b]+4),eu(_,h.x,h.y,a[s.a]+4),d)}this.tunnelFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}setElevatedPoint(i,r,a,n){i.coord.x=r,i.coord.y=a,i.height=n}prepareEdgePoints(i,r,a,n,o){let s=r[n.a].x,l=r[n.a].y,h=r[n.b].x,u=r[n.b].y,c=a[n.a],d=a[n.b],f=o(c,0),p=o(d,0);if(f&&p)return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0;if(!f&&!p)return!1;if(f){if(!p){let i=d/(d-c);h=iw(h,s,i),u=iw(u,l,i),d=iw(d,c,i)}}else{let i=c/(c-d);s=iw(s,h,i),l=iw(l,u,i),c=iw(c,d,i)}return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0}prepareEdges(i,r){if(0===r.length)return;r.sort((i,r)=>i.hash===r.hash?r.polygonIdx-i.polygonIdx:r.hash>i.hash?1:-1);let a=0,n=0,o=0,s=r[0].polygonIdx;do(++n===r.length||r[a].hash!==r[n].hash)&&((1==n-a||r[n-1].polygonIdx!==s)&&(o<a&&(r[o]=r[a],r[a]=null),r[o].type="none",o++),(a=n)!==r.length&&(s=r[a].polygonIdx));while(a!==r.length)if(r.splice(o),0!==r.length&&0!==i.length){r.sort((i,r)=>i.portalHash<r.portalHash?1:-1);let a=0,n=0;for(;a!==r.length&&n!==i.length;){let o=r[a],s=i[n];o.portalHash>s.hash?a++:s.hash>o.portalHash?n++:(o.type=s.type,a++)}}}isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}addFeatureSection(i,r,a,n){return i!==r&&(r=i,a.push({featureIndex:i,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),r}sortSubarray(i,r,a,n){let o=i.slice(r,a);o.sort(n),i.splice(r,o.length,...o)}static computeEdgeHash(i,r){return(i.y===r.y&&i.x>r.x||i.y>r.y)&&([i,r]=[r,i]),BigInt(c2.computePosHash(i))<<32n|BigInt(c2.computePosHash(r))}static computePosHash(i){return((65535&i.x)<<16|65535&i.y)>>>0}}
7class c3{constructor(){this._valid=!1}reset(i){return this.feature=i,this._valid=!0,this._geometry=i.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(i,r){return this._valid&&i(r(this._geometry)),this}require(i,r,a){return this.get(i,!0,r,a)}optional(i,r,a){return this.get(i,!1,r,a)}success(){return this._valid}get(i,r,a,n){let o=Object.hasOwn(this.feature.properties,i)?+this.feature.properties[i]:void 0;return this._valid&&void 0!==o&&!Number.isNaN(o)?a(n?n(o):o):r&&(this._valid=!1),this}}class c4{constructor(i,r){this.featureFunc=i,this.vertexFunc=r}parseFeature(i,r,a){return this.featureFunc(i,r,a)}parseVertex(i,r,a){return this.vertexFunc(i,r,a)}}let c5=new c4((i,r,a)=>i.reset(r).require(lZ,i=>{a.id=i}).optional("fixed_height_relative",i=>{a.constantHeight=i},c8.decodeRelativeHeight).geometry(i=>{a.bounds=i},e9).success(),(i,r,a)=>i.reset(r).require(lZ,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height_relative",i=>{a.height=i},c8.decodeRelativeHeight).geometry(i=>{a.position=i},c8.getPoint).success()),c6=new c4((i,r,a)=>i.reset(r).require(lZ,i=>{a.id=i}).optional("fixed_height",i=>{a.constantHeight=i},c8.decodeMetricHeight).geometry(i=>{a.bounds=i},e9).success(),(i,r,a)=>i.reset(r).require(lZ,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height",i=>{a.height=i},c8.decodeMetricHeight).geometry(i=>{a.position=i},c8.getPoint).success());class c8{static getPoint(i){return eH(i[0][0].x,i[0][0].y)}static decodeRelativeHeight(i){return 1e-4*i*5}static decodeMetricHeight(i){return 1e-4*i}static getVersionSchema(i){return i?"1.0.1"===i?c6:void 0:c5}static parse(i){let r=[],a=[],n=i.length,o=new c3;for(let s=0;s<n;s++){let n=i.feature(s),l=n.properties.version,h=c8.getVersionSchema(l);if(void 0===h){tb(`Unknown elevation feature version number ${l||"(unknown)"}`);continue}let u=n.properties.type;if(!u)continue;let c=lx.types[n.type];if("Point"===c&&"curve_point"===u){let i={};h.parseVertex(o,n,i)&&r.push(i)}else if("Polygon"===c&&"curve_meta"===u){let i={};h.parseFeature(o,n,i)&&a.push(i)}}return{vertices:r,features:a}}}class c9{constructor(i,r){this.feature=i,this.metersToTile=r,this.index=0}get(){let i=this.feature.vertices[this.index],r=this.feature.vertexProps[this.index].dir,a=r[1],n=-r[0],o=(i.extent+1)*this.metersToTile;return[new eJ(Math.trunc(i.position[0]+a*o),Math.trunc(i.position[1]+n*o)),new eJ(Math.trunc(i.position[0]-a*o),Math.trunc(i.position[1]-n*o))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class c7{constructor(i,r,a,n,o,s){if(this.vertices=[],this.vertexProps=[],this.edges=[],this.edgeProps=[],this._tmpVec2=[eG(),eG(),eG(),eG(),eG(),eG(),eG()],this.id=i,this.heightRange={min:a,max:a},this.safeArea=r,this.constantHeight=a,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){for(const i of(this.vertices=n,this.edges=o,this.edges=this.edges.filter(i=>{var r,a;return i.a<this.vertices.length&&i.b<this.vertices.length&&((r=this.vertices[i.a].position)[0]!==(a=this.vertices[i.b].position)[0]||r[1]!==a[1])}),this.heightRange={min:1/0,max:-1/0},this.vertices))this.vertexProps.push({dir:eH(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,i.height),this.heightRange.max=Math.max(this.heightRange.max,i.height);for(const i of this.edges){const r=this.vertices[i.a].position,a=this.vertices[i.b].position,n=e$(eG(),a,r),o=eW(n),s=eZ(eG(),n,1/o);this.edgeProps.push({vec:n,dir:s,len:o});const l=this.vertexProps[i.a].dir,h=this.vertexProps[i.b].dir;eq(l,l,s),eq(h,h,s)}for(const i of this.vertexProps)0===i.dir[0]&&0===i.dir[1]||eX(i.dir,i.dir);this.tessellate(s)}}pointElevation(i){if(null!=this.constantHeight)return this.constantHeight;let r=this.getClosestEdge(i);if(null==r)return 0;let[a,n]=r;return iw(this.vertices[this.edges[a].a].height,this.vertices[this.edges[a].b].height,n)}computeSlopeNormal(i,r){let a=this.getClosestEdge(i);if(!a)return eh(0,0,1);let n=a[0],o=this.edges[n],s=this.edgeProps[n].vec,l=eh(s[0],s[1],(this.vertices[o.b].height-this.vertices[o.a].height)*r),h=eh(l[1],-l[0],0);eS(h,h,l);let u=el(h);return u>0?e_(h,h,1/u):eu(h,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(i){var r,a,n,o;if(0===this.edges.length)return;let s=0,l=1/0,h=0,[u,c,d,f,p,m,_]=this._tmpVec2;r=i.x,a=i.y,_[0]=r,_[1]=a;let g=new uk(_,null);for(let i=0;i<this.edges.length;i++){let r=this.edges[i],a=this.edgeProps[i].dir;g.dir=a;let y=this.vertices[r.a].position,x=this.vertices[r.b].position,v=g.intersectsPlane(y,this.vertexProps[r.a].dir,u),b=g.intersectsPlane(x,this.vertexProps[r.b].dir,c);if(!v||!b)continue;e$(d,c,u),e$(f,_,u);let w=eY(d,d),T=w>0?eY(f,d)/w:0,S=ts(T,0,1),E=Math.abs((T-S)*this.edgeProps[i].len);
7e$(p,_,y),n=a[1],o=-a[0],m[0]=n,m[1]=o;let I=E+Math.abs(eY(p,m));I<l&&(s=i,l=I,h=S)}return[s,h]}tessellate(i){let r=eo(),a=eo(),n=eo(),o=eo();for(let s=this.edges.length-1;s>=0;--s){let l=this.edges[s].a,h=this.edges[s].b,{position:u,height:c,extent:d}=this.vertices[l],{position:f,height:p,extent:m}=this.vertices[h],_=this.vertexProps[l].dir,g=this.vertexProps[h].dir;if(eu(r,u[0]/i,u[1]/i,c),eu(a,f[0]/i,f[1]/i,p),eu(n,_[1],-_[0],0),e_(n,n,d),eu(o,g[1],-g[0],0),e_(o,o,m),.0025000000000000005>=this.distSqLines(eh(r[0]+.5*n[0],r[1]+.5*n[1],r[2]+.5*n[2]),eh(a[0]-.5*o[0],a[1]-.5*o[1],a[2]-.5*o[2]),eh(r[0]-.5*n[0],r[1]-.5*n[1],r[2]-.5*n[2]),eh(a[0]+.5*o[0],a[1]+.5*o[1],a[2]+.5*o[2])))continue;let y=this.vertices.length,x=eq(eG(),u,f);this.vertices.push({position:eZ(x,x,.5),height:.5*(c+p),extent:.5*(d+m)});let v=eq(eG(),_,g);this.vertexProps.push({dir:eX(v,v)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a:l,b:y}),this.edges.push({a:y,b:h});let b=e$(eG(),this.vertices[y].position,u),w=eW(b),T={vec:b,dir:eZ(eG(),b,1/w),len:w};this.edgeProps.push(T),this.edgeProps.push(T)}}distSqLines(i,r,a,n){let o=ed(eo(),r,i),s=ed(eo(),n,a),l=ed(eo(),i,a),h=eT(o,o),u=eT(o,s),c=eT(o,l),d=eT(s,s),f=eT(s,l),p=h*d-u*u;return 0===p?ex(eE(o,a,n,eT(l,s)/eT(s,s)),i):ex(eE(o,i,r,(u*f-c*d)/p),eE(s,a,n,(h*f-u*c)/p))}}class de{constructor(i,r){this.zScale=1,this.xOffset=0,this.yOffset=0,i.equals(r)||(this.zScale=Math.pow(2,r.z-i.z),this.xOffset=(i.x*this.zScale-r.x)*8192,this.yOffset=(i.y*this.zScale-r.y)*8192)}constantElevation(i,r){if(null!=i.constantHeight)return this.computeBiasedHeight(i.constantHeight,r)}pointElevation(i,r,a){let n=this.constantElevation(r,a);return null!=n?n:(i.x=i.x*this.zScale+this.xOffset,i.y=i.y*this.zScale+this.yOffset,this.computeBiasedHeight(r.pointElevation(i),a))}computeBiasedHeight(i,r){return r<=0?i:i+r*tl(0,r,i>=0?i:Math.abs(.5*i))}}function dt(i,r){if(!r)return;let a=+i.properties[lZ];return Number.isNaN(a)?void 0:r.find(i=>i.id===a)}function di(i,r){return i>r?1:i<r?-1:0}a2(c7,"ElevationFeature");class dr{constructor(i=di,r=!1){this._compare=i,this._root=null,this._size=0,this._noDuplicates=!!r}rotateLeft(i){var r=i.right;r&&(i.right=r.left,r.left&&(r.left.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.left=i),i.parent=r}rotateRight(i){var r=i.left;r&&(i.left=r.right,r.right&&(r.right.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.right=i),i.parent=r}_splay(i){for(;i.parent;){var r=i.parent;r.parent?r.left===i&&r.parent.left===r?(this.rotateRight(r.parent),this.rotateRight(r)):r.right===i&&r.parent.right===r?(this.rotateLeft(r.parent),this.rotateLeft(r)):r.left===i&&r.parent.right===r?(this.rotateRight(r),this.rotateLeft(r)):(this.rotateLeft(r),this.rotateRight(r)):r.left===i?this.rotateRight(r):this.rotateLeft(r)}}splay(i){for(var r,a,n,o,s;i.parent;)(a=(r=i.parent).parent)&&a.parent?((n=a.parent).left===a?n.left=i:n.right=i,i.parent=n):(i.parent=null,this._root=i),o=i.left,s=i.right,i===r.left?(a&&(a.left===r?(r.right?(a.left=r.right,a.left.parent=a):a.left=null,r.right=a,a.parent=r):(o?(a.right=o,o.parent=a):a.right=null,i.left=a,a.parent=i)),s?(r.left=s,s.parent=r):r.left=null,i.right=r):(a&&(a.right===r?(r.left?(a.right=r.left,a.right.parent=a):a.right=null,r.left=a,a.parent=r):(s?(a.left=s,s.parent=a):a.left=null,i.right=a,a.parent=i)),o?(r.right=o,o.parent=r):r.right=null,i.left=r),r.parent=i}replace(i,r){i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.parent=i.parent)}minNode(i=this._root){if(i)for(;i.left;)i=i.left;return i}maxNode(i=this._root){if(i)for(;i.right;)i=i.right;return i}insert(i,r){var a=this._root,n=null,o=this._compare;if(this._noDuplicates)for(;a;){if(n=a,0===o(a.key,i))return;a=0>o(a.key,i)?a.right:a.left}else for(;a;)n=a,a=0>o(a.key,i)?a.right:a.left;return a={key:i,data:r,left:null,right:null,parent:n},n?0>o(n.key,a.key)?n.right=a:n.left=a:this._root=a,this.splay(a),this._size++,a}find(i){for(var r=this._root,a=this._compare;r;){var n=a(r.key,i);if(n<0)r=r.right;else{if(!(n>0))return r;r=r.left}}return null}contains(i){for(var r=this._root,a=this._compare;r;){var n=a(i,r.key);if(0===n)return!0;r=n<0?r.left:r.right}return!1}remove(i){var r=this.find(i);if(!r)return!1;if(this.splay(r),r.left)if(r.right){var a=this.minNode(r.right);a.parent!==r&&(this.replace(a,a.right),a.right=r.right,a.right.parent=a),this.replace(r,a),a.left=r.left,a.left.parent=a}else this.replace(r,r.left);else this.replace(r,r.right);return this._size--,!0}removeNode(i){if(!i)return!1;if(this.splay(i),i.left)if(i.right){var r=this.minNode(i.right);r.parent!==i&&(this.replace(r,r.right),r.right=i.right,r.right.parent=r),this.replace(i,r),r.left=i.left,r.left.parent=r}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}erase(i){var r=this.find(i);if(r){this.splay(r);var a=r.left,n=r.right,o=null;a&&(a.parent=null,o=this.maxNode(a),this.splay(o),this._root=o),n&&(a?o.right=n:this._root=n,n.parent=o),this._size--}}pop(){var i=this._root,r=null;if(i){for(;i.left;)i=i.left;r={key:i.key,data:i.data},this.remove(i.key)}return r}next(i){var r=i;if(r)if(r.right)for(r=r.right;r&&r.left;)r=r.left;else for(r=i.parent;r&&r.right===i;)i=r,r=r.parent;return r}prev(i){var r=i;if(r)if(r.left)for(r=r.left;r&&r.right;)r=r.right;else for(r=i.parent;r&&r.left===i;)i=r,r=r.parent;return r}forEach(i){for(var r=this._root,a=[],n=!1,o=0;!n;)r?(a.push(r),r=r.left):a.length>0?(i(r=a.pop(),o++),r=r.right):n=!0;return this}range(i,r,a,n){let o=[],s=this._compare,l=this._root;for(;0!==o.length||l;)if(l)o.push(l),l=l.left;else{if(s((l=o.pop()).key,r)>0)break;if(s(l.key,i)>=0&&a.call(n,l))return this;l=l.right}return this}keys(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).key),i=i.right):n=!0;return a}values(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).data),i=i.right):n=!0;return a}
7at(i){for(var r=this._root,a=[],n=!1,o=0;!n;)if(r)a.push(r),r=r.left;else if(a.length>0){if(r=a.pop(),o===i)return r;o++,r=r.right}else n=!0;return null}load(i=[],r=[],a=!1){if(0!==this._size)throw Error("bulk-load: tree is not empty");let n=i.length;return a&&function i(r,a,n,o,s){if(n>=o)return;let l=r[n+o>>1],h=n-1,u=o+1;while(!0){do h++;while(0>s(r[h],l))do u--;while(s(r[u],l)>0)if(h>=u)break;let i=r[h];r[h]=r[u],r[u]=i,i=a[h],a[h]=a[u],a[u]=i}i(r,a,n,u,s),i(r,a,u+1,o,s)}(i,r,0,n-1,this._compare),this._root=function i(r,a,n,o,s){let l=s-o;if(l>0){let h=o+Math.floor(l/2),u={key:a[h],data:n[h],parent:r};return u.left=i(u,a,n,o,h),u.right=i(u,a,n,h+1,s),u}return null}(null,i,r,0,n),this._size=n,this}min(){var i=this.minNode(this._root);return i?i.key:null}max(){var i=this.maxNode(this._root);return i?i.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(i,r,a,n,o){return new dr(a,o).load(i,r,n)}}let da=(3+8881784197001252e-31)*11102230246251565e-32;function dn(i,r,a,n,o){let s,l,h,u,c=r[0],d=n[0],f=0,p=0;d>c==d>-c?(s=c,c=r[++f]):(s=d,d=n[++p]);let m=0;if(f<i&&p<a)for(d>c==d>-c?(l=c+s,h=s-(l-c),c=r[++f]):(l=d+s,h=s-(l-d),d=n[++p]),s=l,0!==h&&(o[m++]=h);f<i&&p<a;)d>c==d>-c?(u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++f]):(u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++p]),s=l,0!==h&&(o[m++]=h);for(;f<i;)u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++f],s=l,0!==h&&(o[m++]=h);for(;p<a;)u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++p],s=l,0!==h&&(o[m++]=h);return 0===s&&0!==m||(o[m++]=s),m}function ds(i){return new Float64Array(i)}let dl=ds(4),dh=ds(8),du=ds(12),dc=ds(16),dd=ds(4);function df(i,r,a){null===r?(i.inOut=!1,i.otherInOut=!0):(i.isSubject===r.isSubject?(i.inOut=!r.inOut,i.otherInOut=r.otherInOut):(i.inOut=!r.otherInOut,i.otherInOut=r.isVertical()?!r.inOut:r.inOut),r&&(i.prevInResult=!dp(r,a)||r.isVertical()?r.prevInResult:r)),i.resultTransition=dp(i,a)?function(i,r){let a,n=!i.inOut,o=!i.otherInOut;switch(r){case 0:a=n&&o;break;case 1:a=n||o;break;case 3:a=n!==o;break;case 2:a=i.isSubject?n&&!o:o&&!n}return a?1:-1}(i,a):0}function dp(i,r){switch(i.type){case 0:switch(r){case 0:return!i.otherInOut;case 1:return i.otherInOut;case 2:return i.isSubject&&i.otherInOut||!i.isSubject&&!i.otherInOut;case 3:return!0}break;case 2:return 0===r||1===r;case 3:return 2===r}return!1}class dm{constructor(i,r,a,n,o){this.left=r,this.point=i,this.otherEvent=a,this.isSubject=n??!1,this.type=o||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(i){let r=this.point,a=this.otherEvent.point;return this.left?(r[0]-i[0])*(a[1]-i[1])-(a[0]-i[0])*(r[1]-i[1])>0:(a[0]-i[0])*(r[1]-i[1])-(r[0]-i[0])*(a[1]-i[1])>0}isAbove(i){return!this.isBelow(i)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){let i=new dm(this.point,this.left,this.otherEvent,this.isSubject,this.type);return i.contourId=this.contourId,i.resultTransition=this.resultTransition,i.prevInResult=this.prevInResult,i.isExteriorRing=this.isExteriorRing,i.inOut=this.inOut,i.otherInOut=this.otherInOut,i}}function d_(i,r){return i[0]===r[0]&&i[1]===r[1]}function dg(i,r,a){let n=function(i,r,a,n,o,s){let l=(r-s)*(a-o),h=(i-o)*(n-s),u=l-h;if(0===l||0===h||l>0!=h>0)return u;let c=Math.abs(l+h);return Math.abs(u)>=33306690738754716e-32*c?u:-function(i,r,a,n,o,s,l){let h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A=i-o,M=a-o,C=r-s,D=n-s;w=A*D,m=(p=0x8000001*A)-(p-A),_=A-m,g=(p=0x8000001*D)-(p-D),T=_*(y=D-g)-(w-m*g-_*g-m*y),S=C*M,m=(p=0x8000001*C)-(p-C),_=C-m,g=(p=0x8000001*M)-(p-M),x=T-(E=_*(y=M-g)-(S-m*g-_*g-m*y)),f=T-x,dl[0]=T-(x+f)+(f-E),f=(v=w+x)-w,x=(b=w-(v-f)+(x-f))-S,f=b-x,dl[1]=b-(x+f)+(f-S),f=(I=v+x)-v,dl[2]=v-(I-f)+(x-f),dl[3]=I;let R=function(i){let r=i[0];for(let a=1;a<4;a++)r+=i[a];return r}(dl),P=22204460492503146e-32*l;if(R>=P||-R>=P||(f=i-A,h=i-(A+f)+(f-o),f=a-M,c=a-(M+f)+(f-o),f=r-C,u=r-(C+f)+(f-s),f=n-D,d=n-(D+f)+(f-s),0===h&&0===u&&0===c&&0===d)||(P=11093356479670487e-47*l+da*Math.abs(R),(R+=A*d+D*h-(C*c+M*u))>=P||-R>=P))return R;w=h*D,m=(p=0x8000001*h)-(p-h),_=h-m,g=(p=0x8000001*D)-(p-D),T=_*(y=D-g)-(w-m*g-_*g-m*y),S=u*M,m=(p=0x8000001*u)-(p-u),_=u-m,g=(p=0x8000001*M)-(p-M),x=T-(E=_*(y=M-g)-(S-m*g-_*g-m*y)),f=T-x,dd[0]=T-(x+f)+(f-E),f=(v=w+x)-w,x=(b=w-(v-f)+(x-f))-S,f=b-x,dd[1]=b-(x+f)+(f-S),f=(I=v+x)-v,dd[2]=v-(I-f)+(x-f),dd[3]=I;let L=dn(4,dl,4,dd,dh);w=A*d,m=(p=0x8000001*A)-(p-A),_=A-m,g=(p=0x8000001*d)-(p-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=C*c,m=(p=0x8000001*C)-(p-C),_=C-m,g=(p=0x8000001*c)-(p-c),x=T-(E=_*(y=c-g)-(S-m*g-_*g-m*y)),f=T-x,dd[0]=T-(x+f)+(f-E),f=(v=w+x)-w,x=(b=w-(v-f)+(x-f))-S,f=b-x,dd[1]=b-(x+f)+(f-S),f=(I=v+x)-v,dd[2]=v-(I-f)+(x-f),dd[3]=I;let z=dn(L,dh,4,dd,du);w=h*d,m=(p=0x8000001*h)-(p-h),_=h-m,g=(p=0x8000001*d)-(p-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=u*c,m=(p=0x8000001*u)-(p-u),_=u-m,g=(p=0x8000001*c)-(p-c),x=T-(E=_*(y=c-g)-(S-m*g-_*g-m*y)),f=T-x,dd[0]=T-(x+f)+(f-E),f=(v=w+x)-w,x=(b=w-(v-f)+(x-f))-S,f=b-x,dd[1]=b-(x+f)+(f-S),f=(I=v+x)-v,dd[2]=v-(I-f)+(x-f),dd[3]=I;let O=dn(z,du,4,dd,dc);return dc[O-1]}
7(i,r,a,n,o,s,c)}(i[0],i[1],r[0],r[1],a[0],a[1]);return n>0?-1:+(n<0)}function dy(i,r){let a=i.point,n=r.point;return a[0]>n[0]?1:a[0]<n[0]?-1:a[1]!==n[1]?a[1]>n[1]?1:-1:i.left!==r.left?i.left?1:-1:0!==dg(a,i.otherEvent.point,r.otherEvent.point)?i.isBelow(r.otherEvent.point)?-1:1:!i.isSubject&&r.isSubject?1:-1}function dx(i,r,a){let n=new dm(r,!1,i,i.isSubject),o=new dm(r,!0,i.otherEvent,i.isSubject);return d_(i.point,i.otherEvent.point)&&console.warn("what is that, a collapsed segment?",i),n.contourId=o.contourId=i.contourId,dy(o,i.otherEvent)>0&&(i.otherEvent.left=!0,o.left=!1),i.otherEvent.otherEvent=o,i.otherEvent=n,a.push(o),a.push(n),a}function dv(i,r){return i[0]*r[1]-i[1]*r[0]}function db(i,r){return i[0]*r[0]+i[1]*r[1]}function dw(i,r,a){let n=function(i,r,a,n){let o=[r[0]-i[0],r[1]-i[1]],s=[n[0]-a[0],n[1]-a[1]];function l(i,r,a){return[i[0]+r*a[0],i[1]+r*a[1]]}let h=[a[0]-i[0],a[1]-i[1]],u=dv(o,s),c=u*u,d=db(o,o);if(c>0){let r=dv(h,s)/u;if(r<0||r>1)return null;let n=dv(h,o)/u;return n<0||n>1?null:0===r||1===r?[l(i,r,o)]:0===n||1===n?[l(a,n,s)]:[l(i,r,o)]}if((c=(u=dv(h,o))*u)>0)return null;let f=db(o,h)/d,p=f+db(o,s)/d,m=Math.min(f,p),_=Math.max(f,p);return m<=1&&_>=0?1===m?[l(i,m>0?m:0,o)]:0===_?[l(i,_<1?_:1,o)]:[l(i,m>0?m:0,o),l(i,_<1?_:1,o)]:null}(i.point,i.otherEvent.point,r.point,r.otherEvent.point),o=n?n.length:0;if(0===o||1===o&&(d_(i.point,r.point)||d_(i.otherEvent.point,r.otherEvent.point))||2===o&&i.isSubject===r.isSubject)return 0;if(1===o)return d_(i.point,n[0])||d_(i.otherEvent.point,n[0])||dx(i,n[0],a),d_(r.point,n[0])||d_(r.otherEvent.point,n[0])||dx(r,n[0],a),1;let s=[],l=!1,h=!1;return d_(i.point,r.point)?l=!0:1===dy(i,r)?s.push(r,i):s.push(i,r),d_(i.otherEvent.point,r.otherEvent.point)?h=!0:1===dy(i.otherEvent,r.otherEvent)?s.push(r.otherEvent,i.otherEvent):s.push(i.otherEvent,r.otherEvent),l&&h||l?(r.type=1,i.type=r.inOut===i.inOut?2:3,l&&!h&&dx(s[1].otherEvent,s[0].point,a),2):(h?dx(s[0],s[1].point,a):s[0]!==s[3].otherEvent?(dx(s[0],s[1].point,a),dx(s[1],s[2].point,a)):(dx(s[0],s[1].point,a),dx(s[3].otherEvent,s[2].point,a)),3)}function dT(i,r){if(i===r)return 0;if(0!==dg(i.point,i.otherEvent.point,r.point)||0!==dg(i.point,i.otherEvent.point,r.otherEvent.point))return d_(i.point,r.point)?i.isBelow(r.otherEvent.point)?-1:1:i.point[0]===r.point[0]?i.point[1]<r.point[1]?-1:1:1===dy(i,r)?r.isAbove(i.point)?-1:1:i.isBelow(r.point)?-1:1;if(i.isSubject!==r.isSubject)return i.isSubject?-1:1;{let a=i.point,n=r.point;if(a[0]===n[0]&&a[1]===n[1])return a=i.otherEvent.point,n=r.otherEvent.point,a[0]===n[0]&&a[1]===n[1]?0:(i.contourId??0)>(r.contourId??0)?1:-1}return 1===dy(i,r)?1:-1}class dS{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}let dE=Math.max,dI=Math.min,dA=0;function dM(i,r,a,n,o,s){let l,h,u,c,d,f;for(l=0,h=i.length-1;l<h;l++){if(u=i[l],c=i[l+1],d=new dm(u,!1,void 0,r),f=new dm(c,!1,d,r),d.otherEvent=f,u[0]===c[0]&&u[1]===c[1])continue;d.contourId=f.contourId=a,s||(d.isExteriorRing=!1,f.isExteriorRing=!1),dy(d,f)>0?f.left=!0:d.left=!0;let h=u[0],p=u[1];o[0]=dI(o[0],h),o[1]=dI(o[1],p),o[2]=dE(o[2],h),o[3]=dE(o[3],p),n.push(d),n.push(f)}}let dC=[];function dD(i,r,a){var n,o,s,l;let h,u,c=i,d=r;"number"==typeof i[0][0][0]&&(c=[i]),"number"==typeof r[0][0][0]&&(d=[r]);let f=(n=c,o=d,h=null,n.length*o.length==0&&(0===a?h=dC:2===a?h=n:(1===a||3===a)&&(h=0===n.length?o:n)),h);if(f)return f===dC?null:f;let p=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],_=function(i,r,a,n,o){let s,l,h,u,c,d,f=new rD(void 0,dy);for(h=0,u=i.length;h<u;h++)for(s=i[h],c=0,d=s.length;c<d;c++)(l=0===c)&&dA++,dM(s[c],!0,dA,f,a,l);for(h=0,u=r.length;h<u;h++)for(s=r[h],c=0,d=s.length;c<d;c++)l=0===c,2===o&&(l=!1),l&&dA++,dM(s[c],!1,dA,f,n,l);return f}(c,d,p,m,a);if(s=c,l=d,u=null,(p[0]>m[2]||m[0]>p[2]||p[1]>m[3]||m[1]>p[3])&&(0===a?u=dC:2===a?u=s:(1===a||3===a)&&(u=s.concat(l))),f=u)return f===dC?null:f;let g=function(i){let r,a,n=function(i){let r,a,n,o,s,l=[];for(a=0,n=i.length;a<n;a++)((r=i[a]).left&&r.inResult||!r.left&&r.otherEvent.inResult)&&l.push(r);let h=!1;for(;!h;)for(h=!0,a=0,n=l.length;a<n;a++)a+1<n&&1===dy(l[a],l[a+1])&&(o=l[a],l[a]=l[a+1],l[a+1]=o,h=!1);for(a=0,n=l.length;a<n;a++)(r=l[a]).otherPos=a;for(a=0,n=l.length;a<n;a++)(r=l[a]).left||(s=r.otherPos,r.otherPos=r.otherEvent.otherPos,r.otherEvent.otherPos=s);return l}(i),o={},s=[];for(r=0,a=n.length;r<a;r++){if(o[r])continue;let i=s.length,a=function(i,r,a){let n=new dS;if(null!=i.prevInResult){let o=i.prevInResult,s=o.outputContourId;if(o.resultTransition>0){let i=r[s];if(null!=i.holeOf){let o=i.holeOf;r[o].holeIds.push(a),n.holeOf=o,n.depth=r[s].depth}else r[s].holeIds.push(a),n.holeOf=s,n.depth=r[s].depth+1}else n.holeOf=null,n.depth=r[s].depth}else n.holeOf=null,n.depth=0;return n}(n[r],s,i),l=r=>{o[r]=!0,r<n.length&&n[r]&&(n[r].outputContourId=i)},h=r,u=r;for(a.points.push(n[r].point);l(h),l(h=n[h].otherPos),a.points.push(n[h].point),!((h=function(i,r,a,n){let o,s=i+1,l=r[i].point,h=r.length;for(s<h&&(o=r[s].point);s<h&&o[0]===l[0]&&o[1]===l[1];){if(!a[s])return s;++s<h&&(o=r[s].point)}for(s=i-1;a[s]&&s>n;)s--;return s}(h,n,o,u))==u||h>=n.length)&&n[h];);s.push(a)}return s}(function(i,r,a,n){let o,s,l,h=new dr(dT),u=[],c=Math.min(r[2],a[2]);for(;0!==i.length;){let a=i.pop();if(u.push(a),0===n&&a.point[0]>c||2===n&&a.point[0]>r[2])break;if(a.left){s=o=h.insert(a),o=o!==(l=h.minNode())?h.prev(o):null,
7s=h.next(s);let r=o?o.key:null;if(df(a,r,n),s&&2===dw(a,s.key,i)&&(df(a,r,n),df(s.key,a,n)),o&&2===dw(o.key,a,i)){let i=o;df(r,(i=i!==l?h.prev(i):null)?i.key:null,n),df(a,r,n)}}else a=a.otherEvent,s=o=h.find(a),o&&s&&(o=o!==l?h.prev(o):null,s=h.next(s),h.remove(a),s&&o&&dw(o.key,s.key,i))}return u}(_,p,m,a)),y=[];for(let i=0;i<g.length;i++){let r=g[i];if(r.isExterior()){let i=[r.points];for(let a=0;a<r.holeIds.length;a++)i.push(g[r.holeIds[a]].points);y.push(i)}}return y}function dR(i,r=1){return[i.map(i=>i.map(i=>[i.x*r,i.y*r]))]}function dP(i,r){let a=Math.floor(i)+.5;return Math.abs(i-a)<=r?Math.round(a):Math.round(i)}class dL{constructor(i){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=i}canonicalize(i,r){let a=this.tolerance,n=Math.floor(i/a),o=Math.floor(r/a);for(let s=-1;s<=1;s++){let l=this.buckets.get(n+s);if(l)for(let s=-1;s<=1;s++){let h=l.get(o+s);if(h){for(let s of h)if(Math.abs(this.xs[s]-i)<=a&&Math.abs(this.ys[s]-r)<=a){let a=this.ixs[s],l=this.iys[s];return this.xs[s]===i&&this.ys[s]===r||this.store(i,r,a,l,n,o),[a,l]}}}}let s=dP(i,a),l=dP(r,a);return this.store(i,r,s,l,n,o),[s,l]}store(i,r,a,n,o,s){let l=this.xs.length;this.xs.push(i),this.ys.push(r),this.ixs.push(a),this.iys.push(n);let h=this.buckets.get(o);h||(h=new Map,this.buckets.set(o,h));let u=h.get(s);u||(u=[],h.set(s,u)),u.push(l)}}function dz(i,r=1,a){let n=null!=a?new dL(a):null;return i.map(i=>i.map((i,a)=>{let o=i.map(i=>{let a=i[0]*r,o=i[1]*r;if(n){let[i,r]=n.canonicalize(a,o);return new eJ(i,r)}return new eJ(Math.round(a),Math.round(o))});return a>0&&o.reverse(),o}))}class dO{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new sG}empty(){return 0===this.frcCoverage.size}}function dF(i,r,a){if(0===i.frcCoverage.size||0===i.featureTriSegments.length)return;let n=a.get(),o=r.uint16,s=[];i.featureTriSegments.sort((i,r)=>i.segIdx!==r.segIdx?i.segIdx-r.segIdx:null===i.frc&&null===r.frc?0:null===i.frc?-1:null===r.frc?1:r.frc-i.frc);let l=new Map,h=0,u=i.featureTriSegments[0].frc,c={vertexOffset:n[h].vertexOffset,primitiveOffset:0,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0},d=()=>{c.primitiveLength>0&&(l.has(u)||l.set(u,[]),l.get(u).push(Object.assign({},c)))};for(let r of i.featureTriSegments){r.segIdx!==h&&(d(),h=r.segIdx,u=r.frc,c={vertexOffset:n[h].vertexOffset,primitiveOffset:s.length/3,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),r.frc!==u&&(d(),u=r.frc,c=Object.assign({},c,{primitiveOffset:s.length/3,primitiveLength:0}));for(let i=r.start;i<r.end;i++)s.push(o[i]);c.primitiveLength+=(r.end-r.start)/3}d();for(let i=0;i<s.length;i++)o[i]=s[i];for(let[r,a]of l)null!==r?i.frcPerLevel.set(r,new sG(a)):i.frcNonRoadSegments=new sG(a);i.featureTriSegments=[]}a2(dO,"FrcSegmentData");let dB={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function dk(i){let r=i.class;if("string"!=typeof r)return null;let a=dB[r];return void 0!==a?a:null}function dN(i,r,a){for(let n of i)if(n.startsWith("(")){let i=n.indexOf(")");if(-1===i)continue;if(n.slice(1,i)===r&&n.slice(i+1)===a)return!0}else if(n===a)return!0;return!1}class dU{constructor(i,r,a){this.elevationMode=r,r&&(this.elevationBufferData=new cQ(i.layers,i.zoom,i.lut)),a&&(this.frcData=new dO)}isEmpty(){let i=!this.elevationBufferData||this.elevationBufferData.isEmpty(),r=!this.frcData||this.frcData.empty();return i&&r}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(i){if(!this.frcData)return null;let r=dk(i||{});return null!==r&&this.frcData.frcCoverage.add(r),r}recordFeatureRange(i,r,a,n){if(!this.frcData||a<=r)return;let o=i.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*r,end:3*a,segIdx:o.length>0?o.length-1:0,frc:n})}buildFrcSegments(i){this.frcData&&!this.frcData.empty()&&dF(this.frcData,i.bufferData.indexArray,i.bufferData.tri
7angleSegments)}handleFeature(i,r,a,n,o,s){let l=[];if(!this.elevationMode)return!1;let h=dt(i,o);if(!h)return!1;{let i=this.clipPolygonsToTile(r,1);i.length>0&&l.push({polygons:i,elevationFeature:h,elevationTileID:n})}let u={guardRailEnabled:s.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(i,{},n),featureIndex:a};for(let r of l)if(r.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new c2(r.elevationTileID,s.layers,s.zoom,s.lut));let a=r.elevationFeature.isTunnel(),n=0;Object.hasOwn(i.properties,lW)&&(n=+i.properties[lW]),this.elevatedStructures.addPortalCandidates(r.elevationFeature.id,r.polygons,a,r.elevationFeature,n)}null==r.elevationFeature.constantHeight&&(r.polygons=this.prepareElevatedPolygons(r.polygons,r.elevationFeature,r.elevationTileID));let o=new de(n,r.elevationTileID);this.addElevatedGeometry(s,r.polygons,o,r.elevationFeature,.05*("hd-road-base"!==this.elevationMode),a,u)}return!0}populatePaintArrays(i,r,a,n,o,s,l){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(i,r,a,n,o,s,l)}update(i,r,a,n,o,s,l,h){this.elevationBufferData&&this.elevationBufferData.update(i,r,a,n,o,s,l,h),this.elevatedStructures&&this.elevatedStructures.update(i,r,a,n,o,s,l,h)}updateExpressions(i){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(i),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(i),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(i))}upload(i){this.elevationBufferData&&this.elevationBufferData.upload(i),this.elevatedStructures&&this.elevatedStructures.upload(i)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(i,r,a,n,o,s){this.elevatedStructures&&(this.elevatedStructures.construct(i),this.elevatedStructures.populatePaintArrays(r,a,n,o,s))}addElevatedGeometry(i,r,a,n,o,s,l){let[h,u]=i.addGeometry(r,this.elevationBufferData,{elevation:n,elevationSampler:a,bias:o,index:s,featureInfo:l},this.elevatedStructures);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:h,max:u}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,h),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,u))}prepareElevatedPolygons(i,r,a){let n=1/oV(a),o=[];for(let a of i){let i=function(i,r,a=0){let n=dR(i,65536),o=[];for(;r.valid();r.next()){let[i,n]=r.get(),s=65536*i.x,l=65536*i.y,h=65536*n.x,u=65536*n.y,c=h-s,d=u-l,f=Math.hypot(c,d);if(0===f)continue;s-=c*a,l-=d*a,h+=c*a,u+=d*a;let p=Math.trunc(d/f*3),m=-Math.trunc(c/f*3);o.push([[[s,l],[h,u],[h+p,u+m],[s+p,l+m],[s,l]]])}return o.length>0&&(n=dD(n,o,2)),dz(n,152587890625e-16,.001)}(a,new c9(r,n),.1);o.push(...i)}return o}clipPolygonsToTile(i,r){let a=-r,n=-r,o=8192+r,s=8192+r,l=0,h=[],u=[];for(;l<i.length;l++){let r=i[l],c=e9(r);(c.min.x>=a&&c.max.x<=o&&c.min.y>=n&&c.max.y<=s?h:u).push(r)}if(h.length===i.length)return i;let c=[new eJ(a,n),new eJ(o,n),new eJ(o,s),new eJ(a,s),new eJ(a,n)];for(let i of u)h.push(...function(i,r){let a=dD(dR(i),dR([r]),0);return null==a?[]:dz(a)}(i,c));return h}}a2(dU,"FillHDExtension"),a2(c2,"ElevatedStructures");class dV{constructor(i,r){this.elevationEnabled=i,r&&(this.frcData=new dO)}isEmpty(){let i=!this.elevationEnabled||void 0===this.heightRange,r=!this.frcData||this.frcData.empty();return i&&r}trackFeatureFrc(i){if(!this.frcData)return null;let r=dk(i||{});return null!==r&&this.frcData.frcCoverage.add(r),r}recordFeatureRange(i,r,a,n){if(!this.frcData||a<=r)return;let o=i.segments.get();this.frcData.featureTriSegments.push({start:3*r,end:3*a,segIdx:o.length>0?o.length-1:0,frc:n})}buildFrcSegments(i){this.frcData&&!this.frcData.empty()&&dF(this.frcData,i.indexArray,i.segments)}
7handleFeature(i,r,a,n,o,s,l,h,u){if(!this.elevationEnabled)return!1;let c=dt(i,n);if(c){let n=lk(r,-1,-1,8193,8193);for(let r of this.prepareElevatedLines(n,c,a)){let n=u.layoutVertexArray.length;u.addLine(r,i,a,o,s,l,h);let d=new de(a,a),f=u.showElevationIdDebug?function(i){if(0===i)return[0,0,0];let r=aE(i);return[r(),r(),r()]}(c.id):null;for(let i=n;i<u.layoutVertexArray.length;i++){let r=new eJ(u.layoutVertexArray.int16[6*i]>>1,u.layoutVertexArray.int16[6*i+1]>>1),a=d.pointElevation(r,c,.05);this.updateHeightRange(a),u.zOffsetVertexArray.emplaceBack(a,0,0,0),f?u.elevationIdColVertexArray.emplaceBack(f[0],f[1],f[2]):u.showElevationIdDebug&&u.elevationIdColVertexArray.emplaceBack(0,0,0)}}return!0}let d=!(!i.properties||!Object.hasOwn(i.properties,"mapbox_line_metrics"))&&i.properties.mapbox_line_metrics,f=u.layoutVertexArray.length,p=[],m=lk(r,-1,-1,8193,8193,p);for(let r=0;r<m.length;r++){let n=m[r],c=p[r],f={progress:{min:c.progress.min,max:c.progress.max},nextDir:c.nextPoint.sub(n.at(-2)).unit(),prevDir:n[1].sub(c.prevPoint).unit()};u.addLine(n,i,a,o,s,l,h,f,d&&c.parentIndex>0?c.parentIndex:null)}return u.fillNonElevatedRoadSegment(f),!0}prepareElevatedLines(i,r,a){if(null!=r.constantHeight)return i;let n=[],o=1/oV(a);for(let a of i)!function(i,r,a){if(i.length<2)return a.push(i);let n=[];for(;r.valid();){let[a,o]=r.get();for(let r=0;r<i.length-1;r++){let s=i[r],l=i[r+1],h=function(i,r,a,n){let o=lE(i,r,n),s=lE(i,r,a);if(Math.sign(o)===Math.sign(s))return;let l=lE(a,n,i),h=l+s-o;return Math.sign(l)!==Math.sign(h)?[l/(l-h),s/(s-o)]:void 0}(s,l,a,o);if(h){let[i]=h,a=new eJ(iw(s.x,l.x,i),iw(s.y,l.y,i));n.push({t:r+i,distance:0,point:a})}}r.next()}if(0===n.length)return a.push(i);n.sort((i,r)=>i.t-r.t);let o=0,s=0,l=[];for(a.push(l);o!==i.length;){if(s===n.length){for(;o!==i.length;)0!==l.length&&l.at(-1).equals(i[o])||l.push(i[o]),o++;break}n[s].t<=o?(0!==l.length&&l.at(-1).equals(n[s].point)||l.push(n[s].point),n[s].t,s++):(0!==l.length&&l.at(-1).equals(i[o])||l.push(i[o]),o++)}}(a,new c9(r,o),n);return n}updateHeightRange(i){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,i),this.heightRange.max=Math.max(this.heightRange.max,i)):this.heightRange={min:i,max:i}}}a2(dV,"LineHDExtension");class dj{constructor(){this.elevatedLayoutVertexArray=new o2,this.hasElevation=!1}beginFeature(i,r){this.currentFeatureElevation=dt(i,r)}writeVertexQuad(i,r){let a=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new eJ(i,r)):0;this.hasElevation=this.hasElevation||0!==a;for(let i=0;i<4;i++)this.elevatedLayoutVertexArray.emplaceBack(a)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(i){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,l1.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}a2(dj,"CircleHDExtension");let dG=(i,r,a,n)=>{for(let o=0;o<r;o++)i.emplaceBack(a[0],a[1],a[2],n[0],n[1],n[2])};class dH{constructor(){this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1}addElevationFeatures(i){for(let r of i)this.elevationFeatureIdToIndex.set(r.id,this.elevationFeatures.length),this.elevationFeatures.push(r)}updateRoadElevation(i,r){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,i.hasAnyZOffset=!1;let a=!1,n=oV(r),o=1/n,s=!1,l=!1;for(let r=0;r<i.symbolInstances.length;r++){let h=i.symbolInstances.get(r),u=eh(1,0,0),c=eh(0,1,0),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:f,numIconVertices:p,numVerticalIconVertices:m}=h,_=d>0||f>0,g=p>0,y=this.elevationFeatures[h.elevationFeatureIndex];if(y){let r=new eJ(h.tileAnchorX,h.tileAnchorY),d=.075+y.pointElevation(r);h.zOffset!==d&&(a=!0,h.zOffset=d),0!==d&&(i.hasAnyZOffset=!0);let f=y.computeSlopeNormal(r,o),p=ej(eO(),eh(0,0,1),f);eM(u,u,p),eM(c,c,p),u[2]*=n,c[2]*=n,1===u[0]&&0===u[1]&&0===u[2]&&0===c[0]&&1===c[1]&&0===c[2]||(s=s||_,l=l||g)}if(_&&(dG(i.text.orientationVertexArray,d,u,c),dG(i.text.orientationVertexArray,f,u,c)),g){let{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=h;r>=0&&dG(i.icon.orientationVertexArray,p,u,c),a>=0&&dG(i.icon.orientationVertexArray,m,u,c)}}s||(i.text.orientationVertexArray=void 0),l||(i.icon.orientationVertexArray=void 0),a&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}getElevationFeatureForPlacedSymbol(i,r,a){let n=i.symbolInstances.get(r.symbolInstanceIndices[a]).elevationFeatureIndex;if(n<this.elevationFeatures.length)return this.elevationFeatures[n]}}a2(dH,"SymbolHDExtension");let dq=null,d$=null,dZ=null,dW=null,dX={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},dY={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},dK={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function dJ(i,r,a){let n=a.json.bufferViews.length,o=a.buffers.length;r.bufferView=n,a.json.bufferViews[n]={buffer:o,byteLength:i.byteLength},a.buffers[o]=i}let dQ="KHR_draco_mesh_compression",d0="EXT_meshopt_compression",d1=new TextDecoder("utf8");function d2(i,r){return new URL(i,r).href}async function d3(i,r,a,n,o){let s=await fetch(d2(i.uri,n),{signal:o}),l=await s.arrayBuffer();r.buffers[a]=l}function d4(i,r){let a=i.json.bufferViews[r];return new Uint8Array(i.buffers[a.buffer],a.byteOffset||0,a.byteLength)}async function d5(i,r,a,n,o){if(i.uri){let s=d2(i.uri,n),l=await fetch(s,{signal:o}),h=await l.blob(),u=await createImageBitmap(h);r.images[a]=u}else if(void 0!==i.bufferView){let n=new Blob([d4(r,i.bufferView)],{type:i.mimeType}),o=await createImageBitmap(n);r.images[a]=o}}async function d6(i,r=0,a,n){let o={json:null,images:[],buffers:[]};if(0x46546c67===new Uint32Array(i,r,1)[0]){let a=new Uint32Array(i,r),n=2,s=(a[n++]>>2)-3,l=a[n++]>>2;if(n++,o.json=JSON.parse(d1.decode(a.subarray(n,n+l))),(n+=l)<s){let s=a[n++],l=r+(++n<<2);o.buffers[0]=i.slice(l,l+s)}}else o.json=JSON.parse(d1.decode(new Uint8Array(i,r)));let{buffers:s,images:l,meshes:h,extensionsUsed:u,bufferViews:c}=o.json;
7if(s){let i=[];for(let r=0;r<s.length;r++){let l=s[r];l.uri?i.push(d3(l,o,r,a,n)):o.buffers[r]||(o.buffers[r]=null)}await Promise.all(i)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");let d=[],f=u&&u.includes(dQ),p=u&&u.includes(d0);if(f&&d.push(function(){if(!dq)return null!=d$||(d$=(function(i){let r,a=null;function n(){r=new Uint8Array(a.buffer)}function o(){throw Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(i,{a:{a:o,d:function(i,a,n){return r.copyWithin(i,a,a+n)},c:function(i){let o=r.length,s=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*o))-o)/65536);try{return a.grow(s),n(),!0}catch(i){return!1}},b:o}}).then(i=>{let o,s,l,h,{Rb:u,Qb:c,P:d,T:f,X:p,Ja:m,La:_,Qa:g,Va:y,Wa:x,eb:v,jb:b,f:w,e:T,yb:S,zb:E,Ab:I,Bb:A,Db:M,Gb:C}=i.instance.exports;a=T;let D=(o=0,s=0,l=0,h=0,i=>{l&&(u(h),u(o),s+=l,l=o=0),o||(s+=128,o=c(s));let a=i.length+7&-8,n=o;a>=s&&(l=a,n=h=c(a));for(let a=0;a<i.length;a++)r[n+a]=i[a];return n});return n(),w(),{memory:T,_free:u,_malloc:c,Mesh:class{constructor(){this.ptr=d()}destroy(){f(this.ptr)}},Decoder:class{constructor(){this.ptr=m()}destroy(){b(this.ptr)}DecodeArrayToMesh(i,r,a){let n=D(i);return!!p(_(this.ptr,n,r,a.ptr))}GetAttributeByUniqueId(i,r){return{ptr:g(this.ptr,i.ptr,r)}}GetTrianglesUInt16Array(i,r,a){y(this.ptr,i.ptr,r,a)}GetTrianglesUInt32Array(i,r,a){x(this.ptr,i.ptr,r,a)}GetAttributeDataArrayForAllPoints(i,r,a,n,o){v(this.ptr,i.ptr,r.ptr,a,n,o)}},DT_INT8:S(),DT_UINT8:E(),DT_INT16:I(),DT_UINT16:A(),DT_UINT32:M(),DT_FLOAT32:C()}})})(fetch(tG())).then(i=>{dq=i,d$=null})),d$}()),p&&d.push(function(){var i;if(!dZ)return null!=dW||(dW=(i=fetch(tH()),WebAssembly.instantiateStreaming(i,{}).then(i=>{let{sbrk:r,memory:a,meshopt_decodeVertexBuffer:n,meshopt_decodeIndexBuffer:o,meshopt_decodeIndexSequence:s,meshopt_decodeFilterOct:l,meshopt_decodeFilterQuat:h,meshopt_decodeFilterExp:u}=i.instance.exports,c={ATTRIBUTES:n,TRIANGLES:o,INDICES:s},d={OCTAHEDRAL:l,QUATERNION:h,EXPONENTIAL:u};return i.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(i,n,o,s,l,h){let u=n+3&-4,f=r(u*o),p=r(s.length),m=new Uint8Array(a.buffer);m.set(s,p);let _=c[l](f,n,o,p,s.length);if(0===_&&d[h]&&d[h](f,u,o),i.set(m.subarray(f,f+n*o)),r(f-r(0)),0!==_)throw Error(`Malformed buffer data: ${_}`)}}})).then(i=>{dZ=i,dW=null})),dW}()),l)for(let i=0;i<l.length;i++)d.push(d5(l[i],o,i,a,n));if(d.length&&await Promise.all(d),n&&n.aborted)throw new DOMException("Aborted","AbortError");if(f&&h)for(let{primitives:i}of h)for(let r of i)!function(i,r){let a=i.extensions&&i.extensions[dQ];if(!a)return;let n=new dq.Decoder,o=d4(r,a.bufferView),s=new dq.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,s))throw Error("Failed to decode Draco mesh");let l=r.json.accessors[i.indices],h=dX[l.componentType],u=l.count*h.BYTES_PER_ELEMENT,c=dq._malloc(u);for(let o of(h===Uint16Array?n.GetTrianglesUInt16Array(s,u,c):n.GetTrianglesUInt32Array(s,u,c),dJ(dq.memory.buffer.slice(c,c+u),l,r),dq._free(c),Object.keys(a.attributes))){let l=n.GetAttributeByUniqueId(s,a.attributes[o]),h=r.json.accessors[i.attributes[o]],u=dY[h.componentType],c=h.count*dK[h.type]*dX[h.componentType].BYTES_PER_ELEMENT,d=dq._malloc(c);n.GetAttributeDataArrayForAllPoints(s,l,dq[u],c,d),dJ(dq.memory.buffer.slice(d,d+c),h,r),dq._free(d)}n.destroy(),s.destroy(),delete i.extensions[dQ]}(r,o);if(p&&h&&c)for(let i of c)!function(i,r){if(!i.extensions||!i.extensions[d0])return;let a=i.extensions[d0],n=new Uint8Array(r.buffers[a.buffer],a.byteOffset||0,a.byteLength||0),o=new Uint8Array(a.count*a.byteStride);dZ.decodeGltfBuffer(o,a.count,a.byteStride,n,a.mode,a.filter),i.buffer=r.buffers.length,i.byteOffset=0,r.buffers[i.buffer]=o.buffer,delete i.extensions[d0]}(i,o);return o}async function d8(i,r){return d6(await async function(i,r){if(r&&r.aborted)throw new DOMException("Aborted","AbortError");return new Promise((a,n)=>{let o=is(i,(i,r)=>{i?n(i):a(r)});r&&r.addEventListener("abort",()=>{o.cancel(),n(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:i,type:"arrayBuffer"},r),0,i,r)}class d9{constructor(i,r,a,n){if(this.triangleCount=r.length/3,this.min=new eJ(0,0),this.max=new eJ(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===i.length)return;const[o,s]=[i[0].clone(),i[0].clone()];for(let r=1;r<i.length;++r){const a=i[r];o.x=Math.min(o.x,a.x),o.y=Math.min(o.y,a.y),s.x=Math.max(s.x,a.x),s.y=Math.max(s.y,a.y)}if(n&&(a=Math.max(a,Math.ceil(Math.max(s.x-o.x,s.y-o.y)/n))),0===a)return;this.min=o,this.max=s;const l=this.max.sub(this.min);l.x=Math.max(l.x,1),l.y=Math.max(l.y,1);const h=Math.max(l.x,l.y)/a;this.cellsX=Math.max(1,Math.ceil(l.x/h)),this.cellsY=Math.max(1,Math.ceil(l.y/h)),this.xScale=1/h,this.yScale=1/h;const u=[];for(let a=0;a<this.triangleCount;a++){const n=i[r[3*a+0]].sub(this.min),o=i[r[3*a+1]].sub(this.min),s=i[r[3*a+2]].sub(this.min),l=d7(Math.floor(Math.min(n.x,o.x,s.x)),this.xScale,this.cellsX),c=d7(Math.floor(Math.max(n.x,o.x,s.x)),this.xScale,this.cellsX),d=d7(Math.floor(Math.min(n.y,o.y,s.y)),this.yScale,this.cellsY),f=d7(Math.floor(Math.max(n.y,o.y,s.y)),this.yScale,this.cellsY),p=new eJ(0,0),m=new eJ(0,0),_=new eJ(0,0),g=new eJ(0,0);for(let i=d;i<=f;
7++i){p.y=m.y=i*h,_.y=g.y=(i+1)*h;for(let r=l;r<=c;++r)p.x=_.x=r*h,m.x=g.x=(r+1)*h,(lL(n,o,s,p,m,g)||lL(n,o,s,p,g,_))&&u.push({cellIdx:i*this.cellsX+r,triIdx:a})}}if(0===u.length)return;u.sort((i,r)=>i.cellIdx-r.cellIdx||i.triIdx-r.triIdx);let c=0;for(;c<u.length;){const i=u[c].cellIdx,r={start:this.payload.length,len:0};for(;c<u.length&&u[c].cellIdx===i;)++r.len,this.payload.push(u[c++].triIdx);this.cells[i]=r}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(i,r){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>i.x||i.y>this.max.y||this.min.y>i.y)return;let a=d7(i.x-this.min.x,this.xScale,this.cellsX),n=d7(i.y-this.min.y,this.yScale,this.cellsY),o=this.cells[n*this.cellsX+a];if(o){this._lazyInitLookup();for(let i=0;i<o.len;i++){let a=this.payload[o.start+i],n=Math.floor(a/8),s=1<<a%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,r.push(a),r.length===this.triangleCount))return}}}query(i,r,a){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>r.x||i.y>this.max.y||this.min.y>r.y)return;this._lazyInitLookup();let n=d7(i.x-this.min.x,this.xScale,this.cellsX),o=d7(r.x-this.min.x,this.xScale,this.cellsX),s=d7(i.y-this.min.y,this.yScale,this.cellsY),l=d7(r.y-this.min.y,this.yScale,this.cellsY);for(let i=s;i<=l;i++)for(let r=n;r<=o;r++){let n=this.cells[i*this.cellsX+r];if(n)for(let i=0;i<n.len;i++){let r=this.payload[n.start+i],o=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[o]&s)&&(this.lookup[o]|=s,a.push(r),a.length===this.triangleCount))return}}}}function d7(i,r,a){return Math.max(0,Math.min(a-1,Math.floor(i*r)))}a2(d9,"TriangleGridIndex");let fe=oK([{name:"a_pos_3f",components:3,type:"Float32"}]),ft=oK([{name:"a_color_3f",components:3,type:"Float32"}]),fi=oK([{name:"a_color_4f",components:4,type:"Float32"}]),fr=oK([{name:"a_uv_2f",components:2,type:"Float32"}]),fa=oK([{name:"a_normal_3f",components:3,type:"Float32"}]),fn=oK([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),fo=oK([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function fs(i,r){var a,n;let o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E=fh(i.projection,i.zoom,i.width,i.height),I=(a=i.projection,n=i.center,o=new oz(n.lng-180*fu,n.lat),s=new oz(n.lng+180*fu,n.lat),l=a.project(o.lng,o.lat),u=-Math.atan2((h=a.project(s.lng,s.lat)).y-l.y,h.x-l.x),(c=oj.fromLngLat(n)).y=ts(c.y,-1+fu,1-fu),d=c.toLngLat(),f=a.project(d.lng,d.lat),p=oj.fromLngLat(d),p.x+=fu,m=p.toLngLat(),g=fd((_=a.project(m.lng,m.lat)).x-f.x,_.y-f.y,u),y=oj.fromLngLat(d),y.y+=fu,x=y.toLngLat(),b=fd((v=a.project(x.lng,x.lat)).x-f.x,v.y-f.y,u),w=Math.abs(g.x)/Math.abs(b.y),ee(T=Z([]),T,-u*(1-(r?0:E))),K(S=Z([]),S,[1,1-(1-w)*E,1]),S[4]=-b.x/b.y*E,ee(S,S,u),X(S,T,S),S),A=fl(i);return K(I,I,[A,A,1]),I}function fl(i){let r=i.projection,a=fh(i.projection,i.zoom,i.width,i.height);return Math.pow(2,fc(r,i.center)*a+(1-a)*fc(r,oz.convert(r.center)))}function fh(i,r,a,n,o=1/0){let s=i.range;if(!s)return 0;let l=Math.log2(Math.min(o,Math.max(a,n))/1024);return tl(s[0]+l,s[1]+l,r)}let fu=1/4e4;function fc(i,r){let a=ts(r.lat,-85.051129,85.051129),n=new oz(r.lng-180*fu,a),o=new oz(r.lng+180*fu,a),s=i.project(n.lng,a),l=i.project(o.lng,a),h=oj.fromLngLat(n),u=oj.fromLngLat(o),c=l.x-s.x,d=l.y-s.y,f=u.x-h.x,p=u.y-h.y;return Math.log2(Math.sqrt((f*f+p*p)/(c*c+d*d)))}function fd(i,r,a){let n=Math.cos(a),o=Math.sin(a);return{x:i*n-r*o,y:i*o+r*n}}let ff=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function fp(i,r,a){Z(i),ee(i,i,r[2]*e7),J(i,i,r[0]*e7),Q(i,i,r[1]*e7),K(i,i,a),X(i,i,ff)}function fm(i,r,a,n,o,s,l,h){let u=[a[0]-r[0],a[1]-r[1],0],c=[n[0]-r[0],n[1]-r[1],0];if(1e-12>el(u)||1e-12>el(c))return eF(i);let d=eS([],u,c);return ew(d,d),ed(c,n,r),u[2]=(s-o)*h,c[2]=(l-o)*h,eS(u,u,c),ew(u,u),ej(i,d,u)}function f_(i,r,a=!1){let n=ci(r.zoom),o=function(i,r,a){let n,o,s,l=r.worldSize,h=[i[12],i[13],i[14]],u=rm(h[1]/l),c=rp(h[0]/l),d=Z([]),f=1/oF(u)*l,p=1/oF(0)*l*oN(u,r.zoom),m=1/u7(l),_=p*m;if(a){let i=fh(r.projection,r.zoom,r.width,r.height,1024);_=m*r.projection.pixelSpaceConversion(r.center.lat,l,i)}let g=oP(u,c);ec(g,g,e_([],ew([],g),f*_*h[2]));let y=(s=eS([],o=[0,1,0],n=[g[0],g[1],g[2]]),eS(o,n,s),0===ev(o)&&eS(s,n,o=[0,1,0]),ew(s,s),ew(o,o),ew(n,n),[s[0],s[1],s[2],0,o[0],o[1],o[2],0,n[0],n[1],n[2],0,g[0],g[1],g[2],1]);K(d,d,[_,_,_*f]),Y(d,d,[-h[0],-h[1],-h[2]]);let x=X([],r.globeMatrix,y);return X(x,x,d),X(x,x,i),x}(i,r,a);if(n>0){let a,s,l,h,u,c,d,f,p,m,_=(a=r.worldSize,s=1/oF(0)*a*oN(r.center.lat,r.zoom)/u7(a),l=1/oF(r.center.lat)*a,Q(h=Z([]),h,r.center.lng*e7),J(h,h,r.center.lat*e7),Y(h,h,[0,0,oM]),K(h,h,[s,s,s*l]),Y(h,h,[-(u=r.point).x,-u.y,0]),X(h,h,i),X(h,r.globeMatrix,h));return d=(c=(i,r,a)=>{let n=el(i),o=el(r),s=uJ(i,r,a);return e_(s,s,1/el(s)*iw(n,o,a))})([o[0],o[1],o[2]],[_[0],_[1],_[2]],n),f=c([o[4],o[5],o[6]],[_[4],_[5],_[6]],n),p=c([o[8],o[9],o[10]],[_[8],_[9],_[10]],n),m=uJ([o[12],o[13],o[14]],[_[12],_[13],_[14]],n),[d[0],d[1],d[2],0,f[0],f[1],f[2],0,p[0],p[1],p[2],0,m[0],m[1],m[2],1]}return o}function fg(i,r,a,n){let o=uq.projectAabbCorners(n,a),s=Number.MAX_VALUE;for(let i=0;i<o.length;++i){let a=o[i];a[0]=(.5*a[0]+.5)*r.width,a[1]=(.5-.5*a[1])*r.height,a[2]<s&&(s=a[2])}if(lw(i,function(i){let r=[],a=0;for(let r=1;r<i.length;r++)(i[r][0]<i[a][0]||i[r][0]===i[a][0]&&i[r][1]<i[a][1])&&(a=r);let n,o=a,s=new Uint8Array(i.length);do{if(s[o])break;r.push(new eJ(i[o][0],i[o][1])),s[o]=1,n=(o+1)%i.length;for(let r=0;r<i.length;r++){if(i[r][0]===i[n][0]&&i[r][1]===i[n][1]||i[r][0]===i[o][0]&&i[r][1]===i[o][1])continue;let a=[i[r][0]-i[o][0],i[r][1]-i[o][1]],s=[i[n][0]-i[o][0],i[n][1]-i[o][1]],l=a[0]*s[1]-a[1]*s[0];(l>0||0===l&&a[0]*s[0]+a[1]*s[1]>=0&&a[0]*a[0]+a[1]*a[1]>s[0]*s[0]+s[1]*s[1])&&(n=r)}o=n}while(o!==a)return r.length>0&&r.push(r[0]),r}(o)))return s}
7let fy={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function fx(i,r,a,n,o,s,l,h,u,c=!1){let d=a.zoom,f=a.project(n),p=oN(n.lat,d),m=1/p;Z(i),Y(i,i,[f.x+l[0]*m,f.y+l[1]*m,l[2]]);let _=1,g=1,y=a.worldSize;if(c){if("mercator"===a.projection.name){let i=0;a.elevation&&(i=a.elevation.getAtPointOrZero(new oj(f.x/y,f.y/y),0));let r=ez([],[f.x,f.y,i,1],a.projMatrix)[3]/a.cameraToCenterDistance;_=r,g=r*oN(a.center.lat,d)}else if("globe"===a.projection.name){let r=f_(i,a),o=[0,0,0,1];ez(o,o,X([],a.projMatrix,r));let s=o[3]/a.cameraToCenterDistance,l=ci(d),h=a.projection.pixelsPerMeter(n.lat,y)*oN(n.lat,d),u=a.projection.pixelsPerMeter(a.center.lat,y)*oN(a.center.lat,d);_=s/iw(h,ok(a.center.lat),l),g=s*p/h,_*=u,g*=u}}else _=m;K(i,i,[_,_,g]);let x=[...i],v=r.orientation,b=[];if(fp(b,[v[0]+(o?o[0]:0),v[1]+(o?o[1]:0),v[2]+(o?o[2]:0)],s),X(i,x,b),h&&a.elevation){let o=0,s=[];if(u&&a.elevation){o=function(i,r,a,n,o){let s=r.elevation;if(!s)return 0;let l=uq.projectAabbCorners(a,n),h=1/oF(o.lat)*r.worldSize,u=function(i,r){let a=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let o of n){let n=i[o.corners[0]],s=i[o.corners[1]],l=i[o.corners[2]],h=[s[0]-n[0],s[1]-n[1],r*(s[2]-n[2])],u=eS(h,h,[l[0]-n[0],l[1]-n[1],r*(l[2]-n[2])]);ew(u,u),o.dotProductWithUp=eT(u,a)}return n.sort((i,r)=>i.dotProductWithUp-r.dotProductWithUp),n[0].corners}(l,h),c=l[u[0]],d=l[u[1]],f=l[u[2]],p=l[u[3]],m=s.getAtPointOrZero(new oj(c[0]/r.worldSize,c[1]/r.worldSize),0),_=s.getAtPointOrZero(new oj(d[0]/r.worldSize,d[1]/r.worldSize),0),g=s.getAtPointOrZero(new oj(f[0]/r.worldSize,f[1]/r.worldSize),0),y=s.getAtPointOrZero(new oj(p[0]/r.worldSize,p[1]/r.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?fm(i,d,p,c,_,y,m,h):fm(i,f,c,p,g,m,y,h):m<y?fm(i,c,d,f,m,_,g,h):fm(i,p,f,d,y,g,_,h),Math.max(x,v)}(s,a,r.aabb,i,n);let l=X([],en([],s),b);X(i,x,l)}else o=a.elevation.getAtPointOrZero(new oj(f.x/y,f.y/y),0);0!==o&&(i[14]+=o)}}class fv{constructor(i,r,a,n,o){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=i,this.uri=r,this.position=null!=a?new oz(a[0],a[1]):new oz(0,0),this.orientation=null!=n?n:[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new uq([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(i,r){var a;X(i.globalMatrix,r,i.localMatrix);let n=this.nodeOverrides.get(i.name);if(void 0!==n){if(n.orientation){let r=[];a=n.orientation,Z(r),Q(r,r,a[1]*e7),ee(r,r,a[2]*e7),J(r,r,a[0]*e7),X(i.globalMatrix,i.globalMatrix,r)}n.minZoom&&(i.minZoom=n.minZoom),n.maxZoom&&(i.maxZoom=n.maxZoom)}if(i.meshes)for(let r of i.meshes){let a=uq.applyTransformFast(r.aabb,i.globalMatrix);this.aabb.encapsulate(a)}if(i.children)for(let r of i.children)this._applyTransformations(r,i.globalMatrix)}computeBoundsAndApplyParent(){let i=Z([]);for(let r of(this.aabb=new uq([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.nodes))this._applyTransformations(r,i)}computeModelMatrix(i,r,a,n,o,s,l=!1){fx(this.matrix,this,i.transform,this.position,r,a,n,o,s,l)}upload(i){if(!this.uploaded){for(let r of this.nodes)fT(r,i);for(let i of this.nodes)fE(i);this.uploaded=!0}}destroy(){for(let i of this.nodes)fA(i)}}function fb(i,r,a=!1){i.uploaded||(i.gfxTexture=new h3(r,i.image,a?r.gl.R8:r.gl.RGBA8,{useMipmap:i.sampler.minFilter>=r.gl.NEAREST_MIPMAP_NEAREST}),i.uploaded=!0,i.image=null)}function fw(i,r,a){i.indexBuffer=r.createIndexBuffer(i.indexArray,!1,!0),i.vertexBuffer=r.createVertexBuffer(i.vertexArray,fe.members,!1,!0),i.normalArray&&(i.normalBuffer=r.createVertexBuffer(i.normalArray,fa.members,!1,!0)),i.texcoordArray&&(i.texcoordBuffer=r.createVertexBuffer(i.texcoordArray,fr.members,!1,!0)),i.colorArray&&(i.colorBuffer=r.createVertexBuffer(i.colorArray,(12===i.colorArray.bytesPerElement?ft:fi).members,!1,!0)),i.featureArray&&(i.pbrBuffer=r.createVertexBuffer(i.featureArray,fo.members,!0)),i.segments=sG.simpleSegment(0,0,i.vertexArray.length,i.indexArray.length);let n=i.material;n.pbrMetallicRoughness.baseColorTexture&&fb(n.pbrMetallicRoughness.baseColorTexture,r),n.pbrMetallicRoughness.metallicRoughnessTexture&&fb(n.pbrMetallicRoughness.metallicRoughnessTexture,r),n.normalTexture&&fb(n.normalTexture,r),n.occlusionTexture&&fb(n.occlusionTexture,r,a),n.emissionTexture&&fb(n.emissionTexture,r)}function fT(i,r,a){if(i.meshes)for(let n of i.meshes)fw(n,r,a);if(i.lodMeshes)for(let n of i.lodMeshes)fw(n,r,a);if(i.children)for(let n of i.children)fT(n,r,a)}function fS(i){i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy()}function fE(i){if(i.meshes)for(let r of i.meshes)fS(r);if(i.lodMeshes)for(let r of i.lodMeshes)fS(r);if(i.children)for(let r of i.children)fE(r)}function fI(i){var r;i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((r=i.material).pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()))}function fA(i){if(i.meshes)for(let r of i.meshes)fI(r);if(i.lodMeshes)for(let r of i.lodMeshes)fI(r);if(i.footprintDebugMesh&&(i.footprintDebugMesh.vertexBuffer.destroy(),i.footprintDebugMesh.indexBuffer.destroy(),i.footprintDebugMesh.segments.destroy()),i.children)for(let r of i.children)fA(r)}function fM(i,r,a,n){return i[0]<=n[0]&&r[0]>=a[0]&&i[1]<=n[1]&&r[1]>=a[1]&&i[2]<=n[2]&&r[2]>=a[2]}let fC=[];class fD{serializeFromGltf(i,r,a,n){if(i.length<7)return;let o=0;if(109!==i[o++]||98!==i[o++]||120!==i[o++]||98!==i[o++]||118!==i[o++]||104!==i[o++]||43!==i[o++])return;let s=new DataView(i.buffer,i.byteOffset),l=s.getUint16(o,!0);if(o+=2,0===l)return;this._nodes=[];let h=0;for(let i=0;i<l;i++){let i=[r[3*h],r[3*h+1],r[3*h+2]],n=[a[3*h],a[3*h+1],a[3*h+2]];h++;let l=s.getUint16(o,!0);o+=2;let u=0,c=0;65535===l&&(u=s.getUint16(o,!0),o+=2,c=s.getUint32(o,!0),o+=4),this._nodes.push({aabbMin:i,aabbMax:n,backChild:l,indexCount:u,indexOffset:c})}let u=s.getUint32(o,!0);this._indices=n.slice(0,u)}setVertices(i){this._vertices=i}findHighestPoint(i,r){if(!this._nodes||0===this._nodes.length||!fM(this._nodes[0].aabbMin,this._nodes[0].aabbMax,i,r))return null;fC.length=0,fC.push(0);let a=-1/0;for(;fC.length>0;){let n=fC.pop(),o=this._nodes[n];if(o.aabbMax[2]<=a)continue;if(65535===o.backChild){for(let n=0;n<o.indexCount;n+=3){let s=3*this._indices[o.indexOffset+n],l=3*this._indices[o.indexOffset+n+1],h=3*this._indices[o.indexOffset+n+2];(function(i,r,a,n,o,s,l,h,u,c,d){let f,p,m,_,g,y,x=.5*(c[0]+d[0]),v=.5*(c[1]+d[1]),b=.5*(c[2]+d[2]),w=.5*(d[0]-c[0]),T=.5*(d[1]-c[1]),S=.5*(d[2]-c[2]),E=i-x,I=r-v,A=a-b,M=n-x,C=o-v,D=s-b,R=l-x,P=h-v,L=u-b,z=M-E,O=C-I,F=D-A,B=R-M,k=P-C,N=L-D,U=E-R,V=I-P,j=A-L;if(_=Math.min(f=A*O-I*F,p=D*O-C*F,m=L*O-P*F),g=Math.max(f,p,m),_>(y=Math.abs(F)*T+Math.abs(O)*S)||g<-y||(_=Math.min(f=A*k-I*N,p=D*k-C*N,m=L*k-P*N),g=Math.max(f,p,m),_>(y=Math.abs(N)*T+Math.abs(k)*S)||g<-y)||(_=Math.min(f=A*V-I*j,p=D*V-C*j,m=L*V-P*j),g=Math.max(f,p,m),_>(y=Math.abs(j)*T+Math.abs(V)*S)||g<-y)||(_=Math.min(f=E*F-A*z,p=M
7*F-D*z,m=R*F-L*z),g=Math.max(f,p,m),_>(y=Math.abs(F)*w+Math.abs(z)*S)||g<-y)||(_=Math.min(f=E*N-A*B,p=M*N-D*B,m=R*N-L*B),g=Math.max(f,p,m),_>(y=Math.abs(N)*w+Math.abs(B)*S)||g<-y)||(_=Math.min(f=E*j-A*U,p=M*j-D*U,m=R*j-L*U),g=Math.max(f,p,m),_>(y=Math.abs(j)*w+Math.abs(U)*S)||g<-y)||(_=Math.min(f=I*z-E*O,p=C*z-M*O,m=P*z-R*O),g=Math.max(f,p,m),_>(y=Math.abs(O)*w+Math.abs(z)*T)||g<-y)||(_=Math.min(f=I*B-E*k,p=C*B-M*k,m=P*B-R*k),g=Math.max(f,p,m),_>(y=Math.abs(k)*w+Math.abs(B)*T)||g<-y)||(_=Math.min(f=I*U-E*V,p=C*U-M*V,m=P*U-R*V),g=Math.max(f,p,m),_>(y=Math.abs(V)*w+Math.abs(U)*T)||g<-y)||(_=Math.min(E,M,R),g=Math.max(E,M,R),_>w||g<-w)||(_=Math.min(I,C,P),g=Math.max(I,C,P),_>T||g<-T)||(_=Math.min(A,D,L),g=Math.max(A,D,L),_>S||g<-S))return!1;let G=O*N-F*k,H=F*B-z*N,q=z*k-O*B;return y=w*Math.abs(G)+T*Math.abs(H)+S*Math.abs(q),!(Math.abs(-(G*E+H*I+q*A))>y)})(this._vertices[s],this._vertices[s+1],this._vertices[s+2],this._vertices[l],this._vertices[l+1],this._vertices[l+2],this._vertices[h],this._vertices[h+1],this._vertices[h+2],i,r)&&(a=Math.max(a,this._vertices[s+2],this._vertices[l+2],this._vertices[h+2]))}continue}let s=n+1,l=o.backChild,h=this._nodes[s],u=this._nodes[l],c=fM(h.aabbMin,h.aabbMax,i,r),d=fM(u.aabbMin,u.aabbMax,i,r);c&&d?h.aabbMax[2]<u.aabbMax[2]?(fC.push(s),fC.push(l)):(fC.push(l),fC.push(s)):c?fC.push(s):d&&fC.push(l)}return a>=0?a:null}}function fR(i,r){let a=i.json.bufferViews[r.bufferView],n=dX[r.componentType];return new n(i.buffers[a.buffer],(r.byteOffset||0)+(a.byteOffset||0),r.count*(a.byteStride&&a.byteStride!==dK[r.type]*n.BYTES_PER_ELEMENT?a.byteStride/n.BYTES_PER_ELEMENT:dK[r.type]))}function fP(i,r,a,n){let o=dX[r.componentType],s=function(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),l=i.json.bufferViews[r.bufferView],h=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:dK[r.type],u=a.float32,c=u.length/a.capacity,d=r.count*h;for(let i=0,r=0;i<d;i+=h,r+=c)for(let a=0;a<c;a++)u[r+a]=n[i+a]*s}function fL(i,r,a){var n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A;let{matrix:M,rotation:C,translation:D,scale:R,mesh:P,extras:L,children:z,name:O}=i,F={};if(F.name=O,F.localMatrix=M||(n=[],o=C||[0,0,0,1],s=D||[0,0,0],l=R||[1,1,1],h=o[0],u=o[1],c=o[2],d=o[3],f=h+h,p=u+u,m=c+c,_=h*f,g=h*p,y=h*m,x=u*p,v=u*m,b=c*m,w=d*f,T=d*p,S=d*m,E=l[0],I=l[1],A=l[2],n[0]=(1-(x+b))*E,n[1]=(g+S)*E,n[2]=(y-T)*E,n[3]=0,n[4]=(g-S)*I,n[5]=(1-(_+b))*I,n[6]=(v+w)*I,n[7]=0,n[8]=(y+T)*A,n[9]=(v-w)*A,n[10]=(1-(_+x))*A,n[11]=0,n[12]=s[0],n[13]=s[1],n[14]=s[2],n[15]=1,n),F.globalMatrix=$(F.localMatrix),void 0!==P){F.meshes=a[P];let i=F.anchor=[0,0];for(let r of F.meshes){let{min:a,max:n}=r.aabb;i[0]+=a[0]+n[0],i[1]+=a[1]+n[1]}i[0]=Math.floor(i[0]/F.meshes.length/2),i[1]=Math.floor(i[1]/F.meshes.length/2)}if(L&&(L.id&&(F.id=L.id),L.lights&&(F.lights=function(i){if(!i.length)return[];let r=function(i){let r=atob(i),a=new Uint8Array(r.length);for(let i=0;i<r.length;i++)a[i]=r.codePointAt(i);return a}(i),a=[],n=r.length/24,o=new Uint16Array(r.buffer),s=new Float32Array(r.buffer);for(let i=0;i<n;i++){let r=o[2*i*6]/30,n=o[2*i*6+1]/30,l=o[2*i*6+10]/100,h=s[6*i+1],u=s[6*i+2],c=s[6*i+3],d=s[6*i+4],f=c-h,p=d-u,m=Math.hypot(f,p);a.push({pos:[h+.5*f,u+.5*p,n],normal:[p/m,-f/m,0],width:m,height:r,depth:l,points:[h,u,c,d]})}return a}(L.lights)),L.MAPBOX_geometry_bloom&&(F.isGeometryBloom=L.MAPBOX_geometry_bloom),L.MAPBOX_zoom_min&&(F.minZoom=L.MAPBOX_zoom_min),L.MAPBOX_zoom_max&&(F.maxZoom=L.MAPBOX_zoom_max)),z){let i=[];for(let n of z)i.push(fL(r.json.nodes[n],r,a));F.children=i}if(i.extensions&&i.extensions.mbx_bvh&&(F.meshBVH=function(i,r,a){let n=r.binaryAccessor,o=r.positionMinAccessor,s=r.positionMaxAccessor,l=r.indexAccessor;if(!(Number.isInteger(n)&&Number.isInteger(o)&&Number.isInteger(s)&&Number.isInteger(l)))return null;let h=i.json.accessors;if(n>=h.length||o>=h.length||s>=h.length||l>=h.length)return null;let u=h[n],c=h[o],d=h[s],f=h[l];if(void 0===u.bufferView||void 0===c.bufferView||void 0===d.bufferView||void 0===f.bufferView)return null;let p=i.json.bufferViews;if(u.bufferView>=p.length||c.bufferView>=p.length||d.bufferView>=p.length||f.bufferView>=p.length)return null;let m=p[u.bufferView],_=p[c.bufferView],g=p[d.bufferView],y=p[f.bufferView];if(m.buffer>=i.buffers.length||_.buffer>=i.buffers.length||g.buffer>=i.buffers.length||y.buffer>=i.buffers.length)return null;let x=(i,r,a)=>i>=0&&i<=a&&r<=a-i,v=u.byteOffset||0,b=c.byteOffset||0,w=d.byteOffset||0,T=f.byteOffset||0;if(!(x(v,0,m.byteLength)&&x(b,3*c.count*4,_.byteLength)&&x(w,3*d.count*4,g.byteLength)&&x(T,4*f.count,y.byteLength)))return null;let S=new Uint8Array(i.buffers[m.buffer],(m.byteOffset||0)+v,m.byteLength-v),E=new Float32Array(i.buffers[_.buffer],(_.byteOffset||0)+b,3*c.count),I=new Float32Array(i.buffers[g.buffer],(g.byteOffset||0)+w,3*d.count),A=new Uint32Array(i.buffers[y.buffer],(y.byteOffset||0)+T,f.count),M=new fD;if(M.serializeFromGltf(S,E,I,A),void 0!==a&&i.json.meshes&&i.json.meshes[a]){let r=i.json.meshes[a].primitives[0];if(r&&void 0!==r.attributes.POSITION&&r.attributes.POSITION<h.length){let a=h[r.attributes.POSITION];if(void 0!==a.bufferView&&a.bufferView<p.length){let r=p[a.bufferView];if(r.buffer<i.buffers.length){let n=a.byteOffset||0,o=r.byteStride?r.byteStride/4:3;if(x(n,a.count*o*4,r.byteLength)){let s=(r.byteOffset||0)+n;if(3===o)M.setVertices(new Float32Array(i.buffers[r.buffer],s,3*a.c
7ount));else{let n=new Float32Array(i.buffers[r.buffer],s,a.count*o),l=new Float32Array(3*a.count);for(let i=0;i<a.count;i++)l[3*i]=n[i*o],l[3*i+1]=n[i*o+1],l[3*i+2]=n[i*o+2];M.setVertices(l)}}}}}}return M}(r,i.extensions.mbx_bvh,P)),!F.meshBVH&&F.children){for(let i of F.children)if(i.meshBVH){F.meshBVH=i.meshBVH;break}}return F}function fz(i,r){for(let a=0;a<i.length;a++)if(i[a].name===r)return a;return-1}function fO(i){let r=function(i,r){let a=[],n=WebGL2RenderingContext;if(i.json.textures)for(let o of i.json.textures){let s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==o.sampler&&Object.assign(s,i.json.samplers[o.sampler]),a.push({image:r[o.source],sampler:s,uploaded:!1})}return a}(i,i.images),a=function(i,r){let a=[];for(let n of i.json.meshes){let o=[];for(let a of n.primitives)o.push(function(i,r,a){let n=i.indices,o=i.attributes,s={};s.indexArray=new sc;let l=r.json.accessors[n],h=fR(r,l);s.indexArray.resizeExact(l.count/3),s.indexArray.uint16.set(h),s.vertexArray=new o9;let u=r.json.accessors[o.POSITION],c=fR(r,u);s.vertexArray.resizeExact(u.count),s.vertexArray.float32.set(c),s.aabb=new uq(u.min,u.max);let[d,f,p]=u.min,[m,_,g]=u.max;if(s.centroid=[.5*(d+m),.5*(f+_),.5*(p+g)],void 0!==o.COLOR_0){let i=r.json.accessors[o.COLOR_0],a=dK[i.type],n=fR(r,i);s.colorArray=3===a?new o9:new sa,s.colorArray.resizeExact(i.count),fP(r,i,s.colorArray,n)}if(void 0!==o.NORMAL){s.normalArray=new o9;let i=r.json.accessors[o.NORMAL];s.normalArray.resizeExact(i.count);let a=fR(r,i);fP(r,i,s.normalArray,a)}if(void 0!==o.TEXCOORD_0&&a.length>0){s.texcoordArray=new sx;let i=r.json.accessors[o.TEXCOORD_0];s.texcoordArray.resizeExact(i.count);let a=fR(r,i);fP(r,i,s.texcoordArray,a)}if(void 0!==o._FEATURE_ID_RGBA4444){let i=r.json.accessors[o._FEATURE_ID_RGBA4444];r.json.extensionsUsed&&r.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=fR(r,i))}void 0!==o._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(fR(r,r.json.accessors[o._FEATURE_RGBA4444]).buffer));let y=i.material;return s.material=function(i,r){let{emissiveFactor:a=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:o=.5,normalTexture:s,occlusionTexture:l,emissiveTexture:h,doubleSided:u,name:c}=i,{baseColorFactor:d=[1,1,1,1],metallicFactor:f=1,roughnessFactor:p=1,baseColorTexture:m,metallicRoughnessTexture:_}=i.pbrMetallicRoughness||{},g=l?r[l.index]:void 0;if(l&&l.extensions&&l.extensions.KHR_texture_transform&&g){let i=l.extensions.KHR_texture_transform;g.offsetScale=[i.offset[0],i.offset[1],i.scale[0],i.scale[1]]}return{name:c,pbrMetallicRoughness:{baseColorFactor:new iS(...d),metallicFactor:f,roughnessFactor:p,baseColorTexture:m?r[m.index]:void 0,metallicRoughnessTexture:_?r[_.index]:void 0},doubleSided:u,emissiveFactor:new iS(...a),alphaMode:n,alphaCutoff:o,normalTexture:s?r[s.index]:void 0,occlusionTexture:g,emissionTexture:h?r[h.index]:void 0,defined:void 0===i.defined}}(void 0!==y?r.json.materials[y]:{defined:!1},a),s}(a,i,r));a.push(o)}return a}(i,r),{scenes:n,scene:o,nodes:s}=i.json,l=n?fz(n,"Default Scene"):-1;l<0&&(l=o||0);let h=n?n[l].nodes:[...s.keys()],u=[];for(let r of h)u.push(fL(s[r],i,a));!function(i,r,a){let n={},o=new Set;for(let s=0;s<i.length;s++){let i=a[r[s]];if(!i.extras)continue;let l=i.extras["mapbox:footprint:version"],h=i.extras["mapbox:footprint:id"];(l||h)&&o.add(s),"1.0.0"===l&&h&&(n[h]=s)}for(let s=0;s<i.length;s++){if(o.has(s))continue;let l=i[s],h=a[r[s]];if(!h.extras)continue;let u=null;l.id in n&&(u=function(i,r){let a=[],n=[],o=0,s=[];for(let l of i){o=a.length;let i=l.vertexArray.float32,h=l.indexArray.uint16;for(let n=0;n<l.vertexArray.length;n++)s[0]=i[3*n+0],s[1]=i[3*n+1],s[2]=i[3*n+2],eI(s,s,r),a.push(new eJ(s[0],s[1]));for(let i=0;i<3*l.indexArray.length;i++)n.push(h[i]+o)}if(n.length%3!=0)return null;for(let i=0;i<n.length;i+=3){let r=a[n[i+0]],o=a[n[i+1]],s=a[n[i+2]];(r.x-o.x)*(s.y-o.y)-(s.x-o.x)*(r.y-o.y)>0&&([n[i+1],n[i+2]]=[n[i+2],n[i+1]])}return{vertices:a,indices:n}}(i[n[l.id]].meshes,l.localMatrix)),u||(u=function(i){if(!i.extras||!i.extras.ground)return null;let r=i.extras.ground;if(!r||!Array.isArray(r)||0===r.length)return null;let a=r[0];if(!a||!Array.isArray(a)||0===a.length)return null;let n=[];for(let i of a){if(!Array.isArray(i)||2!==i.length)continue;let r=i[0],a=i[1];"number"==typeof r&&"number"==typeof a&&n.push(new eJ(r,a))}if(n.length<3)return null;n.length>1&&n.at(-1).equals(n[0])&&n.pop();let o=0;for(let i=0;i<n.length;i++){let r=n[i],a=n[(i+1)%n.length],s=n[(i+2)%n.length];o+=(r.x-a.x)*(s.y-a.y)-(s.x-a.x)*(r.y-a.y)}o>0&&n.reverse();let s=ol(n.flatMap(i=>[i.x,i.y]),[]);return 0===s.length?null:{vertices:n,indices:s}}(h)),u&&(l.footprint=function(i){if(0===i.vertices.length||0===i.indices.length)return null;let r=new d9(i.vertices,i.indices,8,256),[a,n]=[r.min.clone(),r.max.clone()];return{vertices:i.vertices,indices:i.indices,grid:r,min:a,max:n}}(u))}if(o.size>0){let r=Array.from(o.values()).sort((i,r)=>i-r);for(let a=r.length-1;a>=0;a--)i.splice(r[a],1)}}(u,h,i.json.nodes);let c=n?fz(n,"LOD"):-1;if(c>=0){let r=n[c].nodes,o=new Map;for(let n of r){let r=fL(s[n],i,a);r.id&&o.set(r.id,r)}for(let i of u)if(i.id){let r=o.get(i.id);
7r&&r.meshes&&(i.lodMeshes=r.meshes,r.meshBVH&&(i.meshBVH=r.meshBVH))}}return u}function fF(i,r,a,n,o){a.reserve(a.length+4*i.length),n.reserve(n.length+10*i.length),o.reserve(o.length+10*i.length);let s=n.length;for(let l of i){let i=Math.min(10,Math.max(4,1.3*l.height))*r,h=[-l.normal[1],l.normal[0],0],u=Math.min(.29,.1*l.width/l.depth),c=l.width-2*l.depth*r*(u+.01),d=eg([],l.pos,h,c/2),f=eg([],l.pos,h,-c/2),p=[d[0],d[1],d[2]+l.height],m=[f[0],f[1],f[2]+l.height],_=eg([],l.normal,h,u);e_(_,_,i);let g=eg([],l.normal,h,-u);e_(g,g,i),ec(_,d,_),ec(g,f,g),d[2]+=.1,f[2]+=.1,n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]);let y=c/i/2;o.emplaceBack(-y-u,-1,y,.8),o.emplaceBack(y+u,-1,y,.8),o.emplaceBack(-y,0,y,1.3),o.emplaceBack(y,0,y,1.3),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(0,0,y,1.3),o.emplaceBack(0,0,y,1.3),o.emplaceBack(y+u,-1.2,y,.8),o.emplaceBack(y+u,-1.2,y,.8),a.emplaceBack(6+s,4+s,8+s),a.emplaceBack(7+s,9+s,5+s),a.emplaceBack(0+s,1+s,2+s),a.emplaceBack(1+s,3+s,2+s),s+=10}}a2(fD,"ModelBVH");let fB=oK([{name:"a_pos_3f",components:3,type:"Float32"}]),fk=oK([{name:"a_normal_3",components:3,type:"Int16"}]),fN=oK([{name:"a_centroid_3",components:3,type:"Int16"}]),fU=oK([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),fV=oK([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),fj=oK([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),fG=oK([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),fH=oK([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),fq=oK([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),f$=oK([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),fZ=oK([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),fW=oK([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),fX=oK([{name:"a_centroid_pos",components:2,type:"Uint16"}]),fY=oK([{name:"a_join_normal_inside",components:3,type:"Int16"}]),fK=oK([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),fJ=oK([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:fQ}=f$;function f0(i,r,a,n){let o=[],s=0===n?(i,r,a,n,o,s)=>{i.push(new eJ(s,a+(s-r)/(n-r)*(o-a)))}:(i,r,a,n,o,s)=>{i.push(new eJ(r+(s-a)/(o-a)*(n-r),s))};for(let l of i){let i=[];for(let o of l){if(o.length<=2)continue;let l=[];for(let i=0;i<o.length-1;i++){let h=o[i].x,u=o[i].y,c=o[i+1].x,d=o[i+1].y,f=0===n?h:u,p=0===n?c:d;f<r?p>r&&s(l,h,u,c,d,r):f>a?p<a&&s(l,h,u,c,d,a):l.push(o[i]),p<r&&f>=r&&s(l,h,u,c,d,r),p>a&&f<=a&&s(l,h,u,c,d,a)}let h=o.at(-1),u=0===n?h.x:h.y;u>=r&&u<=a&&l.push(h),l.length&&(h=l.at(-1),l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),i.push(l))}i.length&&o.push(i)}return o}let f1={None:0,Model:1,Symbol:2,FillExtrusion:4},f2=[new eJ(0,0),new eJ(8192,0),new eJ(8192,8192),new eJ(0,8192)];function f3(i,r){let a=[],n=[];if(!r||i.length<2)return[i];if(2===i.length)return lR(i[0],i[1],f2)?[i]:[];for(let r=0;r<i.length+2;r++){let o=0===r?i.at(-1):i[(r-1)%i.length],s=i[r%i.length],l=i[(r+1)%i.length],h=lR(o,s,f2),u=lR(s,l,f2),c=h||u;c&&n.push(s),c&&u||n.length>0&&(n.length>1&&a.push(n),n=[])}return n.length>1&&a.push(n),a}let f4=lx.types,f5=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],f6=["fill-extrusion-flood-light-ground-radius"],f8=new eJ(0,1);function f9(i,r,a,n,o,s,l,h){i.emplaceBack((r<<1)+l,(a<<1)+s,(Math.floor(8192*n)<<1)+o,Math.round(h))}function f7(i,r,a){i.emplaceBack(8192*r.x,8192*r.y,+!!a)}function pe(i,r,a,n,o,s){i.emplaceBack(r.x,r.y,(a.x<<1)+n,(a.y<<1)+o,s)}function pt(i,r,a){i.emplaceBack(r.x,r.y,r.z,16384*a[0],16384*a[1],16384*a[2])}class pi{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class pr{constructor(){this.data=[]}get length(){return this.data.length}push(i){this.data.push(i)}get(i){return this.data[i]}static serialize(i,r){let a=i.data.length,n=new Uint32Array(4*a),o=[];o.length=a;for(let r=0;r<a;r++){let a=i.data[r],s=4*r;n[s]=a.vertexOffset,n[s+1]=a.vertexCount,n[s+2]=a.indexOffset,n[s+3]=a.indexCount,o[r]=a.ringIndices}return r&&r.add(n.buffer),{scalars:n,rings:o}}static deserialize(i){let{scalars:r,rings:a}=i,n=r.length/4,o=new pr,s=[];s.length=n,o.data=s;for(let i=0;i<n;i++){let n=4*i,s=new pi;s.vertexOffset=r[n],s.vertexCount=r[n+1],s.indexOffset=r[n+2],s.indexCount=r[n+3],s.ringIndices=a[i],o.data[i]=s}return o}}class pa{constructor(){this.centroidXY=new eJ(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new eJ(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new eJ(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new eJ(0,0)}span(){return new eJ(this.max.x-this.min.x,this.max.y-this.min.y)}}class pn{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(i){this.data.push(i)}get(i){return this.data[i]}find(i){return this.data.find(i)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(i,r){let a=i.data.length,n=new Float64Array(15*a);for(let r=0;r<a;
7r++){let a=i.data[r],o=15*r;n[o]=a.centroidXY.x,n[o+1]=a.centroidXY.y,n[o+2]=a.min.x,n[o+3]=a.min.y,n[o+4]=a.max.x,n[o+5]=a.max.y,n[o+6]=a.groupCentroidPos.x,n[o+7]=a.groupCentroidPos.y,n[o+8]=a.vertexArrayOffset,n[o+9]=a.vertexCount,n[o+10]=a.groundVertexArrayOffset,n[o+11]=a.groundVertexCount,n[o+12]=a.footprintSegLen,n[o+13]=a.height,n[o+14]=a.buildingId}return r&&r.add(n.buffer),{buffer:n}}static deserialize(i){let r=i.buffer,a=r.length/15,n=new pn;n.buffer=r;let o=[];o.length=a,n.data=o;let s=0;for(let i=0;i<a;i++){let a=15*i,o=new pa;o.centroidXY=new eJ(r[a],r[a+1]),o.min=new eJ(r[a+2],r[a+3]),o.max=new eJ(r[a+4],r[a+5]),o.groupCentroidPos=new eJ(r[a+6],r[a+7]),o.vertexArrayOffset=r[a+8],o.vertexCount=r[a+9],o.groundVertexArrayOffset=r[a+10],o.groundVertexCount=r[a+11],o.footprintSegLen=r[a+12],o.height=r[a+13],o.buildingId=r[a+14],o.footprintSegIdx=s,s+=o.footprintSegLen,n.data[i]=o}return n}}class po{constructor(){this.acc=new eJ(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(i,r){i.min.x===Number.MAX_VALUE&&(i.min.x=i.max.x=r.x,i.min.y=i.max.y=r.y)}appendEdge(i,r,a){this.accCount++,this.acc._add(r);let n=!!this.borders;r.x<i.min.x?(i.min.x=r.x,n=!0):r.x>i.max.x&&(i.max.x=r.x,n=!0),r.y<i.min.y?(i.min.y=r.y,n=!0):r.y>i.max.y&&(i.max.y=r.y,n=!0),((0===r.x||8192===r.x)&&r.x===a.x)!=((0===r.y||8192===r.y)&&r.y===a.y)&&this.processBorderOverlap(r,a),n&&this.checkBorderIntersection(r,a)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,iw(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,iw(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,iw(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,iw(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let a=this.borders[i];r<a[0]&&(a[0]=r),r>a[1]&&(a[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;let a=+(0!==i.x);this.addBorderIntersection(a,r.y),this.addBorderIntersection(a,i.y)}else{let a=0===i.y?2:3;this.addBorderIntersection(a,r.x),this.addBorderIntersection(a,i.x)}}centroid(){return 0===this.accCount?new eJ(0,0):new eJ(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0):0}}function ps(i,r){let a=i.add(r)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(ts(i.x*a.x+i.y*a.y,-1,1)))))/4*32767*(i.x*r.y-i.y*r.x<0?-1:1)}let pl=[i=>i.x<0,i=>i.x>8192,i=>i.y<0,i=>i.y>8192];class ph{constructor(i){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new o6,this.indexArray=new sc,this.programConfigurations=new ln(i.layers,{zoom:i.zoom,lut:i.lut},i=>f6.includes(i)),this._segments=new sG,this.hiddenByLandmarkVertexArray=new sE,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new sG}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(i,r,a,n=!1){let o=i.length;if(o>2){let s,l=Math.max(0,this._segments.get().length-1),h=this._segments._prepareSegment(4*o,this.vertexArray.length,2*this._segmentToGroundQuads[l].length);l!==this._segments.get().length-1&&(l++,this._segmentToGroundQuads[l]=[],this._segmentToRegionTriCounts[l]=[0,0,0,0,0]);{let r=i[0],a=i[1];s=ps(r.sub(i[o-1])._perp()._unit(),a.sub(r)._perp()._unit())}for(let u=0;u<o;u++){let c=u===o-1?0:u+1,d=i[u],f=i[c],p=i[c===o-1?0:c+1],m=f.sub(d)._perp()._unit(),_=ps(m,p.sub(f)._perp()._unit()),g=s;if(pf(d,f,r)||n&&pp(d,r)&&pp(f,r)){s=_;continue}let y=h.vertexLength;for(let i of(pe(this.vertexArray,d,f,1,1,g),pe(this.vertexArray,d,f,1,0,g),pe(this.vertexArray,d,f,0,1,_),pe(this.vertexArray,d,f,0,0,_),h.vertexLength+=4,function(i,r,a,n){let o=[4];if(0===n)return o;a._mult(n);let s=i.sub(a),l=r.sub(a),h=[i,r,s,l];for(let i=0;i<4;i++)for(let r of h)if(pl[i](r)){o.push(i);break}return o}(d,f,m,a)))this._segmentToGroundQuads[l].push({id:y,region:i}),this._segmentToRegionTriCounts[l][i]+=2,h.primitiveLength+=2;s=_}}}prepareBorderSegments(){if(!this.hasData())return;let i=this._segments.get(),r=i.length;for(let i=0;i<r;i++)this._segmentToGroundQuads[i].sort((i,r)=>i.region-r.region);for(let a=0;a<r;a++){let r=this._segmentToGroundQuads[a],n=i[a],o=this._segmentToRegionTriCounts[a];o.reduce((i,r)=>i+r,0);let s=0;for(let i=0;i<=4;i++){let r=o[i];if(0!==r){let a=this.regionSegments[i];a||(a=this.regionSegments[i]=new sG);let o={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:r};a.get().push(o)}s+=r}for(let i=0;i<r.length;i++){let a=r[i].id;this.indexArray.emplaceBack(a,a+1,a+3),this.indexArray.emplaceBack(a,a+3,a+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(i,r,a,n,o,s,l){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,i,r,a,n,o,s,void 0,l)}upload(i){this.hasData()&&(this.vertexBuffer=i.createVertexBuffer(this.vertexArray,fZ.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=i.createVertexBuffer(this.groundRadiusArray,fW.members)))}uploadPaintProperties(i){this.hasData()&&this.programConfigurations.upload(i)}update(i,r,a,n,o,s,l,h){this.hasData()&&this.programConfigurations.updatePaintArrays(i,r,a,n,o,s,l,h)}updateHiddenByLandmark(i){this.updateHiddenByLandmarkRange(i.groundVertexArrayOffset,i.groundVertexCount,!!(0x80000000&i.flags||0x40000000&i.flags))}updateHiddenByLandmarkRange(i,r,a){if(!this.hasData())return;let n=r+i;if(0!==r){for(let r=i;r<n;++r)this.hiddenByLandmarkVertexArray.emplace(r,+!!a);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(i){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=i.createVertexBuffer(this.hiddenByLandmarkVertexArray,fK.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let i=0;i<=4;i++){let r=this.regionSegments[i];r&&r.destroy()}}}}class pu{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaling=i.overscaling,this.layers=i.layers,this.pixelRatio=i.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=i.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new pn,this.footprintIndices=new sc,this.footprintVertices=new oQ,this.footprintSegments=new pr,this.layoutVertexArray=new o5,this.centroidVertexArray=new sF,this.wallVertexArray=new sk,this.indexArray=new sc,this.programConfigurations=new ln(i.layers,{zoom:i.zoom,lut:i.lut},i=>f5.includes(i)),this.segments=new sG,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new ph(i),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=oI("fill-extrusion",this.layers,this.pixelRatio,r),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=oV(a),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),i)){let i=this.layers[0]._featureFilter.needGeometry,u=o$(o,i);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),u,a))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:oq(o,a,n),properties:o.properties,type:o.type,patterns:{}},d=this.layoutVertexArray.length,f="Polygon"===f4[c.type];if(this.hasPattern)this.features.push({featureId:o.id,feature:oA("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,r)});else if(this.wallMode)for(let i of c.geometry)for(let s of f3(i,f))this.addFeature(o.id,c,[s],l,a,{},r.availableImages,n,r.brightness);else this.addFeature(o.id,c,c.geometry,l,a,{},r.availableImages,n,r.brightness);r.featureIndex.insert(o,c.geometry,l,h,this.index,d)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(i,r,a,n,o,s){for(let{featureId:i,feature:l}of this.features){let h="Polygon"===f4[l.type],{geometry:u}=l;if(this.wallMode)for(let c of u)for(let u of f3(c,h))this.addFeature(i,l,[u],l.index,r,a,n,o,s);else this.addFeature(i,l,u,l.index,r,a,n,o,s)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.groundEffect.update(i,r,o,a,n,s,l,this.worldview)}updateExpressions(i){this.programConfigurations.updateExpressions(i),this.groundEffect.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,fQ),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.wallVertexBuffer=i.createVertexBuffer(this.wallVertexArray,fY.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,fJ.members,!0)),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}uploadCentroid(i){this.groundEffect.uploadHiddenByLandmark(i),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,fX.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,a,n,o,s,l,h,u){let c,d,f=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(r,{})/this.tileToMeter,p=[new eJ(0,0),new eJ(8192,8192)],m=h.projection,_="globe"===m.name,g=this.wallMode||"Polygon"===f4[r.type],y=new po;y.centroidDataIndex=this.centroidData.length;let x=new pa;x.buildingId=i,r.properties&&Object.hasOwn(r.properties,"building_id")&&(x.buildingId=Number(r.properties.building_id)),y.buildingId=x.buildingId;let v=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(r,{},o),b=this.layers[0].paint.get("fill-extrusion-height").evaluate(r,{},o);if(x.height=b,x.vertexArrayOffset=this.layoutVertexArray.length,x.groundVertexArrayOffset=this.groundEffect.vertexArray.length,_&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new st),this.wallMode){if(_)return void tb("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==a.length)return;a=[(c=function(i){let r=i[0].x===i.at(-1).x&&i[0].y===i.at(-1).y;(function(i){let r=0,a=i.length;for(let n=0;n<a;
7n++)r+=(i[(n+1)%a].x-i[n].x)*(i[(n+1)%a].y+i[n].y);return r>=0})(i)||(i=i.reverse());let a={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[],l=i.length;for(;l>=2&&i[l-1].equals(i[l-2]);)l--;if(l<(r?3:2))return a;let h,u,c,d,f,p=0;for(;p<l-1&&i[p].equals(i[p+1]);)p++;r&&(h=i[l-2],f=i[p].sub(h)._unit()._perp());for(let a=p;a<l;a++){if((c=a===l-1?r?i[p+1]:void 0:i[a+1])&&i[a].equals(c))continue;f&&(d=f),h&&(u=h),h=i[a],f=c?c.sub(h)._unit()._perp():d;let m=(d=d||f).add(f);0===m.x&&0===m.y||m._unit();let _=m.x*f.x+m.y*f.y,g=0!==_?1/_:1/0,y=d.x*f.y-d.y*f.x>0,x="miter";"miter"===x&&g>2&&(x="bevel"),"bevel"===x&&(g>100&&(x="flipbevel"),g<2&&(x="miter"));let v=(i,r,a,l)=>{let h=new eJ(i.x,i.y),u=new eJ(i.x,i.y);h.x+=r.x*l,h.y+=r.y*l,u.x-=r.x*Math.max(a,1),u.y-=r.y*Math.max(a,1),s.push(r),n.push(h),o.push(u)};if("miter"===x)m._mult(g),v(h,m,0,0);else if("flipbevel"===x)v(h,m=f.mult(-1),0,0),v(h,m.mult(-1),0,0);else{let i=-Math.sqrt(g*g-1),r=y?i:0,a=y?0:i;u&&v(h,d,r,a),c&&v(h,f,r,a)}}a.geometry=[...n,...o.reverse(),n[0]],a.joinNormals=[...s,...s.reverse(),s.at(-1)];let m=a.geometry.length-1;for(let i=0;i<m/2;i++)if(i+1<m/2){let r=i,n=i+1,o=m-1-i,s=m-2-i;r=0===r?m-1:r-1,n=0===n?m-1:n-1,o=0===o?m-1:o-1,s=0===s?m-1:s-1,a.indices.push(o),a.indices.push(n),a.indices.push(r),a.indices.push(o),a.indices.push(s),a.indices.push(n)}return a}(a[0])).geometry]}let w=(i,r)=>i<(r.length-1)/2||i===r.length-1,T=this.wallMode?[a]:e2(a,500);for(let i=T.length-1;i>=0;i--){var S;let r=T[i];(0===r.length||(S=r[0]).every(i=>i.x<=0)||S.every(i=>i.x>=8192)||S.every(i=>i.y<=0)||S.every(i=>i.y>=8192))&&T.splice(i,1)}if(_)d=py(T,p,o);else for(let i of(d=[],T))d.push({polygon:i,bounds:p});let E=g?this.edgeRadius:0,I=E>0&&this.zoom<17,A=(i,r)=>{if(0===i.length)return!1;let a=i.at(-1);return r.x===a.x&&r.y===a.y};for(let{polygon:i,bounds:r}of d){let a=0,n=0;for(let r of i)g&&!r[0].equals(r.at(-1))&&r.push(r[0]),n+=g?r.length-1:r.length;let s=this.segments.prepareSegment((g?5:4)*n,this.layoutVertexArray,this.indexArray);x.footprintSegIdx<0&&(x.footprintSegIdx=this.footprintSegments.length),x.polygonSegIdx<0&&(x.polygonSegIdx=this.polygonSegments.length);let l={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},h=new pi;if(h.vertexOffset=this.footprintVertices.length,h.indexOffset=3*this.footprintIndices.length,h.ringIndices=[],g){let n=[],l=[];a=s.vertexLength;for(let a=0;a<i.length;a++){let u,d,p=i[a];p.length&&0!==a&&l.push(n.length/2);let g=[];u=p[1].sub(p[0])._perp()._unit(),h.ringIndices.push(p.length-1);for(let i=1;i<p.length;i++){let r=p[i],a=p[i===p.length-1?1:i+1],l=r.clone();if(E){d=a.sub(r)._perp()._unit();let i=u.add(d)._unit(),n=E*Math.min(4,1/(u.x*i.x+u.y*i.y));l.x+=n*i.x,l.y+=n*i.y,l.x=Math.round(l.x),l.y=Math.round(l.y),u=d}if(!v||0!==E&&!I||A(g,l)||g.push(l),f9(this.layoutVertexArray,l.x,l.y,0,0,1,1,0),this.wallMode){let r=w(i,p);f7(this.wallVertexArray,c.joinNormals[i],!r)}s.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),n.push(r.x,r.y),_&&pt(this.layoutVertexExtArray,m.projectTilePoint(l.x,l.y,o),m.upVector(o,l.x,l.y))}v&&(0===E||I)&&(0!==g.length&&A(g,g[0])&&g.pop(),this.groundEffect.addData(g,r,f))}let u=this.wallMode?c.indices:ol(n,l);for(let i=0;i<u.length;i+=3)this.footprintIndices.emplaceBack(h.vertexOffset+u[i+0],h.vertexOffset+u[i+1],h.vertexOffset+u[i+2]),this.indexArray.emplaceBack(a+u[i],a+u[i+2],a+u[i+1]),s.primitiveLength++;h.indexCount+=u.length,h.vertexCount+=this.footprintVertices.length-h.vertexOffset}for(let n=0;n<i.length;n++){let l,h,u,d=i[n];y.startRing(x,d[0]);let p=d.length>4&&pm(d[d.length-2],d[0],d[1]),b=E?function(i,r,a,n){let o=r.sub(i)._perp()._unit(),s=a.sub(r)._perp()._unit();return pd(i,r,a,pc(o,s),n)}(d[d.length-2],d[0],d[1],E):0,T=[];h=d[1].sub(d[0])._perp()._unit();let S=!0;for(let i=1,n=0;i<d.length;i++){let f=d[i-1],g=d[i],I=d[i===d.length-1?1:i+1];if(y.appendEdge(x,g,f),pf(g,f,r)){E&&(h=I.sub(g)._perp()._unit(),S=!S);continue}let M=g.sub(f)._perp(),C=M.x/(Math.abs(M.x)+Math.abs(M.y)),D=+(M.y>0),R=f.dist(g);if(n+R>32768&&(n=0),E){u=I.sub(g)._perp()._unit();let i=pd(f,g,I,pc(h,u),E);isNaN(i)&&(i=0);let r=g.sub(f)._unit();f=f.add(r.mult(b))._round(),g=g.add(r.mult(-i))._round(),b=i,h=u,v&&this.zoom>=17&&(A(T,f)||T.push(f),A(T,g)||T.push(g))}let P=s.vertexLength,L=d.length>4&&pm(f,g,I),z=p_(n,p,S);if(f9(this.layoutVertexArray,f.x,f.y,C,D,0,0,z),f9(this.layoutVertexArray,f.x,f.y,C,D,0,1,z),this.wallMode){let r=w(i-1,d),a=c.joinNormals[i-1];f7(this.wallVertexArray,a,r),f7(this.wallVertexArray,a,r)}if(n+=R,z=p_(n,L,!S),p=L,f9(this.layoutVertexArray,g.x,g.y,C,D,0,0,z),f9(this.layoutVertexArray,g.x,g.y,C,D,0,1,z),this.wallMode){let r=w(i,d),a=c.joinNormals[i];f7(this.wallVertexArray,a,r),f7(this.wallVertexArray,a,r)}
7if(s.vertexLength+=4,this.indexArray.emplaceBack(P+0,P+1,P+2),this.indexArray.emplaceBack(P+1,P+3,P+2),s.primitiveLength+=2,E){let n=a+(1===i?d.length-2:i-2),o=1===i?a:n+1;if(this.indexArray.emplaceBack(P+1,n,P+3),this.indexArray.emplaceBack(n,o,P+3),s.primitiveLength+=2,void 0===l&&(l=P),!pf(I,d[i],r)){let r=i===d.length-1?l:s.vertexLength;this.indexArray.emplaceBack(P+2,P+3,r),this.indexArray.emplaceBack(P+3,r+1,r),this.indexArray.emplaceBack(P+3,o,r+1),s.primitiveLength+=3}S=!S}if(_){let i=this.layoutVertexExtArray,r=m.projectTilePoint(f.x,f.y,o),a=m.projectTilePoint(g.x,g.y,o),n=m.upVector(o,f.x,f.y),s=m.upVector(o,g.x,g.y);pt(i,r,n),pt(i,r,n),pt(i,a,s),pt(i,a,s)}}g&&(a+=d.length-1),v&&E&&this.zoom>=17&&(0!==T.length&&A(T,T[0])&&T.pop(),this.groundEffect.addData(T,r,f,E>0))}this.footprintSegments.push(h),l.triangleCount=this.indexArray.length-l.triangleArrayOffset,this.polygonSegments.push(l),++x.footprintSegLen,++x.polygonSegLen}if(x.vertexCount=this.layoutVertexArray.length-x.vertexArrayOffset,x.groundVertexCount=this.groundEffect.vertexArray.length-x.groundVertexArrayOffset,0!==x.vertexCount){if(x.centroidXY=y.borders?f8:this.encodeCentroid(y,x),r.properties&&Object.hasOwn(r.properties,"building_id")){let i=x.buildingId,r=this.buildingGroups.get(i);r||(r={accX:0,accY:0,accCount:0,mergedMin:new eJ(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new eJ(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(i,r)),r.accX+=y.acc.x,r.accY+=y.acc.y,r.accCount+=y.accCount,r.mergedMin.x=Math.min(r.mergedMin.x,x.min.x),r.mergedMin.y=Math.min(r.mergedMin.y,x.min.y),r.mergedMax.x=Math.max(r.mergedMax.x,x.max.x),r.mergedMax.y=Math.max(r.mergedMax.y,x.max.y),r.partIndices.push(this.centroidData.length)}if(this.centroidData.push(x),y.borders){this.featuresOnBorder.push(y);let i=this.featuresOnBorder.length-1;for(let r=0;r<y.borders.length;r++)y.borders[r][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[r].push(i)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,n,s,l,o,u,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(r,n,s,l,o,u,this.worldview),this.maxHeight=Math.max(this.maxHeight,b)}}_finalizeBuildingGroups(){for(let[,i]of this.buildingGroups){if(0===i.partIndices.length)continue;let r=new po;r.acc=new eJ(i.accX,i.accY),r.accCount=i.accCount;let a=new pa;a.min=i.mergedMin,a.max=i.mergedMax;let n=this.encodeCentroid(r,a),o=r.centroid();for(let r of i.partIndices){let a=this.centroidData.get(r);a.centroidXY.x===f8.x&&a.centroidXY.y===f8.y||(a.centroidXY=n),a.min=i.mergedMin,a.max=i.mergedMax,a.groupCentroidPos=o}}this.buildingGroups.clear()}sortBorders(){for(let i=0;i<this.borderFeatureIndices.length;i++)this.borderFeatureIndices[i].sort((r,a)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[a].borders[i][0])}splitToSubtiles(){let i=[];for(let r=0;r<this.centroidData.length;r++){let a=this.centroidData.get(r),n=+(a.min.y+a.max.y>8192),o=2*n+(a.min.x+a.max.x>8192^n);for(let n=0;n<a.polygonSegLen;n++){let s=a.polygonSegIdx+n;i.push({centroidIdx:r,subtile:o,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx})}}let r=new sc;i.sort((i,r)=>i.triangleSegmentIdx===r.triangleSegmentIdx?i.subtile-r.subtile:i.triangleSegmentIdx-r.triangleSegmentIdx);let a=0,n=0,o=0;for(let r of i){if(r.triangleSegmentIdx!==a)break;o++}let s=i.length;for(;n!==i.length;){a=i[n].triangleSegmentIdx;let l=0,h=n,u=n;for(let r=h;r<o&&i[r].subtile===l;r++)u++;for(;h!==o;){let n=i[h];l=n.subtile;let s=this.centroidData.get(n.centroidIdx).min.clone(),c=this.centroidData.get(n.centroidIdx).max.clone(),d={vertexOffset:this.segments.segments[a].vertexOffset,primitiveOffset:r.length,vertexLength:this.segments.segments[a].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let a=h;a<u;a++){let n=i[a],o=this.polygonSegments[n.polygonSegmentIdx],l=this.centroidData.get(n.centroidIdx).min,h=this.centroidData.get(n.centroidIdx).max,u=this.indexArray.uint16;for(let i=o.triangleArrayOffset;i<o.triangleArrayOffset+o.triangleCount;i++)r.emplaceBack(u[3*i],u[3*i+1],u[3*i+2]);d.primitiveLength+=o.triangleCount,s.x=Math.min(s.x,l.x),s.y=Math.min(s.y,l.y),c.x=Math.max(c.x,h.x),c.y=Math.max(c.y,h.y)}d.primitiveLength>0&&this.triangleSubSegments.push({segment:d,min:s,max:c}),h=u;for(let r=h;r<o&&i[r].subtile===i[h].subtile;r++)u++}n=o;for(let r=n;r<s&&i[r].triangleSegmentIdx===i[n].triangleSegmentIdx;r++)o++}r._trim(),this.indexArray=r}getVisibleSegments(i,r,a){let n,o=new sG;if(this.wallMode){for(let i of this.triangleSubSegments)o.segments.push(i.segment);return o}let s=0,l=0,h=1<<i.canonical.z;if(r){let a=r.getMinMaxForTile(i);a&&(s=a.min,l=a.max)}l+=this.maxHeight;let u=i.toUnwrapped(),c=[u.canonical.x/h+u.wrap,u.canonical.y/h],d=[(u.canonical.x+1)/h+u.wrap,(u.canonical.y+1)/h],f=(i,r,a)=>[iw(i[0],r[0],a[0]),iw(i[1],r[1],a[1])],p=[],m=[];for(let i of this.triangleSubSegments){p[0]=i.min.x/8192,p[1]=i.min.y/8192,m[0]=i.max.x/8192,m[1]=i.max.y/8192;let r=f(c,d,p),h=f(c,d,m);
7if(0===new uq([r[0],r[1],s],[h[0],h[1],l]).intersectsPrecise(a)){n&&(o.segments.push(n),n=void 0);continue}let u=i.segment;n&&n.vertexOffset!==u.vertexOffset&&(o.segments.push(n),n=void 0),n?(n.vertexLength+=u.vertexLength,n.primitiveLength+=u.primitiveLength):n={vertexOffset:u.vertexOffset,primitiveLength:u.primitiveLength,vertexLength:u.vertexLength,primitiveOffset:u.primitiveOffset,sortKey:void 0,vaos:{}}}return n&&o.segments.push(n),o}encodeCentroid(i,r){let a=i.centroid(),n=r.span(),o=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(6,Math.round(n.y*this.tileToMeter/10));return new eJ(ts(a.x,1,8191)<<3|o,ts(a.y,1,8191)<<3|s)}encodeBorderCentroid(i){if(!i.borders)return new eJ(0,0);let r=i.borders,a=Number.MAX_VALUE;if(r[0][0]!==a||r[1][0]!==a){let i=+(r[0][0]===a);return new eJ(6|65528*(r[0][0]===a),(r[i][0]+r[i][1])/2<<3|6)}{let i=r[2][0]!==a?2:3;return new eJ((r[i][0]+r[i][1])/2<<3|6,6|65528*(r[2][0]===a))}}showCentroid(i){let r=this.centroidData.get(i.centroidDataIndex);if(r.flags&=0x80000000,0!==r.groupCentroidPos.x||0!==r.groupCentroidPos.y){let i=r.span(),a=Math.min(7,Math.round(i.x*this.tileToMeter/10)),n=Math.min(6,Math.round(i.y*this.tileToMeter/10));r.centroidXY=new eJ(ts(r.groupCentroidPos.x,1,8191)<<3|a,ts(r.groupCentroidPos.y,1,8191)<<3|n)}else r.centroidXY=new eJ(0,0);this.writeCentroidToBuffer(r)}writeCentroidToBuffer(i){this.groundEffect.updateHiddenByLandmark(i);let r=i.vertexArrayOffset,a=i.vertexCount+i.vertexArrayOffset,n=-0x40000000&i.flags?f8:i.centroidXY,o=this.centroidVertexArray.geta_centroid_pos0(r);if(this.centroidVertexArray.geta_centroid_pos1(r)!==n.y||o!==n.x){for(let i=r;i<a;++i)this.centroidVertexArray.emplace(i,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let i of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(i)}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(ck(this.activeReplacements,n))return;if(this.activeReplacements=n,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let i of this.centroidData)i.flags&=0x3fffffff;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));if(r.footprint.buildingIds)for(let i of this.centroidData)0x80000000&i.flags||0x40000000&i.flags||r.min.x>i.max.x||i.min.x>r.max.x||r.min.y>i.max.y||i.min.y>r.max.y||r.footprint.buildingIds.has(i.buildingId)&&(i.flags|=r.clipMask!==f1.None?-0x40000000:0x80000000);else for(let a of this.centroidData)if(!(0x80000000&a.flags||0x40000000&a.flags||r.min.x>a.max.x||a.min.x>r.max.x||r.min.y>a.max.y||a.min.y>r.max.y))for(let s=0;s<a.footprintSegLen;s++){let l=this.footprintSegments.get(a.footprintSegIdx+s);if(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.int16[2*(h+r)+0],u=i.int16[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new eJ(a,u))}}(this.footprintVertices,l.vertexOffset,l.vertexCount,r.footprintTileId.canonical,i.canonical,o),cU(r.footprint,o,this.footprintIndices.uint16,l.indexOffset,l.indexCount,-l.vertexOffset,-n)){a.flags|=r.clipMask!==f1.None?-0x40000000:0x80000000;break}}}for(let i of this.centroidData)this.writeCentroidToBuffer(i);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(i,r,a){let n=!1;for(let o=0;o<a.footprintSegLen;o++){let s=this.footprintSegments.get(a.footprintSegIdx+o),l=0;for(let a of s.ringIndices){for(let o=l,h=a+l-1;o<a+l;h=o++){let a=this.footprintVertices.int16[2*(o+s.vertexOffset)+0],l=this.footprintVertices.int16[2*(o+s.vertexOffset)+1],u=this.footprintVertices.int16[2*(h+s.vertexOffset)+1];l>r!=u>r&&i<(this.footprintVertices.int16[2*(h+s.vertexOffset)+0]-a)*(r-l)/(u-l)+a&&(n=!n)}l=a}}return n}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(Object.hasOwn(this.partLookup,o)){let i=this.partLookup[o];return i?{height:i.height,hidden:!!(0x80000000&i.flags)}:void 0}let s=this.centroidData.buffer,l=this.centroidData.length;for(let h=0;h<l;h++){let l=15*h;if(i>s[l+4]||s[l+2]>i||r>s[l+5]||s[l+3]>r)continue;let u=s[l+13];if(u<=a)continue;let c=this.centroidData.get(h);this.footprintContainsPoint(i,r,c)&&(a=u,this.partLookup[o]=c,n=!!(0x80000000&c.flags))}if(a!==-1/0)return{height:a,hidden:n};this.partLookup[o]=void 0}}function pc(i,r){let a=i.add(r)._unit();return i.x*a.x+i.y*a.y}function pd(i,r,a,n,o){let s=Math.sqrt(1-n*n);return Math.min(i.dist(r)/3,r.dist(a)/3,o*s/n)}function pf(i,r,a){return i.x<a[0].x&&r.x<a[0].x||i.x>a[1].x&&r.x>a[1].x||i.y<a[0].y&&r.y<a[0].y||i.y>a[1].y&&r.y>a[1].y}function pp(i,r){return i.x<r[0].x||i.x>r[1].x||i.y<r[0].y||i.y>r[1].y}function pm(i,r,a){if(i.x<0||i.x>=8192||r.x<0||r.x>=8192||a.x<0||a.x>=8192)return!1;let n=a.sub(r),o=n.perp(),s=i.sub(r);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&o.x*s.x+o.y*s.y<0}function p_(i,r,a){let n=r?2|i:-3&i;return a?1|n:-2&n}function pg(){let i=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*i*i)-6371008.8}function py(i,r,a){let n=1<<a.z,o=rp(a.x/n);return function(i,r,a,n,o=0,s){let l=[];
7if(!i.length||!a||!n)return l;let h=(i,r)=>{for(let a of i)l.push({polygon:a,bounds:r})},u=Math.ceil(Math.log2(a)),c=Math.ceil(Math.log2(n)),d=u-c,f=[];for(let i=0;i<Math.abs(d);i++)f.push(d>0?0:1);for(let i=0;i<Math.min(u,c);i++)f.push(0),f.push(1);let p=i;if(p=f0(p,r[0].y-o,r[1].y+o,1),!(p=f0(p,r[0].x-o,r[1].x+o,0)).length)return l;let m=[];for(f.length?m.push({polygons:p,bounds:r,depth:0}):h(p,r);m.length;){let i=m.pop(),r=i.depth,a=f[r],n=i.bounds[0],l=i.bounds[1],u=0===a?n.x:n.y,c=0===a?l.x:l.y,d=s?s(a,u,c):.5*(u+c),p=f0(i.polygons,u-o,d+o,a),_=f0(i.polygons,d-o,c+o,a);if(p.length){let i=[n,new eJ(0===a?d:l.x,1===a?d:l.y)];f.length>r+1?m.push({polygons:p,bounds:i,depth:r+1}):h(p,i)}if(_.length){let i=[new eJ(0===a?d:n.x,1===a?d:n.y),l];f.length>r+1?m.push({polygons:_,bounds:i,depth:r+1}):h(_,i)}}return l}(i,r,Math.ceil((rp((a.x+1)/n)-o)/11.25),Math.ceil((rm(a.y/n)-rm((a.y+1)/n))/11.25),1,(i,r,o)=>{if(0===i)return.5*(r+o);{let i=rm((a.y+r/8192)/n);return(rf(.5*(rm((a.y+o/8192)/n)+i))*n-a.y)*8192}})}a2(pu,"FillExtrusionBucket",{omit:["layers","features"]}),a2(pa,"PartData"),a2(pn,"PartDataArray"),a2(pr,"FootprintSegmentArray"),a2(po,"BorderCentroidData"),a2(ph,"GroundEffect");class px{constructor(i){this.module=i,this.memoryStack=this.module.malloc(4096),this.memoryStackNextFree=this.memoryStack}createIntArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Int32Array(this.module.heap32.buffer,r,i.length).set(i),r)}createFloatArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Float32Array(this.module.heapF32.buffer,r,i.length).set(i),r)}readStringBuffer(i){let r="";for(;0!==this.module.heapU8[i];)r+=String.fromCharCode(this.module.heapU8[i]),++i;return r}setStyle(i){let r=i.normalScale;this.module.setStyle(r[0],r[1],r[2],i.tileToMeters)}setAOOptions(i,r){this.module.setAOOptions(+!!i,r)}setMetricOptions(i,r){this.module.setMetricOptions(+!!i,r)}setStructuralOptions(i){this.module.setStructuralOptions(+!!i)}setFacadeOptions(i,r){this.module.setFacadeOptions(i,+!!r)}setFauxFacadeOptions(i,r,a){this.module.setFauxFacadeOptions(+!!i,+!!r,a)}setFacadeClassifierOptions(i){this.module.setFacadeClassifierOptions(i)}generateMesh(i,r){for(let r of(this.memoryStackNextFree=this.memoryStack,i)){let i=this.createIntArray(r.ringIndices),a=this.createFloatArray(r.coordinates);if(-1===i||-1===a)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(r.id,r.sourceId,r.minHeight,r.height,r.roofType,a,i,r.ringIndices.length-1)}for(let i of r){let r;r=i.entrances?JSON.parse(i.entrances):[];let a=this.createFloatArray(r),n=this.createFloatArray(i.coordinates);if(-1===a||-1===n)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(i.sourceId,i.crossPerc,i.distanceToRoad,a,r.length,n,i.coordinates.length)}if(!this.module.generateMesh()){let i=this.module.getLastError();return this.readStringBuffer(i)}let a=this.module.getMeshCount(),n=Array(a);for(let i=0;i<a;i++){let r=this.module.getPositionsPtr(i),a=this.module.getPositionsLength(i),o=new Float32Array(this.module.heapF32.buffer,r,a),s=this.module.getNormalsPtr(i),l=this.module.getNormalsLength(i),h=new Float32Array(this.module.heapF32.buffer,s,l),u=this.module.getAOPtr(i),c=this.module.getAOLength(i),d=new Float32Array(this.module.heapF32.buffer,u,c),f=this.module.getUVPtr(i),p=this.module.getUVLength(i),m=new Float32Array(this.module.heapF32.buffer,f,p),_=this.module.getFauxFacadePtr(i),g=this.module.getFauxFacadeLength(i),y=new Uint8Array(this.module.heapU8.buffer,_,g),x=this.module.getIndicesPtr(i),v=this.module.getIndicesLength(i),b=new Int16Array(this.module.heap16.buffer,x,v),w=this.module.getBuildingPart(i);n[i]={positions:o,normals:h,ao:d,uv:m,isFauxFacade:y,indices:b,buildingPart:w}}let o=this.module.getRingCount(),s=[];for(let i=0;i<o;i++){let r=this.module.getRingPtr(i),a=this.module.getRingLength(i),n=new Float32Array(this.module.heapF32.buffer,r,a);s.push(n)}return{meshes:n,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:s}}}let pv=lx.types,pb,pw,pT=null,pS=null,pE=null;class pI{constructor(){this.layoutVertexArray=new o9,this.layoutAttenuationArray=new sa,this.layoutColorArray=new so,this.indexArray=new sc,this.indexArrayForConflation=new sc,this.segmentsBucket=new sG}}class pA{constructor(i){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new sG,this.entranceBloom=new pI,this.layoutVertexArray=new o9,this.layoutVertexArray.reserve(66560),this.layoutNormalArray=new o0,this.layoutNormalArray.reserve(66560),this.layoutCentroidArray=new o0,this.layoutCentroidArray.reserve(66560),this.layoutColorArray=new so,this.layoutColorArray.reserve(66560),this.layoutFloodLightDataArray=new sS,this.layoutFloodLightDataArray.reserve(66560),this.layoutAOArray=new sE,this.layoutAOArray.reserve(66560),this.indexArray=new sc,this.indexArray.reserve(66560),this.indexArrayForConflation=new sc,this.segmentsBucket=new sG,this.entranceBloom=new pI,i&&(this.layoutFacadePaintArray=new so,this.layoutFacadeDataArray=new se,this.layoutFacadeVerticalRangeArray=new so)}reserve(i,r,a){this.layoutVertexArray.reserveForAdditional(i),this.layoutCentroidArray.reserveForAdditional(i),this.layoutFloodLightDataArray.reserveForAdditional(i),this.layoutNormalArray.reserveForAdditional(i),this.layoutAOArray.reserveForAdditional(i),this.layoutColorArray.reserveForAdditional(i),this.indexArray.reserveForAdditional(r),a&&(this.layoutFacadePaintArray.reserveForAdditional(i),this.layoutFacadeDataArray.reserveForAdditional(i),this.layoutFacadeVerticalRangeArray.reserveForAdditional(i))}}class pM{constructor(i){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new sx,this.footprintsIndices=new sb,this.footprintsMin=new eJ(1/0,1/0),this.footprintsMax=new eJ(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new pA(!1),this.buildingWithFacade=new pA(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=i.zoom,this.canonical=i.canonical,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.worldview=i.worldview,this.lut=i.lut,this.programConfigurations=new ln(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.groundEffect=new ph(i),this.groundEffect.groundRadiusArray=new o2,this.hasAppearances=null}updateFootprints(i,r){let a=new d9([],[],1),n={vertices:[],indices:new Uint32Array(0),grid:a,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};r.push({footprint:n,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){if(!pE)return;let o=oV(a);this.tileToMeter=o,this.brightness=r.brightness,pE.setStyle({normalScale:[1,-1,o],tileToMeters:o}),pE.setAOOptions(!1,.3),pE.setMetricOptions(!1,16),pE.setStructuralOptions(!0),pE.setFacadeClassifierOptions(3);let s=new Map,l=new Map,h=0;for(let{feature:r}of i){if("LineString"!==pv[r.type]){s.set(r.id,r.properties.source_id);continue}let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new nk(this.zoom),r,a))continue;let o=o$(r,i);if(!i&&!this.layers[0]._featureFilter.filter(new nk(this.zoom),o,a))continue;let u=i?o.geometry:oq(r,a,n),c=[];for(let i of u)for(let r of i)c.push(r.x),c.push(r.y);let d={coordinates:c,crossPerc:r.properties.cross_perc,distanceToRoad:r.properties.distance_to_road,entrances:r.properties.entrances,sourceId:0},f=r.properties.source_id,p=l.get(f);p||(p=[],l.set(f,p)),p.push(d),++h}this.maxHeight=0;let u=[],c=new Set,d=i=>{null!=i&&c.add(i)},f=(i,r)=>{null!=i&&u.push({buildingId:i,footprintIndex:r})},p=64*(i.length-h),m=p/2;for(let{feature:u,id:_,index:g,sourceLayerIndex:y}of(this.buildingWithFacade.reserve(p,m,!0),this.buildingWithoutFacade.reserve(2*p,2*m,!1),this.footprintsIndices.reserve(16*(i.length-h)),this.footprintsVertices.reserve(8*(i.length-h)),i)){if("LineString"===pv[u.type])continue;let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new nk(this.zoom),u,a))continue;let h=null;if(u.properties&&Object.hasOwn(u.properties,"building_id")&&(h=Number(u.properties.building_id),c.has(h)))continue;let p=o$(u,i);if(!i&&!this.layers[0]._featureFilter.filter(new nk(this.zoom),p,a))continue;let m=i?p.geometry:oq(u,a,n),x=e2(m,500),v=!1;for(let i of x)if(1!==i.length){v=!0;break}if(v||!function(i){for(let r of i)for(let i of r)if(i.x<-163||i.x>8355||i.y<-163||i.y>8355)return!1;return!0}(m)){d(h);continue}let b=this.layers[0],w=function(i){switch(i){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw Error(`Unknown roof shape: ${i}`)}}(b.layout.get("building-roof-shape").evaluate(u,{},a)),T=b.layout.get("building-base").evaluate(u,{},a),S=b.layout.get("building-height").evaluate(u,{},a),E=b.layout.get("building-flood-light-ground-radius").evaluate(u,{},a),I=b.paint.get("building-ambient-occlusion-intensity"),A=E/this.tileToMeter;u.properties["building-part"]="roof";let M=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),C=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="wall";let D=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),R=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="window";let P=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),L=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="door";let z=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),O=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical),F=b.layout.get("building-flood-light-wall-radius").evaluate(u,{},a),B=(F=ts(F,0,2048))/2048*32767,k=s.get(_),N=l.get(k)||[],U=0!==N.length&&b.layout.get("building-facade").evaluate(u,{},a);pE.setFacadeOptions(4,!0),pE.setFauxFacadeOptions(U,!1,1);let V=0,j=0,G=0,H=0,q=0,$=0,Z=0,W=0,X=0,Y=0,K=0;if(U){let i=Math.round(b.layout.get("building-facade-floors").evaluate(u,{},a));if(0===T){i=Math.max(1,i-(N.length>0));let r=4;if(S>100){let i=[10,13,15];r=i[u.id?u.id%i.length:0]}else S<=10&&(r=3);pE.setFacadeOptions(r,!0),q=(S<15?1.3:1.61803)*r/o}else q=T/o;
7q=Math.min(q,$=S/o),G=b.layout.get("building-facade-unit-width").evaluate(u,{},a)/o,H=($-q)/i,pE.setFauxFacadeOptions(!0,!0,G);let r=b.layout.get("building-facade-window").evaluate(u,{},a);V=r[0],j=r[1],Z=Math.floor(65535*Math.min(1,q/8192)),W=Math.floor(65535*Math.min(1,$/8192)),X=Math.floor(255*V)<<8|Math.floor(255*j),Y=Math.floor(65535*Math.min(1,G/8192)),K=Math.floor(65535*Math.min(1,H/8192))}let J=Array(x.length),Q={x:1/0,y:1/0},ee={x:-1/0,y:-1/0},et={x:0,y:0},ei=0;for(let i=0;i<x.length;i++){let r=x[i];if(r.length>0){let a=[],n=Array(r.length+1);n[0]=0;for(let i=0;i<r.length;i++){let o=r[i];for(let i=0;i<o.length;i++){let r=o[o.length-i-1];Q.x=Math.min(Q.x,r.x),Q.y=Math.min(Q.y,r.y),ee.x=Math.max(ee.x,r.x),ee.y=Math.max(ee.y,r.y),et.x+=r.x,et.y+=r.y,ei++,a.push(r.x),a.push(r.y)}n[i+1]=a.length}J[i]={id:u.id?u.id:0,height:S,minHeight:T,sourceId:0,roofType:w,coordinates:a,ringIndices:n}}}et.x/=ei||1,et.y/=ei||1;let er=pE.generateMesh(J,N);if("string"==typeof er){tb(`Unable to generate building ${u.id}: ${er}`),d(h);continue}if(0===er.meshes.length||0===er.modifiedPolygonRings.length){d(h);continue}let ea=U?this.buildingWithFacade:this.buildingWithoutFacade,en=0;for(let i of er.meshes)en+=i.positions.length/3;let eo=ea.segmentsBucket.prepareSegment(en,ea.layoutVertexArray,ea.indexArray),es=[],el=null,eh=0,eu=-1,ec=ea.layoutVertexArray.length,ed=ec+en;ea.layoutVertexArray.resize(ed),ea.layoutCentroidArray.resize(ed),ea.layoutNormalArray.resize(ed),ea.layoutAOArray.resize(ed),ea.layoutColorArray.resize(ed),ea.layoutFloodLightDataArray.resize(ed),U&&(ea.layoutFacadePaintArray.resize(ed),ea.layoutFacadeDataArray.resize(ed),ea.layoutFacadeVerticalRangeArray.resize(ed));let ef=ea.indexArray.length,ep=0,em=ec;for(let i of er.meshes){let r,a;if(1===i.buildingPart)r=M,a=C;else if(0===i.buildingPart)r=D,a=R;else if(2===i.buildingPart)r=P,a=L;else{if(3!==i.buildingPart)continue;r=z,a=O}if(a=ts(a,0,1),3===i.buildingPart){let r=[];for(let a=0;a<i.positions.length;a+=12){let n=i.positions[a+0],o=i.positions[a+1],s=i.positions[a+3],l=i.positions[a+4],h=i.positions[a+2],u=i.positions[a+8]-h,c=s-n,d=l-o,f=Math.hypot(c,d);r.push({pos:[n+.5*c,o+.5*d,h],normal:[d/f,-c/f,0],width:f,height:u,depth:1,points:[n,o,s,l]})}let a=ea.entranceBloom.segmentsBucket.prepareSegment(10*r.length,ea.entranceBloom.layoutVertexArray,ea.entranceBloom.indexArray),n=ea.entranceBloom.layoutVertexArray.length;eh=ea.entranceBloom.indexArray.length,fF(r,.5/this.tileToMeter,ea.entranceBloom.indexArray,ea.entranceBloom.layoutVertexArray,ea.entranceBloom.layoutAttenuationArray);let o=ea.entranceBloom.layoutVertexArray.length-n;eu=ea.entranceBloom.indexArray.length-eh;for(let i=0;i<o;i++)ea.entranceBloom.layoutColorArray.emplaceBack(255*z.r<<8|255*z.g,255*z.b<<8|51*O);a.vertexLength+=o,a.primitiveLength+=eu,el={part:i.buildingPart,vertexOffset:n,vertexLength:o}}ea.layoutVertexArray.float32.set(i.positions,3*em);let n=i.positions.length/3;for(let o=0;o<n;++o){let n=3*o;ep=Math.max(ep,i.positions[n+2]);let s=32767*i.normals[n+1],l=32767*i.normals[n+2],h=3*(em+o);ea.layoutNormalArray.int16[h]=32767*i.normals[n],ea.layoutNormalArray.int16[h+1]=s,ea.layoutNormalArray.int16[h+2]=l;let u=i.ao[o];ea.layoutAOArray.uint8[em+o]=255*u;let c=1+(u-1)*I,d=255*r.b*c<<8|255*a;ea.layoutColorArray.uint16[2*(em+o)]=255*r.r*c<<8|255*r.g*c,ea.layoutColorArray.uint16[2*(em+o)+1]=d}let o=Math.min(8191,Math.max(0,Math.floor(et.x))),s=Math.min(8191,Math.max(0,Math.floor(et.y))),l=Math.floor(S),h=4*o+Math.min(3,Math.round((ee.x-Q.x)*this.tileToMeter/20)),u=4*s+Math.min(3,Math.round((ee.y-Q.y)*this.tileToMeter/20));for(let i=0;i<n;++i){let r=3*(em+i);ea.layoutCentroidArray.int16[r]=h,ea.layoutCentroidArray.int16[r+1]=u,ea.layoutCentroidArray.int16[r+2]=l}if(ea.layoutFloodLightDataArray.int16.fill(0===i.buildingPart?B:0,em,em+n),U){let r=255*P.r<<8|255*P.g,a=255*P.b<<8|255*L;for(let i=0;i<n;++i){let n=2*(em+i);ea.layoutFacadePaintArray.uint16[n]=r,ea.layoutFacadePaintArray.uint16[n+1]=a}for(let r=0;r<n;++r)if(i.isFauxFacade[r]){let a=Math.min(65535,Math.floor(i.uv[2*r]*er.outerRingLength));ea.layoutFacadeDataArray.emplace(em+r,1|a,X,Y,K),ea.layoutFacadeVerticalRangeArray.emplace(em+r,Z,W)}else ea.layoutFacadeDataArray.emplace(em+r,0,0,0,0),ea.layoutFacadeVerticalRangeArray.emplace(em+r,0,0)}let c=eo.vertexLength,d=i.indices.length/3,f=ea.indexArray.length;ea.indexArray.resize(f+d);for(let r=0;r<d;++r){let a=3*r,n=3*f+a;ea.indexArray.uint16[n]=c+i.indices[a],ea.indexArray.uint16[n+1]=c+i.indices[a+1],ea.indexArray.uint16[n+2]=c+i.indices[a+2]}1!==i.buildingPart&&0!==i.buildingPart&&2!==i.buildingPart&&3!==i.buildingPart||es.push({part:i.buildingPart,vertexOffset:em,vertexLength:i.positions.length/3}),em+=n,eo.vertexLength+=n,eo.primitiveLength+=i.indices.length/3}this.maxHeight=Math.max(this.maxHeight,ep);let e_=ea.indexArray.length-ef,eg=this.footprintsIndices.length,ey=this.footprintsVertices.length,ex=[],ev=new eJ(1/0,1/0),eb=new eJ(-1/0,-1/0),ew=this.groundEffect.vertexArray.length;for(let i of er.modifiedPolygonRings){let r=[],a=new eJ(1/0,1/0),n=new eJ(-1/0,-1/0);for(let o=0;o<i.length;o+=2){let s=i.length-o-2;a.x=Math.min(a.x,i[s]),a.y=Math.min(a.y,i[s+1]),n.x=Math.max(n.x,i[s]),n.y=Math.max(n.y,i[s+1]);let l=new eJ(i[s],i[s+1]);r.push(l),ex.push(l.x,l.y),this.footprintsVertices.emplaceBack(l.x,l.y)}ev.x=Math.min(ev.x,a.x),ev.y=Math.min(ev.y,a.y),eb.x=Math.max(eb.x,n.x),eb.y=Math.max(eb.y,n.y),this.groundEffect.addData(r,[a,n],A)}let eT=this.groundEffect.vertexArray.length-ew;this.groundEffect.groundRadiusArray.reserveForAdditional(eT);for(let i=0;i<eT;i++)this.groundEffect.groundRadiusArray.emplaceBack(E);(Q.x<0||ee.x>8192||Q.y<0||ee.y>8192)&&this.featuresOnBorder.push({featureId:u.id,footprintIndex:this.footprints.length});{let i=ol(ex,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+i.length),this.footprintsIndices.uint16.set(i,eg),this.buildingIds.add(null!=h?h:u.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ev.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ev.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,eb.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,eb.y);let r={footprintVertexOffset:ey,footprintVertexLength:this.footprintsVertices.length-ey,footprintIndexOffset:eg,footprintIndexLength:this.footprintsIndices.length-eg,min:ev,max:eb,hiddenFlags:0,indicesOffset:ef,indicesLength:e_,bloomIndicesOffset:eh,bloomIndicesLength:eu,groundEffectVertexOffset:ew,groundEffectVertexLength:eT,hasFauxFacade:U,height:ep,promoteId:_,feature:p,parts:es,buildingBloom:el},a=this.footprints.length;void 0!==u.id&&this.featureFootprintLookup.set(u.id,a),f(h,a),this.footprints.push(r)}this.programConfigurations.populatePaintArrays(ea.layoutVertexArray.length,u,g,{},r.availableImages,a,r.brightness),this.groundEffect.addPaintPropertiesData(u,g,{},r.availableImages,a,r.brightness),r.featureIndex.insert(u,m,g,y,this.index,ec)}u.forEach(({buildingId:i,footprintIndex:r})=>{c.has(i)&&(this.footprints[r].hiddenFlags|=4)});let _=new Set;this.buildingIds.forEach((i,r,a)=>{c.has(i)||_.add(i)}),this.buildingIds=_,this.groundEffect.prepareBorderSegments()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l),this.groundEffect.update(i,r,o,a,n,s,l),this.evaluate(this.layers[0],i),this.colorBufferUploaded=!1}updateExpressions(i){this.programConfigurations.updateExpressions(i),this.groundEffect.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){let r=r=>{r.layoutVertexBuffer=i.createVertexBuffer(r.layoutVertexArray,fB.members),r.layoutNormalBuffer=i.createVertexBuffer(r.layoutNormalArray,fk.members),r.layoutCentroidBuffer=i.createVertexBuffer(r.layoutCentroidArray,fN.members),r.layoutFloodLightDataBuffer=i.createVertexBuffer(r.layoutFloodLightDataArray,fq.members),r.layoutFacadeDataArray&&r.layoutFacadeDataArray.length&&(r.layoutFacadeDataBuffer=i.createVertexBuffer(r.layoutFacadeDataArray,fj.members)),r.layoutFacadeVerticalRangeArray&&r.layoutFacadeVerticalRangeArray.length&&(r.layoutFacadeVerticalRangeBuffer=i.createVertexBuffer(r.layoutFacadeVerticalRangeArray,fG.members)),r.entranceBloom.layoutVertexArray.length&&(r.entranceBloom.layoutVertexBuffer=i.createVertexBuffer(r.entranceBloom.layoutVertexArray,fB.members),r.entranceBloom.layoutAttenuationBuffer=i.createVertexBuffer(r.entranceBloom.layoutAttenuationArray,fH.members)),this.uploadUpdatedColorBuffer(i),this.uploadUpdatedIndexBuffer(i)};this.uploaded||(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){let i=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}
7updateFootprintHiddenFlags(i,r,a=!0){let n=!1,o=a?r:0,s=0|(a?-1:~r);for(let r of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),i)){let i=this.footprints[r],a=i.hiddenFlags&s|o;i.hiddenFlags!==a&&(i.hiddenFlags=a,n=!0,this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(i){if(this.groundEffect.uploadHiddenByLandmark(i),this.indexArrayForConflationUploaded)return;let r=i=>{0!==i.indexArray.length&&(i.indexArrayForConflation.resize(i.indexArray.length),i.indexArrayForConflation.uint16.set(i.indexArray.uint16),i.entranceBloom.indexArrayForConflation.resize(i.entranceBloom.indexArray.length),i.entranceBloom.indexArrayForConflation.uint16.set(i.entranceBloom.indexArray.uint16))};for(let i of(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.footprints)){let r=i.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,a=i.indicesOffset+i.indicesLength;if(0!==i.hiddenFlags){for(let n=i.indicesOffset;n<a;n++)r.indexArrayForConflation.uint16[3*n+0]=0,r.indexArrayForConflation.uint16[3*n+1]=0,r.indexArrayForConflation.uint16[3*n+2]=0;let n=i.bloomIndicesOffset+i.bloomIndicesLength;for(let a=i.bloomIndicesOffset;a<n;a++)r.entranceBloom.indexArrayForConflation.uint16[3*a+0]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+1]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+2]=0}}let a=r=>{0!==r.indexArray.length&&(r.indexBuffer?r.indexBuffer.updateData(r.indexArrayForConflation):r.indexBuffer=i.createIndexBuffer(r.
7indexArrayForConflation,!0),r.entranceBloom.indexBuffer?r.entranceBloom.indexBuffer.updateData(r.entranceBloom.indexArrayForConflation):r.entranceBloom.indexBuffer=i.createIndexBuffer(r.entranceBloom.indexArrayForConflation,!0))};a(this.buildingWithoutFacade),a(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(i){let r=r=>{r.layoutColorBuffer?r.layoutColorBuffer.updateData(r.layoutColorArray):r.layoutColorBuffer=i.createVertexBuffer(r.layoutColorArray,fU.members,!0),r.layoutFacadePaintArray&&(r.layoutFacadePaintBuffer?r.layoutFacadePaintBuffer.updateData(r.layoutFacadePaintArray):r.layoutFacadePaintBuffer=i.createVertexBuffer(r.layoutFacadePaintArray,fV.members,!0)),r.entranceBloom.layoutColorBuffer?r.entranceBloom.layoutColorBuffer.updateData(r.entranceBloom.layoutColorArray):r.entranceBloom.layoutColorBuffer=i.createVertexBuffer(r.entranceBloom.layoutColorArray,fU.members,!0)};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(i,r){let a=i.paint.get("building-ambient-occlusion-intensity");for(let n of this.footprints){if(4&n.hiddenFlags)continue;let o=r[n.promoteId],s=n.feature;s.properties["building-part"]="roof";let l=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),h=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="wall";let u=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),c=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="window";let d=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),f=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="door";let p=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),m=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical),_=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(let i of n.parts){let r,o=l;1===i.part?(o=l,r=h):0===i.part?(o=u,r=c):2===i.part?(o=d,r=f):3===i.part&&(o=p,r=m),r=ts(r,0,1);for(let s=0;s<i.vertexLength;s++){let l=i.vertexOffset+s,h=1+(_.layoutAOArray.uint8[l]/255-1)*a;_.layoutColorArray.emplace(l,o.r*h*255<<8|o.g*h*255,o.b*h*255<<8|255*r),n.hasFauxFacade&&_.layoutFacadePaintArray.emplace(l,255*d.r<<8|255*d.g,255*d.b<<8|255*f)}}let g=n.buildingBloom;if(g)for(let i=0;i<g.vertexLength;i++)_.entranceBloom.layoutColorArray.emplace(g.vertexOffset+i,255*p.r<<8|255*p.g,255*p.b<<8|51*m)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(ck(this.activeReplacements,n))return;for(let i of(this.activeReplacements=n,this.footprints))i.hiddenFlags&=-2;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));for(let a of this.footprints)a.min.x>r.max.x||a.max.x<r.min.x||a.min.y>r.max.y||a.max.y<r.min.y||(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.float32[2*(h+r)+0],u=i.float32[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new eJ(a,u))}}(this.footprintsVertices,a.footprintVertexOffset,a.footprintVertexLength,r.footprintTileId.canonical,i.canonical,o),cU(r.footprint,o,this.footprintsIndices.uint16,a.footprintIndexOffset,a.footprintIndexLength,0,-n)&&(a.hiddenFlags|=1))}for(let i of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.footprints))this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(i){if(void 0!==i.id){let r=this.featureFootprintLookup.get(i.id);return this.footprints[r]}return null}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(Object.hasOwn(this.footprintLookup,o)){let i=this.footprintLookup[o];return i?{height:i.height,hidden:0!==i.hiddenFlags}:void 0}let s=new eJ(i,r);for(let l of this.footprints)i>l.max.x||l.min.x>i||r>l.max.y||l.min.y>r||l.height<=a||function(i,r,a){for(let n=0;n<a.length;n+=3){let o=a[n],s=a[n+1],l=a[n+2],h=r[2*o+0],u=r[2*o+1],c=r[2*s+0],d=r[2*s+1],f=r[2*l+0],p=r[2*l+1
7],m=(h-f)*(i.y-p)-(u-p)*(i.x-f),_=(c-h)*(i.y-u)-(d-u)*(i.x-h);if(m<0!=_<0&&0!==m&&0!==_)continue;let g=(f-c)*(i.y-d)-(p-d)*(i.x-c);if(0===g||g<0==m+_<=0)return!0}return!1}(s,this.footprintsVertices.float32.subarray(2*l.footprintVertexOffset,2*(l.footprintVertexOffset+l.footprintVertexLength)),this.footprintsIndices.uint16.subarray(l.footprintIndexOffset,l.footprintIndexOffset+l.footprintIndexLength))&&(a=l.height,this.footprintLookup[o]=l,n=0!==l.hiddenFlags);if(a!==-1/0)return{height:a,hidden:n};this.footprintLookup[o]=void 0}}a2(pM,"BuildingBucket",{omit:["layers"]}),a2(pA,"BuildingGeometry"),a2(pI,"BuildingBloomGeometry");class pC{constructor(i=0,r=[]){this.frcMask=i,this.rings=r}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}async function pD(){}function pR(i,r,a){let n=r.paint.get(i).value;return"constant"===n.kind?n.value:a.programConfigurations.get(r.id).getMaxValue(i)}function pP(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function pL(i,r,a,n,o){if(!r[0]&&!r[1])return i;let s=eJ.convert(r)._mult(o);"viewport"===a&&s._rotate(-n);let l=[];for(let r=0;r<i.length;r++)l.push(i[r].sub(s));return l}function pz(i,r,a,n){let o=eJ.convert(i)._mult(n);return"viewport"===r&&o._rotate(-a),o}a2(pC,"FrcCoveragePolygon");let pO=q(),pF=i=>{let r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r};function pB(i,r,a,n,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,d=a.projection.upVectorScale(c,a.center.lat,a.worldSize).metersToTile;for(let p of r)for(let r of p){var f;let p=r.add(h),m=o&&a.elevation?a.elevation.exaggeration()*o.getElevationAt(p.x,p.y,!0):0,_=a.projection.projectTilePoint(p.x,p.y,c);if(m>0){let i=a.projection.upVector(c,p.x,p.y);_.x+=i[0]*d*m,_.y+=i[1]*d*m,_.z+=i[2]*d*m}let g=s?p:function(i,r,a,n){let o=ez([],[i,r,a,1],n);return new eJ(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,n),y=s?i.tilespaceRays.map(i=>(function(i,r){let a=eo();return pk[2]=r,i.intersectsPlane(pk,pN,a),new eJ(a[0],a[1])})(i,m)):i.queryGeometry.screenGeometry,x=ez([],[_.x,_.y,_.z,1],n);if(!l&&s?u*=x[3]/a.cameraToCenterDistance:l&&!s&&(u*=a.cameraToCenterDistance/x[3]),s){let i=rm((r.y/8192+c.y)/(1<<c.z));u/=a.projection.pixelsPerMeter(i,1)/(1/oF(i))}if(f=u,lC(y,g)||lI(g,y,f))return!0}return!1}let pk=eh(0,0,0),pN=eh(0,0,1);class pU extends l3{}function pV(i){let r={},a=i.resolution||256,n=i.clips?i.clips.length:1,o=i.image||new lH({width:a,height:n}),s=i.lut||null,l=(a,n,l)=>{r[i.evaluationKey]=l;let h=i.expression.evaluate(r),u=h?h.toNonPremultipliedRenderColor(s):null;u&&(o.data[a+n+0]=Math.floor(255*u.r),o.data[a+n+1]=Math.floor(255*u.g),o.data[a+n+2]=Math.floor(255*u.b),o.data[a+n+3]=Math.floor(255*u.a))};if(i.clips)for(let r=0,o=0;r<n;++r,o+=4*a)for(let n=0,s=0;n<a;n++,s+=4){let h=n/(a-1),{start:u,end:c}=i.clips[r];l(o,s,iw(u,c,h))}else for(let i=0,r=0;i<a;i++,r+=4)l(0,r,i/(a-1));return o}a2(pU,"HeatmapBucket",{omit:["layers"]});class pj{constructor(i){this.zoom=i.zoom,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){for(let a of this.footprints)r.push({footprint:a,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of i){let i=this.layers[0]._featureFilter.needGeometry,c=o$(s,i);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),c,a))continue;let d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:i?c.geometry:oq(s,a,n),patterns:{}};o.push(d)}for(let n of o){let{geometry:o,index:s,sourceLayerIndex:l}=n;this.addFeature(n,o,s,a,{},r.availableImages,r.brightness),r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(i){}update(i,r,a,n,o,s,l){}destroy(){}addFeature(i,r,a,n,o,s=[],l){for(let i of e2(r,2)){let r=[],a=[],n=[],o=new eJ(1/0,1/0),s=new eJ(-1/0,-1/0);for(let l of i)if(0!==l.length){l!==i[0]&&n.push(a.length/2);for(let i=0;i<l.length;i++)a.push(l[i].x),a.push(l[i].y),r.push(l[i]),o.x=Math.min(o.x,l[i].x),o.y=Math.min(o.y,l[i].y),s.x=Math.max(s.x,l[i].x),s.y=Math.max(s.y,l[i].y)}let l=ol(a,n),h=new d9(r,l,8,256);this.footprints.push({vertices:r,indices:l,grid:h,min:o,max:s})}}}function pG(i,r){return i.x*r.x+i.y*r.y}function pH(i,r){if(1===i.length){let a,n=0,o=r[n++];for(;!a||o.equals(a);)if(!(a=r[n++]))return 1/0;for(;n<r.length;
7n++){let s=r[n],l=i[0],h=a.sub(o),u=s.sub(o),c=l.sub(o),d=pG(h,h),f=pG(h,u),p=pG(u,u),m=pG(c,h),_=pG(c,u),g=d*p-f*f,y=(p*m-f*_)/g,x=(d*_-f*m)/g,v=o.z*(1-y-x)+a.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let a of r)i=Math.min(i,a.z);return i}}function pq(i,r,a){let n=1/0;lT(a,r)&&(n=pH(a,r[0]));for(let o=0;o<r.length;o++){let s=r[o],l=i[o];for(let i=0;i<s.length-1;i++){let r=s[i],o=[r,s[i+1],l[i+1],l[i],r];lw(a,o)&&(n=Math.min(n,pH(a,o)))}}return n!==1/0&&n}function p$(i,r,a,n,o,s,l,h,u,c,d){return"globe"===i.projection.name?function(i,r,a,n,o,s,l,h,u,c,d){let f=[],p=[],m=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(i,r,a,n)=>{i[0]=r,i[1]=a,i[2]=n,i[3]=1},x=pg();for(let v of(a>0&&(a+=x),n+=x,r)){let r=[],x=[];for(let f of v){let p=f.x+o.x,v=f.y+o.y,b=i.projection.projectTilePoint(p,v,d),w=i.projection.upVector(d,f.x,f.y),T=a,S=n;if(l){let i=pZ(p,v,a,n,l,h,u,c);T+=i.base,S+=i.top}0!==a?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*S,b.y+w[1]*m*S,b.z+w[2]*m*S),eI(_,_,s),eI(g,g,s),r.push(new lz(_[0],_[1],_[2])),x.push(new lz(g[0],g[1],g[2]))}f.push(r),p.push(x)}return[f,p]}(i,r,a,n,o,s,l,h,u,c,d):l?function(i,r,a,n,o,s,l,h,u){let c=[],d=[],f=[0,0,0,1];for(let p of i){let i=[],m=[];for(let c of p){let d=c.x+n.x,p=c.y+n.y,_=pZ(d,p,r,a,s,l,h,u);f[0]=d,f[1]=p,f[2]=_.base,f[3]=1,ez(f,f,o),f[3]=Math.max(f[3],1e-5);let g=new lz(f[0]/f[3],f[1]/f[3],f[2]/f[3]);f[0]=d,f[1]=p,f[2]=_.top,f[3]=1,ez(f,f,o),f[3]=Math.max(f[3],1e-5);let y=new lz(f[0]/f[3],f[1]/f[3],f[2]/f[3]);i.push(g),m.push(y)}c.push(i),d.push(m)}return[c,d]}(r,a,n,o,s,l,h,u,c):function(i,r,a,n,o){let s=[],l=[],h=o[8]*r,u=o[9]*r,c=o[10]*r,d=o[11]*r,f=o[8]*a,p=o[9]*a,m=o[10]*a,_=o[11]*a;for(let r of i){let i=[],a=[];for(let s of r){let r=s.x+n.x,l=s.y+n.y,g=o[0]*r+o[4]*l+o[12],y=o[1]*r+o[5]*l+o[13],x=o[2]*r+o[6]*l+o[14],v=o[3]*r+o[7]*l+o[15],b=g+h,w=y+u,T=x+c,S=Math.max(v+d,1e-5),E=g+f,I=y+p,A=x+m,M=Math.max(v+_,1e-5);i.push(new lz(b/S,w/S,T/S)),a.push(new lz(E/M,I/M,A/M))}s.push(i),l.push(a)}return[s,l]}(r,a,n,o,s)}function pZ(i,r,a,n,o,s,l,h){var u,c;let d,f,p,m,_,g,y,x,v,b,w,T,S,E,I=l*o.getElevationAt(i,r,!0,!0),A=0!==s[0],M=A?0===s[1]?l*(s[0]/7-450):l*(d=Math.floor(s[0]/8),f=Math.floor(s[1]/8),p=10*(s[0]-8*d),m=10*(s[1]-8*f),_=o.getElevationAt(d,f,!0,!0),y=Math.floor(.5*(p*(g=o.getMeterToDEM(h))-1)),x=Math.floor(.5*(m*g-1)),v=o.tileCoordToPixel(d,f),b=2*y+1,w=2*x+1,u=v.x-y,c=v.y-x,S=Math.abs((T=[o.getElevationAtPixel(u,c,!0),o.getElevationAtPixel(u+w,c,!0),o.getElevationAtPixel(u,c+w,!0),o.getElevationAtPixel(u+b,c+w,!0)])[0]-T[1]),E=Math.abs(T[2]-T[3]),_+Math.max(Math.min(.25,.5*g*(S+E)/b)*p,Math.min(.25,.5*g*(Math.abs(T[0]-T[2])+Math.abs(T[1]-T[3]))/w)*m)):I;return{base:I+(0===a?-1:a),top:A?Math.max(M+n,I+a+2):I+n}}function pW(i,r,a){return r*(8192/(i.tileSize*Math.pow(2,a-i.tileID.overscaledZ)))}function pX(i,r){return 1/pW(i,1,r.tileZoom)}function pY(i,r,a,n){return i.translatePosMatrix(n||r.tileID.projMatrix,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}a2(pj,"ClipBucket",{omit:["layers"]});let pK=i=>{let r=[];pJ(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT"),"multiply"===i.paint.get("line-blend-mode")&&r.push("LINE_BLEND_MULTIPLY"),"additive"===i.paint.get("line-blend-mode")&&r.push("LINE_BLEND_ADDITIVE");let a=i.paint.get("line-trim-offset");0===a[0]&&0===a[1]||r.push("RENDER_LINE_TRIM_OFFSET"),0!==i.paint.get("line-border-width").constantOr(1)&&r.push("RENDER_LINE_BORDER");let n="none"===i.layout.get("line-join").constantOr("miter"),o=!!i.paint.get("line-pattern").constantOr(1);return n&&o&&r.push("LINE_JOIN_NONE"),r};function pJ(i){let r=i.paint.get("line-dasharray").value;return"constant"!==r.kind||r.value}let pQ=()=>T||(T={layout:b||(b=new nY({"line-cap":new nW(nK.layout_line["line-cap"]),"line-join":new nW(nK.layout_line["line-join"]),"line-miter-limit":new nZ(nK.layout_line["line-miter-limit"]),"line-round-limit":new nZ(nK.layout_line["line-round-limit"]),"line-sort-key":new nW(nK.layout_line["line-sort-key"]),"line-z-offset":new nW(nK.layout_line["line-z-offset"]),"line-elevation-reference":new nZ(nK.layout_line["line-elevation-reference"]),"line-cross-slope":new nZ(nK.layout_line["line-cross-slope"]),visibility:new nZ(nK.layout_line.visibility),"line-width-unit":new nZ(nK.layout_line["line-width-unit"]),"line-elevation-ground-scale":new nW(nK.layout_line["line-elevation-ground-scale"])})),paint:w||(w=new nY({"line-opacity":new nW(nK.paint_line["line-opacity"]),"line-color":new nW(nK.paint_line["line-color"]),"line-translate":new nZ(nK.paint_line["line-translate"]),"line-translate-anchor":new nZ(nK.paint_line["line-translate-anchor"]),"line-width":new nW(nK.paint_line["line-width"]),"line-gap-width":new nW(nK.paint_line["line-gap-width"]),"line-offset":new nW(nK.paint_line["line-offset"]),"line-blur"
7:new nW(nK.paint_line["line-blur"]),"line-dasharray":new nW(nK.paint_line["line-dasharray"]),"line-pattern":new nW(nK.paint_line["line-pattern"]),"line-pattern-cross-fade":new nZ(nK.paint_line["line-pattern-cross-fade"]),"line-gradient":new nX(nK.paint_line["line-gradient"]),"line-trim-offset":new nZ(nK.paint_line["line-trim-offset"]),"line-trim-fade-range":new nZ(nK.paint_line["line-trim-fade-range"]),"line-trim-color":new nZ(nK.paint_line["line-trim-color"]),"line-emissive-strength":new nW(nK.paint_line["line-emissive-strength"]),"line-border-width":new nW(nK.paint_line["line-border-width"]),"line-border-color":new nW(nK.paint_line["line-border-color"]),"line-occlusion-opacity":new nZ(nK.paint_line["line-occlusion-opacity"]),"line-blend-mode":new nZ(nK.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new nZ(nK.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))});class p0 extends nW{possiblyEvaluate(i,r){return r=new nk(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition,worldview:r.worldview}),super.possiblyEvaluate(i,r)}evaluate(i,r,a,n){return r=Object.assign({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,a,n)}}function p1(i,r){return r.replace(/{([^{}]+)}/g,(r,a)=>a in i?String(i[a]):"")}class p2{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:iP,this.defaultValue=i}evaluate(i){if(i.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}a2(p2,"FormatSectionOverride",{omit:["defaultValue"]});let p3=()=>A||(A={layout:E||(E=new nY({"symbol-placement":new nZ(nK.layout_symbol["symbol-placement"]),"symbol-spacing":new nZ(nK.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new nZ(nK.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nW(nK.layout_symbol["symbol-sort-key"]),"symbol-z-order":new nZ(nK.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new nZ(nK.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new nZ(nK.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new nZ(nK.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new nZ(nK.layout_symbol["icon-ignore-placement"]),"icon-optional":new nZ(nK.layout_symbol["icon-optional"]),"icon-rotation-alignment":new nZ(nK.layout_symbol["icon-rotation-alignment"]),"icon-size":new nW(nK.layout_symbol["icon-size"]),"icon-size-scale-range":new nZ(nK.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new nW(nK.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new nW(nK.layout_symbol["icon-text-fit-padding"]),"icon-image":new nW(nK.layout_symbol["icon-image"]),"icon-image-use-theme":new nZ({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new nW(nK.layout_symbol["icon-rotate"]),"icon-padding":new nZ(nK.layout_symbol["icon-padding"]),"icon-keep-upright":new nZ(nK.layout_symbol["icon-keep-upright"]),"icon-offset":new nW(nK.layout_symbol["icon-offset"]),"icon-anchor":new nW(nK.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new nZ(nK.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new nZ(nK.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new nZ(nK.layout_symbol["text-rotation-alignment"]),"text-field":new nW(nK.layout_symbol["text-field"]),"text-font":new nW(nK.layout_symbol["text-font"]),"text-size":new nW(nK.layout_symbol["text-size"]),"text-size-scale-range":new nZ(nK.layout_symbol["text-size-scale-range"]),"text-max-width":new nW(nK.layout_symbol["text-max-width"]),"text-line-height":new nW(nK.layout_symbol["text-line-height"]),"text-letter-spacing":new nW(nK.layout_symbol["text-letter-spacing"]),"text-justify":new nW(nK.layout_symbol["text-justify"]),"text-radial-offset":new nW(nK.layout_symbol["text-radial-offset"]),"text-variable-anchor":new nZ(nK.layout_symbol["text-variable-anchor"]),"text-anchor":new nW(nK.layout_symbol["text-anchor"]),"text-max-angle":new nZ(nK.layout_symbol["text-max-angle"]),"text-writing-mode":new nZ(nK.layout_symbol["text-writing-mode"]),"text-rotate":new nW(nK.layout_symbol["text-rotate"]),"text-padding":new nZ(nK.layout_symbol["text-padding"]),"text-keep-upright":new nZ(nK.layout_symbol["text-keep-upright"]),"text-transform":new nW(nK.layout_symbol["text-transform"]),"text-offset":new nW(nK.layout_symbol["text-offset"]),"text-allow-overlap":new nZ(nK.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new nZ(nK.layout_symbol["text-ignore-placement"]),"text-optional":new nZ(nK.layout_symbol["text-optional"]),visibility:new nZ(nK.layout_symbol.visibility)})),paint:I||(I=new nY({"icon-opacity":new nW(nK.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new nW(nK.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new nW(nK.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new nW(nK.paint_symbol["text-emissive-strength"]),"icon-color":new nW(nK.paint_symbol["icon-color"]),"icon-halo-color":new nW(nK.paint_symbol["icon-halo-color"]),"icon-halo-width":new nW(nK.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nW(nK.paint_symbol["icon-halo-blur"]),"icon-translate":new nZ(nK.paint_symbol["icon-translate"]),"icon-translate-anchor":new nZ(nK.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new nZ(nK.paint_symbol["icon-image-cross-fade"]),"text-opacity":new nW(nK.paint_symbol["text-opacity"]),"text-occlusion-opacity":new nW(nK.paint_symbol["text-occlusion-opacity"]),"text-color":new nW(nK.paint_symbol["text-color"],{runtimeType:iF,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new nW(nK.paint_symbol["text-halo-color"]),"text-halo-width":new nW(nK.paint_symbol["text-halo-width"]),"text-halo-blur":new nW(nK.paint_symbol["text-halo-blur"]),"text-translate":new nZ(nK.paint_symbol["text-translate"]),"text-translate-anchor":new nZ(nK.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new nZ(nK.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new nZ(nK.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new nZ(nK.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new nZ(nK.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new nW(nK.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))});var p4=oK([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function p5(i,r,a,n,o,s,l,h){let u=[i,r,1,a,n,1,o,s,1],c=[l,h,1],[d,f,p]=eA(c,c,G([],u));return H(u,u,[d,0,0,0,f,0,0,0,p])}
7function p6(i,r,a,n,o,s,l,h){let u,c,d=(u=p5(0,0,1,0,1,1,0,1),H(c=p5(i,r,a,n,o,s,l,h),c,G([],u)));return[d[2]/d[8]/8192,d[5]/d[8]/8192]}function p8(i){return[i[0],Math.min(Math.max(i[1],-85.051129),85.051129)]}class p9 extends ig{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=r,this._dirty=!1}load(i,r){(this._loaded=r||!1,this.fire(new id("dataloading",{dataType:"source"})),this.url=this.options.url,this.url)?this._imageRequest=iu(this.map._requestManager.transformRequest(this.url,ie.Image),(r,a)=>{this._imageRequest=null,this._loaded=!0,r?this.fire(new ip(r)):a&&(this.image=a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,i&&(this.coordinates=i),this._finishLoading())}):(i&&(this.coordinates=i),this._loaded=!0,this._finishLoading())}loaded(){return this._loaded}updateImage(i){return i.url&&(this._imageRequest&&i.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}setTexture(i){if(!(i.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new h4(this.map.painter.context,i.handle),this.width=i.dimensions[0],this.height=i.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new id("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(i){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof h4||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(i){if(this.coordinates=i,this._boundsArray=void 0,this._unsupportedCoords=!1,!i.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let r=i[0][1],a=i[0][1];for(let n of i)n[1]>a&&(a=n[1]),n[1]<r&&(r=n[1]);let n=(a+r)/2;if(n>85.051129?this.onNorthPole=!0:n<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let r=i.map(oj.fromLngLat);this.tileID=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);let s=Math.max(0,Math.floor(-Math.log2(Math.max(n-r,o-a)))),l=Math.pow(2,s),h=Math.floor((r+n)/2*l);return h>1&&(h-=1),new ch(s,h,Math.floor((a+o)/2*l))}(r),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new id("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof h4||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(i){var r,a,n,o,s,l,h,u,c;let d,f,p,m,_,g,y,x,v,b,w,T;for(let i in this.tiles){let r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let S=cp(new ch(0,0,0),this.map.transform.projection),E=[S.projection.project(this.coordinates[0][0],this.coordinates[0][1]),S.projection.project(this.coordinates[1][0],this.coordinates[1][1]),S.projection.project(this.coordinates[2][0],this.coordinates[2][1]),S.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(d=E[1].x-E[0].x,f=E[1].y-E[0].y,p=E[2].x-E[1].x,m=E[2].y-E[1].y,_=E[3].x-E[2].x,g=E[3].y-E[2].y,y=E[0].x-E[3].x,x=E[0].y-E[3].y,v=d*m-p*f,b=p*g-_*m,w=_*x-y*g,T=y*f-d*x,(!(v>0)||!(b>0)||!(w>0)||!(T>0))&&(!(v<0)||!(b<0)||!(w<0)||!(T<0)))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let I=cp(this.tileID,this.map.transform.projection),[A,M,C,D]=this.coordinates.map(i=>{let r=I.projection.project(i[0],i[1]);return cm(I,r)._round()});this.perspectiveTransform=p6(A.x,A.y,M.x,M.y,C.x,C.y,D.x,D.y);let R=this._boundsArray=new o1;R.emplaceBack(A.x,A.y,0,0),R.emplaceBack(M.x,M.y,8192,0),R.emplaceBack(D.x,D.y,0,8192),R.emplaceBack(C.x,C.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=i.createVertexBuffer(R,p4.members),this.boundsSegments=sG.simpleSegment(0,0,4,2);let P=[],[L,z,O,F]=function(i){let r=i[0][0],a=r,n=i[0][1],o=n;for(let s=1;s<i.length;s++)i[s][0]<r?r=i[s][0]:i[s][0]>a&&(a=i[s][0]),i[s][1]<n?n=i[s][1]:i[s][1]>o&&(o=i[s][1]);return[r,n,a-r,o-n]}([p8((r=this.coordinates)[0]),p8(r[1]),p8(r[2]),p8(r[3])]);{let r,d=new o1,[f,p,m,_]=function(i){let r=i[0].x,a=r,n=i[0].y,o=n;for(let s=1;s<i.length;s++)i[s].x<r?r=i[s].x:i[s].x>a&&(a=i[s].x),i[s].y<n?n=i[s].y:i[s].y>o&&(o=i[s].y);return[r,n,a-r,o-n]}(E),g=i=>[(i.x-f)/m,(i.y-p)/_],[y,x,v,b]=E.map(g),w=(a=y[0],n=y[1],o=x[0],s=x[1],l=v[0],h=v[1],u=b[0],c=b[1],H(r=p5(0,0,1,0,1,1,0,1),r,G([],p5(a,n,o,s,l,h,u,c))));this.elevatedGlobePerspectiveTransform=p6(y[0],y[1],x[0],x[1],v[0],v[1],b[0],b[1]);let T=(i,r)=>{P.push(i.lng);let a=Math.round((i.lng-L)/O*8192),n=Math.round((i.lat-z)/F*8192),o=g(r),s=eA([],[o[0],o[1],1],w),l=Math.round(s[0]/s[2]*8192),h=Math.round(s[1]/s[2]*8192);d.emplaceBack(a,n,l,h)},I=E[3].x-E[0].x,A=E[3].y-E[0].y,M=E[2].x-E[1].x,C=E[2].y-E[1].y;for(let i=0;i<65;i++){let r=i/64,a=[E[0].x+r*I,E[0].y+r*A],n=[E[1].x+r*M,E[1].y+r*C],o=n[0]-a[0],s=n[1]-a[1];for(let i=0;i<65;i++){let r=i/64,n={x:a[0]+o*r,y:a[1]+s*r};T(S.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=i.createVertexBuffer(d,p4.members)}{this.maxLongitudeTriangleSize=0;let r=[],a=new sc,n=(i,n,o)=>{a.emplaceBack(i,n,o);let s=P[i],l=P[n],h=P[o],u=Math.min(Math.min(s,l),h),c=Math.max(Math.max(s,l),h)-u;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),r.push(u+c/2)};for(let i=0;i<64;i++)for(let r=0;r<64;r++){let a=65*i+r,o=a+1,s=a+65,l=s+1;n(a,s,o),n(o,s,l)}[r,a]=function(i,r){let a=Array.from({length:i.length},(i,r)=>r);a.sort((r,a)=>i[r]-i[a]);let n=[],o=new sc;for(let s=0;s<a.length;s++){let l=a[s];n.push(i[l]);let h=3*l,u=h+1;o.emplaceBack(r.uint16[h],r.uint16[u],r.uint16[u+1])}return[n,o]}(r,a),this.elevatedGlobeTrianglesCenterLongitudes=r,this.elevatedGlobeIndexBuffer=i.createIndexBuffer(a)}this.elevatedGlobeSegments=sG.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,O/8192,0,F/8192,0,0,z,L,0])}prepare(){let i=0!==Object.keys(this.tiles).length;if(this.tileID&&!i)return;let r=this.map.painter.context,a=r.gl;!this._dirty||this.texture instanceof h4||(this.texture?this.texture.update(this.image):(this.texture=new h3(r,this.image,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE)),this._dirty=!1),i&&this._prepareData(r)}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored",r(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(i){var r;let a=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!a)return null;let n=this.elevatedGlobeTrianglesCenterLongitudes,o=(r=i+180)+360*Math.round((n[0]-r)/360),s=new sG,l=(i,r)=>{s.segments.push({vertexOffset:0,primitiveOffset:i,vertexLength:a.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},h=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=h){let i=tF(n,0,n.length,o+h);return i===n.length||l(i,tO(n,i+1,n.length,o+360-h)-i),s}o<n[0]&&(o+=360);let u=tO(n,0,n.length,o-h);if(u===n.length)return l(0,n.length),s;l(0,u-0);let c=tF(n,u+1,n.length,o+h);return c!==n.length&&l(c,n.length-c),s}}
7class p7 extends oo{constructor(i,r,a,n){super(i,{layout:D||(D=new nY({visibility:new nZ(nK.layout_raster.visibility)})),paint:R||(R=new nY({"raster-opacity":new nZ(nK.paint_raster["raster-opacity"]),"raster-color":new nX(nK.paint_raster["raster-color"]),"raster-color-mix":new nZ(nK.paint_raster["raster-color-mix"]),"raster-color-range":new nZ(nK.paint_raster["raster-color-range"]),"raster-hue-rotate":new nZ(nK.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new nZ(nK.paint_raster["raster-brightness-min"]),"raster-brightness-max":new nZ(nK.paint_raster["raster-brightness-max"]),"raster-saturation":new nZ(nK.paint_raster["raster-saturation"]),"raster-contrast":new nZ(nK.paint_raster["raster-contrast"]),"raster-resampling":new nZ(nK.paint_raster["raster-resampling"]),"raster-fade-duration":new nZ(nK.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new nZ(nK.paint_raster["raster-emissive-strength"]),"raster-array-band":new nZ(nK.paint_raster["raster-array-band"]),"raster-elevation":new nZ(nK.paint_raster["raster-elevation"]),"raster-elevation-reference":new nZ(nK.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(i){return!(i&&i._source instanceof p9&&(i._source.onNorthPole||i._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(i){"raster-color"!==i&&"raster-color-range"!==i||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(i){if(!this.hasColorMap()||!this._curRampRange)return;let r=this._transitionablePaint._values["raster-color"].value.expression,[a,n]=i||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(a)&&isNaN(n)||a===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=pV({expression:r,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:a,end:n}],resolution:1024}),this.colorRampTexture=null,this._curRampRange=[a,n])}is3D(i){return this.paint.get("raster-elevation")>0}}class me extends oo{constructor(i,r,a,n){super(i,{layout:P||(P=new nY({visibility:new nZ(nK["layout_raster-particle"].visibility)})),paint:L||(L=new nY({"raster-particle-array-band":new nZ(nK["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new nZ(nK["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new nX(nK["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new nZ(nK["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new nZ(nK["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new nZ(nK["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new nZ(nK["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new nZ(nK["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp(),this.lastInvalidatedAt=tV.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(i){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(i){return!1}_handleSpecialPaintPropertyUpdate(i){"raster-particle-color"!==i&&"raster-particle-max-speed"!==i||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===i&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let i=this._transitionablePaint._values["raster-particle-color"].value.expression,r=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=pV({expression:i,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:r}],resolution:256}),this.colorRampTexture=null}
7_invalidateAnimationState(){this.lastInvalidatedAt=tV.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class mt extends oo{constructor(i,r){super(i,{},r,null),this.implementation=i,i.slot&&(this.slot=i.slot)}is3D(i){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(i){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}function mi(i,r,a){let n=[0,0,1],o=eF([]);return ek(o,o,a?-(i*e7)+Math.PI:i*e7),eB(o,o,-(r*e7)),eM(n,n,o),ew(n,n)}class mr{constructor(i,r){this.feature=i,this.instancedDataOffset=r,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class ma{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new sw,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=Math.floor(a[r+2]),o=1.05*(a[r+2]-n);return n/=100,[a[r]%1*1.05,a[r+1]%1*1.05,o,n]}tileCoordinatesForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=a[r+0];return new eJ(Math.trunc(n=n>8192?n-8192:n),Math.trunc(a[r+1]))}translationForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+4],a[r+5],a[r+6]]}rotationScaleForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+10],a[r+11],a[r+12],a[r+13],a[r+14],a[r+15]]}transformForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+4],a[r+10],a[r+11],a[r+12],a[r+5],a[r+13],a[r+14],a[r+15],a[r+6],0,0,0,1]}}class mn{constructor(i){this.requiresStandardRuntime=!0,this.zoom=i.zoom,this.canonical=i.canonical,this.overscaledZ=this.canonical.z+Math.log2(i.overscaling),this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=i.projection,this.index=i.index,this.worldview=i.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=i.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.tileToMeter=oV(a);let o=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);let s="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?r.elevationFeatures:void 0;for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=null!=h?h:l.properties&&Object.hasOwn(l.properties,"id")?l.properties.id:void 0,d=o$(l,o);if(!this.layers[0]._featureFilter.filter(new nk(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let f={id:i,sourceLayerIndex:c,index:u,geometry:o?d.geometry:oq(l,a,n),properties:l.properties,type:l.type,patterns:{}},p=this.addFeature(f,f.geometry,d,s,a);p&&r.featureIndex.insert(l,f.geometry,u,c,this.index,this.instancesPerModel[p].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){let i=this.layers[0].modelManager,r=this.layers[0].scope,a=0;for(let n of this.modelUris){let o=i.getModel(n,r);if(!o)continue;let s=this.instancesPerModel[n];s&&(a=Math.max(Math.min(8192,Math.max((.5*ey(o.aabb.max,o.aabb.min)*s.maxScale+s.maxXYTranslationDistance)/this.tileToMeter,256)),a))}return a}update(i,r,a,n){for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r in i)Object.hasOwn(a.idToFeaturesIndex,r)&&(this.evaluate(a.features[a.idToFeaturesIndex[r]],i[r],a,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let i=!1;for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r of a.features){let n=this.layers[0],o=r.feature,s=this.canonical,l=n.paint.get("model-rotation").evaluate(o,{},s),h=n.paint.get("model-scale").evaluate(o,{},s),u=n.paint.get("model-translation").evaluate(o,{},s);eD(r.rotation,l)&&eD(r.scale,h)&&eD(r.translation,u)||(this.evaluate(r,r.featureStates,a,!0),i=!0)}}return i}updateReplacement(i,r,a,n){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let o=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);if(ck(this.activeReplacements,o))return!1;this.activeReplacements=o;let s=!1;for(let r in this.instancesPerModel){let o=this.instancesPerModel[r],l=o.instancedDataArray;for(let r of o.features){let o=r.instancedDataOffset,h=r.instancedDataCount;for(let r=0;r<h;r++){let h=16*(r+o),u=l.float32[h+0],c=u>8192,d=Math.floor(u=c?u-8192:u),f=Math.floor(l.float32[h+1]),p=!1;for(let r of this.activeReplacements)if(!cz(r,a,f1.Model,n)&&!(r.min.x>d||d>r.max.x||r.min.y>f||f>r.max.y)&&(p=cj(cV(d,f,i.canonical,r.footprintTileId.canonical),r.footprint)))break;l.float32[h]=p?u+8192:u,s=s||p!==c}}}return s}isEmpty(){for(let i in this.instancesPerModel)if(0!==this.instancesPerModel[i].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(i){if(!this.uploaded)for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];a.instancedDataArray.length<0||0===a.instancedDataArray.length||(a.instancedDataBuffer?a.instancedDataBuffer.updateData(a.instancedDataArray):a.instancedDataBuffer=i.createVertexBuffer(a.instancedDataArray,fn.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(i){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];0!==r.instancedDataArray.length&&r.instancedDataBuffer&&r.instancedDataBuffer.destroy()}let r=this.layers[0].modelManager;if(i&&r&&this.modelUris&&this.modelsRequested)for(let i of this.modelUris)r.removeModel(i,"",!0)}addFeature(i,r,a,n,o){let s,l=this.layers[0],h=l.layout.get("model-id"),u=l.layout.get("model-allow-density-reduction"),c=h.evaluate(a,{},this.canonical);if(!c)return tb(`modelId is not evaluated for layer ${l.id} and it is not going to get rendered.`),c;!c.includes("://")&&!this.styleDefinedModelURLs[c]||this.modelUris.includes(c)||this.modelUris.push(c),this.instancesPerModel[c]||(this.instancesPerModel[c]=new ma);let d=this.instancesPerModel[c],f=d.instancedDataArray,p=new mr(a,f.length);for(let a of(n&&(s=dt(i,n)),r))for(let i of a){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;if(0!==this.lookupDim&&u){let r=(this.lookupDim-1)/8192,a=this.lookupDim*(i.y*r|0)+i.x*r|0;if(this.lookup){if(0!==this.lookup[a])continue;this.lookup[a]=1}}this.instanceCount++;let r=f.length;if(f.resize(r+1),n){d.instancesRoadElevation||(d.instancesRoadElevation=[]);let r=s?s.pointElevation(new eJ(i.x,i.y)):0;d.instancesRoadElevation.push(r)}d.instancesEvaluatedElevation.push(0),f.float32[16*r]=i.x,f.float32[16*r+1]=i.y}return p.instancedDataCount=d.instancedDataArray.length-p.instancedDataOffset,p.instancedDataCount>0&&(i.id&&(d.idToFeaturesIndex[i.id]=d.features.length),d.features.push(p),this.evaluate(p,{},d,!1)),c}getModelUris(){return this.modelUris}evaluate(i,r,a,n){let o=this.layers[0],s=i.feature,l=this.canonical,h=i.rotation=o.paint.get("model-rotation").evaluate(s,r,l),u=i.scale=o.paint.get("model-scale").evaluate(s,r,l),c=i.translation=o.paint.get("model-translation").evaluate(s,r,l),{r:d,g:f,b:p}=o.paint.get("model-color").evaluate(s,r,l),m=o.paint.get("model-color-mix-intensity").evaluate(s,r,l),_=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);let g=c[0]*c[0]+c[1]*c[1],y=g>0?Math.sqrt(g):0;a.maxScale=Math.max(Math.max(a.maxScale,u[0]),Math.max(u[1],u[2])),a.maxXYTranslationDistance=Math.max(a.maxXYTranslationDistance,y),this.maxScale=Math.max(Math.max(this.maxScale,u[0]),Math.max(u[1],u[2])),fp(_,h,u);let x=Math.round(100*m)+p/1.05;for(let r=0;r<i.instancedDataCount;++r){let o=i.instancedDataOffset+r,s=16*o,h=a.instancedDataArray.float32,u=0;n&&(u=h[s+6]-a.instancesEvaluatedElevation[o]);let p=0|h[s+1];
7h[s]=(0|h[s])+d/1.05,h[s+1]=p+f/1.05,h[s+2]=x,h[s+3]=1/(l.z>10?this.tileToMeter:oV(l,p)),h[s+4]=c[0],h[s+5]=c[1],h[s+6]=c[2]+(a.instancesRoadElevation?a.instancesRoadElevation[o]:0)+u,h[s+7]=_[0],h[s+8]=_[1],h[s+9]=_[2],h[s+10]=_[4],h[s+11]=_[5],h[s+12]=_[6],h[s+13]=_[8],h[s+14]=_[9],h[s+15]=_[10],a.instancesEvaluatedElevation[o]=c[2]}}}a2(mn,"ModelBucket",{omit:["layers"]}),a2(ma,"PerModelAttributes"),a2(mr,"ModelFeature");class mo{constructor(i,r,a){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=a}static create(i,r,a){let n=a||i.findDEMTileFor(r);if(!n||!n.dem)return;let o=n.dem,s=n.tileID,l=1<<r.canonical.z-s.canonical.z;return new mo(n,o.dim/8192/l,[(r.canonical.x/l-s.canonical.x)*o.dim,(r.canonical.y/l-s.canonical.y)*o.dim])}tileCoordToPixel(i,r){let a=r*this._scale+this._offset[1];return new eJ(Math.floor(i*this._scale+this._offset[0]),Math.floor(a))}getElevationAt(i,r,a,n){let o=i*this._scale+this._offset[0],s=r*this._scale+this._offset[1],l=Math.floor(o),h=Math.floor(s),u=this._dem;return n=!!n,a?iw(iw(u.get(l,h,n),u.get(l,h+1,n),s-h),iw(u.get(l+1,h,n),u.get(l+1,h+1,n),s-h),o-l):u.get(l,h,n)}getElevationAtPixel(i,r,a){return this._dem.get(i,r,!!a)}getMeterToDEM(i){return(1<<this._demTile.tileID.canonical.z)*(1/oF(i))*this._dem.stride}}let ms=new Float32Array(262144),ml=new Uint8Array(262144),mh=[0,0,0],mu=[0,0,0],mc=["","wall","door","roof","window","lamp","logo"];class md{constructor(i){this.node=i,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.targetLod=-1,this.feature={type:"Point",id:i.id,geometry:[],properties:{height:function i(r){let a=0;if(r.meshes)for(let i of r.meshes)a=Math.max(a,i.aabb.max[2]);if(r.children)for(let n of r.children)a=Math.max(a,i(n));return a}(i)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new uq([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let i=0,r=new uq([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let a of this.node.meshes)this.node.lightMeshIndex!==i&&(a.transformedAabb=uq.applyTransformFast(a.aabb,this.node.globalMatrix),r.encapsulate(a.transformedAabb)),i++;this.aabb=r}return this.aabb}}class mf{constructor(i,r,a,n,o,s,l,h){for(const u of(this.requiresStandardRuntime=!0,this.id=a,this.layers=i,this.layerIds=this.layers.map(i=>i.fqid),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.modelTraits|=fy.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=fy.HasMapboxMeshFeatures),o&&(this.modelTraits|=fy.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[],r))this.nodesInfo.push(new md(u)),function i(r,a,n){if(r.meshes)for(let i of r.meshes){if(i.aabb.min[0]===1/0)continue;let o=uq.applyTransform(i.aabb,r.globalMatrix);n.insert(a,o.min[0],o.min[1],o.max[0],o.max[1])}if(r.children)for(let o of r.children)i(o,a,n)}(u,l.featureIndexArray.length,l.grid),l.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,l.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(i,r){for(let a of this.getNodesInfo()){let n=a.node;n.footprint&&r.push({footprint:n.footprint,id:i})}}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(i){let r=0!==Object.keys(i).length;if(r&&!this.stateDependentLayers.length)return;let a=r?this.stateDependentLayers:this.layers;if(!eQ(i,this.states))for(let r of a)this.evaluate(r,i);this.states=structuredClone(i)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(i){if(!this.needsUpload)return;let r=this.getNodesInfo();for(let a of r){let r=a.node;this.uploaded?this.updatePbrBuffer(r):fT(r,i,!0)}for(let i of r)fE(i.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(i){let r=!1;if(!i.meshes)return r;for(let a of i.meshes)a.pbrBuffer&&(a.pbrBuffer.updateData(a.featureArray),r=!0);if(i.lodMeshes)for(let a of i.lodMeshes)a.pbrBuffer&&(a.pbrBuffer.updateData(a.featureArray),r=!0);return r}needsReEvaluation(i,r,a){let n=i.transform.projectionOptions,o=i.style.getBrightness(),s=this.brightness!==o;if(!this.uploaded||this.dirty||n.name!==this.projection.name||mp(a.paint.get("model-color").value,s)||mp(a.paint.get("model-color-mix-intensity").value,s)||mp(a.paint.get("model-roughness").value,s)||mp(a.paint.get("model-emissive-strength").value,s)||mp(a.paint.get("model-height-based-emissive-strength-multiplier").value,s)){for(let i of(this.projection=n,this.brightness=o,this.getNodesInfo()))i.state=null;return!0}return!1}evaluateTransform(i,r){if(i.transform.zoom===this.zoom)return;this.zoom=i.transform.zoom;let a=this.getNodesInfo(),n=this.id.canonical;for(let i of a){let a=i.feature;i.evaluatedTranslation=r.paint.get("model-translation").evaluate(a,{},n),i.evaluatedScale=r.paint.get("model-scale").evaluate(a,{},n)}}
7evaluate(i,r){for(let a of this.getNodesInfo()){if(!a.node.meshes)continue;let n=a.feature,o=r&&r[n.id];if(eQ(o,a.state))continue;a.state=structuredClone(o);let s=a.node.meshes&&a.node.meshes[0].featureData,l=a.evaluatedColor[2],h=a.evaluatedRMEA[2],u=this.id.canonical;if(a.hasTranslucentParts=!1,s){for(let r=0;r<mc.length;r++){let s=mc[r];s.length&&(n.properties.part=s);let l=i.paint.get("model-color").evaluate(n,o,u).toPremultipliedRenderColor(null),h=i.paint.get("model-color-mix-intensity").evaluate(n,o,u);a.evaluatedColor[r]=[l.r,l.g,l.b,h],a.evaluatedRMEA[r][0]=i.paint.get("model-roughness").evaluate(n,o,u),a.evaluatedRMEA[r][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u),a.evaluatedRMEA[r][3]=l.a,a.emissionHeightBasedParams[r]=i.paint.get("model-height-based-emissive-strength-multiplier").evaluate(n,o,u),!a.hasTranslucentParts&&l.a<1&&(a.hasTranslucentParts=!0)}delete n.properties.part,function(i,r,a){let n=i.node,o=a&fy.HasMeshoptCompression,s=16*!o,l=16*!!o;for(let a=0;a<n.meshes.length;a++)n.lights&&n.lightMeshIndex===a||m_(n.meshes[a],i,s,l,r);if(n.lodMeshes)for(let r of n.lodMeshes)m_(r,i,s,l,!1)}(a,l!==a.evaluatedColor[2]||h!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u);a.evaluatedTranslation=i.paint.get("model-translation").evaluate(n,o,u),a.evaluatedScale=i.paint.get("model-scale").evaluate(n,o,u),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(i,r,a,n){let o=i.findDEMTileFor(a);if(o&&(o.tileID.canonical!==this.terrainTile||r!==this.terrainExaggeration)){if(o.dem&&o.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=o.tileID.overscaledZ;let r=mo.create(i,a,o);if(!r)return;for(let o of(this.modelTraits&fy.HasMapboxMeshFeatures&&this.updateDEM(i,r,a,n),this.getNodesInfo())){let i=o.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;let a=i.footprint.vertices,n=r.getElevationAt(a[0].x,a[0].y,!0,!0);for(let i=1;i<a.length;i++)n=Math.min(n,r.getElevationAt(a[i].x,a[i].y,!0,!0));i.elevation=n}}this.terrainTile=o.tileID.canonical,this.terrainExaggeration=r}}updateDEM(i,r,a,n){let o=r._dem._modifiedForSources[n];if(void 0===o&&(r._dem._modifiedForSources[n]=[],o=r._dem._modifiedForSources[n]),o.includes(a.canonical))return;let s=r._dem.dim;o.push(a.canonical);let l=!1;for(let i of this.getNodesInfo()){let a=i.node;if(!a.footprint||!a.footprint.grid)continue;let n=a.footprint.grid,o=r.tileCoordToPixel(n.min.x,n.min.y),h=r.tileCoordToPixel(n.max.x,n.max.y),u=Math.min(Math.min(s-h.y,o.x),Math.min(o.y,s-h.x));if(u<0)continue;let c=ts(u,2,5),d=Math.max(0,o.x-c),f=Math.max(0,o.y-c),p=Math.min(h.x+c,s-1),m=Math.min(h.y+c,s-1);for(let i=f;i<=m;++i)for(let r=d;r<=p;++r)ml[i*s+r]=255;let _=0,g=0;for(let i=0;i<n.cellsY;++i)for(let a=0;a<n.cellsX;++a){if(!n.cells[i*n.cellsX+a])continue;let o=r.tileCoordToPixel(n.min.x+a/n.xScale,n.min.y+i/n.yScale),l=r.tileCoordToPixel(n.min.x+(a+1)/n.xScale,n.min.y+(i+1)/n.yScale);for(let i=o.y;i<=Math.min(l.y+1,s-1);++i)for(let a=o.x;a<=Math.min(l.x+1,s-1);++a)255===ml[i*s+a]&&(ml[i*s+a]=0,_+=r.getElevationAtPixel(a,i),g++)}let y=_/g;d=Math.max(1,o.x-c),f=Math.max(1,o.y-c),p=Math.min(h.x+c,s-2),m=Math.min(h.y+c,s-2),l=!0;for(let i=f;i<=m;++i)for(let a=d;a<=p;++a)0===ml[i*s+a]&&(ms[i*s+a]=r._dem.set(a,i,y));for(let i=1;i<c;++i){d=Math.max(1,o.x-i),f=Math.max(1,o.y-i),p=Math.min(h.x+i,s-2),m=Math.min(h.y+i,s-2);for(let a=f;a<=m;++a)for(let n=d;n<=p;++n){let o=a*s+n;if(255===ml[o]){let l=0,h=0,u=-1,d=-1;for(let r=-1;r<=1;++r)for(let o=-1;o<=1;++o){let c=(a+r)*s+n+o;if(ml[c]>=i)continue;let f=ms[c],p=Math.abs(f);p>h&&(l=f,h=p,u=o,d=r)}if(h>.1){let s=1-(i+.5*Math.abs(u*d))/c,h=r._dem.get(n,a)+l*s,f=r._dem.get(n+u,a+d),p=r._dem.get(n-u,a-d,!0);(h-f)*(h-p)>0&&(h=(f+p)/2),ms[o]=r._dem.set(n,a,h),ml[o]=i}}}}}l&&(r._demTile.needsDEMTextureUpload=!0,r._dem._timestamp=tV.now())}setFilter(i){this.filter=i?n1(i):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(i=>this.filter.filter(new nk(this.id.overscaledZ,{worldview:this.worldview}),i.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let i of this.getNodesInfo())fE(i.node),fA(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped());for(let i of this.getNodesInfo()){let r=i.node.footprint;i.hiddenByReplacement=!!r&&!a.some(i=>i.footprint===r)}}getHeightAtTileCoord(i,r){let a=[0,0,0],n=Z([]);for(let o of this.getNodesInfo()){let s=o.node.meshes[0],l=s.transformedAabb;if(i<l.min[0]||r<l.min[1]||i>l.max[0]||r>l.max[1])continue;if(!0===o.node.hidden)return{height:1/0,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]};if(W(n,o.node.globalMatrix),a[0]=i,a[1]=r,a[2]=0,eI(a,a,n),o.node.meshBVH){let i=a[0],r=a[1];mh[0]=i-1,mh[1]=r-1,mh[2]=-1e3,mu[0]=i+1,mu[1]=r+1,mu[2]=1e3;let n=o.node.meshBVH.findHighestPoint(mh,mu);if(null!==n)return{height:n,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]};continue}let h=(a[0]-s.aabb.min[0])/(s.aabb.max[0]-s.aabb.min[0])*64|0,u=64*Math.min(63,(a[1]-s.aabb.min[1])/(s.aabb.max[1]-s.aabb.min[1])*64|0)+Math.min(63,h),c=s.heightmap[u];if(c<0&&o.node.footprint){let a=[];if(o.node.footprint.grid.query(new eJ(i,r),new eJ(i,r),a),a.length>0)return{height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]};continue}if(o.hiddenByReplacement)return;return{height:c,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]}}}}function mp(i,r){return i instanceof aY&&!i.isLightConstant&&r}let mm=new Float64Array(10*mc.length);function m_(i,r,a,n,o){if(!i.featureData)return;let s=i.featureArray=new sT;s.reserveExact(i.featureData.length),function(i,r,a){let n=a-r;for(let a=0;a<mc.length;a++){let o=i.evaluatedRMEA[a],s=i.evaluatedColor[a],l=i.emissionHeightBasedParams[a],h=ts(l[0],0,1),u=ts(l[1],0,1),c=65535,d=0,f=1,p=1;if(h!==u&&0!==n){let i=ts(l[2],0,1),a=ts(l[3],0,1),o=n*(u-h);d=1/o,f=-(r+n*h)/o,p=Math.pow(10,ts(l[4],-1,1)),c=255*i<<8|255*a}let m=10*a;mm[m]=255*s[0],mm[m+1]=255*s[1],mm[m+2]=255*s[2],mm[m+3]=s[3],mm[m+4]=Math.floor(255*o[3]),mm[m+5]=Math.min(Math.round(.5*ts(o[2],0,2)*255),255)<<8|15*o[0]<<4|15*o[1],mm[m+6]=c,mm[m+7]=d,mm[m+8]=f,mm[m+9]=p}}(r,i.aabb.min[2],i.aabb.max[2]);let l=r.node,h=o&&!!l.lights;for(let r of i.featureData){let i=r>>a&65535,o=r>>n&15,u=o<8?o:0,c=10*u,d=(61440&i|(61440&i)>>4)>>8,f=(3840&i|(3840&i)>>4)>>4,p=240&i|(240&i)>>4,m=(15&i|(15&i)<<4)/255,_=mm[c+3];_>0&&(d=iw(d,mm[c],_),f=iw(f,mm[c+1],_),p=iw(p,mm[c+2],_)),d*=m,f*=m,p*=m;let g=d<<8|f,y=p<<8|mm[c+4],x=mm[c+5],v=mm[c+6],b=mm[c+7],w=mm[c+8],T=mm[c+9];if(s.emplaceBack(g,y,x,v,b,w,T),h&&2===u){h=!1;let i=10*l.lights.length,r=new sT;r.reserveExact(i);for(let a=0;a<i;a++)r.emplaceBack(g,y,x,v,b,w,T);l.meshes[l.lightMeshIndex].featureArray=r}}}a2(mf,"Tiled3dModelBucket",{omit:["layers"]}),a2(md,"Tiled3dModelFeature");let mg=["id","tile","layer","source","sourceLayer","state"];class my{constructor(i,r,a,n,o){this.type="Feature",this._vectorTileFeature=i,this._z=r,this._x=a,this._y=n,this.properties=i?i.properties:{},this.id=o}clone(){let i=new my(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(i.state=Object.assign({},this.state)),this.layer&&(i.layer=Object.assign({},this.layer)),this.source&&(i.source=this.source),this.sourceLayer&&(i.sourceLayer=this.sourceLayer),i}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(i){this._geometry=i}toJSON(){let i={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let r of mg)void 0!==this[r]&&(i[r]=this[r]);return i}}class mx extends ig{constructor(i,r,a,n){super(),this.id=i,this.type="model",this.models=[],this._options=r,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(i,r){return d8(this.map._requestManager.transformRequest(i,ie.Model).url,r)}async loadModel(i,r,a){try{let n=await this.loadGLTFFromURI(r.uri,a);if(a.aborted)return;let o=this._modelsInfo.get(i);if(!o)return;let s=fO(n),l=o.modelSpec,h=new fv(i,l.uri,l.position,l.orientation,s);mx.applyModelSpecification(h,l),h.computeBoundsAndApplyParent(),this.models.push(h),o.model=h}catch(n){if(n instanceof Error&&"AbortError"===n.name)return;let a=n instanceof Error?n.message:"Unknown error";this.fire(new ip(Error(`Could not load model ${i} from ${r.uri}: ${a}`)))}}async load(){this._abortController||(this._abortController=new AbortController);let i=this._abortController.signal,r=[];for(let a in this._options.models){let n=this._options.models[a],o=this._modelsInfo.get(a);if(o&&o.model){o.modelSpec=n;let i=o.model;i.position=null!=n.position?new oz(n.position[0],n.position[1]):new oz(0,0),i.orientation=null!=n.orientation?n.orientation:[0,0,0],mx.applyModelSpecification(i,n),i.computeBoundsAndApplyParent(),this.models.push(i)}else o?o.modelSpec=n:(this._modelsInfo.set(a,{modelSpec:n,model:null}),r.push(this.loadModel(a,n,i)))}0!==r.length?(await Promise.allSettled(r),i.aborted||this.fire(new id("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new id("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(i,r){r.nodeOverrides&&mx.convertNodeOverrides(i,r.nodeOverrides),r.materialOverrides&&mx.convertMaterialOverrides(i,r.materialOverrides),r.nodeOverrideNames&&(i.nodeOverrideNames=[...r.nodeOverrideNames]),r.materialOverrideNames&&(i.materialOverrideNames=[...r.materialOverrideNames]),r.featureProperties&&(i.featureProperties=r.featureProperties)}static convertNodeOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.nodeOverrideNames=[],r))i.nodeOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n={orientation:[0,0,0],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(a,"orientation")){let i=a.orientation;i&&(n.orientation=i)}Object.hasOwn(a,"minzoom")&&(n.minZoom=a.minzoom),Object.hasOwn(a,"maxzoom")&&(n.maxZoom=a.maxzoom),i.nodeOverrides.set(r,n)})}static convertMaterialOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.materialOverrideNames=[],r))i.materialOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n=a["model-color"],o={color:void 0!==n?new iS(n[0],n[1],n[2]):new iS(1,1,1),colorMix:0,emissionStrength:0,opacity:1},s=a["model-color-mix-intensity"];void 0!==s&&(o.colorMix=s);let l=a["model-emissive-strength"];void 0!==l&&(o.emissionStrength=l);let h=a["model-opacity"];void 0!==h&&(o.opacity=h),i.materialOverrides.set(r,o)})}onAdd(i){this.map=i,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(let i of this._modelsInfo.values())if(null==i.model)return!1;return!0}getModels(){return this.models}loadTile(i,r){}serialize(){return this._options}setProperty(i,r){return!1}reload(){this.cancelModelRequests();let i=n7(this.id,this.scope);this.map.style.clearSource(i),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(i){this.cancelModelRequests()}setModels(i){this.models=[];let r=new Map;for(let a in i){let n=i[a],o=this._modelsInfo.get(a);o&&o.modelSpec.uri===n.uri&&r.set(a,o)}if(this._modelsInfo.size!==r.size)for(let[i,a]of(this.cancelModelRequests(),r))a.model||r.delete(i);this._modelsInfo=r,this._options.models=i,this.load()}}function mv(i,r,a,n){let o=1<<i.z;r.lat=rm((n/8192+i.y)/o),r.lng=rp((a/8192+i.x)/o)}let mb={circle:class extends oo{constructor(i,r,a,n){super(i,{layout:pb||(pb=new nY({"circle-sort-key":new nW(nK.layout_circle["circle-sort-key"]),"circle-elevation-reference":new nZ(nK.layout_circle["circle-elevation-reference"]),visibility:new nZ(nK.layout_circle.visibility)})),paint:pw||(pw=new nY({"circle-radius":new nW(nK.paint_circle["circle-radius"]),"circle-color":new nW(nK.paint_circle["circle-color"]),"circle-blur":new nW(nK.paint_circle["circle-blur"]),"circle-opacity":new nW(nK.paint_circle["circle-opacity"]),"circle-translate":new nZ(nK.paint_circle["circle-translate"]),"circle-translate-anchor":new nZ(nK.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new nZ(nK.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new nZ(nK.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new nW(nK.paint_circle["circle-stroke-width"]),"circle-stroke-color":new nW(nK.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new nW(nK.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new nZ(nK.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}createBucket(i){return new l3(i)}queryRadius(i){return pR("circle-radius",this,i)+pR("circle-stroke-width",this,i)+pP(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=pz(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a);return pB(i,n,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(i,r,a){let n=pF(this);return{config:new la(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}
vendor: 3,358 bytes, line 7
7is3D(i){return!i&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}mayUse(i){return"HD"===i&&os(this,"circle-elevation-reference",i=>"hd-road-markup"===i)}prepare(){return this.mayUse("HD")?pD():Promise.resolve()}},heatmap:class extends oo{createBucket(i){return new pU(i)}constructor(i,r,a,n){super(i,{layout:h||(h=new nY({visibility:new nZ(nK.layout_heatmap.visibility)})),paint:u||(u=new nY({"heatmap-radius":new nW(nK.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nW(nK.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new nZ(nK.paint_heatmap["heatmap-intensity"]),"heatmap-color":new nX(nK.paint_heatmap["heatmap-color"]),"heatmap-opacity":new nZ(nK.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=pV({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(i){return pR("heatmap-radius",this,i)}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,a);return pB(i,n,s,l,h,!0,!0,new eJ(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(i,r,a){return"heatmap"===i?{config:new la(this,{zoom:r,lut:a}),overrideFog:!1}:{}}},hillshade:class extends oo{constructor(i,r,a,n){super(i,{layout:c||(c=new nY({visibility:new nZ(nK.layout_hillshade.visibility)})),paint:d||(d=new nY({"hillshade-illumination-direction":new nZ(nK.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new nZ(nK.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new nZ(nK.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new nZ(nK.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new nZ(nK.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new nZ(nK.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new nZ(nK.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}},fill:class extends oo{constructor(i,r,a,n){super(i,{layout:f||(f=ne
vendor: 13,115 bytes, line 7
7w nY({"fill-sort-key":new nW(nK.layout_fill["fill-sort-key"]),visibility:new nZ(nK.layout_fill.visibility),"fill-elevation-reference":new nZ(nK.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new nW(nK.layout_fill["fill-construct-bridge-guard-rail"])})),paint:p||(p=new nY({"fill-antialias":new nZ(nK.paint_fill["fill-antialias"]),"fill-opacity":new nW(nK.paint_fill["fill-opacity"]),"fill-color":new nW(nK.paint_fill["fill-color"]),"fill-outline-color":new nW(nK.paint_fill["fill-outline-color"]),"fill-translate":new nZ(nK.paint_fill["fill-translate"]),"fill-translate-anchor":new nZ(nK.paint_fill["fill-translate-anchor"]),"fill-pattern":new nW(nK.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new nZ(nK.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new nZ(nK.paint_fill["fill-emissive-strength"]),"fill-z-offset":new nW(nK.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new nW(nK.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new nW(nK.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){let i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),a=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&a.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),a}getDefaultProgramParams(i,r,a){return{config:new la(this,{zoom:r,lut:a}),overrideFog:!1}}recalculate(i,r){super.recalculate(i,r);let a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&&void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new lc(i)}queryRadius(){return pP(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,a,n,o,s){return!i.queryGeometry.isAboveHorizon&&lT(pL(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),n)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(i){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;let r=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=i?r&&!i:r}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}mayUse(i){return"HD"===i&&os(this,"fill-elevation-reference",i=>"none"!==i)}prepare(){return this.mayUse("HD")?pD():Promise.resolve()}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends oo{constructor(i,r,a,n){super(i,{layout:g||(g=new nY({visibility:new nZ(nK["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new nZ(nK["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new nZ(nK["layout_fill-extrusion"]["source-max-zoom"])})),paint:y||(y=new nY({"fill-extrusion-opacity":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nW(nK["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new nW(nK["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new nW(nK["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nW(nK["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new nW(nK["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new nW(nK["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new nW(nK["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new nW(nK["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new nZ(nK["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new pu(i)}queryRadius(){return pP(this.paint.get("fill-extrusion-translate"))}is3D(i){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(i,r,a,n,o,s,l,h,u){let c=pz(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),d=this.paint.get("fill-extrusion-height").evaluate(r,a),f=this.paint.get("fill-extrusion-base").evaluate(r,a),p=[0,0],m=h&&s.elevation,_=s.elevation?s.elevation.exaggeration():1,g=i.tile.getBucket(this);if(g instanceof pu){let i=g.centroidData.find(i=>u>=i.vertexArrayOffset&&u<i.vertexArrayOffset+i.vertexCount);if(i&&0x40000000&i.flags)return!1;if(m){let i=g.centroidVertexArray,r=u+1;r<i.length&&(p[0]=i.geta_centroid_pos0(r),p[1]=i.geta_centroid_pos1(r))}}if(0===p[0]&&1===p[1])return!1;"globe"===s.projection.name&&(n=py([n],[new eJ(0,0),new eJ(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let[y,x]=p$(s,n,f,d,c,l,m?h:null,p,_,s.center.lat,i.tileID.canonical),v=i.queryGeometry;return pq(y,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends oo{constructor(i,r,a,n){super(i,{layout:x||(x=new nY({visibility:new nZ(nK.layout_building.visibility),"building-facade":new nW(nK.layout_building["building-facade"]),"building-facade-floors":new nW(nK.layout_building["building-facade-floors"]),"building-facade-unit-width":new nW(nK.layout_building["building-facade-unit-width"]),"building-facade-window":new nW(nK.layout_building["building-facade-window"]),"building-roof-shape":new nW(nK.layout_building["building-roof-shape"]),"building-height":new nW(nK.layout_building["building-height"]),"building-base":new nW(nK.layout_building["building-base"]),"building-flood-light-wall-radius":new nW(nK.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new nW(nK.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new nW(nK.layout_building["building-flip-roof-orientation"])})),paint:v||(v=new nY({"building-opacity":new nZ(nK.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new nZ(nK.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new nZ(nK.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new nZ(nK.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new nZ(nK.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new nZ(nK.paint_building["building-vertical-scale"]),"building-cast-shadows":new nZ(nK.paint_building["building-cast-shadows"]),"building-color":new nW(nK.paint_building["building-color"]),"building-emissive-strength":new nW(nK.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new nZ(nK.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new nZ(nK.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new nZ(nK.paint_building["building-front-cutoff"]),"building-flood-light-color":new nZ(nK.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new nZ(nK.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new nZ(nK.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return"HD"===i}prepare(){return async function(){return tS(self)&&null==pE&&null==pS?null!=pT?pT:pT=(function(i){let r,a,n,o,s;function l(){r=new Uint8Array(s.buffer),a=new Int16Array(s.buffer),n=new Int32Array(s.buffer),o=new Float32Array(s.buffer)}function h(){throw Error("Unexpected BuildingGen error.")}let u=()=>{},c={a:{a:h,f:function(i){let a=r.length,n=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*a))-a)/65536);try{return s.grow(n),l(),!0}catch(i){return!1}},g:h,b:u,c:u,d:u,e:u}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,c):i.then(i=>i.arrayBuffer()).then(i=>WebAssembly.instantiate(i,c))).then(i=>{let h=i.instance.exports;return(0,h.g)(),s=h.f,l(),new px({setStyle:h.h,setAOOptions:h.i,setMetricOptions:h.j,setStructuralOptions:h.k,setFacadeOptions:h.l,setFauxFacadeOptions:h.m,setFacadeClassifierOptions:h.n,addFeature:h.o,addFacade:h.p,generateMesh:h.q,getLastError:h.r,getOuterRingLength:h.s,getMeshCount:h.t,getPositionsPtr:h.u,getPositionsLength:h.v,getNormalsPtr:h.w,getNormalsLength:h.x,getAOPtr:h.y,getAOLength:h.z,getUVPtr:h.A,getUVLength:h.B,getFauxFacadePtr:h.C,getFauxFacadeLength:h.D,getIndicesPtr:h.E,getIndicesLength:h.F,getBuildingPart:h.G,getRingCount:h.H,getRingPtr:h.I,getRingLength:h.J,malloc:h.K,free:h.L,heapU8:r,heap16:a,heap32:n,heapF32:o})})})(fetch(tq())).then(i=>{pT=null,pE=i}).catch(i=>{tb("Could not load building-gen"),pT=null,pS=i}):null}()}createBucket(i){return new pM(i)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(i){return!0}queryRadius(i){return 0}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){let d=this.layout.get("building-height").evaluate(r,a),f=this.layout.get("building-base").evaluate(r,a),p=i.tile.getBucket(this).getFootprint(r);if(p){if(0!==p.hiddenFlags)return!1;d=p.height}let[m,_]=p$(s,n,f,d,new eJ(0,0),l,null,[0,0],1,s.center.lat,i.tileID.canonical),g=i.queryGeometry;return pq(m,_,g.isPointQuery()?g.screenBounds:g.screenGeometry)}},line:class extends oo{constructor(i,r,a,n){const o=pQ();super(i,o,r,a,n),o.layout&&(this.layout=new n$(o.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(i){if("line-gradient"===i){let i=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof r6,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}
7else"line-gradient-use-theme"===i&&(this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(i,r){super.recalculate(i,r),this.paint._values["line-floorwidth"]=(S||((S=new p0(pQ().paint.properties["line-width"].specification)).useIntegerZoom=!0),S).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new lJ(i)}getProgramIds(){let i=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&i.push("lineBlendComposite"),i}getDefaultProgramParams(i,r,a){if("lineBlendComposite"===i)return{};let n=pK(this);return{config:new la(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}queryRadius(i){var r,a;return r=pR("line-width",this,i),((a=pR("line-gap-width",this,i))>0?a+2*r:r)/2+Math.abs(pR("line-offset",this,i))+pP(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,a,n,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=pL(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,a),(h=this.paint.get("line-gap-width").evaluate(r,a))>0?h+2*l:l),d=this.paint.get("line-offset").evaluate(r,a);return d&&(n=function(i,r){let a=[],n=new eJ(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;i++){let a=s[i],o=s[i+1],h=0===i?n:a.sub(s[i-1])._unit()._perp(),u=i===s.length-1?n:o.sub(a)._unit()._perp(),c=h._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),l.push(c._mult(r)._add(a))}a.push(l)}return a}(n,d*i.pixelToTileUnitsFactor)),function(i,r,a){for(let n=0;n<r.length;n++){let o=r[n];if(i.length>=3){for(let r=0;r<o.length;r++)if(lC(i,o[r]))return!0}if(function(i,r,a){if(i.length>1){if(lS(i,r))return!0;for(let n=0;n<r.length;n++)if(lI(r[n],i,a))return!0}for(let n=0;n<i.length;n++)if(lI(i[n],r,a))return!0;return!1}(i,o,a))return!0}return!1}(u,n,c)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(i){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}mayUse(i){return"HD"===i&&os(this,"line-elevation-reference",i=>"hd-road-markup"===i)}prepare(){return this.mayUse("HD")?pD():Promise.resolve()}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}onRemove(i){this._destroyLineBlendFbo(i.painter&&i.painter.context&&i.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(i){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),i&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(i),this.lineBlendDensityReadback=null}},symbol:class i extends oo{constructor(i,r,a,n){super(i,p3(),r,a,n,i.layout?i.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Z([]),this.hasOcclusionOpacityProperties=void 0!==i.paint&&("icon-occlusion-opacity"in i.paint||"text-occlusion-opacity"in i.paint)}_handleSpecialPaintPropertyUpdate(i){"icon-occlusion-opacity"!==i&&"text-occlusion-opacity"!==i||(this.hasOcclusionOpacityProperties=!0)}recalculate(i,r){super.recalculate(i,r),this.appearances&&this.appearances.forEach(a=>{a.recalculate(i,r,this.iconImageUseTheme)}),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let a=this.layout.get("text-writing-mode");if(a){let i=[];for(let r of a)i.includes(r)||i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(i,r,a,n){var o,s;let l,h,u,c,d;return this._saturation===i&&this._contrast===r&&this._brightnessMin===a&&this._brightnessMax===n||(this._colorAdjustmentMatrix=(o=i,s=r,o=tk(o),s=tB(s),l=q(),u=1-2*(h=o/3),c=.5-.5*s,X(l,[d=n-a,0,0,0,0,d,0,0,0,0,d,0,a,a,a,1],[s,0,0,0,0,s,0,0,0,0,s,0,c,c,c,1]),X(l,l,[u,h,h,0,h,u,h,0,h,h,u,0,0,0,0,1]),l),this._saturation=i,this._contrast=r,this._brightnessMin=a,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(i,r,a,n){let o=this.layout.get(i).evaluate(r,{},a,n),s=this._unevaluatedLayout._values[i];return s.isDataDriven()||aW(s.value)||!o?o:p1(r.properties,o)}getAppearanceValueAndResolveTokens(i,r,a,n,o){let s=i.getLayoutProperty(r);if(!s)return;let l=s.evaluate(a,{},n,o),h=i.getUnevaluatedLayoutProperties()._values[r];return h.isDataDriven()||aW(h.value)||!l||"string"!=typeof l?l:p1(a.properties,l)}createBucket(i){return new cJ(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let r of p3().paint.overridableProperties){if(!i.hasPaintOverride(this.layout,r))continue;let a=this.paint.get(r),n=new aZ(new p2(a),a.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme")),o=null;o="constant"===a.value.kind||"source"===a.value.kind?new aY("source",n):new aK("composite",n,a.value.zoomStops,a.value.interpolationType),this.paint._values[r]=new nq(a.property,o,a.parameters)}}_handleOverridablePaintPropertyUpdate(r,a,n){return!(!this.layout||a.isDataDriven()||n.isDataDriven())&&i.hasPaintOverride(this.layout,r)}static hasPaintOverride(i,r){let a=i.get("text-field"),n=p3().paint.properties[r],o=!1,s=i=>{for(let r of i)if(n.overrides&&n.overrides.hasOverride(r))return void(o=!0)};if("constant"===a.value.kind&&a.value.value instanceof iK)s(a.value.value.sections);else if("source"===a.value.kind){let i=r=>{o||(r instanceof i4&&i2(r.value)===iU?s(r.value.sections):r instanceof i9?s(r.sections):r.eachChild(i))},r=a.value;r._styleExpression&&i(r._styleExpression.expression)}return o}getProgramIds(){return["symbol"]}getDefaultProgramParams(i,r,a){return{config:new la(this,{zoom:r,lut:a}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}mayUse(i){return"HD"===i&&os(this,"symbol-elevation-reference",i=>"hd-road-markup"===i)}prepare(){return this.mayUse("HD")?pD():Promise.resolve()}},background:class extends oo{constructor(i,r,a,n){super(i,{layout:M||(M=new nY({visibility:new nZ(nK.layout_background.visibility)})),paint:C||(C=new nY({"background-pitch-alignment":new nZ(nK.paint_background["background-pitch-alignment"]),"background-color":new nZ(nK.paint_background["background-color"]),"background-pattern":new nZ(nK.paint_background["background-pattern"]),"background-opacity":new nZ(nK.paint_background["background-opacity"]),"background-emissive-strength":new nZ(nK.paint_background["background-emissive-strength"]),"background-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}is3D(i){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:p7,"raster-particle":me,sky:class extends oo{constructor(i,r,a,n){super(i,{layout:z||(z=ne
7w nY({visibility:new nZ(nK.layout_sky.visibility)})),paint:O||(O=new nY({"sky-type":new nZ(nK.paint_sky["sky-type"]),"sky-atmosphere-sun":new nZ(nK.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new nZ(nK.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new nZ(nK.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new nZ(nK.paint_sky["sky-gradient-radius"]),"sky-gradient":new nX(nK.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new nZ(nK.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new nZ(nK.paint_sky["sky-atmosphere-color"]),"sky-opacity":new nZ(nK.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(i){"sky-gradient"===i?this._updateColorRamp():"sky-atmosphere-sun"!==i&&"sky-atmosphere-halo-color"!==i&&"sky-atmosphere-color"!==i&&"sky-atmosphere-sun-intensity"!==i||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=pV({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if("atmosphere"===this.paint.get("sky-type")){let a=this.paint.get("sky-atmosphere-sun"),n=!a,o=i.style.light,s=o.properties.get("position");return n&&"viewport"===o.properties.get("anchor")&&tb("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?mi(s.azimuthal,90-s.polar,r):mi(a[0],90-a[1],r)}let a=this.paint.get("sky-gradient-center");return mi(a[0],90-a[1],r)}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let i=this.paint.get("sky-type");return"atmosphere"===i?["skyboxCapture","skybox"]:"gradient"===i?["skyboxGradient"]:null}},slot:class extends oo{constructor(i,r,a,n){super(i,{paint:F||(F=new nY({}))},r,null)}},model:class extends oo{constructor(i,r,a,n){super(i,{layout:B||(B=new nY({visibility:new nZ(nK.layout_model.visibility),"model-id":new nW(nK.layout_model["model-id"]),"model-allow-density-reduction":new nZ(nK.layout_model["model-allow-density-reduction"])})),paint:k||(k=new nY({"model-opacity":new nW(nK.paint_model["model-opacity"]),"model-rotation":new nW(nK.paint_model["model-rotation"]),"model-scale":new nW(nK.paint_model["model-scale"]),"model-translation":new nW(nK.paint_model["model-translation"]),"model-color":new nW(nK.paint_model["model-color"]),"model-color-mix-intensity":new nW(nK.paint_model["model-color-mix-intensity"]),"model-type":new nZ(nK.paint_model["model-type"]),"model-cast-shadows":new nZ(nK.paint_model["model-cast-shadows"]),"model-receive-shadows":new nZ(nK.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new nZ(nK.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new nW(nK.paint_model["model-emissive-strength"]),"model-roughness":new nW(nK.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new nW(nK.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new nZ(nK.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new nZ(nK.paint_model["model-front-cutoff"]),"model-elevation-reference":new nZ(nK.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new nZ(nK.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new nW({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.layer=i,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return"Standard"===i}prepare(){return async function(){return Promise.resolve()}()}createBucket(i){return new mn(i)}getProgramIds(){return["model"]}is3D(i){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(i){return 8191*(i instanceof mf)}queryRenderedFeatures(i,r,a){let n=r.getSource();if(!(n&&n instanceof mx))return{};let o={};o[this.id]=[];let s=o[this.id],l=0;for(let o of n.models){let n=r.getFeatureState(this.sourceLayer,o.id),h={type:"Unknown",id:o.id,properties:o.featureProperties},u=this.paint.get("model-rotation").evaluate(h,n),c=this.paint.get("model-scale").evaluate(h,n),d=this.paint.get("model-translation").evaluate(h,n),f=this.paint.get("model-elevation-reference"),p=[];fx(p,o,a,o.position,u,c,d,"ground"===f,"ground"===f,!1),"globe"===a.projection.name&&(p=f_(p,a));let m=X([],a.projMatrix,p),_=fg(i.isPointQuery()?i.screenBounds:i.screenGeometry,a,m,o.aabb);if(null!=_){let i=new my(void 0,0,0,0,o.id);i.layer=this.layer,i.properties=structuredClone(o.featureProperties),i.properties.layer=this.id,i.properties.uri=o.uri,i.properties.orientation=o.orientation,i.sourceLayer=this.sourceLayer,i.geometry={type:"Point",coordinates:[o.position.lng,o.position.lat]},i.state=n,i.source=this.source,s.push({featureIndex:l,feature:i,intersectionZ:_})}++l}return o}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){if(!this.modelManager)return!1;let d=this.modelManager,f=i.tile.getBucket(this);if(!(f&&f instanceof mn))return!1;for(let a in f.instancesPerModel){let n=f.instancesPerModel[a],o=void 0!==r.id?r.id:r.properties&&Object.hasOwn(r.properties,"id")?r.properties.id:void 0;if(Object.hasOwn(n.idToFeaturesIndex,o)){let r=n.features[n.idToFeaturesIndex[o]],l=d.getModel(a,c||this.scope);if(!l)return!1;let h=[],u=new oz(0,0),p=f.canonical,m=Number.MAX_VALUE;for(let a=0;a<r.instancedDataCount;++a){let o=16*(r.instancedDataOffset+a),c=n.instancedDataArray.float32,d=[c[o+4],c[o+5],c[o+6]];mv(p,u,Math.floor(c[o]),Math.floor(c[o+1])),fx(h,l,s,u,r.rotation,r.scale,d,!1,!1,!1),"globe"===s.projection.name&&(h=f_(h,s));let f=X([],s.projMatrix,h),_=i.queryGeometry,g=fg(_.isPointQuery()?_.screenBounds:_.screenGeometry,s,f,l.aabb);null!=g&&(m=Math.min(g,m))}return m!==Number.MAX_VALUE&&m}}return!1}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven()||"model-color"!==i&&"model-color-mix-intensity"!==i&&"model-rotation"!==i&&"model-scale"!==i&&"model-translation"!==i&&"model-emissive-strength"!==i)}_isPropertyZoomDependent(i){let r=this._transitionablePaint._values[i];return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof aK}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends oo{constructor(i,r,a,n){super(i,{layout:m||(m=new nY({"clip-layer-types":ne
7w nZ(nK.layout_clip["clip-layer-types"]),"clip-layer-scope":new nZ(nK.layout_clip["clip-layer-scope"]),visibility:new nZ(nK.layout_clip.visibility)})),paint:_||(_=new nY({}))},r,a,n)}recalculate(i,r){super.recalculate(i,r)}createBucket(i){return new pj(i)}is3D(i){return!0}}};class mw{constructor(i){this.capacity=i,this.cache=new Map}get(i){if(!this.cache.has(i))return;let r=this.cache.get(i);return this.cache.delete(i),this.cache.set(i,r),r}put(i,r){this.cache.has(i)?this.cache.delete(i):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(i,r)}delete(i){this.cache.delete(i)}}a2(mw,"LRUCache");class mT{constructor(i){this._callback=i,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}class mS{constructor(i){this._stringToNumber={},this._numberToString=[];for(let r=0;r<i.length;r++){const a=i[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(i){return this._stringToNumber[i]}decode(i){return this._numberToString[i]}}class mE{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new a0(8192,8192,512),this.featureIndexArray=new sO,this.promoteId=r,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(i,r,a,n,o,s=0,l=0){let h=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,n,o,s);let u=this.grid;for(let i=0;i<r.length;i++){let a=r[i],n=[1/0,1/0,-1/0,-1/0];for(let i=0;i<a.length;i++){let r=a[i];n[0]=Math.min(n[0],r.x),n[1]=Math.min(n[1],r.y),n[2]=Math.max(n[2],r.x),n[3]=Math.max(n[3],r.y)}0!==l&&(n[0]-=l,n[1]-=l,n[2]+=l,n[3]+=l),n[0]<8192&&n[1]<8192&&n[2]>=0&&n[3]>
7=0&&u.insert(h,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new lb(new hp(this.rawTileData)).layers,this.sourceLayerCoder=new mS(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r){let a,{tilespaceGeometry:n,transform:o,tileTransform:s,pixelPosMatrix:l,availableImages:h,worldview:u}=r;this.loadVTLayers(),this.serializedLayersCache.clear();let c=r.queryRadius?r.queryRadius:0,d=n.bufferedTilespaceBounds,f=this.grid.queryKeys(d.min.x,d.min.y,d.max.x,d.max.y,(i,r,a,o)=>lD(n.bufferedTilespaceGeometry,i-c,r-c,a+c,o+c));f.sort(mA);let p=null;o.elevation&&f.length>0&&(p=mo.create(o.elevation,this.tileID));let m={};for(let c=0;c<f.length;c++){let d=f[c];if(d===a)continue;a=d;let _=this.featureIndexArray.get(d),g=null;this.is3DTile?this.loadMatchingModelFeature(m,_,i,n,o,u):this.loadMatchingFeature(m,_,i,h,u,(i,a,h,u=0)=>(g||(g=oq(i,this.tileID.canonical,s)),a.queryIntersectsFeature(n,i,h,g,this.z,o,l,p,u,r.scope)))}return m}loadMatchingFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h,sourceLayerIndex:u,layoutVertexArrayOffset:c}=r,d=this.bucketLayerIDs[h],f=a.layers,p=Object.keys(f);if(p.length&&!tx(p,d))return;let m=a.sourceCache,_=this.sourceLayerCoder.decode(u),g=this.vtLayers[_].feature(l),y=this.getId(g,_);for(let r=0;r<d.length;r++){let a=d[r];if(!f[a])continue;let{styleLayer:h,targets:u}=f[a],p={};void 0!==y&&(p=m.getFeatureState(h.sourceLayer,y));let _=!s||s(g,h,p,c);if(!_)continue;let x=new my(g,this.z,this.x,this.y,y);x.tile=this.tileID.canonical,x.state=p;let v=this.serializedLayersCache.get(a);v||((v=h.serialize()).id=a,this.serializedLayersCache.set(a,v)),x.source=v.source,x.sourceLayer=v["source-layer"],x.layer=Object.assign({},v),x.layer.paint=mI(v.paint,h.paint,g,p,n),x.layer.layout=mI(v.layout,h.layout,g,p,n);let b=!1;for(let i of u){this.updateFeatureProperties(x,i);let{filter:r}=i;if(r){if(g.properties=x.properties,r.needGeometry){let i=o$(g,!0);if(!r.filter(new nk(this.tileID.overscaledZ,{worldview:o}),i,this.tileID.canonical))continue}else if(!r.filter(new nk(this.tileID.overscaledZ,{worldview:o}),g))continue}b=!0,i.targetId&&this.addFeatureVariant(x,i)}b&&this.appendToResult(i,a,l,x,_)}}loadMatchingModelFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h}=r,u=this.bucketLayerIDs[h],c=a.layers,d=Object.keys(c);if(!d.length||tx(d,u))for(let r=0;r<u.length;r++){let h=u[r],{styleLayer:d,targets:f}=c[h];if("model"!==d.type)continue;let p=n.tile,m=p.getBucket(d);if(!(m&&m instanceof mf))continue;let _=function(i,r,a,n){let o=i.getNodesInfo()[r];if(!o||o.hiddenByReplacement||!o.node.meshes)return;let s=Number.MAX_VALUE,l=o.node,h=a.tile,u=n.calculatePosMatrix(h.tileID.toUnwrapped(),n.worldSize),c=o.evaluatedScale,d=0;n.elevation&&l.elevation&&(d=l.elevation*n.elevation.exaggeration()),Y(u,u,[(l.anchor?l.anchor[0]:0)*(c[0]-1),(l.anchor?l.anchor[1]:0)*(c[1]-1),d]),K(u,u,c);let f=a.queryGeometry,p=f.isPointQuery()?f.screenBounds:f.screenGeometry,m=function(i){let r=X([],u,i.globalMatrix);X(r,n.expandedFarZProjMatrix,r);for(let a=0;a<i.meshes.length;++a){let o=i.meshes[a];if(a===i.lightMeshIndex)continue;let l=fg(p,n,r,o.aabb);null!=l&&(s=Math.min(l,s))}if(i.children)for(let r of i.children)m(r)};if(m(l),s===Number.MAX_VALUE)return;let _=new oz(0,0);return mv(h.tileID.canonical,_,o.node.anchor[0],o.node.anchor[1]),{intersectionZ:s,position:_,feature:o.feature}}(m,l,n,o);if(!_)continue;let{z:g,x:y,y:x}=p.tileID.canonical,{feature:v,intersectionZ:b,position:w}=_,T={};void 0!==v.id&&(T=a.sourceCache.getFeatureState(d.sourceLayer,v.id));let S=new my({},g,y,x,v.id);S.tile=this.tileID.canonical,S.state=T,S.properties=v.properties,S.geometry={type:"Point",coordinates:[w.lng,w.lat]};let E=this.serializedLayersCache.get(h);E||((E=d.serialize()).id=h,this.serializedLayersCache.set(h,E)),S.source=E.source,S.sourceLayer=E["source-layer"],S.layer=Object.assign({},E);let I=!1;for(let i of f){this.updateFeatureProperties(S,i);let{filter:r}=i;if(r){if(v.properties=S.properties,r.needGeometry){if(!r.filter(new nk(this.tileID.overscaledZ,{worldview:s}),v,this.tileID.canonical))continue}else if(!r.filter(new nk(this.tileID.overscaledZ,{worldview:s}),v))continue}I=!0,i.targetId&&this.addFeatureVariant(S,i)}I&&this.appendToResult(i,h,l,S,b)}}updateFeatureProperties(i,r,a){if(r.properties){let n={};for(let o in r.properties){let s=r.properties[o].evaluate({zoom:this.z},i._vectorTileFeature,i.state,i.tile,a);null!=s&&(n[o]=s)}i.properties=n}}addFeatureVariant(i,r,a){let n={target:r.target,namespace:r.namespace,uniqueFeatureID:r.uniqueFeatureID};r.properties&&(n.properties=i.properties),i.variants=i.variants||{},i.variants[r.targetId]=i.variants[r.targetId]||[],i.variants[r.targetId].push(n)}appendToResult(i,r,a,n,o){let s=i[r];void 0===s&&(s=i[r]=[]),s.push({featureIndex:a,feature:n,intersectionZ:o})}lookupSymbolFeatures(i,r,a,n,o,s){let l={};
7for(let h of(this.loadVTLayers(),i))this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:a,featureIndex:h,layoutVertexArrayOffset:0},n,o,s);return l}loadFeature(i){let{featureIndex:r,sourceLayerIndex:a}=i;this.loadVTLayers();let n=this.sourceLayerCoder.decode(a),o=this.vtFeatures[n];if(o[r])return o[r];let s=this.vtLayers[n].feature(r);return o[r]=s,s}hasLayer(i){for(let r of this.bucketLayerIDs)for(let a of r)if(i===a)return!0;return!1}getId(i,r){let a=i.id;if(this.promoteId){let n=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[r];if(null!=n)if(Array.isArray(n)){if(!this.promoteIdExpression){let i=aX(n);if("success"!==i.result){let r=i.value.map(i=>`${i.key}: ${i.message}`).join(", ");return void tb(`Failed to create expression for promoteId: ${r}`)}this.promoteIdExpression=i.value}a=this.promoteIdExpression.evaluate({zoom:0},i)}else a=i.properties[n];"boolean"==typeof a&&(a=Number(a))}return a}}function mI(i,r,a,n,o){return t_(i,(i,s)=>{let l=r instanceof n$?r.get(s):null;return l&&l.evaluate?l.evaluate(a,n,void 0,o):l})}function mA(i,r){return r-i}function mM(i,r){let a={};if(!r)return a;for(let n of i){let i=n.layerIds.map(i=>r.getLayer(i)).filter(Boolean);if(0!==i.length)for(let r of(n.layers=i,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(r=>i.filter(i=>i.id===r)[0])),n.updateExpressions&&n.updateExpressions(i),i))a[r.fqid]=n}return a}a2(mE,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let mC=new Uint16Array(8184);for(let i=0;i<2046;i++){let r=i+2,a=0,n=0,o=0,s=0,l=0,h=0;for(1&r?o=s=l=32:a=n=h=32;(r>>=1)>1;){let i=a+o>>1,u=n+s>>1;1&r?(o=a,s=n,a=l,n=h):(a=o,n=s,o=l,s=h),l=i,h=u}let u=4*i;mC[u+0]=a,mC[u+1]=n,mC[u+2]=o,mC[u+3]=s}let mD=new Uint16Array(2178),mR=new Uint8Array(1089),mP=new Uint16Array(1089);function mL(i){return 0===i?-.03125:.03125*(32===i)}let mz={Other:0,Symbol:1,FillExtrusion:2,HdRoadCoverage:3},mO={type:2,extent:8192,loadGeometry:()=>[[new eJ(0,0),new eJ(8193,0),new eJ(8193,8193),new eJ(0,8193),new eJ(0,0)]]};class mF{constructor(){this.tasks=new Map,tm(["process"],this),this.invoker=new mT(this.process),this.nextId=0}add(i,r){let a=this.nextId++,n=function({type:i,renderSourceType:r,zoom:a}){a=a||0;let n=r===mz.Symbol;return"message"===i?0:"maybePrepare"!==i||n?"parseTile"!==i||n?"parseTile"===i&&n?300-a:"maybePrepare"===i&&n?400-a:500:200-a:100-a}(r);return 0===n?(i(),null):(this.tasks.set(a,{fn:i,metadata:r,priority:n,id:a}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(a)}})}process(){{let i=this.pick();if(!i)return;this.tasks.delete(i.id),this.tasks.size>0&&this.invoker.trigger(),i.fn()}}pick(){let i=null,r=1/0;for(let a of this.tasks.values())a.priority<r&&(r=a.priority,i=a);return i}remove(){this.tasks.clear(),this.invoker.remove()}}var mB=Uint8Array,mk=Uint16Array,mN=Int32Array,mU=new mB([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mV=new mB([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),mj=new mB([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mG=function(i,r){for(var a=new mk(31),n=0;n<31;++n)a[n]=r+=1<<i[n-1];var o=new mN(a[30]);for(n=1;n<30;++n)for(var s=a[n];s<a[n+1];++s)o[s]=s-a[n]<<5|n;return{b:a,r:o}},mH=mG(mU,2),mq=mH.b,m$=mH.r;mq[28]=258,m$[258]=28;for(var mZ=mG(mV,0).b,mW=new mk(32768),mX=0;mX<32768;++mX){var mY=(43690&mX)>>1|(21845&mX)<<1;mW[mX]=((65280&(mY=(61680&(mY=(52428&mY)>>2|(13107&mY)<<2))>>4|(3855&mY)<<4))>>8|(255&mY)<<8)>>1}var mK=function(i,r,a){for(var n=i.length,o=0,s=new mk(r);o<n;++o)i[o]&&++s[i[o]-1];var l,h=new mk(r);for(o=1;o<r;++o)h[o]=h[o-1]+s[o-1]<<1;l=new mk(1<<r);var u=15-r;for(o=0;o<n;++o)if(i[o])for(var c=o<<4|i[o],d=r-i[o],f=h[i[o]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)l[mW[f]>>u]=c;return l},mJ=new mB(288);for(mX=0;mX<144;++mX)mJ[mX]=8;for(mX=144;mX<256;++mX)mJ[mX]=9;for(mX=256;mX<280;++mX)mJ[mX]=7;for(mX=280;mX<288;++mX)mJ[mX]=8;var mQ=new mB(32);for(mX=0;mX<32;++mX)mQ[mX]=5;var m0=mK(mJ,9),m1=mK(mQ,5),m2=function(i){for(var r=i[0],a=1;a<i.length;++a)i[a]>r&&(r=i[a]);return r},m3=function(i,r,a){var n=r/8|0;return(i[n]|i[n+1]<<8)>>(7&r)&a},m4=function(i,r){var a=r/8|0;return(i[a]|i[a+1]<<8|i[a+2]<<16)>>(7&r)}
7,m5=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],m6=function(i,r,a){var n=Error(r||m5[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,m6),!a)throw n;return n},m8=new mB(0),m9="u">typeof TextDecoder&&new TextDecoder;try{m9.decode(m8,{stream:!0})}catch(i){}let m7={gzip_data:"gzip"};class _e extends Error{constructor(i){super(i),this.name="MRTError"}}let _t={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},_i={uint32:1,uint16:2,uint8:4},_r={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class _a{constructor(i=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=i}getLayer(i){let r=this.layers[i];if(!r)throw new _e(`Layer '${i}' not found`);return r}getHeaderLength(i){let r=new Uint8Array(i),a=new DataView(i);if(13!==r[0])throw new _e("File is not a valid MRT.");return a.getUint32(1,!0)}parseHeader(i){let r=new Uint8Array(i),a=this.getHeaderLength(i);if(r.length<a)throw new _e(`Expected header with length >= ${a} but got buffer of length ${r.length}`);let n=function(i){let r,a={headerLength:0,x:0,y:0,z:0,layers:[]};for(;r=i.nextField(void 0);)1===r?a.headerLength=i.readFixed32():2===r?a.x=i.readVarint():3===r?a.y=i.readVarint():4===r?a.z=i.readVarint():5===r&&a.layers.push(function(i,r){let a,n={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};for(;a=i.nextField(r);)1===a?n.version=i.readVarint():2===a?n.name=i.readString():3===a?n.units=i.readString():4===a?n.tileSize=i.readVarint():5===a?n.buffer=i.readVarint():6===a?n.pixelFormat=i.readVarint():7===a&&n.dataIndex.push(function(i,r){let a={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},n,o=0,s=0;for(;n=i.nextField(r);)1===n?a.firstByte=i.readFixed64():2===n?a.lastByte=i.readFixed64():3===n?a.filters.push(function(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(n.delta_filter=function(i,r){let a,n={blockSize:0};for(;a=i.nextField(r);)1===a&&(n.blockSize=i.readVarint());return n}(i,i.readVarint()+i.pos),n.filter="delta_filter"):2===a?(i.readVarint(),n.filter="zigzag_filter"):3===a?(i.readVarint(),n.filter="bitshuffle_filter"):4===a&&(i.readVarint(),n.filter="byteshuffle_filter");return n}(i,i.readVarint()+i.pos)):4===n?a.codec=function(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(i.readVarint(),n.codec="gzip_data"):2===a?(i.readVarint(),n.codec="jpeg_image"):3===a?(i.readVarint(),n.codec="webp_image"):4===a&&(i.readVarint(),n.codec="png_image");return n}(i,i.readVarint()+i.pos):5===n?s=i.readFloat():6===n?o=i.readFloat():7===n?a.bands.push(i.readString()):8===n?a.offset=i.readDouble():9===n&&(a.scale=i.readDouble());return 0===a.offset&&(a.offset=s),0===a.scale&&(a.scale=o),a}(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos));return a}(new N(r.subarray(0,a)));if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new _e(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);for(let i of(this.x=n.x,this.y=n.y,this.z=n.z,n.layers))this.layers[i.name]=new _n(i,{cacheSize:this._cacheSize});return this}createDecodingTask(i){let r=[],a=this.getLayer(i.layerName);for(let n of i.blockIndices){let o=a.dataIndex[n],s=o.firstByte-i.firstByte,l=o.lastByte-i.firstByte;if(a._blocksInProgress.has(n))continue;let h={layerName:a.name,firstByte:s,lastByte:l,pixelFormat:a.pixelFormat,blockIndex:n,blockShape:[o.bands.length].concat(a.bandShape),buffer:a.buffer,codec:o.codec.codec,filters:o.filters.map(i=>i.filter)};a._blocksInProgress.add(n),r.push(h)}return new _o(r,()=>{r.forEach(i=>a._blocksInProgress.delete(i.blockIndex))},(i,n)=>{if(r.forEach(i=>a._blocksInProgress.delete(i.blockIndex)),i)throw i;n.forEach(i=>{this.getLayer(i.layerName).processDecodedData(i)})})}}class _n{constructor({version:i,name:r,units:a,tileSize:n,pixelFormat:o,buffer:s,dataIndex:l},h){if(this.version=i,1!==this.version)throw new _e(`Cannot parse raster layer encoded with MRT version ${i}`);this.name=r,this.units=a,this.tileSize=n,this.buffer=s,this.pixelFormat=_t[o],this.dataIndex=l,this.bandShape=[n+2*s,n+2*s,_i[this.pixelFormat]],this._decodedBlocks=new mw(h?h.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return _i[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:i})=>i).flat()}processDecodedData(i){let r=i.blockIndex.toString();this._decodedBlocks.get(r)||this._decodedBlocks.put(r,i.data)}getBlockForBand(i){let r=0;switch(typeof i){case"string":for(let[a,n]of this.dataIndex.entries()){for(let[o,s]of n.bands.entries())if(s===i)return{bandIndex:r+o,blockIndex:a,blockBandIndex:o};r+=n.bands.length}break;case"number":for(let[a,n]of this.dataIndex.entries()){if(i>=r&&i<r+n.bands.length)return{bandIndex:i,blockIndex:a,blockBandIndex:i-r};r+=n.bands.length}break;default:throw new _e(`Invalid band \`${JSON.stringify(i)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(i){let r=1/0,a=-1/0,n=[],o=new Set;for(let s of i){let{blockIndex:i}=this.getBlockForBand(s);if(i<0)throw new _e(`Invalid band: ${JSON.stringify(s)}`);let l=this.dataIndex[i];n.includes(i)||n.push(i),o.add(i),r=Math.min(r,l.firstByte),a=Math.max(a,l.lastByte)}if(o.size>this.cacheSize)throw new _e(`Number of blocks to decode (${o.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:r,lastByte:a,blockIndices:n}}hasBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0}hasDataForBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0&&!!this._decodedBlocks.get(r.toString())}getBandView(i){let{blockIndex:r,blockBandIndex:a}=this.getBlockForBand(i);if(r<0)throw new _e(`Band not found: ${JSON.stringify(i)}`);let n=this._decodedBlocks.get(r.toString());if(!n)throw new _e(`Data for band ${JSON.stringify(i)} of layer "${this.name}" not decoded.`);let o=this.dataIndex[r],s=this.bandShape.reduce((i,r)=>i*r,1),l=a*s,h=n.subarray(l,l+s);return{data:h,bytes:new Uint8Array(h.buffer).subarray(h.byteOffset,h.byteOffset+h.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:o.offset,scale:o.scale}}}_a.setPbf=function(i){N=i};class _o{constructor(i,r,a){this.tasks=i,this._onCancel=r,this._onComplete=a,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(i,r){this._finalized||(this._onComplete(i,r),this._finalized=!0)}}function _s(i,r,a){try{r=function(i){if(!i.variants)return i;
7if(!Array.isArray(i.variants))throw Error("variants must be an array");for(let r of i.variants){if(null==r||"object"!=typeof r||r.constructor!==Object)throw Error("variant must be an object");if(!Array.isArray(r.capabilities))throw Error("capabilities must be an array");if(1===r.capabilities.length&&"meshopt"===r.capabilities[0])return Object.assign(i,r)}return i}(r)}catch(i){return Error("Failed to process TileJSON variants",{cause:i})}let n=tc(Object.assign({},r,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return i.url&&r.tiles&&i.tiles&&(n.tiles=r.tiles),n.tiles=a.canonicalizeTileset(n,i.url),n}_a.performDecoding=function(i,r){let a=new Uint8Array(i);return Promise.all(r.tasks.map(i=>{let{layerName:r,firstByte:n,lastByte:o,pixelFormat:s,blockShape:l,blockIndex:h,filters:u,codec:c}=i,d=a.subarray(n,o+1),f=new Uint32Array(l[0]*l[1]*l[2]);if("gzip_data"!==c)throw new _e(`Unhandled codec: ${c}`);return(function(i,r){var a,n,o;if(!globalThis.DecompressionStream&&"gzip_data"===r)return Promise.resolve(((o=function(i){31==i[0]&&139==i[1]&&8==i[2]||m6(6,"invalid gzip data");var r=i[3],a=10;4&r&&(a+=2+(i[10]|i[11]<<8));for(var n=(r>>3&1)+(r>>4&1);n>0;n-=!i[a++]);return a+(2&r)}(i))+8>i.length&&m6(6,"invalid gzip data"),function(i,r,a,n){var o,s,l=i.length;if(!l||r.f&&!r.l)return a||new mB(0);var h=!a,u=h||2!=r.i,c=r.i;h&&(a=new mB(3*l));var d=function(i){var r=a.length;if(i>r){var n=new mB(Math.max(2*r,i));n.set(a),a=n}},f=r.f||0,p=r.p||0,m=r.b||0,_=r.l,g=r.d,y=r.m,x=r.n,v=8*l;do{if(!_){f=m3(i,p,1);var b=m3(i,p+1,3);if(p+=3,!b){var w=i[(L=((p+7)/8|0)+4)-4]|i[L-3]<<8,T=L+w;if(T>l){c&&m6(0);break}u&&d(m+w),a.set(i.subarray(L,T),m),r.b=m+=w,r.p=p=8*T,r.f=f;continue}if(1==b)_=m0,g=m1,y=9,x=5;else if(2==b){var S=m3(i,p,31)+257,E=m3(i,p+10,15)+4,I=S+m3(i,p+5,31)+1;p+=14;for(var A=new mB(I),M=new mB(19),C=0;C<E;++C)M[mj[C]]=m3(i,p+3*C,7);p+=3*E;var D=m2(M),R=(1<<D)-1,P=mK(M,D);for(C=0;C<I;){var L,z=P[m3(i,p,R)];if(p+=15&z,(L=z>>4)<16)A[C++]=L;else{var O=0,F=0;for(16==L?(F=3+m3(i,p,3),p+=2,O=A[C-1]):17==L?(F=3+m3(i,p,7),p+=3):18==L&&(F=11+m3(i,p,127),p+=7);F--;)A[C++]=O}}var B=A.subarray(0,S),k=A.subarray(S);y=m2(B),x=m2(k),_=mK(B,y),g=mK(k,x)}else m6(1);if(p>v){c&&m6(0);break}}u&&d(m+131072);for(var N=(1<<y)-1,U=(1<<x)-1,V=p;;V=p){var j=(O=_[m4(i,p)&N])>>4;if((p+=15&O)>v){c&&m6(0);break}if(O||m6(2),j<256)a[m++]=j;else{if(256==j){V=p,_=null;break}var G=j-254;j>264&&(G=m3(i,p,(1<<($=mU[C=j-257]))-1)+mq[C],p+=$);var H=g[m4(i,p)&U],q=H>>4;if(H||m6(3),p+=15&H,k=mZ[q],q>3){var $=mV[q];k+=m4(i,p)&(1<<$)-1,p+=$}if(p>v){c&&m6(0);break}u&&d(m+131072);var Z=m+G;if(m<k){var W=0-k,X=Math.min(k,Z);for(W+m<0&&m6(3);m<X;++m)a[m]=n[W+m]}for(;m<Z;++m)a[m]=a[m-k]}}r.l=_,r.p=V,r.b=m,r.f=f,_&&(f=1,r.m=y,r.d=g,r.n=x)}while(!f)return m!=a.length&&h?(o=a,(null==(s=m)||s>o.length)&&(s=o.length),new mB(o.subarray(0,s))):a.subarray(0,m)}(i.subarray(o,-8),{i:2},new mB((i[(n=i.length)-4]|i[n-3]<<8|i[n-2]<<16|i[n-1]<<24)>>>0),a)));let s=m7[r];if(!s)throw Error(`Unhandled codec: ${r}`);let l=new globalThis.DecompressionStream(s);return new Response(new Blob([i]).stream().pipeThrough(l)).arrayBuffer().then(i=>new Uint8Array(i))})(d,c).then(i=>((function(i,r){let a;for(;a=i.nextField();)if(2===a)!function(i,r,a){let n;for(;n=i.nextField(r);)if(1===n){let r=0,n=i.readVarint()+i.pos;for(;i.pos<n;)a[r++]=i.readVarint()}}(i,i.readVarint()+i.pos,r);else if(3===a)throw Error("Not implemented")})(new N(i),f),new _r[s](f.buffer))).then(i=>{for(let r=u.length-1;r>=0;r--)switch(u[r]){case"delta_filter":!function(i,r){if(4!==r.length)throw Error(`Expected data of dimension 4 but got ${r.length}.`);let a=r[3];for(let n=2;n>=1;n--){let o=+(1===n),s=+(2===n);for(let n=0;n<r[0];n++){let l=r[1]*n;for(let n=o;n<r[1];n++){let o=r[2]*(n+l);for(let n=s;n<r[2];n++){let s=r[3]*(n+o);for(let n=0;n<r[3];n++){let r=s+n;i[r]+=i[r-a]}}}}a*=r[n]}}(i,l);break;case"zigzag_filter":var a=i;for(let i=0,r=a.length;i<r;i++)a[i]=a[i]>>>1^-(1&a[i]);break;case"bitshuffle_filter":!function(i,r){switch(r){case"uint32":return;case"uint16":for(let r=0;r<i.length;r+=2){let a=i[r],n=i[r+1];i[r]=(240&a)>>4|(61440&a)>>8|(240&n)<<4|61440&n,i[r+1]=15&a|(3840&a)>>4|(15&n)<<8|(3840&n)<<4}return;case"uint8":for(let r=0;r<i.length;r+=4){let a=i[r],n=i[r+1],o=i[r+2],s=i[r+3];i[r+0]=(192&a)>>6|(192&n)>>4|(192&o)>>2|192&s,i[r+1]=(48&a)>>4|(48&n)>>2|48&o|(48&s)<<2,i[r+2]=(12&a)>>2|12&n|(12&o)<<2|(12&s)<<4,i[r+3]=3&a|(3&n)<<2|(3&o)<<4|(3&s)<<6}return;default:throw Error(`Invalid pixel format, "${r}"`)}}(i,s);break;default:throw new _e(`Unhandled filter "${u[r]}"`)}return{layerName:r,blockIndex:h,data:i}}).catch(i=>{throw i})}))},a2(_o,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),a2(_a,"MapboxRasterTile"),a2(_n,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let _l=new Map,_h=new Map;class _u{constructor(i){this.size=i,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(i,r){let a=this.toIdx(i,r);return{min:this.minimums[a],max:this.maximums[a]}}isLeaf(i,r){return this.leaves[this.toIdx(i,r)]}toIdx(i,r){return r*this.size+i}}function _c(i,r,a,n){let o=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(n[l])){if(a[l]<i[l]||a[l]>r[l])return null}else{let h=1/n[l],u=(i[l]-a[l])*h,c=(r[l]-a[l])*h;if(u>c){let i=u;u=c,c=i}if(u>o&&(o=u),c<s&&(s=c),o>s)return null}return o}function _d(i,r,a,n,o,s,l,h,u,c,d){let f=n-i,p=o-r,m=s-a,_=l-i,g=h-r,y=u-a,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=f*x+p*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,S=c[0]-i,E=c[1]-r,I=c[2]-a,A=(S*x+E*v+I*b)*T;if(A<0||A>1)return null;let M=E*m-I*p,C=I*f-S*m,D=S*p-E*f,R=(d[0]*M+d[1]*C+d[2]*D)*T;return R<0||A+R>1?null:(_*M+g*C+y*D)*T}function _f(i,r,a,n,o,s,l,h,u){let c=1<<a,d=s-n,f=l-o;h[0]=(i+0)/c*d+n,h[1]=(r+0)/c*f+o,u[0]=(i+1)/c*d+n,u[1]=(r+1)/c*f+o}class _p{constructor(i){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=i,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const r=function(i){let r=Math.ceil(Math.log2(i.dim/8)),a=[],n=Math.ceil(Math.pow(2,r)),o=1/n,s=(i,r,a,n,o)=>{let s=+!!n;o[0]=i*a,o[1]=r*a,o[2]=(i+1)*a-s,o[3]=(r+1)*a-s},l=new _u(n),h=[];for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),o,!1,h);let a=__(h[0],h[1],i),u=__(h[2],h[1],i),c=__(h[2],h[3],i),d=__(h[0],h[3],i);l.minimums.push(Math.min(a,u,c,d)),l.maximums.push(Math.max(a,u,c,d)),l.leaves.push(1)}for(a.push(l),n/=2;n>=1;n/=2){let i=a.at(-1);l=new _u(n);for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),2,!0,h);let a=i.getElevation(h[0],h[1]),o=i.getElevation(h[2],h[1]),u=i.getElevation(h[2],h[3]),c=i.getElevation(h[0],h[3]),d=i.isLeaf(h[0],h[1]),f=i.isLeaf(h[2],h[1]),p=i.isLeaf(h[2],h[3]),m=i.isLeaf(h[0],h[3]),_=Math.min(a.min,o.min,u.min,c.min),g=Math.max(a.max,o.max,u.max,c.max),y=d&&f&&p&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}a.push(l)}return a}(this.dem),a=r.length-1,n=r[a];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(r,0,0,a,0)}raycastRoot(i,r,a,n,o,s,l=1){return _c([i,r,-100],[a,n,this.maximums[0]*l],o,s)}raycast(i,r,a,n,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,a,n,o,s,l);if(null==h)return null;let u=[],c=[],d=[],f=[],p=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;p.length>0;){let{idx:h,t:x,nodex:v,nodey:b,depth:w}=p.pop();if(this.leaves[h]){_f(v,b,w,i,r,a,n,d,f);let h=1<<w,u=(v+0)/h,c=(v+1)/h,p=(b+0)/h,T=(b+1)/h,S=__(u,p,this.dem)*l,E=__(c,p,this.dem)*l,I=__(c,T,this.dem)*l,A=__(u,T,this.dem)*l,M=_d(d[0],d[1],S,f[0],d[1],E,f[0],f[1],I,o,s),C=_d(f[0],f[1],I,d[0],f[1],A,d[0],d[1],S,o,s),D=Math.min(null!==M?M:Number.MAX_VALUE,null!==C?C:Number.MAX_VALUE);if(D!==Number.MAX_VALUE)return D;{var m,_,g,y;let i=eg([],o,s,x);if(_m(S,E,A,I,(m=i[0],(m-(_=d[0]))/(f[0]-_)),(g=i[1],(g-(y=d[1]))/(f[1]-y)))>=i[2])return x}continue}let T=0;for(let p=0;p<this._siblingOffset.length;p++){_f((v<<1)+this._siblingOffset[p][0],(b<<1)+this._siblingOffset[p][1],w+1,i,r,a,n,d,f),d[2]=-100,f[2]=this.maximums[this.childOffsets[h]+p]*l;let m=_c(d,f,o,s);if(null!=m){u[p]=m;let i=!1;for(let r=0;r<T&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,p),i=!0);i||(c[T]=p),T++}}for(let i=0;i<T;i++){let r=c[i];p.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(v<<1)+this._siblingOffset[r][0],nodey:(b<<1)+this._siblingOffset[r][1],depth:w+1})}}return null}_addNode(i,r,a){return this.minimums.push(i),this.maximums.push(r),this.leaves.push(a),this.childOffsets.push(0),this.nodeCount++}_construct(i,r,a,n,o){if(1===i[n].isLeaf(r,a))return;
7this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);let s=n-1,l=i[s],h=0,u=0;for(let i=0;i<this._siblingOffset.length;i++){let n=2*r+this._siblingOffset[i][0],o=2*a+this._siblingOffset[i][1],s=l.getElevation(n,o),c=l.isLeaf(n,o),d=this._addNode(s.min,s.max,c);c&&(h|=1<<i),u||(u=d)}for(let n=0;n<this._siblingOffset.length;n++)h&1<<n||this._construct(i,2*r+this._siblingOffset[n][0],2*a+this._siblingOffset[n][1],s,u+n)}}function _m(i,r,a,n,o,s){return iw(iw(i,a,s),iw(r,n,s),o)}function __(i,r,a){let n=a.dim,o=ts(i*n-.5,0,n-1),s=ts(r*n-.5,0,n-1),l=Math.floor(o),h=Math.floor(s),u=Math.min(l+1,n-1),c=Math.min(h+1,n-1);return _m(a.get(l,h),a.get(u,h),a.get(l,c),a.get(u,c),o-l,s-h)}let _g={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function _y(i,r,a){return(256*i*256+256*r+a)/10-1e4}function _x(i,r,a){return 256*i+r+a/256-32768}class _v{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(i,r,a,n=!1){if(this.uid=i,r.height!==r.width)throw RangeError("DEM tiles must be square");if(a&&"mapbox"!==a&&"terrarium"!==a)return void tb(`"${a}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const o=this.dim=r.height-2,s=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.floatView=new Float32Array(r.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let i=0;i<o;i++)s[this._idx(-1,i)]=s[this._idx(0,i)],s[this._idx(o,i)]=s[this._idx(o-1,i)],s[this._idx(i,-1)]=s[this._idx(i,0)],s[this._idx(i,o)]=s[this._idx(i,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)]}const l="terrarium"===a?_x:_y;for(let i=0;i<s.length;++i){const r=4*i;this.floatView[i]=l(this.pixels[r],this.pixels[r+1],this.pixels[r+2])}this._timestamp=tV.now()}_buildQuadTree(){this._tree=new _p(this)}get(i,r,a=!1){a&&(i=ts(i,-1,this.dim),r=ts(r,-1,this.dim));let n=this._idx(i,r);return this.floatView[n]}set(i,r,a){let n=this._idx(i,r),o=this.floatView[n];return this.floatView[n]=a,a-o}static getUnpackVector(i){return _g[i]}_idx(i,r){if(i<-1||i>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}static pack(i,r){let a=[0,0,0,0],n=_v.getUnpackVector(r),o=Math.floor((i+n[3])/n[2]);return a[2]=o%256,o=Math.floor(o/256),a[1]=o%256,o=Math.floor(o/256),a[0]=o,a}getPixels(){return new lq({width:this.stride,height:this.stride},this.pixels)}backfillBorder(i,r,a){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let n=r*this.dim,o=r*this.dim+this.dim,s=a*this.dim,l=a*this.dim+this.dim;switch(r){case-1:n=o-1;break;case 1:o=n+1}switch(a){case-1:s=l-1;break;case 1:l=s+1}let h=-r*this.dim,u=-a*this.dim;for(let r=s;r<l;r++)for(let a=n;a<o;a++){let n=4*this._idx(a,r),o=4*this._idx(a+h,r+u);this.pixels[n+0]=i.pixels[o+0],this.pixels[n+1]=i.pixels[o+1],this.pixels[n+2]=i.pixels[o+2],this.pixels[n+3]=i.pixels[o+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}a2(_v,"DEMData"),a2(_p,"DemMinMaxQuadTree",{omit:["dem"]});let _b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_w=new Uint32Array(96);function _T(i,r,a,n){_S(i,a,n),_S(r,2*a,2*n),_S(r,2*a+1,2*n+1)}function _S(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function _E(i,r,a,n){let o=i-a,s=r-n;return o*o+s*s}r.$=class{constructor(i){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(i&&i.maxTextureMemoryMB?i.maxTextureMemoryMB:256)*1024,this.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(i=>{this.cache.delete(i),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}calculateTextureMemory(i){return i.image?Math.ceil(i.image.width*i.image.height*4*(i.patternPositions.size>0?1.33:1)):0}evictTexture(i){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textures.delete(i),this.textureAccessTimes.delete(i),this.textureMemoryUsed-=a,i.uploaded=!1}}evictTexturesIfNeeded(i){for(;this.textureMemoryUsed+i>this.maxTextureMemory&&this.textures.size>0;){let i=null,r=1/0;for(let[a]of this.textures.entries()){if(this.currentFrameAtlases.has(a))continue;let n=this.textureAccessTimes.get(a)||0;n<r&&(r=n,i=a)}if(!i)break;this.evictTexture(i)}}findCachedAtlas(i){let r=this.cache.get(i.hash);if(r){let a=r.deref();if(a&&a.contentDescriptor&&this.isMipmapCompatible(i,a.contentDescriptor))return a}for(let[,r]of this.cache.entries()){let a=r.deref();if(a&&a.contentDescriptor){let r=i.subsetOf(a.contentDescriptor),n=this.isMipmapCompatible(i,a.contentDescriptor);if(r&&n)return a}}}getTextureForAtlas(i,r,a){this.textureAccessTimes.set(i,performance.now()),this.currentFrameAtlases.add(i);let n=this.textures.get(i);if(n)return n;if(i.image){let o=this.calculateTextureMemory(i);return this.evictTexturesIfNeeded(o),n=new h3(r,i.image,a,{useMipmap:!!i.patternPositions.size}),this.textures.set(i,n),this.textureMemoryUsed+=o,n}return null}clearExpiredTextures(){for(let[i]of this.textures.entries())if(!this.isAtlasCached(i)){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textureMemoryUsed-=a}this.textures.delete(i),this.textureAccessTimes.delete(i)}}isAtlasCached(i){if(!i.contentDescriptor)return!1;let r=this.cache.get(i.contentDescriptor.hash);return!!r&&r.deref()===i}getOrCache(i){if(!("image"in i)){let r=this.cache.get(i.sourceAtlasHash);if(r){let i=r.deref();if(i)return i}return tb("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!i.contentDescriptor)return i;let r=i.contentDescriptor,a=r.hash,n=this.cache.get(a);if(n){let i=n.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(r,i.contentDescriptor))return i}return this.cache.set(a,new WeakRef(i)),this.finalizationRegistry.register(i,a,i),i}isMipmapCompatible(i,r){return!i.requiresMipMaps||r.requiresMipMaps}destroyTextures(){for(let i of this.textures.values())i&&i.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(let i of this.textures.values())i&&i.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},r.A=uq,r.B=2,r.C=.0039101094886591446,r.D=_v,r.E=450,r.F=7,r.G=4,r.H=5,r.I=mE,r.J=lc,r.K=pu,r.L=lq,r.M=pC,r.N=class i{constructor(i,r){for(const a of(this.points=i||Array(8).fill([0,0,0]),this.planes=r||Array(6).fill([
70,0,0,0]),this.bounds=uq.fromPoints(this.points),this.projections=[],this.frustumEdges=[ed([],this.points[2],this.points[3]),ed([],this.points[0],this.points[3]),ed([],this.points[4],this.points[0]),ed([],this.points[5],this.points[1]),ed([],this.points[6],this.points[2]),ed([],this.points[7],this.points[3])],this.frustumEdges)){const i=[0,-a[2],a[1]],r=[a[2],0,-a[0]];this.projections.push({axis:i,projection:uU(this.points,this.points[0],i,[0,0])}),this.projections.push({axis:r,projection:uU(this.points,this.points[0],r,[0,0])})}}static fromInvProjectionMatrix(r,a,n,o){let s=Math.pow(2,n),l=[[-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(i=>{var n;let l=ez([],i,r),h=1/l[3]/a*s;return l[0]=l[0]*(n=[h,h,o?1/l[3]:h,h])[0],l[1]=l[1]*n[1],l[2]=l[2]*n[2],l[3]=l[3]*n[3],l}),h=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=ew([],eS([],ed([],l[i[0]],l[i[1]]),ed([],l[i[2]],l[i[1]]))),a=-eT(r,l[i[1]]);return r.concat(a)}),u=[];for(let i=0;i<l.length;i++)u.push([l[i][0],l[i][1],l[i][2]]);return new i(u,h)}intersectsPrecise(i,r,a){for(let a=0;a<r.length;a++)if(!uH(i,r[a]))return 0;for(let r=0;r<this.planes.length;r++)if(!uH(i,this.planes[r]))return 0;let n=this.points,o=n[0][0],s=n[0][1],l=n[0][2];for(let r of a)for(let a of this.frustumEdges){let h=r[1]*a[2]-r[2]*a[1],u=r[2]*a[0]-r[0]*a[2],c=r[0]*a[1]-r[1]*a[0];if(0===h&&0===u&&0===c)continue;let d=1/0,f=-1/0;for(let i=0;i<n.length;i++){let r=n[i],a=(r[0]-o)*h+(r[1]-s)*u+(r[2]-l)*c;a<d&&(d=a),a>f&&(f=a)}let p=1/0,m=-1/0;for(let r=0;r<i.length;r++){let a=i[r],n=(a[0]-o)*h+(a[1]-s)*u+(a[2]-l)*c;n<p&&(p=n),n>m&&(m=n)}if(d>m||p>f)return 0}return 1}containsPoint(i){for(let r of this.planes){let a=r[3];if(eT([r[0],r[1],r[2]],i)+a<0)return!1}return!0}},r.O=class i{constructor(i,r,a,n,o){this.TL=i,this.TR=r,this.BR=a,this.BL=n,this.horizon=o}static fromInvProjectionMatrix(r,a,n){let o=[-1,1,1],s=[1,1,1],l=[1,-1,1],h=[-1,-1,1];return new i(eI(o,o,r),eI(s,s,r),eI(l,l,r),eI(h,h,r),a/n)}},r.P=oM,r.Q=45,r.R=6,r.S=5,r.T=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){for(let i of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))i.destroy();for(let i of this._gridSegments)i.withSkirts.destroy(),i.withoutSkirts.destroy()}_fillGridMeshWithLods(i,r){let a=new oQ,n=new sc,o=[],s=i+1+2,l=r[0]+1,h=r[0]+1+(1+r.length),u=(i,r,a)=>{let n=i===s-1?i-2:0===i?i:i-1;return[n+=24575*!!a,r]};for(let i=0;i<s;++i)a.emplaceBack(...u(i,0,!0));for(let i=0;i<l;++i)for(let r=0;r<s;++r)a.emplaceBack(...u(r,i,0===r||r===s-1));for(let i=0;i<r.length;++i){let n=r[i];for(let i=0;i<s;++i)a.emplaceBack(...u(i,n,!0))}for(let i=0;i<r.length;++i){let l=n.length,u=r[i]+1+2,c=new sc;for(let a=0;a<u-1;a++){let o=a===u-2,l=o?s*(h-r.length+i-a):s;for(let i=0;i<s-1;i++){let r=a*s+i;0===a||o||0===i||i===s-2?(c.emplaceBack(r+1,r,r+l),c.emplaceBack(r+l,r+l+1,r+1)):(n.emplaceBack(r+1,r,r+l),n.emplaceBack(r+l,r+l+1,r+1))}}let d=sG.simpleSegment(0,l,a.length,n.length-l);for(let i=0;i<c.uint16.length;i+=3)n.emplaceBack(c.uint16[i],c.uint16[i+1],c.uint16[i+2]);let f=sG.simpleSegment(0,l,a.length,n.length-l);o.push({withoutSkirts:d,withSkirts:f})}return{vertices:a,indices:n,segments:o}}_createGrid(i){let r=this._fillGridMeshWithLods(64,oC);this._gridSegments=r.segments,this._gridBuffer=i.createVertexBuffer(r.vertices,uB.members),this._gridIndexBuffer=i.createIndexBuffer(r.
7indices,!0)}_createPoles(i){let r=new sc;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let a=new sm,n=new sm,o=new sm,s=new sm;this._poleSegments=[];for(let i=0,r=0;i<6;i++){let l=360/(1<<i);a.emplaceBack(0,-oM,0,.5,0),n.emplaceBack(0,-oM,0,.5,1),o.emplaceBack(0,-oM,0,.5,.5),s.emplaceBack(0,-oM,0,.5,.5);for(let i=0;i<=64;i++){let r=i/64,h=0,u=iw(0,l,r),[c,d,f]=oR(co,cs,u,oM);a.emplaceBack(c,d,f,r,h),n.emplaceBack(c,d,f,r,1-h);let p=u*e7;r=.5+.5*Math.sin(p),h=.5+.5*Math.cos(p),o.emplaceBack(c,d,f,r,h),s.emplaceBack(c,d,f,r,1-h)}this._poleSegments.push(sG.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(a,uO,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,uO,!1),this._texturedPoleNorthVertexBuffer=i.createVertexBuffer(o,uO,!1),this._texturedPoleSouthVertexBuffer=i.createVertexBuffer(s,uO,!1)}getGridBuffers(i,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[i].withSkirts:this._gridSegments[i].withoutSkirts]}getPoleBuffers(i,r){return[r?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,r?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}},r.U=ul,r.V=a0,r.W="hd_road_elevation",r.X="hd_road_coverage",r.Y=0x80000000,r.Z=1,r._=h7,r.a=class{constructor(i,r,a){this.target=i,this.parent=r,this.mapId=a,this.callbacks={},this.cancelCallbacks={},tm(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new mF}send(i,r,a,n,o=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);a&&(a.metadata=s,this.callbacks[l]=a);let h=new Set;return this.target.postMessage({id:l,type:i,hasCallback:!!a,targetMapId:n,mustQueue:o,sourceMapId:this.mapId,data:a4(r,h)},h),{cancel:()=>{a&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(i){let r=i.data;if(!r)return;
7let a=r.id;if(a&&(!r.targetMapId||this.mapId===r.targetMapId))if("<cancel>"===r.type){let i=this.cancelCallbacks[a];delete this.cancelCallbacks[a],i&&i.cancel()}else if(r.mustQueue||tS(self)){let i=this.callbacks[a],n=this.scheduler.add(()=>this.processTask(a,r),i&&i.metadata||{type:"message"});n&&(this.cancelCallbacks[a]=n)}else this.processTask(a,r)}processTask(i,r){if(delete this.cancelCallbacks[i],"<response>"===r.type){let a=this.callbacks[i];delete this.callbacks[i],a&&(r.error?a(a5(r.error)):a(null,a5(r.data)))}else{let a=new Set,n=r.hasCallback?(r,n)=>{this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:r?a4(r):null,data:a4(n,a)},a)}:()=>{},o=a5(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,o,n);else if(this.parent.getWorkerSource){let i=r.type.split("."),{source:a,scope:s}=o;this.parent.getWorkerSource(r.sourceMapId,{type:i[0],source:a,scope:s,uid:0})[i[1]](o,n)}else n(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},r.a$=class{constructor(i,r,a,n){this.context=i,this.format=n,this.size=a,this.texture=i.gl.createTexture();const[o,s,l]=this.size,{gl:h}=i;h.bindTexture(h.TEXTURE_3D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in r&&r.data&&h.texImage3D(h.TEXTURE_3D,0,this.format,o,s,l,0,h1(this.format),h2(this.format),r.data)}bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_3D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}},r.a0=h9,r.a1=iy,r.a2=h5,r.a3=p9,r.a4=iJ,r.a5=class{static calculate(i,r,a){let n=new Set,o=new Map,s=new Set,l=new Set;for(let a of Object.values(i))for(let[i,h]of Object.entries(a.floors)){s.add(i),h.isDefault&&l.add(i),h.conflicts&&o.set(i,h.conflicts);let a=i===r,u=h.connections&&r&&h.connections.has(r);(a||u)&&n.add(i)}let h=i=>{let r=o.get(i)||new Set;for(let a of n)if((o.get(a)||new Set).has(i)||r.has(a))return!0;return!1};if(a)for(let i of a)s.has(i)&&(h(i)||n.add(i));for(let i of l)n.has(i)||h(i)||n.add(i);return n}},r.a6=class i{static from(r){if(!r||void 0===r.byteLength||r.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[a,n]=new Uint8Array(r,0,2);if(219!==a)throw Error("Data does not appear to be in a KDBush format.");let o=n>>4;if(1!==o)throw Error(`Got v${o} data when expected v1.`);let s=_b[15&n];if(!s)throw Error("Unrecognized array type.");let[l]=new Uint16Array(r,2,1),[h]=new Uint32Array(r,4,1);return new i(h,l,s,void 0,r)}constructor(i,r=64,a=Float64Array,n=ArrayBuffer,o){if(isNaN(i)||i<0)throw Error(`Unexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const s=_b.indexOf(this.ArrayType),l=2*i*this.ArrayType.BYTES_PER_ELEMENT,h=i*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-h%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${a}.`);if(o)this.data=o,this.ids=new this.IndexArrayType(o,8,i),this.coords=new a(o,8+h+u,2*i),this._pos=2*i,this._finished=!0;else{const o=this.data=new n(8+l+h+u);this.ids=new this.IndexArrayType(o,8,i),this.coords=new a(o,8+h+u,2*i),this._pos=0,this._finished=!1,new Uint8Array(o,0,2).set([219,16+s]),new Uint16Array(o,2,1)[0]=r,new Uint32Array(o,4,1)[0]=i}}add(i,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=i,this.coords[this._pos++]=r,a}finish(){let i=this._pos>>1;if(i!==this.numItems)throw Error(`Added ${i} items when expected ${this.numItems}.`);return function i(r,a,n,o,s,l){if(s-o<=n)return;let h=o+s>>1;(function i(r,a,n,o,s,l){for(;s>o;){if(s-o>600){let h=s-o+1,u=n-o+1,c=Math.log(h),d=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*d*(h-d)/h)*(u-h/2<0?-1:1);i(r,a,n,Math.max(o,Math.floor(n-u*d/h+f)),Math.min(s,Math.floor(n+(h-u)*d/h+f)),l)}let h=a[2*n+l],u=o,c=s;for(_T(r,a,o,n),a[2*s+l]>h&&_T(r,a,o,s);u<c;){for(_T(r,a,u,c),u++,c--;a[2*u+l]<h;)u++;for(;a[2*c+l]>h;)c--}a[2*o+l]===h?_T(r,a,o,c):_T(r,a,++c,s),c<=n&&(o=c+1),n<=c&&(s=c-1)}})(r,a,h,o,s,l),i(r,a,n,o,h-1,1-l),i(r,a,n,h+1,s,1-l)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,r,a,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:l}=this;_w[0]=0,_w[1]=o.length-1,_w[2]=0;let h=3,u=[];for(;h>0;){let c=_w[--h],d=_w[--h],f=_w[--h];if(d-f<=l){for(let l=f;l<=d;l++){let h=s[2*l],c=s[2*l+1];h>=i&&h<=a&&c>=r&&c<=n&&u.push(o[l])}continue}let p=f+d>>1,m=s[2*p],_=s[2*p+1];m>=i&&m<=a&&_>=r&&_<=n&&u.push(o[p]),(0===c?i<=m:r<=_)&&(_w[h++]=f,_w[h++]=p-1,_w[h++]=1-c),(0===c?a>=m:n>=_)&&(_w[h++]=p+1,_w[h++]=d,_w[h++]=1-c)}return u}within(i,r,a){let n=[];return this.withinInto(i,r,a,n),n}withinInto(i,r,a,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:l}=this;_w[0]=0,_w[1]=o.length-1,_w[2]=0;let h=3,u=0,c=a*a;for(;h>0;){let d=_w[--h],f=_w[--h],p=_w[--h];if(f-p<=l){for(let a=p;a<=f;a++)_E(s[2*a],s[2*a+1],i,r)<=c&&(n[u++]=o[a]);continue}let m=p+f>>1,_=s[2*m],g=s[2*m+1];_E(_,g,i,r)<=c&&(n[u++]=o[m]),(0===d?i-a<=_:r-a<=g)&&(_w[h++]=p,_w[h++]=m-1,_w[h++]=1-d),(0===d?i+a>=_:r+a>=g)&&(_w[h++]=m+1,_w[h++]=f,_w[h++]=1-d)}return u}},r.a7=mw,r.a8=f1,r.a9=l$,r.aA=p7,r.aB=uN,r.aC=mz,r.aD=cL-1,r.aE=cL,r.aF=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new eJ(1/0,1/0),max:new eJ(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(i,r=!1){let a=cN(new eJ(0,0),new eJ(8192,8192),i),n=[];if(r&&!cB(a,this._globalClipBounds))return n;for(let r of this._activeRegions){if(r.hiddenByOverlap||!cB(a,r))continue;let o=function(i,r,a){let n=1<<a.canonical.z,o=((r.x-a.wrap)*n-a.canonical.x)*8192,s=(r.y*n-a.canonical.y)*8192;return{min:new eJ(((i.x-a.wrap)*n-a.canonical.x)*8192,(i.y*n-a.canonical.y)*8192),max:new eJ(o,s)}}(r.min,r.max,i);n.push({min:o.min,max:o.max,sourceId:this._sourceIds[r.priority],footprint:r.footprint,footprintTileId:r.tileId,order:r.order,clipMask:r.clipMask,clipScope:r.clipScope})}return n}
7setSources(i){this._setSources(i.map(i=>({getSourceId:()=>i.cache.id,getFootprints:()=>{let r=[];for(let a of i.cache.getVisibleCoordinates()){let n=i.cache.getTile(a).buckets[i.layer];n&&n.updateFootprints(a.toUnwrapped(),r)}return r},getOrder:()=>i.order,getClipMask:()=>i.clipMask,getClipScope:()=>i.clipScope})))}_addSource(i){let r=i.getFootprints();if(0===r.length)return;let a=i.getOrder(),n=i.getClipMask(),o=i.getClipScope();for(let i of r){if(!i.footprint)continue;let r=cN(i.footprint.min,i.footprint.max,i.id);this._activeRegions.push({min:r.min,max:r.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:i.id,footprint:i.footprint,order:a,clipMask:n,clipScope:o})}this._sourceIds.push(i.getSourceId())}_computeReplacement(){this._activeRegions.sort((i,r)=>{var a,n;let o;return i.priority-r.priority||cO(i.min,r.min)||cO(i.max,r.max)||i.order-r.order||i.clipMask-r.clipMask||(a=i.clipScope,n=r.clipScope,o=(i,r)=>i+r,a.length-n.length||a.reduce(o,"").localeCompare(n.reduce(o,"")))});let i=this._activeRegions.length!==this._prevRegions.length;if(!i){let r=0;for(;!i&&r!==this._activeRegions.length;){let a=this._activeRegions[r],n=this._prevRegions[r];i=a.priority!==n.priority||!cF(a,n)||a.order!==n.order||a.clipMask!==n.clipMask||!eQ(a.clipScope,n.clipScope),this._activeRegions[r].hiddenByOverlap=n.hiddenByOverlap,++r}}if(i){for(let i of(++this._updateTime,this._activeRegions))i.order!==cL&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));let i=i=>{let r=this._activeRegions;if(i>=r.length)return i;let a=r[i].priority;for(;i<r.length&&r[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let r=0,a=i(0);for(;r!==a;){let n=r,o=r;for(;n!==a;){let i=this._activeRegions[n];i.hiddenByOverlap=!1;for(let r=0;r<o;r++){let a=this._activeRegions[r];if(!a.hiddenByOverlap&&i.order===cL&&cB(i,a)&&(i.hiddenByOverlap=function i(r,a,n,o){if(!r||!n)return!1;let s=r.vertices;if(!a.canonical.equals(o.canonical)||a.wrap!==o.wrap){if(n.vertices.length<r.vertices.length)return i(n,o,r,a);let l=a.canonical,h=o.canonical,u=Math.pow(2,h.z-l.z);s=r.vertices.map(i=>new eJ((i.x+8192*l.x)*u-8192*h.x,(i.y+8192*l.y)*u-8192*h.y))}return cU(n,s,r.indices,0,r.indices.length,0,0)}(i.footprint,i.tileId,a.footprint,a.tileId),i.hiddenByOverlap))break}++n}a=i(r=a)}}}}_setSources(i){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let r=i.length-1;r>=0;r--)this._addSource(i[r]);this._computeReplacement()}},r.aG=iQ,r.aH=ie,r.aI=2,r.aJ=sG,r.aK=sg,r.aL=sS,r.aM=sb,r.aN=sh,r.aO=sx,r.aP=o1,r.aQ=oQ,r.aR=so,r.aS=o9,r.aT=sc,r.aU=sm,r.aV=s_,r.aW=sy,r.aX=cJ,r.aY=/^(.*)-transition$/,r.aZ=class extends my{constructor(i,r){super(i._vectorTileFeature,i._z,i._x,i._y,i.id),i.state&&(this.state=Object.assign({},i.state)),this.target=r.target,this.namespace=r.namespace,r.properties&&(this.properties=r.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=i.source,this.sourceLayer=i.sourceLayer,this.layer=i.layer)}toJSON(){let i=super.toJSON();return i.target=this.target,i.namespace=this.namespace,i}},r.a_=h3,r.aa=lJ,r.ab=oz,r.ac=oO,r.ad=us,r.ae=85.051129,r.af=_a,r.ag=oj,r.ah=fv,r.ai=mx,r.aj=fy,r.ak=3,r.al=2,r.am=0,r.an=1,r.ao=24,r.ap=cc,r.aq=2,r.ar=lZ,r.as=hp,r.at=class{constructor(i=new Uint8Array(16)){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.length=this.buf.length}writeTag(i,r){this.writeVarint(i<<3|r)}realloc(i){let r=this.length||16;for(;r<this.pos+i;)r*=2;if(r!==this.length){let i=new Uint8Array(r);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}writeSFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}
7writeFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeSFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeVarint(i){(i=+i||0)>=0&&i<128?(this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=i):i>0xfffffff||i<0?function(i,r){var a,n;let o,s,l;if(i>=0?(o=i%0x100000000|0,s=i/0x100000000|0):(o=~(-i%0x100000000),s=~(-i/0x100000000),0xffffffff^o?o=o+1|0:(o=0,s=s+1|0)),i>=0xffffffffffffffff||i<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),a=o,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,r.buf[r.pos]=127&(a>>>=7),l=(7&(n=s))<<4,r.buf[r.pos++]|=l|128*!!(n>>>=3),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=i>>>7&127))))}writeSVarint(i){this.writeVarint(i<0?-(2*i)-1:2*i)}writeBoolean(i){this.writeVarint(+i)}writeString(i){i=String(i),this.realloc(4*i.length),this.pos++;let r=this.pos;this.pos=function(i,r,a){for(let n,o,s=0;s<r.length;s++){if((n=r.charCodeAt(s))>55295&&n<57344){if(!o){n>56319||s+1===r.length?(i[a++]=239,i[a++]=191,i[a++]=189):o=n;continue}if(n<56320){i[a++]=239,i[a++]=191,i[a++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(i[a++]=239,i[a++]=191,i[a++]=189,o=null);n<128?i[a++]=n:(n<2048?i[a++]=n>>6|192:(n<65536?i[a++]=n>>12|224:(i[a++]=n>>18|240,i[a++]=n>>12&63|128),i[a++]=n>>6&63|128),i[a++]=63&n|128)}return a}(this.buf,i,this.pos);let a=this.pos-r;a>=128&&hm(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeFloat(i){this.realloc(4),this.dataView.setFloat32(this.pos,i,!0),this.pos+=4}writeDouble(i){this.realloc(8),this.dataView.setFloat64(this.pos,i,!0),this.pos+=8}writeBytes(i){let r=i.length;this.writeVarint(r),this.realloc(r),this.buf.set(i,this.pos),this.pos+=r}writeRawMessage(i,r){this.pos++;let a=this.pos;i(r,this);let n=this.pos-a;n>=128&&hm(a,n,this),this.pos=a-1,this.writeVarint(n),this.pos+=n}writeMessage(i,r,a){this.writeTag(i,2),this.writeRawMessage(r,a)}writePackedVarint(i,r){r.length&&this.writeMessage(i,h_,r)}writePackedSVarint(i,r){r.length&&this.writeMessage(i,hg,r)}writePackedBoolean(i,r){r.length&&this.writeMessage(i,hv,r)}writePackedFloat(i,r){r.length&&this.writeMessage(i,hy,r)}writePackedDouble(i,r){r.length&&this.writeMessage(i,hx,r)}writePackedFixed32(i,r){r.length&&this.writeMessage(i,hb,r)}writePackedSFixed32(i,r){r.length&&this.writeMessage(i,hw,r)}writePackedFixed64(i,r){r.length&&this.writeMessage(i,hT,r)}writePackedSFixed64(i,r){r.length&&this.writeMessage(i,hS,r)}writeBytesField(i,r){this.writeTag(i,2),this.writeBytes(r)}writeFixed32Field(i,r){this.writeTag(i,5),this.writeFixed32(r)}writeSFixed32Field(i,r){this.writeTag(i,5),this.writeSFixed32(r)}writeFixed64Field(i,r){this.writeTag(i,1),this.writeFixed64(r)}writeSFixed64Field(i,r){this.writeTag(i,1),this.writeSFixed64(r)}writeVarintField(i,r){this.writeTag(i,0),this.writeVarint(r)}writeSVarintField(i,r){this.writeTag(i,0),this.writeSVarint(r)}writeStringField(i,r){this.writeTag(i,2),this.writeString(r)}writeFloatField(i,r){this.writeTag(i,5),this.writeFloat(r)}writeDoubleField(i,r){this.writeTag(i,1),this.writeDouble(r)}writeBooleanField(i,r){this.writeVarintField(i,+r)}},r.au=eJ,r.av=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return tT(i.expression.evaluate(r))}interpolate(i,r,a){return{x:iw(i.x,r.x,a),y:iw(i.y,r.y,a),z:iw(i.z,r.z,a),azimuthal:iw(i.azimuthal,r.azimuthal,a),polar:iw(i.polar,r.polar,a)}}},r.aw=n$,r.ax=nY,r.ay=lH,r.az=me,r.b=lG,r.b$=aJ,r.b0=class{constructor(i,r,a,n,o,s){this.tileID=i,this.uid=tf(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection),this.worldview=s,this._hasAppearances=null}registerFadeDuration(i){let r=i+this.timeAdded;r<tV.now()||void 0!==this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=cp(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=mM(i.buckets,r.style),i.frcCoveragePolygons&&i.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=i.frcCoveragePolygons),this.hasDeferredRoadStructure=!!i.hasDeferredRoadStructure,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!i.hasTunnelGeometry,this.buckets){let i=this.buckets[n];if(i instanceof cJ){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof cJ&&r.hasRTLText){this.hasRTLText=!0,nB();break}}for(let i in this.queryPadding=0,this.buckets){let a=this.buckets[i],n=r.style.getOwnLayer(i);if(!n)continue;let o=n.queryRadius(a)||0;this.queryPadding=Math.max(this.queryPadding,o)}i.imageAtlas&&(this.imageAtlas=r.style.imageManager.imageAtlasCache.getOrCache(i.imageAtlas)),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new sA}unloadVectorData(){if(this.hasData()){for(let i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(i,r,a){i&&(i.resourceTiming&&(this.resourceTiming=i.resourceTiming),this.buckets=Object.assign({},this.buckets,mM(i.buckets,r.style)),i.featureIndex&&(this.latestFeatureIndex=i.featureIndex))}getBucket(i){return this.buckets[i.fqid]}upload(i,r){for(let a in this.buckets){let n=this.buckets[a];if(n.uploadPending()){let a={},o=[],s={zoom:0,pitch:0,brightness:0,worldview:""};if(r){if(r.style){o=r.style.listImages();let i=n.layers[0],s=i.sourceLayer||"_geojsonTileLayer",l=r.style.getLayerSourceCache(i);l&&(a=l._state.getState(s,void 0))}s={zoom:r.transform.zoom||0,pitch:r.transform.pitch||0,brightness:r.style.getBrightness()||0,worldview:r.worldview||""}}n.upload(i,this.tileID.canonical,a,o,s)}}let a=i.gl,n=this.imageAtlas;n&&r&&(this.imageAtlasTexture=r.style.imageManager.imageAtlasCache.getTextureForAtlas(n,i,a.RGBA8),n.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new h3(i,this.glyphAtlasImage,a.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new h3(i,this.lineAtlas.image,a.R8),this.lineAtlas.uploaded=!0)}prepare(i,r,a){if(this.imageAtlas&&this.imageAtlasTexture&&r){let n=r.style.getLut(a);this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture,a,n)}if(!r||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let n=r.style.getBrightness(),o=r.style.listImages(),s=o.length,l=r.style._changes.getUpd
7atedPaintProperties(),h=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>l.has(i.fqid))),u=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>i.hasTransition&&i.hasTransition())),c=this._firstPrepareComplete&&s!==this._lastAvailableImagesCount;null===this._hasAppearances&&(this._hasAppearances=this.hasAppearances(r));let d=this._lastUpdatedBrightness!==n;this._lastAvailableImagesCount=s,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||n||this._hasAppearances||h||u||c)&&(!(this._hasAppearances||h||u||c)&&this._lastUpdatedBrightness&&n&&.001>Math.abs(this._lastUpdatedBrightness-n)||(this.updateBuckets(r,d,void 0,c||h||u,l,o),this._lastUpdatedBrightness=n))}evaluateQueryRenderedFeaturePadding(){let i=0;for(let r in this.buckets){let a=this.buckets[r];a.evaluateQueryRenderedFeaturePadding&&(i=Math.max(i,a.evaluateQueryRenderedFeaturePadding()))}return i}queryRenderedFeatures(i,r,a,n,o,s,l){var h;let u;if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let c=this.evaluateQueryRenderedFeaturePadding(),d=(h=this.tileID,Y(u=ei([],[.5*o.width,-(.5*o.height),1]),u,[1,-1,0]),X(u,u,o.calculateProjMatrix(h.toUnwrapped())),Float32Array.from(u));return this.latestFeatureIndex.query(i,{tilespaceGeometry:r,pixelPosMatrix:d,transform:n,availableImages:a,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:c,scope:l})}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=n1(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=o$(n,!0);if(!l.filter(new nk(this.tileID.overscaledZ,{worldview:this.worldview}),i,this.tileID.canonical))continue}else if(!l.filter(new nk(this.tileID.overscaledZ,{worldview:this.worldview}),n))continue;let f=a.getId(n,o),p=new my(n,h,u,c,f);p.tile=d,i.push(p)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=tE(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let i=Date.now(),a=!1;if(this.expirationTime>i)a=!1;else if(r)if(this.expirationTime<r)a=!0;else{let n=this.expirationTime-r;n?this.expirationTime=i+Math.max(n,3e4):a=!0}else a=!0;a?(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-Date.now(),0x7fffffff)}refreshFeatureState(i,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!i)return;let a=i.style.listImages();this.updateBuckets(i,!1,r,void 0,void 0,a)}hasAppearances(i){for(let r in this.buckets)if(i.style.hasLayer(r)&&this.buckets[r].layers.some(i=>i.appearances&&i.appearances.length>0))return!0;return!1}updateBuckets(i,r,a,n,o,s){if(!this.latestFeatureIndex||!i.style)return;let l=s||i.style.listImages(),h=i.style.getBrightness(),u=o||new Set;for(let o in this.buckets){if(!i.style.hasLayer(o))continue;let s=this.buckets[o],c=s.layers[0],d=c.sourceLayer||"_geojsonTileLayer",f=i.style.getLayerSourceCache(c),p=s.layers.some(i=>u.has(i.fqid)),m=(n||p)&&s instanceof cJ?i.style.getOwnLayer(o):void 0,_=a&&a[d]||{};f&&!a&&(_=f._state.getState(d,void 0));let g=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},y=Object.keys(_).length>0&&!r;s.hasAppearances=s.layers.some(i=>i.appearances&&i.appearances.length>0);let x=y?s.stateDependentLayers:s.layers;if(y&&0!==s.stateDependentLayers.length||r||p||n){let a=this.latestFeatureIndex.loadVTLayers()[d];if(s.update(_,a,l,g,x,r,h,this.tileID.canonical),(n||p)&&(!r||r&&s instanceof cJ&&(!s.text.uboBinder||s.text.uboBinder.isLightConstant||!s.icon.uboBinder||s.icon.uboBinder.isLightConstant))&&s instanceof cJ&&m&&"symbol"===m.type&&(s.text&&s.text.uboBinder&&s.text.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h)),s instanceof cJ){let r=i.context;s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}if(y&&0!==s.stateDependentLayers.length||r||s.hasAppearances){let r={zoom:i.transform.zoom,pitch:i.transform.pitch,brightness:i.style.getBrightness()||0,worldview:i.worldview},a=s.updateAppearances(this.tileID.canonical,_,l,r,i.imageManager,y&&0!==s.stateDependentLayers.length);if(a&&a.hasUboChanges){let r=i.context;s instanceof cJ&&s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s instanceof cJ&&s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}(s instanceof lJ||s instanceof lc)&&i._terrain&&i._terrain.enabled&&f&&s.uploadPending()&&i._terrain._clearRenderCacheForTile(f.i
7d,this.tileID);let v=i&&i.style&&i.style.getOwnLayer(o);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(s)||0))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<tV.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=tV.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof h3?this.texture.update(i):(this.texture=new h3(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(i,r){let a={};for(let i of r)a[i]=!0;this.dependencies[i]=a}hasDependency(i,r){for(let a of i){let i=this.dependencies[a];if(i){for(let a of r)if(i[a])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=oq(mO,this.tileID.canonical,this.tileTransform)[0],n=new oQ,o=new sb;for(let i=0;i<a.length;i++){let{x:r,y:s}=a[i];n.emplaceBack(r,s),o.emplaceBack(i)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,uB.members),this._tileDebugSegments=sG.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=oq(mO,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=cp(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=rp((i.x+(s+mL(s))/32)/n),h=rm((i.y+(o+mL(o))/32)/n),u=r.project(l,h),c=33*o+s;mD[2*c+0]=Math.round((u.x*a.scale-a.x)*8192),mD[2*c+1]=Math.round((u.y*a.scale-a.y)*8192)}mR.fill(0),mP.fill(0);for(let i=2045;i>=0;i--){let r=4*i,a=mC[r+0],n=mC[r+1],o=mC[r+2],s=mC[r+3],l=a+o>>1,h=n+s>>1,u=l+h-n,c=h+a-l,d=33*n+a,f=33*s+o,p=33*h+l,m=Math.hypot((mD[2*d+0]+mD[2*f+0])/2-mD[2*p+0],(mD[2*d+1]+mD[2*f+1])/2-mD[2*p+1])>=16;mR[p]=mR[p]||+!!m,i<1022&&(mR[p]=mR[p]||mR[(n+c>>1)*33+(a+u>>1)]||mR[(s+c>>1)*33+(o+u>>1)])}let o=new o1,s=new sc,l=0;function h(i,r){let a=33*r+i;return 0===mP[a]&&(o.emplaceBack(mD[2*a+0],mD[2*a+1],8192*i/32,8192*r/32),mP[a]=++l),mP[a]-1}function u(i,r,a,n,o,l){let c=i+a>>1,d=r+n>>1;if(Math.abs(i-o)+Math.abs(r-l)>1&&mR[33*d+c])u(o,l,i,r,c,d),u(a,n,o,l,c,d);else{let u=h(i,r),c=h(a,n),d=h(o,l);s.emplaceBack(u,c,d)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new o1,n=new sc,o))a.emplaceBack(i,r,0,0);let i=ol(a.int16.subarray(0,4*a.length),void 0,4);for(let r=0;r<i.length;r+=3)n.emplaceBack(i[r],i[r+1],i[r+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,p4.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=sG.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a,n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=u8(uQ(o,r)),l=ci(r.zoom);l>0&&(a=W(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,s,a,l),this._makeGlobeTileDebugTextBuffer(i,o,r,s,a,l)}_globePoint(i,r,a,n,o,s,l){let h=u4(i,r,a);if(s){let o=1<<a.z,u=rd(n.center.lng),c=rf(n.center.lat),d=(a.x+.5)/o-u,f=0;d>.5?f=-1:d<-.5&&(f=1);let p=(i/8192+a.x)/o+f,m=(r/8192+a.y)/o;p=(p-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[p*n.worldSize,m*n.worldSize,0];eI(_,_,s),h=uJ(h,_,l)}return eI(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new oQ,h=new sb,u=new o0,c=(i,c,d,f,p)=>{let m=(d-i)/(p-1),_=(f-c)/(p-1),g=l.length;for(let d=0;d<p;d++){let f=i+d*m,p=c+d*_;l.emplaceBack(f,p);let y=this._globePoint(f,p,r,a,n,o,s);u.emplaceBack(y[0],y[1],y[2]),h.emplaceBack(g+d)}};c(0,0,8192,0,16),c(8192,0,8192,8192,16),c(8192,8192,0,8192,16),c(0,8192,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,uB.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,uF.members),this._tileDebugSegments=sG.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=new oQ,h=new sc,u=new o0;h.reserve(32),l.reserve(25),u.reserve(25);let c=(i,r)=>25*i+r;for(let i=0;i<25;i++){let h=2048*i;for(let i=0;i<25;i++){let c=2048*i;l.emplaceBack(c,h);let d=this._globePoint(c,h,r,a,n,o,s);u.emplaceBack(d[0],d[1],d[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let a=c(i,r),n=c(i,r+1),o=c(i+1,r),s=c(i+1,r+1);h.emplaceBack(a,n,o),h.emplaceBack(o,n,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(h),this._tileDebugTextBuffer=i.createVertexBuffer(l,uB.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(u,uF.members),this._tileDebugTextSegments=sG.simpleSegment(0,0,25,32)}destroy(i=!0){for(let r in this.buckets)this.buckets[r].destroy(i);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),i&&this.texture&&this.texture instanceof h3&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof h3&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}},r.b1=mf,r.b2=nV,r.b3=/^(.*)-use-theme$/,r.b4=sQ,r.b5=sJ,r.b6=s0,r.b7=s1,r.b8=s3,r.b9=s4,r.bA=fx,r.bB=function(i,r,a){let n=Math.sqrt(i*i+r*r+a*a),o=n>0?Math.acos(a/n)*te:0,s=0!==i||0!==r?Math.atan2(-r,-i)*te+90:0;return s<0&&(s+=360),[n,s,o]},r.bC=pF,r.bD=(i,r,a,n,o,s)=>{let l,h=i.transform,u="globe"===h.projection.name;if("map"===s.paint.get("circle-pitch-alignment"))if(u){let i=ce(h.zoom,r.canonical)*h._pixelsPerMercatorPixel;l=Float32Array.from([i,0,0,i])}else l=h.calculatePixelsToTileUnitsMatrix(a);else l=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);let c={u_camera_to_center_distance:i.transform.getCameraToCenterDistance(h.projection),u_matrix:i.translatePosMatrix(r.projMatrix,a,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:tV.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:pO,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(u){c.u_inv_rot_matrix=n,c.u_merc_center=o,c.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],c.u_zoom_transition=ci(h.zoom);let i=8192*o[0],a=8192*o[1];c.u_up_dir=h.projection.upVector(new ch(0,0,0),i,a)}return c},r.bE=i=>({u_camera_to_center_distance:new sQ(i),u_extrude_scale:new s6(i),u_device_pixel_ratio:new sQ(i),u_matrix:new s5(i),u_inv_rot_matrix:new s5(i),u_merc_center:new s0(i),u_tile_id:new s1(i),u_zoom_transition:new sQ(i),u_up_dir:new s1(i),u_emissive_strength:new sQ(i)}),r.bF=oF,r.bG=ts,r.bH=function(i){let r=t0();if(!r)return;let a=r.delete(tY);i&&a.then(()=>i()).catch(i)},r.bI=lk,r.bJ=$,r.bK=es,r.bL=ty,r.bM=ha,r.bN=tj,r.bO=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},r.bP=tB,r.bQ=fO,r.bR=f_,r.bS=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i},r.bT=q,r.bU=eo,r.bV=j,r.bW=eO,r.bX=eR,r.bY=aX,r.bZ=n1,r.b_=oK,r.ba=class extends sK{constructor(i){super(i),this.current=ne
7w Float32Array(9)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;for(let i=0;i<9;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix3fv(this.location,!1,n);break}}},r.bb=s5,r.bc=cu,r.bd=h4,r.be=lb,r.bf=lx,r.bg=hE,r.bh=aK,r.bi=u1,r.bj=ec,r.bk=eq,r.bl=cX,r.bm=function(i,r){if(!i||!r)throw Error("TileProvider name and URL are required");tj.TILE_PROVIDER_URLS[i]=tV.resolveURL(r)},r.bn=oB,r.bo=iM,r.bp=tu,r.bq=function(i){return decodeURIComponent(atob(i).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join(""))},r.br=function(i){return btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r))))},r.bs=tm,r.bt=p4,r.bu=function(i,r){let a=[];for(let n=0;n<i.length;n++){let o=th(n-1,-1,i.length-1),s=th(n+1,-1,i.length-1),l=i[n],h=i[s],u=i[o].sub(l).unit(),c=h.sub(l).unit(),d=c.angleWithSep(u.x,u.y),f=u.add(c).unit().mult(-1*r/Math.sin(d/2));a.push(l.add(f))}return a},r.bv=function(i){++t2>tJ&&(i.getActor().send("enforceCacheSizeLimit",tK),t2=0)},r.bw=function(i,r){let{x:a,y:n}=i.point,o=ct(a,n,i.worldSize/i._pixelsPerMercatorPixel,0,0);return X(o,o,u9(uK(r)))},r.bx=function(i){let{x:r,y:a}=i.point,{lng:n,lat:o}=i._center;return ct(r,a,i.worldSize,n,o)},r.by=function(i){let r=i.pixelsPerMeter,a=r/(1/oF(i.center.lat)),n=Z(new Float64Array(16));return Y(n,n,[i.point.x,i.point.y,0]),K(n,n,[a,a,r]),Float32Array.from(n)},r.bz=cd,r.c=h0,r.c$=cP,r.c0=function(i,r,a,n){return"custom"===i.type?new mt(i,r):new mb[i.type](i,r,a,n)},r.c1=eS,r.c2=eQ,r.c3=nQ,r.c4=function(i){return i*e7},r.c5=ey,r.c6=function(i,r,a){return i[0]=r[0]/a[0],i[1]=r[1]/a[1],i[2]=r[2]/a[2],i},r.c7=eT,r.c8=ol,r.c9=6371008.8,r.cA=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n,i[6]=a,i[7]=0,i[8]=0,i[9]=-a,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},r.cB=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=n,i[1]=0,i[2]=-a,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=a,i[9]=0,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},r.cC=function(i){return ta[Math.round((i+45+360)%360/90)%4]},r.cD=function(i,r,a){let n=0;for(let a=0;a<2;++a)i[a]>0&&(n+=(i[a]-0)*(i[a]-0)),r[a]<0&&(n+=(0-r[a])*(0-r[a]));return n},r.cE=hz,r.cF=uC,r.cG=ih,r.cH=function(i,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>1e-6?(i[0]=r[0]/n,i[1]=r[1]/n,i[2]=r[2]/n):(i[0]=1,i[1]=0,i[2]=0),a},r.cI=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);return{min:new eJ(r,a),max:new eJ(n,o)}},r.cJ=function(){return{API_URL:tj.API_URL,DRACO_URL:tj.DRACO_URL,MESHOPT_URL:tj.MESHOPT_URL,MESHOPT_SIMD_URL:tj.MESHOPT_SIMD_URL,BUILDING_GEN_URL:tj.BUILDING_GEN_URL}},r.cK=tq,r.cL=tz,r.cM=function(i,r){return is(Object.assign(i,{method:"GET"}),r)},r.cN=tG,r.cO=function(i){return i?{cacheControl:i.get("cache-control"),expires:i.get("expires")}:{cacheControl:void 0,expires:void 0}},r.cP=function(i,r,a,n){let o=r.getNorth(),s=r.getSouth(),l=r.getWest(),h=r.getEast(),u=1<<i.z,c=h-l,d=o-s,f=c/64,p=-d/oC[a],m=[0,f,0,p,0,0,o,l,0];if(i.z>0){let i=180/n;H(m,m,[i/c+1,0,0,0,i/d+1,0,-.5*i/f,.5*i/p,1])}return m[2]=u,m[5]=i.x,m[8]=i.y,m},r.cQ=iu,r.cR=h6,r.cS=function(i){let r=i.lastIndexOf("\x1f");return r>=0?i.slice(r+1):""},r.cT=il,r.cU=function(i){return Math.round(Math.pow(Math.abs(Math.sin((i=ts(i,-80.051129,80.051129)/80.051129*90)*e7)),3)*(oC.length-1))},r.cV=rN,r.cW=tH,r.cX=oN,r.cY=function(i){let r=i.indexOf("\x1f");return r>=0?i.slice(0,r):i},r.cZ=oe,r.c_=function(i,r){let{scale:a}=i.tileTransform,n=8192*a/(i.tileSize*Math.pow(2,r.zoom-i.tileID.overscaledZ+i.tileID.canonical.z)),o=r.inverseAdjustmentMatrix;return new Float32Array([o[0]*n,o[1]*n,o[2]*n,o[3]*n])},r.ca=to,r.cb=tn,r.cc=function(i){return i*i*i*i*i},r.cd=function([i,r,a]){let n=Math.hypot(i,r,a);return new oz(Math.atan2(i,a)*te,(.5*Math.PI-Math.acos(-r/n))*te)},r.ce=lR,r.cf=function(i){t1(),null!=a&&a.then(r=>{r.keys().then(a=>{for(let n=0;n<a.length-i;n++)r.delete(a[n]).catch(i=>tb(i.message))}).catch(i=>tb(i.message))}).catch(i=>tb(i.message))},r.cg=function(i){return i>>>=0,(i=Math.imul((i=Math.imul((i=Math.imul(0xa3c59ac3^i,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)/0x100000000},r.ch=hG,r.ci=hH,r.cj=ub,r.ck=nL,r.cl=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]},r.cm=eD,r.cn=t3,r.co=tV,r.cp=dk,r.cq=pg,r.cr=tg,r.cs=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[4],i[4]=r[5],i[5]=r[6],i[6]=r[8],i[7]=r[9],i[8]=r[10],i},r.ct=en,r.cu=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=n,i[1]=a,i[2]=0,i[3]=-a,i[4]=n,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},r.cv=ei,r.cw=et,r.cx=eh,r.cy=function(i,r,a,n){var o=new U(4);return o[0]=i,o[1]=r,o[2]=a,o[3]=n,o},r.cz=eH,r.d=256,r.d$=pK,r.d0=function(i){let r=fs(i,!0);return V([],[r[0],r[1],r[4],r[5]])},r.d1=fs,r.d2=fh,r.d3=nz,r.d4=ir,r.d5=function(i,r){var a=new U(3);ea(a,r);var n=1/a[0],o=1/a[1],s=1/a[2],l=r[0]*n,h=r[1]*o,u=r[2]*s,c=r[4]*n,d=r[5]*o,f=r[6]*s,p=r[8]*n,m=r[9]*o,_=r[10]*s,g=l+d+_,y=0;return g>0?(y=2*Math.sqrt(g+1),i[3]=.25*y,i[0]=(f-m)/y,i[1]=(p-u)/y,i[2]=(h-c)/y):l>d&&l>_?(y=2*Math.sqrt(1+l-d-_),i[3]=(f-m)/y,i[0]=.25*y,i[1]=(h+c)/y,i[2]=(p+u)/y):d>_?(y=2*Math.sqrt(1+d-l-_),i[3]=(p-u)/y,i[0]=(h+c)/y,i[1]=.25*y,i[2]=(f+m)/y):(y=2*Math.sqrt(1+_-l-d),i[3]=(h-c)/y,i[0]=(p+u)/y,i[1]=(f+m)/y,i[2]=.25*y),i},r.d6=fl,r.d7=ea,r.d8=cm,r.d9=function(i,r,a=0){return eh(((r.x-a)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,oB(r.z,r.y))},r.dA=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},r.dB=aU,r.dC=rJ,r.dD=ii,r.dE=ca,r.dF=function(i){return tj.API_CDN_URL_REGEX.test(i)},r.dG=function(i){return tj.API_FONTS_REGEX.test(i)},r.dH=tZ,r.dI=function(i){return tj.API_STYLE_REGEX.test(i)&&!tZ(i)},r.dJ=function(i){return tj.API_TILEJSON_REGEX.test(i)},r.dK=t$,r.dL=function(i){return 0===i.indexOf("mapbox:")},r.dM=rr,r.dN=rt,r.dO=function(i){let r=i.navigator?i.navigator.userAgent:null;return!!function(i){if(null==tL){let r=i.navigator?i.navigator.userAgent:null;tL=!!i.safari||!(!r||!(ti.test(r)||r.match("Safari")&&!r.match("Chrome")))}return tL}(i)&&!(!r||!(r.match("Version/15.4")||r.match("Version/15.5")||r.match(tr)))},r.dP=rK,r.dQ=ri,r.dR=tS,r.dS=function(i,r){let a=[];for(let n in i)n in r||a.push(n);return a},r.dT=rm,r.dU=oP,r.dV=el,r.dW=el,r.dX=function(i){var r=i[0],a=i[1],n=i[2],o=i[3];return Math.sqrt(r*r+a*a+n*n+o*o)},r.dY=iw,r.dZ=eE,r.d_=function(i,r,a,n){var o=r[0],s=r[1],l=r[2],h=r[3];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i[3]=h+n*(a[3]-h),i},r.da=re,r.db=function(i,r){let a=document.createElement("video");a.muted=!0,a.onloadstart=function(){r(null,a)};for(let r=0;r<i.length;r++){let n=document.createElement("source");(function(i){let r=document.createElement("a");return r.href=i,r.protocol===location.protocol&&r.host===location.host})(i[r])||(a.crossOrigin="Anonymous"),n.src=i[r],a.appendChild(n)}return{cancel:()=>{}}}
7,r.dc=fc,r.dd=function(i){let r=[0,0,0],a=Z(new Float64Array(16));return X(a,i.pixelMatrix,i.globeMatrix),eI(r,r,a),new eJ(r[0],r[1])},r.de=u9,r.df=function(i,r){let a=[0,0,0];return eI(a,a,u8(uK(r.canonical))),eI(a,a,i),a},r.dg=u$,r.dh=u8,r.di=ce,r.dj=function(i,r,a){let n=Z(new Float64Array(16)),o=(r/(1<<i)-.5)*Math.PI*2;return Q(n,a.globeMatrix,o),Float32Array.from(n)},r.dk=uK,r.dl=cr,r.dm=ci,r.dn=function(i,r,a){let n=ci(a.zoom),o=i.style.map._antialias,s=i.terrain&&i.terrain.exaggeration()>0;return 0===n&&!o&&!s},r.dp=eF,r.dq=Z,r.dr=W,r.ds=V,r.dt=function(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],f=d*l-h*c,p=-d*s+h*u,m=c*s-l*u,_=a*f+n*p+o*m;return _?(i[0]=f*(_=1/_),i[1]=(-d*n+o*c)*_,i[2]=(h*n-o*l)*_,i[3]=p*_,i[4]=(d*a-o*u)*_,i[5]=(-h*a+o*s)*_,i[6]=m*_,i[7]=(-c*a+n*u)*_,i[8]=(l*a-n*s)*_,i):null},r.du=ra,r.dv=aW,r.dw=n0,r.dx=function(i){return i.includes("\x1f")},r.dy=rY,r.dz=function(i,r){let a=dk(i);return null!==a&&!!(r&1<<a)},r.e=1024,r.e$=pV,r.e0=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,f=d.pitch<15?iw(.07,.7,ts((14-d.zoom)/5,0,1)):.07,p="none"===a.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:pY(i,r,a,n),u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:d.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:l,u_image:0,u_tile_units_to_pixels:pX(r,d),u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(p?null:a.lut).toArray01(),u_zbias_factor:f,u_tile_to_meter:oV(r.tileID.canonical,0),u_ground_shadow_factor:u,u_pattern_transition:c,u_opacity_multiplier:1}},r.e1=i=>({u_matrix:new s5(i),u_texsize:new s0(i),u_pixels_to_tile_units:new s6(i),u_device_pixel_ratio:new sQ(i),u_width_scale:new sQ(i),u_floor_width_scale:new sQ(i),u_image:new sJ(i),u_units_to_pixels:new s0(i),u_tile_units_to_pixels:new sQ(i),u_alpha_discard_threshold:new sQ(i),u_trim_offset:new s0(i),u_trim_fade_range:new s0(i),u_trim_gradient_mix_range:new s0(i),u_trim_color:new s3(i),u_zbias_factor:new sQ(i),u_tile_to_meter:new sQ(i),u_ground_shadow_factor:new s1(i),u_pattern_transition:new sQ(i),u_opacity_multiplier:new sQ(i)}),r.e2=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,f=d.calculatePixelsToTileUnitsMatrix(r),p="none"===a.paint.get("line-trim-color-use-theme").constantOr("default"),m=d.pitch<15?iw(.07,.7,ts((14-d.zoom)/5,0,1)):.07;return{u_matrix:pY(i,r,a,n),u_pixels_to_tile_units:f,u_device_pixel_ratio:s,u_width_scale:l,u_floor_width_scale:h,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:pJ(a)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:pX(r,i.transform),u_alpha_discard_threshold:0,u_trim_offset:u,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(p?null:a.lut).toArray01(),u_zbias_factor:m,u_tile_to_meter:oV(r.tileID.canonical,0),u_ground_shadow_factor:c,u_opacity_multiplier:1}},r.e3=i=>({u_matrix:new s5(i),u_pixels_to_tile_units:new s6(i),u_device_pixel_ratio:new sQ(i),u_width_scale:new sQ(i),u_floor_width_scale:new sQ(i),u_units_to_pixels:new s0(i),u_dash_image:new sJ(i),u_gradient_image:new sJ(i),u_image_height:new sQ(i),u_texsize:new s0(i),u_tile_units_to_pixels:new sQ(i),u_alpha_discard_threshold:new sQ(i),u_trim_offset:new s0(i),u_trim_fade_range:new s0(i),u_trim_gradient_mix_range:new s0(i),u_trim_color:new s3(i),u_zbias_factor:new sQ(i),u_tile_to_meter:new sQ(i),u_ground_shadow_factor:new s1(i),u_opacity_multiplier:new sQ(i)}),r.e4=function(i){return[Math.pow(i[0],1/2.2),Math.pow(i[1],1/2.2),Math.pow(i[2],1/2.2)]},r.e5=function(i){let r=0;if(0x46546c67!==new Uint32Array(i,0,1)[0]){let a=new Uint32Array(i,0,7),[,,n,o,s,l]=a;r=a.byteLength+o+s+l+s,(n!==i.byteLength||r>=i.byteLength)&&tb("Invalid b3dm header information.")}return d6(i,r)},r.e6=d8,r.e7=function(i,r,a,n,o){let s=function(a,n){if(a)return o(a);if(n){i.url&&n.tiles&&i.tiles&&delete i.tiles;let a=_s(i,n,r);if(a instanceof Error)return o(a);o(null,a)}},l=function(i,r,a){if(!i)return null;if(!r&&!a)return i;a=a||i.worldview_default;let n=Object.values(i.language||{});if(0===n.length)return null;let o=Object.values(i.worldview||{});if(0===o.length)return null;let s=n.every(i=>i===r),l=o.every(i=>i===a);return s&&l?i:r in(i.language_options||{})||a in(i.worldview_options||{})?null:i.language_options&&i.worldview_options?i:null}(i.data,a,n);return l?tV.frame(()=>s(null,l)):i.url?il(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),ie.Source),s):tV.frame(()=>{let{data:r,...a}=i;s(null,a)})},r.e8=async function(i,r){let a=_h.get(i);if(a)return a;let n=_l.get(i);if(void 0!==n)return n;let o=import(r).catch(r=>{throw Error(`TileProvider "${i}" failed to load: ${r instanceof Error?r.message:String(r)}`)}).then(r=>{let a=r.default;if("function"!=typeof a)throw Error(`TileProvider "${i}" module must default-export a class`);if("function"!=typeof a.prototype.loadTile)throw Error(`TileProvider "${i}" class must have a loadTile method`);return _h.set(i,a),a}).finally(()=>{_l.delete(i)});return _l.set(i,o),o},r.e9=function(i,r,a){let n=JSON.stringify(i.request);return i.data&&(this.deduped.entries[n]={result:[null,i.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom},r=>{let n=ih(i.request,(i,n,o)=>{i?ii(i)?r(null,null):r(i):n&&r(null,{rawData:n,vectorTile:a?void 0:new lb(ne
7w hp(n)),responseHeaders:new Map(o.entries())})});return()=>{n.cancel(),r(null,null)}},r)},r.eA=tU,r.eB=function(i,r,a,n,o,s,l){var h=1/(r-a),u=1/(n-o),c=1/(s-l);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(r+a)*h,i[13]=(o+n)*u,i[14]=(l+s)*c,i[15]=1,i},r.eC=function(i,r){let a=i.url&&!i.tiles?r.transformRequest(i.url,ie.Source):void 0;return{request:a,options:a?Object.assign({},i,{url:a.url}):i}},r.eD=function(i,r,a,n,o,s,l,h=1,u,c,d,f,p,m,_,g,y){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let x=i.layers[0].layout,v=i.layers[0]._unevaluatedLayout._values,b={};b.scaleFactor=h,b.textSizeScaleRange=x.get("text-size-scale-range"),b.iconSizeScaleRange=x.get("icon-size-scale-range");let[w,T]=b.textSizeScaleRange,[S,E]=b.iconSizeScaleRange;b.textScaleFactor=ts(b.scaleFactor,w,T),b.iconScaleFactor=ts(b.scaleFactor,S,E);let I=v["text-size"],A=v["icon-size"];if("composite"===i.textSizeData.kind){let{minZoom:r,maxZoom:a}=i.textSizeData;b.compositeTextSizes=[I.possiblyEvaluate(new nk(r,{worldview:d}),s),I.possiblyEvaluate(new nk(a,{worldview:d}),s)]}if("composite"===i.iconSizeData.kind){let{minZoom:r,maxZoom:a}=i.iconSizeData;b.compositeIconSizes=[A.possiblyEvaluate(new nk(r,{worldview:d}),s,f),A.possiblyEvaluate(new nk(a,{worldview:d}),s,f)]}b.layoutTextSize=I.possiblyEvaluate(new nk(l+1,{worldview:d}),s),b.layoutIconSize=A.possiblyEvaluate(new nk(l+1,{worldview:d}),s,f),b.textMaxSize=I.possiblyEvaluate(new nk(18,{worldview:d}),s);let M=x.get("symbol-placement"),C="map"===x.get("text-rotation-alignment")&&"point"!==M,D=x.get("text-size"),R=!1,P=[],L=null!=p&&0!==p;for(let l of i.features){if(L&&l.properties&&g&&g(l.properties,p))continue;let h=x.get("text-font").evaluate(l,{},s).join(","),m=D.evaluate(l,{},s)*b.textScaleFactor,_=b.layoutTextSize.evaluate(l,{},s)*b.textScaleFactor,y=b.layoutIconSize.evaluate(l,{},s,f)*b.iconScaleFactor,w={horizontal:{},vertical:void 0},T=l.text,S,E=[0,0];if(T){let n=T.toString(),c=24*x.get("text-letter-spacing").evaluate(l,{},s),d=24*x.get("text-line-height").evaluate(l,{},s),f=!function(i){for(let a of i){var r;if(a6(r=a.charCodeAt(0))||a8(r)||a9(r)||ng(r)||nb(r))return!1}return!0}(n)?0:c,p=x.get("text-anchor").evaluate(l,{},s),g=x.get("text-variable-anchor");if(!g){let i=x.get("text-radial-offset").evaluate(l,{},s);if(i)E=ub(p,[24*i,uy]);else{let i=x.get("text-offset").evaluate(l,{},s);E=[24*i[0],24*i[1]]}}let y=C?"center":x.get("text-justify").evaluate(l,{},s),v="point"===M,S=v?24*x.get("text-max-width").evaluate(l,{},s):1/0,I=s=>{i.allowVerticalPlacement&&nT(n)&&(w.vertical=hM(T,r,a,o,h,S,d,p,s,f,E,hE.vertical,!0,_,m,u,b.textScaleFactor))};if(!C&&g){let i="auto"===y?g.map(i=>uC(i)):[y],n=!1;for(let s=0;s<i.length;s++){let l=i[s];if(!w.horizontal[l])if(n)w.horizontal[l]=w.horizontal[0];else{let i=hM(T,r,a,o,h,S,d,"center",l,f,E,hE.horizontal,!1,_,m,u,b.textScaleFactor);i&&(w.horizontal[l]=i,n=1===i.positionedLines.length)}}I("left")}else{if("auto"===y&&(y=uC(p)),v||x.get("text-writing-mode").includes("horizontal")||!nT(n)){let i=hM(T,r,a,o,h,S,d,p,y,f,E,hE.horizontal,!1,_,m,u,b.textScaleFactor);i&&(w.horizontal[y]=i)}
7I(v?"left":y)}}let I,A,z,O,F,B,k=!1,N=x.get("icon-text-fit").evaluate(l,{},s);if(l.icon&&l.icon.hasPrimary()){let r=uI(l.icon,i.iconSizeData,v["icon-size"],s,i.zoom,l,u,b.iconScaleFactor,d,f);I=r.iconPrimary,z=r.iconSecondary;let a=I.toString();if((A=n.get(a))&&(F=x.get("icon-offset").evaluate(l,{},s),B=x.get("icon-anchor").evaluate(l,{},s),S=hB(o.get(a),z?o.get(z.toString()):void 0,F,B),k=A.sdf,void 0===i.sdfIcons?i.sdfIcons=A.sdf:i.sdfIcons!==A.sdf&&tb("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(A.pixelRatio!==i.pixelRatio||0!==x.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0)),z){let i=z.toString();O=n.get(i)}}R=R||!(!l.icon||!l.icon.hasSecondary());let U=uP(w.horizontal)||w.vertical;i.iconsInText||(i.iconsInText=!!U&&U.iconsInText);let{defaultShapedIcon:V,verticallyShapedIcon:j}=function(i,r,a,n,o,s,l,h,u){let c=uP(s.horizontal)||s.vertical,d=a.get("icon-text-fit-padding").evaluate(n,{},o),f,p=r;return r&&"none"!==u&&(i.allowVerticalPlacement&&s.vertical&&(f=hk(r,s.vertical,u,d,h,l)),c&&(p=hk(r,c,u,d,h,l))),{defaultShapedIcon:p,verticallyShapedIcon:f}}(i,S,x,l,s,w,_*b.textScaleFactor/24,F,N);"none"!==N&&S&&(hN(S)||hU(S))&&(uS(0,A,I,S,V,N,c,n,o),uS(0,O,z,S,V,N,c,n,o),j&&(uS(0,A,I,S,j,N,c,n,o),uS(0,O,z,S,j,N,c,n,o)));let{iconBBox:G,iconVerticalBBox:H,textBBox:q,textVerticalBBox:$}=function(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_){let g=i.layers[0],y=g.appearances;if(0===y.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};let x={iconBBox:null,iconVerticalBBox:null},v={textBBox:null,textVerticalBBox:null},{baseIconRotate:b,baseTextRotate:w,iconScaleFactor:T}=function(i,r,a){let n=i.get("icon-rotate").evaluate(r,{},a),o=i.get("text-rotate").evaluate(r,{},a),[s,l]=i.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:o,iconScaleFactor:ts(1,s,l)}}(n,o,s);r&&(x.iconBBox=uv(r,x.iconBBox,b),a)&&(x.iconVerticalBBox=uv(a,x.iconVerticalBBox,b+90));let S=uP(f.horizontal);for(let a of(S&&(v.textBBox=uv(S,v.textBBox,w,1,m)),f.vertical&&(v.textVerticalBBox=uv(f.vertical,v.textVerticalBBox,w+90,1,m)),y))a.hasIconLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_){let{appearanceIconOffset:g,appearanceIconRotate:y,appearanceIconSize:x}=uw(n,a,o,s,l,h,u,c.iconScaleFactor),v=null,b=null,w=null;n.hasLayoutProperty("icon-image")?w=function(i,r,a,n,o,s,l,h){let u=null,c=r.getAppearanceValueAndResolveTokens(a,"icon-image",n,o,h);if(c){let d=i.getResolvedImageFromTokens(c),f=a.hasLayoutProperty("icon-size")?a.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"],p=uI(d,hj(i.zoom,f,i.worldview,h),f,o,i.zoom,n,i.pixelRatio,l,i.worldview,h);u=s.get(p.iconPrimary.toString())}return u}(r,a,n,o,s,f,p,_):d&&(w=d.imagePrimary),w&&(v=hB(w,null,g,m),r.allowVerticalPlacement&&(b=hB(w,null,g,m)));let T=u>0?x/u:1;v&&(i.iconBBox=uv(v,i.iconBBox,y,1!==T?T:void 0)),b&&(i.iconVerticalBBox=uv(b,i.iconVerticalBBox,y+90,1!==T?T:void 0))}(x,i,g,a,o,s,h,b,l,u,r,c,T,d,_),a.hasTextLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c){let{appearanceTextOffset:d,appearanceTextRotate:f,appearanceTextSize:p}=uT(a,r,n,o,s,l,h),m=p/h,_=[(d[0]-s[0])*m,(d[1]-s[1])*m],g=0!==_[0]||0!==_[1];u&&(i.textBBox=uv(u,i.textBBox,f,m,d,g?_:void 0)),c&&(i.textVerticalBBox=uv(c,i.textVerticalBBox,f+90,m,d,g?_:void 0))}(v,g,a,o,s,m,w,p,S,f.vertical);return{iconBBox:x.iconBBox,iconVerticalBBox:x.iconVerticalBBox,textBBox:v.textBBox,textVerticalBBox:v.textVerticalBBox}}(i,S=V,j,x,l,s,y,F,b,o,B,w,_,E,f);P.push({feature:l,shapedTextOrientations:w,shapedText:U,shapedIcon:S,iconPrimary:I,iconSecondary:z,iconOffset:F,iconAnchor:B,verticallyShapedIcon:j,layoutTextSize:_,layoutIconSize:y,textOffset:E,isSDFIcon:k,iconTextFit:N,iconCollisionBounds:G,iconVerticalCollisionBounds:H,textCollisionBounds:q,textVerticalCollisionBounds:$})}return{featureData:P,sizes:b,hasAnySecondaryIcon:R,textAlongLine:C,symbolPlacement:M,coverageFrcMask:p,coveragePolygons:m,coverageTileZoom:_,isFeatureCoveredByFrcMask:g,symbolAnchorInFrcCoverage:y}},r.eE=function(i,r,a,n,o){var s=1/Math.tan(r/2);if(i[0]=s/a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=o&&o!==1/0){var l=1/(n-o);i[10]=(o+n)*l,i[14]=2*o*n*l}else i[10]=-1,i[14]=-2*n;return i},r.eF=tc,r.eG=pW,r.eH=nF,r.eI=cj,r.eJ=e5,r.eK=function(i){let r=Z(new Float64Array(16));X(r,i.pixelMatrix,i.globeMatrix);let a=[0,oD,0],n=[0,oM,0];return eI(a,a,r),eI(n,n,r),[a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!ca(i,new oz(i.center.lat,90)),n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!ca(i,new oz(i.center.lat,-90))]},r.eL=lC,r.eM=lD,r.eN=lT,r.eO=lw,r.eP=function(i,r,a=0,n=!0){let o=new eJ(a,a),s=i.sub(o),l=r.add(o),h=[s,new eJ(l.x,s.y),l,new eJ(s.x,l.y)];return n&&h.push(s.clone()),h},r.eQ=uB,r.eR=function(i,r){return is(Object.assign(i,{method:"POST"}),r)},r.eS=function(i,r,a,n,o,s,l,h,u,c){i.iconAtlasPositions=c.iconPositions;let{featureData:d,hasAnySecondaryIcon:f,sizes:p,textAlongLine:m,symbolPlacement:_,coveragePolygons:g,coverageTileZoom:y,symbolAnchorInFrcCoverage:
7x}=r;for(let r of d){let{shapedIcon:a,verticallyShapedIcon:s,feature:d,shapedTextOrientations:v,shapedText:b,layoutTextSize:w,textOffset:T,isSDFIcon:S,iconPrimary:E,iconSecondary:I,iconTextFit:A,iconOffset:M,iconCollisionBounds:C,iconVerticalCollisionBounds:D,textCollisionBounds:R}=r;uA(a,c.iconPositions,E,I),uA(s,c.iconPositions,E,I),function(i,r){for(let a in i.horizontal)uM(i.horizontal[a],r);uM(i.vertical,r)}(v,c.iconPositions),function(i,r,a){if(!r)return;let n=a.get(i.toString()),o=a.get(r.toString());n&&o&&(n.paddedRect.w===o.paddedRect.w&&n.paddedRect.h===o.paddedRect.h||tb(`Mismatch in icon variant sizes: ${i.toString()} and ${r.toString()}`),n.usvg!==o.usvg&&tb(`Mismatch in icon variant image types: ${i.id} and ${r.id}`))}(E,I,c.iconPositions),(b||a)&&function(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I){var A;let M=l.textMaxSize.evaluate(r,{},f);void 0===M?M=h*l.textScaleFactor:M*=l.textScaleFactor;let C=i.layers[0].layout,D=h*l.textScaleFactor/24,R=uP(a.horizontal)||a.vertical,P=i.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),L=i.getAppearanceFeatureData(r.index);("none"!==g||P)&&L&&(L.textShaping=R,L.iconTextFitPadding=C.get("icon-text-fit-padding").evaluate(r,{},f),L.fontScale=D,L.textScaleFactor=l.textScaleFactor);let z="globe"===p.name,O=i.tilePixelRatio*M/24,F=(A=i.overscaling,i.zoom>18&&A>2&&(A>>=1),Math.max(8192/(512*A),1)*C.get("symbol-spacing")),B=C.get("text-padding")*i.tilePixelRatio,k=C.get("icon-padding")*i.tilePixelRatio,N=C.get("text-max-angle")*e7,U="map"===C.get("icon-rotation-alignment")&&"point"!==v,V=F/2;!1===i.hasAnyIconTextFit&&"none"!==g&&(i.hasAnyIconTextFit=!0);let j=r.properties?+r.properties[lZ]:null,G=i.hdExt?i.hdExt.elevationFeatureIdToIndex:void 0,H=j&&G?G.get(j):65535,q=(h,v,A)=>{if(v.x<0||v.x>=8192||v.y<0||v.y>=8192||S&&S.length>0&&r.properties&&I&&I(S,r.properties,v,f,E))return;let M=null;if(z){let{x:i,y:r,z:a}=p.projectTilePoint(v.x,v.y,A);M={anchor:new hq(i,r,a,0,void 0),up:p.upVector(A,v.x,v.y)}}!function(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,D,R,P){let L=i.addToLineVertexArray(r,n),z,O,F,B,k,N,U,V=0,j=0,G=0,H=0,q=-1,$=-1,Z={},W=ic(""),X=a?a.anchor:r,Y="none"!==M,K=0,J=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")){let i=u.layout.get("text-offset").evaluate(b,{},E);K=24*i[0],J=24*i[1]}else K=24*u.layout.get("text-radial-offset").evaluate(b,{},E),J=uy;if(i.allowVerticalPlacement&&o.vertical){let i=o.vertical;if(_)N=uz(i),h&&(U=uz(h));else{let a=u.layout.get("text-rotate").evaluate(b,{},E)+90;F=uL(c,X,r,d,f,p,i,m,a,g,P),h&&(B=uL(c,X,r,d,f,p,h,y,a,null,R))}}if(s){let n=u.layout.get("icon-rotate").evaluate(b,{},E),o=uu(s,n,T,Y,w.iconScaleFactor),l=h?uu(h,n,T,Y,w.iconScaleFactor):void 0;O=uL(c,X,r,d,f,p,s,y,n,null,D);let m=function(i,r,a,n,o,s,l,h,u){let c=i.layers[0],d=c.appearances,f=r.length;if(a&&(f=Math.max(f,a.length)),0===d.length)return f;let[p,m]=n.get("icon-size-scale-range"),_=ts(1,p,m);for(let r of d)if(r.hasLayoutProperty("icon-image")){let a=c.getAppearanceValueAndResolveTokens(r,"icon-image",s,l,u);if(a){let n=i.getResolvedImageFromTokens(a);if(n){let a=r.hasLayoutProperty("icon-size")?r.getUnevaluatedLayoutProperty("icon-size"):o._values["icon-size"],c=uI(n,hj(i.zoom,a,i.worldview,u),a,l,i.zoom,s,i.pixelRatio,_,i.worldview,u),d=h.get(c.iconPrimary.toString());d&&(f=Math.max(f,function(i){let r=i.stretchY||[[0,i.paddedRect.h-2]];return i.stretchX||i.stretchY?uf(i.stretchX||[[0,i.paddedRect.w-2]])*uf(r):1}(d)))}}}return f}(i,o,l,u.layout,u._unevaluatedLayout,b,E,i.iconAtlasPositions,S);V=4*m;let _=u.layout.get("icon-size").evaluate(b,{},E,S),g=w.compositeIconSizes?w.compositeIconSizes[0].evaluate(b,{},E,S):0,M=w.compositeIconSizes?w.compositeIconSizes[1].evaluate(b,{},E,S):0,C=uR(i.layerIds[0],i.iconSizeData,_,s.imagePrimary.usvg?1:w.iconScaleFactor,g,M);i.addSymbols(i.icon,o,C,v,x,b,void 0,a,r,L.lineStartIndex,L.lineLength,-1,S,E,I,A,i.symbolInstances.length,m),q=i.icon.placedSymbolArray.length-1,l&&(j=4*m,i.addSymbols(i.icon,l,C,v,x,b,hE.vertical,a,r,L.lineStartIndex,L.lineLength,-1,S,E,I,A,i.symbolInstances.length,m),$=i.icon.placedSymbolArray.length-1)}for(let n in o.horizontal){let s=o.horizontal[n];z||(W=ic(s.text),_?k=uz(s):z=uL(c,X,r,d,f,p,s,m,u.layout.get("text-rotate").evaluate(b,{},E),g,P));let h=1===s.positionedLines.length;if(G+=uD(i,a,r,s,l,u,_,b,g,L,o.vertical?hE.horizontal:hE.horizontalOnly,h?ug(o.horizontal):[n],Z,q,w,S,E,i.symbolInstances.length,I),h)break}o.vertical&&(H+=uD(i,a,r,o.vertical,l,u,_,b,g,L,hE.vertical,["vertical"],Z,$,w,S,E,i.symbolInstances.length,I));let Q=-1,ee=(i,r)=>i?Math.max(i,r):r;
7Q=ee(k,-1),Q=ee(N,Q);let et=+((Q=ee(U,Q))>-1);i.glyphOffsetArray.length>=65535&&tb("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,b.sortKey),i.symbolInstances.emplaceBack(r.x,r.y,X.x,X.y,X.z,Z.right>=0?Z.right:-1,Z.center>=0?Z.center:-1,Z.left>=0?Z.left:-1,Z.vertical>=0?Z.vertical:-1,q,$,W,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==F?F:i.collisionBoxArray.length,void 0!==F?F+1:i.collisionBoxArray.length,void 0!==O?O:i.collisionBoxArray.length,void 0!==O?O+1:i.collisionBoxArray.length,B||i.collisionBoxArray.length,B?B+1:i.collisionBoxArray.length,d,G,H,V,j,et,0,K,J,Q,0,+!!Y,C)}(i,v,M,h,a,n,s,o,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,B,x,u,k,U,y,r,l,c,d,f,m,_,g,H,b,w,T)};if("line"===v)for(let o of lk(r.geometry,0,0,8192,8192))for(let r of function(i,r,a,n,o,s,l){let h=n?.6*24*s:0,u=hW(n,o),c=u*s,d=0===i[0].x||8192===i[0].x||0===i[0].y||8192===i[0].y;return r-c<r/4&&(r=c+r/4),function i(r,a,n,o,s,l,h,u,c){let d=l/2,f=hZ(r),p=0,m=a-n,_=[];for(let i=0;i<r.length-1;i++){let a=r[i],h=r[i+1],u=a.dist(h),g=h.angleTo(a);for(;m+n<p+u;){let y=((m+=n)-p)/u,x=iw(a.x,h.x,y),v=iw(a.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-d>=0&&m+d<=f){let a=new hq(x,v,0,g,i);o&&!h$(r,a,l,o,s)||_.push(a)}}p+=u}return u||_.length||h||(_=i(r,p/2,n,o,s,l,h,!0,c)),_}(i,d?r/2*l%r:(u/2+48)*s*l%r,r,h,a,c,d,!1,8192)}(o,F,N,a.vertical||R,n,O,i.overscaling))R&&function(i,r,a,n){let o=i.compareText;if(r in o){let i=o[r];for(let r=i.length-1;r>=0;r--)if(n.dist(i[r])<a)return!0}else o[r]=[];return o[r].push(n),!1}(i,R.text,V,r)||q(o,r,f);else if("line-center"===v){for(let i of r.geometry)if(i.length>1){let r=function(i,r,a,n,o){let s=a?.6*24*o:0,l=hW(a,n)*o,h=0,u=hZ(i)/2;for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1],c=n.dist(o);if(h+c>u){let d=(u-h)/c,f=new hq(iw(n.x,o.x,d),iw(n.y,o.y,d),0,o.angleTo(n),a);return!s||h$(i,f,l,s,r)?f:void 0}h+=c}}(i,N,a.vertical||R,n,O);r&&q(i,r,f)}}else if("Polygon"===r.type)for(let i of e2(r.geometry,0)){let r=function(i,r=1,a=!1){let n=1/0,o=1/0,s=-1/0,l=-1/0,h=i[0];for(let i=0;i<h.length;i++){let r=h[i];(!i||r.x<n)&&(n=r.x),(!i||r.y<o)&&(o=r.y),(!i||r.x>s)&&(s=r.x),(!i||r.y>l)&&(l=r.y)}let u=Math.min(s-n,l-o),c=u/2,d=new rD([],um);if(0===u)return new eJ(n,o);for(let r=n;r<s;r+=u)for(let a=o;a<l;a+=u)d.push(new u_(r+c,a+c,c,i));let f=function(i){let r=0,a=0,n=0,o=i[0];for(let i=0,s=o.length,l=s-1;i<s;l=i++){let s=o[i],h=o[l],u=s.x*h.y-h.x*s.y;a+=(s.x+h.x)*u,n+=(s.y+h.y)*u,r+=3*u}return new u_(a/r,n/r,0,i)}(i),p=d.length;for(;d.length;){let n=d.pop();(n.d>f.d||!f.d)&&(f=n,a&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-f.d<=r||(c=n.h/2,d.push(new u_(n.p.x-c,n.p.y-c,c,i)),d.push(new u_(n.p.x+c,n.p.y-c,c,i)),d.push(new u_(n.p.x-c,n.p.y+c,c,i)),d.push(new u_(n.p.x+c,n.p.y+c,c,i)),p+=4)}return a&&(console.log(`num probes: ${p}`),console.log(`best distance: ${f.d}`)),f.p}(i,16);q(i[0],new hq(r.x,r.y,0,0,void 0),f)}else if("LineString"===r.type)for(let i of r.geometry)q(i,new hq(i[0].x,i[0].y,0,0,void 0),f);else if("Point"===r.type)for(let i of r.geometry)for(let r of i)q([r],new hq(r.x,r.y,0,0,void 0),f)}(i,d,v,a,s,u,p,w,T,S,n,o,l,h,f,A,M,m,_,C,D,R,g,y,x)}a&&i.generateCollisionDebugBuffers(s,i.collisionBoxArray,p.textScaleFactor),i.text.uboBinder&&i.text.uboBinder.finalize(),i.icon.uboBinder&&i.icon.uboBinder.finalize()},r.eT=hX,r.eU=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log2(i)))},r.eV=function(i,r){let a=i.json.extensionsUsed&&i.json.extensionsUsed.includes("mbx_bvh"),n=fO(i);for(let i of n){if(!a)for(let r of i.meshes)!function(i){i.heightmap=new Float32Array(4096),i.heightmap.fill(-1);let r=i.vertexArray.float32,a=i.aabb.min[0]-1,n=i.aabb.min[1]-1,o=64/(i.aabb.max[0]-a+2),s=64/(i.aabb.max[1]-n+2);for(let l=0;l<r.length;l+=3){let h=r[l+2],u=(r[l+0]-a)*o|0,c=(r[l+1]-n)*s|0;h>i.heightmap[64*c+u]&&(i.heightmap[64*c+u]=h)}}(r);i.lights&&(i.lightMeshIndex=i.meshes.length,i.meshes.push(function(i,r){let a={};a.indexArray=new sc,a.vertexArray=new o9,a.colorArray=new sa,a.indexArray.reserveExact(4*i.length),a.vertexArray.reserveExact(10*i.length),a.colorArray.reserveExact(10*i.length),fF(i,r,a.indexArray,a.vertexArray,a.colorArray);let n={defined:!0};n.emissiveFactor=iS.black;let o={};return o.baseColorFactor=iS.white,n.pbrMetallicRoughness=o,a.material=n,a.aabb=new uq([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),a}(i.lights,r)))}return n},r.eW=function(i,r,a){return r?_s(i,r,a):i.tiles&&i.tiles.length>0?{tiles:i.tiles}:Error('TileJSON is missing required "tiles" property')},r.eX=function(i){return i*te},r.eY=["type","source","source-layer","minzoom","maxzoom","filter","layout"],r.eZ=a2,r.e_=function(i){return i({pluginStatus:nC,pluginURL:nD}
7),nL.on("pluginStateChange",i),i},r.ea=n7,r.eb=t_,r.ec=function(i,r,a,n,o){return ts((i-r)/(a-r)*(o-n)+n,n,o)},r.ed=dN,r.ee=function(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i[3]=Math.max(r[3],a[3]),i},r.ef=function(i){let r=i.layers[0];"circle"===r.type&&"hd-road-markup"===r.layout.get("circle-elevation-reference")&&(i.hdExt=new dj)},r.eg=function(i,r){let a=i.layers[0].layout.get("fill-elevation-reference"),n="hd-road-base"===a||"hd-road-markup"===a?a:null,o=!!r&&r.length>0&&dN(r,i.layers[0].source,i.sourceLayerName);(n||o)&&(i.hdExt=new dU(i,n,o))},r.eh=function(i,r){let a="hd-road-markup"===i.layers[0].layout.get("line-elevation-reference"),n=!!r&&r.length>0&&dN(r,i.layers[0].source,i.sourceLayerName);(a||n)&&(i.hdExt=new dV(a,n))},r.ei=function(i){"hd-road-markup"===i.layers[0].layout.get("symbol-elevation-reference")&&(i.hdExt=new dH)},r.ej=oU,r.ek=rd,r.el=rf,r.em=function(i,r){return i/oF(r)},r.en=function(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i[3]=Math.min(r[3],a[3]),i},r.eo=X,r.ep=ef,r.eq=aE,r.er=X,r.es=ef,r.et=ic,r.eu=eb,r.ev=cf,r.ew=tp,r.ex=ew,r.ey=eL,r.ez=eL,r.f=ch,r.f$=th,r.f0=oG,r.f1=function(i){let r;if("provider"in i&&!i.provider)return null;let a=i.provider;if(!a&&"url"in i&&i.url&&(a=function(i){try{let r=new URL(i).pathname.split("/").pop()||"",a=r.lastIndexOf(".");return a>=0?r.slice(a+1):""}catch{return""}}(i.url)),!a)return null;let n=tj.TILE_PROVIDER_URLS[a];if(!n)return null;try{r=new URL(n,tj.API_URL).href}catch(i){return Error(`TileProvider "${a}" has an invalid URL: "${n}"`)}return{name:a,url:r}},r.f2=eB,r.f3=J,r.f4=ek,r.f5=function(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+o*h,i[1]=o*u-n*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i},r.f6=ee,r.f7=nA,r.f8=function(i,r){return[Math.pow(i[0],2.2)*r,Math.pow(i[1],2.2)*r,Math.pow(i[2],2.2)*r]},r.f9=tk,r.fA=aN,r.fB=aB,r.fC=aF,r.fD=ak,r.fE=function(i,r,a,n,o,s,l,h,u){if("globe"===u.name)return u1(i,r,new ch(a,n,o),!1);let c=cp({z:a,x:n,y:o},u);return new uq([(s+c.x/c.scale)*r,r*(c.y/c.scale),l],[(s+c.x2/c.scale)*r,r*(c.y2/c.scale),h])},r.fF=u2,r.fG=mv,r.fH=oV,r.fI=cp,r.fJ=o$,r.fK=eA,r.fL=eI,r.fM=ez,r.fN=cV,r.fO=eM,r.fP=uQ,r.fQ=Y,r.fR=function(i,r){if(i===r){var a=r[1],n=r[2],o=r[3],s=r[6],l=r[7],h=r[11];i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=a,i[6]=r[9],i[7]=r[13],i[8]=n,i[9]=s,i[11]=r[14],i[12]=o,i[13]=l,i[14]=h}else i[0]=r[0],i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=r[1],i[5]=r[5],i[6]=r[9],i[7]=r[13],i[8]=r[2],i[9]=r[6],i[10]=r[10],i[11]=r[14],i[12]=r[3],i[13]=r[7],i[14]=r[11],i[15]=r[15];return i},r.fS=nR,r.fT=nJ,r.fU=tf,r.fV=eK,r.fW=function(i,r,a,n,o){let s=5*r+2;i.float32[s+0]=a,i.float32[s+1]=n,i.float32[s+2]=o},r.fX=function(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()},r.fY=function(i){let r=[],a=i.id;return void 0===a&&r.push({message:`layers.${a}: missing required property "id"`}),void 0===i.render&&r.push({message:`layers.${a}: missing required method "render"`}),i.renderingMode&&"2d"!==i.renderingMode&&"3d"!==i.renderingMode&&r.push({message:`layers.${a}: property "renderingMode" must be either "2d" or "3d"`}),r},r.fZ=function(i){return!!i&&tt.test(i)},r.f_=tb,r.fa=e_,r.fb=eP,r.fc=K,r.fd=eZ,r.fe=eg,r.ff=eu,r.fg=function(i){tj.ACCESS_TOKEN=i},r.fh=function(i){tj.API_URL=i},r.fi=function(i){tj.BUILDING_GEN_URL=tV.resolveURL(i)},r.fj=function(i,r){tK=i,tJ=r},r.fk=function(i,r,a){i[4*r+0]=a[0],i[4*r+1]=a[1],i[4*r+2]=a[2],i[4*r+3]=a[3]},r.fl=function(i){tj.DRACO_URL=tV.resolveURL(i)},r.fm=function(i){tj.MAX_PARALLEL_IMAGE_REQUESTS=i},r.fn=function(i){let r=tV.resolveURL(i);tj.MESHOPT_URL=r,tj.MESHOPT_SIMD_URL=r},r.fo=function(i,r,a=!1){if(nC===nA.deferred||nC===nA.loading||nC===nA.loaded)throw Error("setRTLTextPlugin cannot be called multiple times.");nD=tV.resolveURL(i),nC=nA.deferred,nM=r,nP(),a||nO()},r.fp=cz,r.fq=tl,r.fr=h8,r.fs=nK,r.ft=tT,r.fu=ev,r.fv=function(i){try{let r=self[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}},r.fw=tX,r.fx=ed,r.fy=e$,r.fz=ed,r.g=l3,r.g0=eC,r.h=sA,r.i=iS,r.j=rh,r.k=mo,r.l=nZ,r.m=class{constructor(i){this.entries={}
7,this.scheduler=i}request(i,r,a,n){let o=this.entries[i]=this.entries[i]||{callbacks:[]};if(o.result){let[i,a]=o.result;return this.scheduler?this.scheduler.add(()=>{n(i,a)},r):n(i,a),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=a((a,n)=>{for(let i of(o.result=[a,n],o.callbacks))this.scheduler?this.scheduler.add(()=>{i(a,n)},r):i(a,n);setTimeout(()=>delete this.entries[i],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(i=>i!==n),o.callbacks.length||(o.cancel(),delete this.entries[i]))}}},r.n=[1,1,1],r.o=mS,r.p=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return function([i,r]){let a=tT([1,i,r]);return{x:a.x,y:a.y,z:a.z}}(i.expression.evaluate(r))}interpolate(i,r,a){return{x:iw(i.x,r.x,a),y:iw(i.y,r.y,a),z:iw(i.z,r.z,a)}}},r.q=7,r.r=8192,r.s=class{isDataAvailableAtPoint(i){let r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;let a=r.getSource().maxzoom,n=1<<a,o=Math.floor(i.x),s=Math.floor((i.x-o)*n),l=Math.floor(i.y*n),h=this.findDEMTileFor(new cc(a,o,a,s,l));return!(!h||!h.dem)}
7getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,a=!0){if(this.isUsingMockSource())return null;null==r&&(r=null);let n=this._source();if(!n||i.y<0||i.y>1)return r;let o=n.getSource().maxzoom,s=1<<o,l=Math.floor(i.x),h=i.x-l,u=new cc(o,l,o,Math.floor(h*s),Math.floor(i.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return r;let d=c.dem,f=1<<c.tileID.canonical.z,p=(h*f-c.tileID.canonical.x)*d.dim,m=(i.y*f-c.tileID.canonical.y)*d.dim,_=Math.floor(p),g=Math.floor(m);return(a?this.exaggeration():1)*iw(iw(d.get(_,g),d.get(_,g+1),m-g),iw(d.get(_+1,g),d.get(_+1,g+1),m-g),p-_)}static getAtTileOffset(i,r,a,n){let o=1<<i.canonical.z;return n?n.pointElevation(r):a?a.getAtPointOrZero(new oj(i.wrap+(i.canonical.x+r.x/8192)/o,(i.canonical.y+r.y/8192)/o)):0}static getAtTileOffsetFunc(i,r,a,n){return(o,s,l)=>{let h=this.getAtTileOffset(i,o,s,l),u=n.upVector(i.canonical,o.x,o.y);return e_(u,u,h*n.upVectorScale(i.canonical,r,a).metersToTile),u}}getForTilePoints(i,r,a,n){if(this.isUsingMockSource())return!1;let o=mo.create(this,i,n);return!!o&&(r.forEach(i=>{i[2]=this.exaggeration()*o.getElevationAt(i[0],i[1],a,!0)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;let r=this.findDEMTileFor(i);if(!r||!r.dem)return null;let a=r.dem.tree,n=r.tileID,o=1<<i.canonical.z-n.canonical.z,s=i.canonical.x/o-n.canonical.x,l=i.canonical.y/o-n.canonical.y,h=0;for(let r=0;r<i.canonical.z-n.canonical.z&&!a.leaves[h];r++){let i=2*Math.floor(l*=2)+Math.floor(s*=2);h=a.childOffsets[h]+i,s%=1,l%=1}return{min:this.exaggeration()*a.minimums[h],max:this.exaggeration()*a.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(i,r,a){throw Error("Pure virtual method called.")}pointCoordinate(i){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(i){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let i=this.visibleDemTiles;if(0===i.length)return null;let r=!1,a=Number.MAX_VALUE,n=5e-324;for(let o of i){let i=this.getMinMaxForTile(o.tileID);i&&(a=Math.min(a,i.min),n=Math.max(n,i.max),r=!0)}return r?{min:a,max:n}:null}},r.t=class{static parseFrom(i,r){let a=c8.parse(i);if(!a)return[];let{vertices:n,features:o}=a,s=1/oV(r);o.sort((i,r)=>i.id-r.id),n.sort((i,r)=>i.id-r.id||i.idx-r.idx);let l=[],h=0,u=(n=n.filter((i,r,a)=>r===a.findIndex(r=>
7r.id===i.id&&r.idx===i.idx))).length;for(let i of o){if(i.constantHeight){l.push(new c7(i.id,i.bounds,i.constantHeight));continue}for(;h!==u&&n[h].id<i.id;)h++;if(h===u||n[h].id!==i.id)continue;let r=[],a=[],o=h;for(;h!==u&&n[h].id===i.id;){let i=n[h];if(r.push({position:i.position,height:i.height,extent:i.extent}),h!==o&&n[h-1].idx===i.idx-1){let i=h-o;a.push({a:i-1,b:i})}h++}l.push(new c7(i.id,i.bounds,void 0,r,a,s))}return l}},r.u=c0,r.v=ip,r.w=nk,r.x=id,r.y=ig,r.z=6}),n(["require","./shared"],function(i,r){var a;function n(i){let r=i?i.url.toString():void 0;return r?performance.getEntriesByName(r):[]}function o(i,a){if(Object.hasOwn(i.layers,r.W))return r.t.parseFrom(i.layers[r.W],a)}function s({buckets:i,data:a,sourceLayerCoder:n,canonical:o,options:l}){if(!l.elevationFeatures||0===l.elevationFeatures.length)return;let h=[];for(let a of Object.values(i))if(a instanceof r.J&&a.hdExt){let i=a.hdExt.getUnevaluatedPortalGraph();i&&h.push(i)}let u=r.u.evaluate(h);for(let s of Object.values(i))if(s instanceof r.J&&s.hdExt){let i=a.layers[n.decode(s.sourceLayerIndex)];s.hdExt.setEvaluatedPortalGraph(u,i,o,l.availableImages,l.brightness,s.worldview)}}function l(i){let a=[];for(let n=0;n<i.length;n++){let o=i.feature(n),s=o.properties.frc_mask;if(null==s)continue;let l=Number(s);if(!l)continue;let h=o.loadGeometry();if(h.length>0){let i=!1;for(let a of h[0])if(a.x<0||a.x>r.r||a.y<0||a.y>r.r){i=!0;break}if(i)continue}let u=1===h.length&&5===h[0].length&&h[0].some(i=>i.x<=0&&i.y<=0)&&h[0].some(i=>i.x>=r.r&&i.y<=0)&&h[0].some(i=>i.x>=r.r&&i.y>=r.r)&&h[0].some(i=>i.x<=0&&i.y>=r.r);a.push(new r.M(l,u?[]:h))}return a}function h(i,a,n,o,s){let l=r.cp(a);if(null===l)return!1;let h=n.x,u=n.y,c=null!=s?s:o.z;if(o.z!==c){let i=1<<o.z-c,a=r.r/i;h=o.x%i*a+n.x/i,u=o.y%i*a+n.y/i}for(let a of i){if(!(a.hasGeometry()&&a.frcMask&1<<l))continue;let i=a.rings.map(i=>i.map(i=>[i.x,i.y]));if(r.eJ([h,u],i))return!0}return!1}function u(i,a,n,o){let s=a.indoorState.activeFloorsVisible;if(!a.sourceLayers)return s?a.indoorState.activeFloors:void 0;let l=function(i,a){if(!i)return r.f_("No source layers defined in indoor specification"),a;if(0===i.size)return a;for(let n of i.difference(a))r.f_(`Missing source layer required in indoor specification: ${n}`);return a.intersection(a)}(a.sourceLayers,new Set(Object.keys(i.layers))),h=a.indoorState,u=function(i,a,n,o,s){let l={};for(let n of a){let a=i.layers[n];if(a)for(let i=0;i<a.length;i++){let n=a.feature(i);if(d(h=n,["type","id","name"])&&"structure"===h.properties.type){let{id:i,center:r}={id:(u=n).properties.id.toString(),center:[u.properties.center_lon||0,u.properties.center_lat||0]};c(l,i,r);continue}if(d(f=n,["type","id","name","z_index"])&&"floor"===f.properties.type){let i=(p=n,m=s,{id:p.properties.id.toString(),isDefault:!!p.properties.is_default&&p.properties.is_default,connections:p.properties.connected_floor_ids?new Set(p.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:p.properties.conflicted_floor_ids?new Set(p.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:p.properties.structure_ids?new Set(p.properties.structure_ids.toString().split(";")):new Set,name:p.properties.name.toString(),zIndex:p.properties.z_index,geometry:function(i,a){let n=i.loadGeometry();if(!n||0===n.length)return;let o=n.map(n=>n.map(n=>r.cV(n,a,i.extent)));return 0===o.length?void 0:{type:"Polygon",coordinates:[o[0]]}}(p,m)});var h,u,f,p,m,_=l,g=i.buildings,y=i.id,x=i;for(let i of g)c(_,i),_[i].floors[y]=x,_[i].floorIds.add(y)}}else r.f_(`indoor source layer not found: ${n}`)}return{buildings:l,activeFloors:r.a5.calculate(l,o,n)}}(i,l,h.activeFloors,h.selectedFloorId,o);return n.send("setIndoorData",u),s?u.activeFloors:void 0}function c(i,r,a){i[r]?a&&(i[r].center=a):i[r]={floorIds:new Set,center:a||[0,0],floors:{}}}function d(i,r){return r.every(r=>i.properties&&null!=i.properties[r])}function f(i,a){i instanceof r.J?r.eg(i,a):i instanceof r.aa?r.eh(i,a):i instanceof r.g?r.ef(i):i instanceof r.aX&&r.ei(i)}function p(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${p(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}:${p(i[a])},`;return`${r}}`}function m(i,r){return function i(a){return"string"==typeof a&&a===r||(Array.isArray(a)?a.some(i):!(!a||"object"!=typeof a)&&Object.values(a).some(i))}(i)}class _{constructor(i){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),i&&this.replace(i)}replace(i,r){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(i,[],r)}update(i,a,n){for(let a of(this._options=n,i))this._layerConfigs[a.id]=a,(this._layers[a.id]=r.c0(a,this.scope,null,this._options)).compileFilter(n),this.keyCache[a.id]&&delete this.keyCache[a.id];for(let i of a)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];for(let i of(this.familiesBySource=Object.create(null),function(i,a){let n=Object.create(null);for(let o=0;o<i.length;o++){let s=i[o],l=a&&a[s.id];l||("symbol"===s.type?l=s.id:(l=function(i){let a="";for(let n of r.eY)a+=`/${p(i[n])}`;return a}(s),"line"===s.type&&s.paint&&(m(s.paint["line-width"],"line-progress")&&(l+=`/${p(s.paint["line-width"])}`),m(s.paint["line-emissive-strength"],"line-progress")&&(l+=`/${p(s.paint["line-emissive-strength"])}`)))),a&&(a[s.id]=l);let h=n[l];h||(h=n[l]=[]),h.push(s)}let o=[];for(let i in n)o.push(n[i]);return o}(Object.values(this._layerConfigs),this.keyCache))){let r=i.map(i=>this._layers[i.id]),a=r[0];if("none"===a.visibility)continue;let n=a.source||"",o=this.familiesBySource[n];o||(o=this.familiesBySource[n]=Object.create(null));let s=a.sourceLayer||"_geojsonTileLayer",l=o[s];l||(l=o[s]=[]),l.push(r)}}}let g=+r.aI;class y{constructor(i){const a={},n=[];for(const r in i){const o=i[r],s=a[r]={};for(const i in o.glyphs){const r=o.glyphs[+i];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=r.metrics.localGlyph?g:1,l={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(l),s[i]=l}}const{w:o,h:s}=r.eT(n),l=new r.b({width:o||1,height:s||1});for(const n in i){const o=i[n];for(const i in o.glyphs){const s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const h=a[n][i],u=s.metrics.localGlyph?g:1;r.b.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=a}}function x(i){for(let r of i)if(null!=r.hdExt||r.requiresHDRuntime)return!0;return!1}function v(i){for(let r of i)if(r.requiresStandardRuntime)return!0;return!1}r.eZ(y,"GlyphAtlas");class b{constructor(i){this.tileID=new r.ap(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.showElevationIdDebug=i.showElevationIdDebug,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.renderSourceType=i.renderSourceType,this.frcCoverage=i.frcCoverage||null,this.deferRoadStructure=!1,this.tileTransform=r.fI(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor,this.worldview=i.worldview,this.indoor=i.indoor}isLayerActiveForTile(i){return!(this.renderSourceType===r.aC.Symbol&&"symbol"!==i.t
7ype||this.renderSourceType===r.aC.FillExtrusion&&"fill-extrusion"!==i.type||this.renderSourceType===r.aC.Other&&("symbol"===i.type||"fill-extrusion"===i.type)||i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"===i.visibility)}parse(i,r,a,n,o,s){this._parseAfterHD(i,r,a,n,o,s)}_parseAfterHD(i,a,n,c,d,p){let m;if(this.status="parsing",this.data=i,this.renderSourceType===r.aC.HdRoadCoverage){let a=i.layers[r.X];m=a&&l?l(a):[]}this.collisionBoxArray=new r.h;let _=new r.o(Object.keys(i.layers).sort()),g=new r.I(this.tileID,this.promoteId);g.bucketLayerIDs=[];let b={},T=new r.a9(256,256),S={featureIndex:g,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:T,availableImages:n,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&u&&(S.activeFloors=u(i,this.indoor,d,this.canonical));let E=[],I=a.familiesBySource[this.source];if(this.deferRoadStructure=!1,this.renderSourceType!==r.aC.HdRoadCoverage&&null!=this.frcCoverage&&!this.frcCoverage.resolved&&null===this.frcCoverage.frcMask){for(let i in I)if(r.ed&&r.ed(this.frcCoverage.sourceLayers,this.source,i)){this.deferRoadStructure=!0;break}}for(let a in I){let s=i.layers[a];if(!s)continue;let l=!1,h=!1,u=!1,d=!1;for(let i of I[a])"symbol"===i[0].type?l=!0:"fill-extrusion"===i[0].type?h=!0:u=!0,i[0].is3D()&&"model"!==i[0].type&&(d=!0);if(this.extraShadowCaster&&!d||this.renderSourceType===r.aC.Symbol&&!l||this.renderSourceType===r.aC.FillExtrusion&&!h||(this.renderSourceType===r.aC.Other||this.renderSourceType===r.aC.HdRoadCoverage)&&!u)continue;let p=null!=this.frcCoverage&&!!r.ed&&r.ed(this.frcCoverage.sourceLayers,this.source,a);if(this.deferRoadStructure&&p)continue;1===s.version&&r.f_(`Vector tile source "${this.source}" layer "${a}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let m=_.encode(a),y=[],x=this.localizableLayerIds&&this.localizableLayerIds.has(a),v=!1;for(let i=0,n=0;i<s.length;i++){let o=s.feature(i),l=g.getId(o,a),h=o.properties?o.properties.worldview:null;if(x&&this.worldview&&"string"==typeof h)if("all"===h)o.properties.$localized=!0;else{if(!h.split(",").includes(this.worldview))continue;o.properties.$localized=!0,o.properties.worldview=this.worldview}!v&&o.properties&&Object.hasOwn(o.properties,r.ar)&&(v=!0),p&&this.frcCoverage&&this.frcCoverage.frcMask&&o.properties&&r.dz&&r.dz(o.properties,this.frcCoverage.frcMask)||(y.push({feature:o,id:l,index:n,sourceLayerIndex:m}),n++)}for(let s of(v&&!S.elevationFeatures&&o&&(S.elevationFeatures=o(i,this.canonical)),I[a])){let i=s[0];if(this.extraShadowCaster&&(!i.is3D()||"model"===i.type)||this.renderSourceType===r.aC.Symbol&&"symbol"!==i.type||this.renderSourceType===r.aC.FillExtrusion&&"fill-extrusion"!==i.type||(this.renderSourceType===r.aC.Other||this.renderSourceType===r.aC.HdRoadCoverage)&&("symbol"===i.type||"fill-extrusion"===i.type)||!this.isLayerActiveForTile(i))continue;w(s,this.zoom,S.brightness,n,this.worldview,S.activeFloors);let o=g.bucketLayerIDs.length;g.bucketLayerIDs.push(s.map(i=>r.ea(i.id,i.scope)));let l=()=>{let r=b[i.id]=i.createBucket({index:o,layers:s,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:m,sourceLayerName:a,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:c,worldview:this.worldview,localizable:x,availableImages:n,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});f&&f(r,this.frcCoverage?this.frcCoverage.sourceLayers:null),r.populate(y,S,this.tileID.canonical,this.tileTransform)};i.mayUse("HD")||i.mayUse("Standard")?E.push(i.prepare().then(()=>l())):l()}}let A=()=>{let a,o,l,u,c,f,E;T.trim();let I=!(!S.elevationFeatures||!S.elevationFeatures.some(i=>i.heightRange.min<0)),A={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},M=()=>
7{if(a)return this.status="done",p(a);if(this.extraShadowCaster){this.status="done";let i=Object.values(b).filter(i=>!i.isEmpty());p(null,{buckets:i,containsHdExt:x(i),containsStandardExt:v(i),featureIndex:g,collisionBoxArray:null,hasTunnelGeometry:I,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:S.brightness,glyphMap:null,iconMap:null,glyphPositions:null})}else if(o&&l&&u&&E){let i,a=new y(o),s=new Map;for(let[i,a]of l.entries()){let{imagePosition:n}=r.cR(i,a,r.Z);s.set(i,n)}let p={};for(let i in b){let u=b[i];u instanceof r.aX&&(w(u.layers,this.zoom,S.brightness,n,this.worldview,S.activeFloors),p[i]=r.eD(u,o,a.positions,l,s,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,c,this.worldview,n,this.frcCoverage?this.frcCoverage.frcMask:null,this.frcCoverage?this.frcCoverage.polygons:null,this.frcCoverage?this.frcCoverage.tileZoom:null,r.dz||null,h||null))}c.size||f.size?this.rasterizeTask=d.send("rasterizeImages",{scope:this.scope,iconTasks:c,patternTasks:f},(r,n)=>{if(!r)for(let[i,r]of n.entries())l.has(i)&&l.set(i,Object.assign(l.get(i),{data:r})),u.has(i)&&u.set(i,Object.assign(u.get(i),{data:r}));C(p,a,i,E)}):C(p,a,i,E)}},C=(i,a,o,s)=>{let h=l.size>0||u.size>0,c=Object.keys(i).length>0;if(!h&&!c){this.status="done";let i=Object.values(b).filter(i=>!i.isEmpty());return void p(null,{buckets:i,containsHdExt:x(i),containsStandardExt:v(i),featureIndex:g,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:I,glyphAtlasImage:a.image,lineAtlas:T,imageAtlas:null,brightness:S.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:m})}let f=(o,s)=>{for(let a in b){let o=b[a];if(a in i)r.eS(o,i[a],this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,l,s);else if(o.hasPattern&&(o instanceof r.aa||o instanceof r.J||o instanceof r.K)){w(o.layers,this.zoom,S.brightness,n,this.worldview,S.activeFloors);let i=Object.fromEntries(s.patternPositions);o.addFeatures(S,this.tileID.canonical,i,n,this.tileTransform,this.brightness)}}this.status="done";let h=Object.values(b).filter(i=>!i.isEmpty());p(null,{buckets:h,containsHdExt:x(h),containsStandardExt:v(h),featureIndex:g,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:I,glyphAtlasImage:a.image,lineAtlas:T,imageAtlas:o,brightness:S.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:m})};if(h){let i=new Map,a=r.fr(l,i),n=r.fr(u,i),o=new r.c(a,n,s,this.lut,i);d.send("checkAtlasCache",{descriptor:o,scope:this.scope},(i,a)=>{let n,o;
7if(i&&r.f_(`[Worker] Error checking atlas cache: ${i.message}`),a)n=new r.a0(a.sourceHash),o=a;else{let i=new r._(l,u,this.lut,s);n=i,o=i}f(n,o)})}else f(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){let i=r.eb(S.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(i).length?d.send("getGlyphs",{uid:this.uid,stacks:i},(i,r)=>{a||(a=i,o=r,M())},void 0,!1,A):o={},E=new Map;let n=Array.from(S.iconDependencies.keys()).map(i=>r.a1.parse(i)),s=Array.from(S.patternDependencies.keys()).map(i=>r.a1.parse(i));n.length||s.length?d.send("getImages",{icons:n,patterns:s,source:this.source,scope:this.scope,tileID:this.tileID},(i,r)=>{if(!a){for(let[n,o]of(a=i,l=new Map,u=new Map,c=this.updateImageMapAndGetImageTaskQueue(l,r.images,S.iconDependencies),f=this.updateImageMapAndGetImageTaskQueue(u,r.images,S.patternDependencies),r.versions.entries()))E.set(n,o);M()}},void 0,!1,A):(l=new Map,u=new Map,c=new Map,f=new Map)}s&&s({buckets:b,data:i,sourceLayerCoder:_,canonical:this.tileID.canonical,options:S}),M()};E.length>0?Promise.allSettled(E).then(A).catch(p):A()}updateParameters(i){this.scaleFactor=i.scaleFactor,this.showCollisionBoxes=i.showCollisionBoxes,this.showElevationIdDebug=i.showElevationIdDebug,this.projection=i.projection,this.brightness=i.brightness,this.tileTransform=r.fI(i.tileID.canonical,i.projection),this.extraShadowCaster=i.extraShadowCaster,this.lut=i.lut,this.worldview=i.worldview,this.indoor=i.indoor,this.frcCoverage=i.frcCoverage||null}updateImageMapAndGetImageTaskQueue(i,r,a){let n=new Map;for(let o of r.keys())for(let s of a.get(o)||[]){let a=s.toString(),o=r.get(s.id.toString());o.usvg?n.has(a)||(n.set(a,s),i.set(a,Object.assign({},o))):i.set(a,o)}return n}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function w(i,a,n,o,s,l){let h=new r.w(a,{brightness:n,worldview:s,activeFloors:l});for(let r of i)r.recalculate(h,o)}class T extends r.y{constructor({actor:i,layerIndex:a,availableImages:n,availableModels:o,isSpriteLoaded:s,tileProvider:l,brightness:h,maxUniformBufferBindings:u,maxUniformBlockSizeDwords:c,disableSymbolUBO:d}){super(),this.actor=i,this.layerIndex=a,this.availableImages=n,this.availableModels=o,this.loadVectorData=r.e9,this.tileProvider=l,this.loading={},this.loaded={},this.deduped=new r.m(i.scheduler),this.isSpriteLoaded=s,this.scheduler=i.scheduler,this.brightness=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSizeDwords=c,this.disableSymbolUBO=d}loadTileData(i,r){if(!this.tileProvider)return this.loadVectorData(i,r);let a=new AbortController;return this.loadTileWithProvider(this.tileProvider,i,a,r),()=>a.abort()}async loadTileWithProvider(i,r,a,n){let{z:o,x:s,y:l}=r.tileID.canonical;try{let h=await i.loadTile({z:o,x:s,y:l},{request:r.request,signal:a.signal});if(a.signal.aborted)return;if(null==h){let i=Error("Tile not found");return i.status=404,n(i)}if(null==h.data)return n(null,null);if(h.data instanceof ImageBitmap)return n(Error("Vector tiles require ArrayBuffer data"));let u=new Map;h.expires&&u.set("expires",h.expires),h.cacheControl&&u.set("cache-control",h.cacheControl),n(null,{rawData:h.data,responseHeaders:u})}catch(i){if(a.signal.aborted)return;n(i instanceof Error?i:Error(String(i)))}}loadTile(i,a){let o=i.uid,s=i&&i.request,l=s&&s.collectResourceTiming,h=this.loading[o]=new b(i);h.maxUniformBufferBindings=this.maxUniformBufferBindings,h.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,h.disableSymbolUBO=this.disableSymbolUBO,h.abort=this.loadTileData(i,(u,c)=>{let d=!this.loading[o];if(delete this.loading[o],h.cancelRasterize(),d||u||!c)return h.status="done",d||(this.loaded[o]=h),a(u);let f=c.rawData,p={},m=r.cO(c.responseHeaders);m&&m.expires&&(p.expires=m.expires),m&&m.cacheControl&&(p.cacheControl=m.cacheControl),h.vectorTile=c.vectorTile||new r.be(new r.as(f));let _=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(i,r)=>{if(i||!r)return a(i);let o={};if(l){let i=n(s);i.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(i)))}a(null,Object.assign({rawTileData:f.slice(0),responseHeaders:c.responseHeaders},r,p,o))})};this.isSpriteLoaded?_():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(_,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom}):_()}),this.loaded=this.loaded||{},this.loaded[o]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.updateParameters(i);let s=(i,a)=>{let n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,n)),r(i,a)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,s):s())}else r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}class S{constructor(i){this.tileProvider=i.tileProvider,this.loading={}}loadTile(i,a){let n=i.uid;if(this.tileProvider){let r=new AbortController;return this.loading[n]={cancel:()=>r.abort()},void this.loadTileWithProvider(this.tileProvider,n,i,r,a)}let{cancel:o}=r.cG(i.request,(o,s,l)=>{let h=!this.loading[n];if(delete this.loading[n],h||o||!s)return a(o);this.decodeTile(n,s,i.encoding).then(i=>{let{expires:n,cacheControl:o}=r.cO(l);a(null,Object.assign(i,{expires:n,cacheControl:o}
7))}).catch(i=>a(i))});this.loading[n]={cancel:o}}async decodeTile(i,a,n){let o=a instanceof ImageBitmap?a:await createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})),s=1-(o.width-r.eU(o.width))/2,l=s<1,h=this.getImageData(o,s);return o.close(),{dem:new r.D(i,h,n,l),borderReady:l}}async loadTileWithProvider(i,r,a,n,o){let{z:s,x:l,y:h}=a.tileID.canonical;try{let u=await i.loadTile({z:s,x:l,y:h},{request:a.request,signal:n.signal});if(n.signal.aborted)return o(null,null);if(null==u){let i=Error("Tile not found");return i.status=404,o(i)}if(null==u.data)return o(null,null);let c=await this.decodeTile(r,u.data,a.encoding);if(n.signal.aborted)return o(null,null);o(null,Object.assign(c,{expires:u.expires,cacheControl:u.cacheControl}))}catch(i){if(n.signal.aborted||i instanceof DOMException&&"AbortError"===i.name)return o(null,null);o(i instanceof Error?i:Error(String(i)))}finally{delete this.loading[r]}}reloadTile(i,r){r(null,null)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.cancel(),delete this.loading[a]),r()}removeTile(i,r){r()}getImageData(i,r){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(i.width,i.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=i.width,this.offscreenCanvas.height=i.height,this.offscreenCanvasContext.drawImage(i,0,0,i.width,i.height);let a=this.offscreenCanvasContext.getImageData(-r,-r,i.width+2*r,i.height+2*r);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),a}}r.af.setPbf(r.as);class E{constructor(i){this._mrt=new r.af(i.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=i.uid,this.tileID=i.tileID,this.source=i.source}parse(i,a){let n=this._mrt;this.status="parsing",this._entireBuffer=i;try{n.parseHeader(i),this._isHeaderLoaded=!0;let o=[];for(let a in n.layers){let s=n.getLayer(a),l=s.getDataRange(s.getBandList()),h=n.createDecodingTask(l),u=i.slice(l.firstByte,l.lastByte+1),c=r.af.performDecoding(u,h).then(i=>h.complete(null,i)).catch(i=>h.complete(i,null));o.push(c)}Promise.allSettled(o).then(()=>a(null,n)).catch(i=>a(i))}catch(i){a(i)}}}class I{constructor({actor:i}){this.actor=i,this.loading={},this.loaded={}}loadTile(i,a){let n=i.uid,o=i.request,s=this.loading[n]=new E(i),{cancel:l}=r.cG(o,(i,r,o)=>{let l=!this.loading[n];if(delete this.loading[n],l||i||!r)return s.status="done",l||(this.loaded[n]=s),a(i);s.parse(r,(i,r)=>{if(i||!r)return a(i);a(null,r,o)}),this.loaded[n]=s});s.abort=l}reloadTile(i,r){r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=i.uid;this.loaded[a]&&delete this.loaded[a],r()}decodeRasterArray(i,a){r.af.performDecoding(i.buffer,i.task).then(i=>a(null,i)).catch(i=>a(i))}}let A=r.bf.prototype.toGeoJSON;class M{constructor(i){this._feature=i,this.extent=r.r,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let a of this._feature.geometry)i.push([new r.au(a[0],a[1])]);return i}{let i=[];for(let a of this._feature.geometry){let n=[];for(let i of a)n.push(new r.au(i[0],i[1]));i.push(n)}return i}}toGeoJSON(i,r,a){return A.call(this,i,r,a)}}class C{constructor(i,a){this.name=i,this.extent=r.r,this.length=a.length,this._jsonFeatures=a}feature(i){return new M(this._jsonFeatures[i])}}class D{constructor(i){for(const a of(this.layers={},this.extent=r.r,Object.keys(i)))this.layers[a]=new C(a,i[a])}}let R=64/4096;class P{constructor(){this.features=new Map}clear(){this.features.clear()}load(i=[],r){for(let a of i){let i=a.id;if(null==i)continue;let n=this.features.get(i);n&&this.updateCache(n,r),a.geometry?(n=function(i){let{id:r,geometry:a,properties:n}=i;if(!a)return;if("GeometryCollection"===a.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:o,coordinates:s}=a,l={id:r,type:1,geometry:[],tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},h=l.geometry;if("Point"===o)z(s,h,l);else if("MultiPoint"===o)for(let i of s)z(i,h,l);else if("LineString"===o)l.type=2,O(s,h,l);else if("MultiLineString"===o)l.type=2,F(s,h,l);else if("Polygon"===o)l.type=3,F(s,h,l,!0);else{if("MultiPolygon"!==o)throw Error("Input data is not a valid GeoJSON object.");for(let i of(l.type=3,s))F(i,h,l,!0)}return l}(a),this.updateCache(n,r),this.features.set(i,n)):this.features.delete(i),this.updateCache(n,r)}}updateCache(i,r){for(let{canonical:a,uid:n}of Object.values(r)){let{z:o,x:s,y:l}=a;L(i,Math.pow(2,o),s,l)&&delete r[n]}}getTile(i,a,n){let o=Math.pow(2,i),s=[];for(let i of this.features.values())L(i,o,a,n)&&s.push(function(i,a,n,o){let{id:s,type:l,geometry:h,tags:u}=i,c=[];if(1===l)for(let i=0;i<h.length;i+=2){let s=Math.round(r.r*(h[i+0]*a-n)),l=Math.round(r.r*(h[i+1]*a-o));c.push([s,l])}else if(2===l)for(let i of h)!function(i,a,n,o,s){let l,h=r.r+128;for(let u=0;u<i.length-2;u+=2){let c=Math.round(r.r*(i[u+0]*a-n)),d=Math.round(r.r*(i[u+1]*a-o)),f=Math.round(r.r*(i[u+2]*a-n)),p=Math.round(r.r*(i[u+3]*a-o)),m=f-c,_=p-d;c<-128&&f<-128||(c<-128?(d+=Math.round((-128-c)/m*_),c=-128):f<-128&&(p=d+Math.round((-128-c)/m*_),f=-128),d<-128&&p<-128||(d<-128?(c+=Math.round((-128-d)/_*m),d=-128):p<-128&&(f=c+Math.round((-128-d)/_*m),p=-128),c>=h&&f>=h||(c>=h?(d+=Math.round((h-c)/m*_),c=h):f>=h&&(p=d+Math.round((h-c)/m*_),f=h),d>=h&&p>=h||(d>=h?(c+=Math.round((h-d)/_*m),d=h):p>=h&&(f=c+Math.round((h-d)/_*m),p=h),l&&c===l.at(-1)[0]&&d===l.at(-1)[1]||(l=[[c,d]],s.push(l)),l.push([f,p])))))}}(i,a,n,o,c);else if(3===l)for(let i of h)!function(i,a,n,o,s){let l=(n-R)/a,h=(o-R)/a,u=(n+1+R)/a,c=(o+1+R)/a;function d(i,r){let a=0;return i<l?a|=1:i>u&&(a|=2),r<h?a|=4:r>c&&(a|=8),a}let f=[];for(let r=1;r<=8;r*=2){let a=i[i.length-2],n=i.at(-1),o=!(d(a,n)&r);for(let s=0;s<i.length;s+=2){let p=i[s],m=i[s+1],_=!(d(p,m)&r);_!==o&&(8&r?f.push(a+(p-a)*(c-n)/(m-n),c):4&r?f.push(a+(p-a)*(h-n)/(m-n),h):2&r?f.push(u,n+(m-n)*(u-
7a)/(p-a)):1&r&&f.push(l,n+(m-n)*(l-a)/(p-a))),_&&f.push(p,m),a=p,n=m,o=_}if(!(i=f).length||8===r)break;f=[]}let p=[];for(let i=0;i<f.length;i+=2)p.push([Math.round(r.r*(f[i]*a-n)),Math.round(r.r*(f[i+1]*a-o))]);p.length&&s.push(p)}(i,a,n,o,c);return{id:s,type:l,geometry:c,tags:u}}(i,o,a,n));return{features:s}}getFeatures(){return[...this.features.values()]}}function L({minX:i,minY:r,maxX:a,maxY:n},o,s,l){return i<(s+1+R)/o&&r<(l+1+R)/o&&a>(s-R)/o&&n>(l-R)/o}function z([i,a],n,o){let s=r.ek(i),l=r.el(a);l=l<0?0:l>1?1:l,n.push(s,l),o.minX=Math.min(o.minX,s),o.minY=Math.min(o.minY,l),o.maxX=Math.max(o.maxX,s),o.maxY=Math.max(o.maxY,l)}function O(i,r,a,n=!1,o=!1){let s=[];for(let r of i)z(r,s,a);r.push(s),n&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(s,o)}function F(i,r,a,n=!1){for(let o=0;o<i.length;o++)O(i[o],r,a,n,0===o)}function B({name:i,features:a},n){n.writeStringField(1,i),n.writeVarintField(5,r.r);let o=new Map,s=new Map,l={keys:o,values:s,feature:null};for(let i of a)l.feature=i,n.writeMessage(2,k,l);for(let i of o.keys())n.writeStringField(3,i);for(let i of s.keys())n.writeMessage(4,G,i)}function k(i,r){let a=i.feature;void 0!==a.id&&Number.isSafeInteger(+a.id)&&r.writeVarintField(1,+a.id),a.tags&&r.writeMessage(2,N,i),r.writeVarintField(3,a.type),r.writeMessage(4,j,a)}function N({keys:i,values:r,feature:a},n){for(let o of Object.keys(a.tags)){let s=a.tags[o];if(null===s)continue;let l=i.get(o);void 0===l&&(l=i.size,i.set(o,l)),n.writeVarint(l);let h=typeof s;"string"!==h&&"boolean"!==h&&"number"!==h&&(s=JSON.stringify(s));let u=r.get(s);void 0===u&&(u=r.size,r.set(s,u)),n.writeVarint(u)}}function U(i,r){return(r<<3)+(7&i)}function V(i){return i<<1^i>>31}function j(i,r){let{geometry:a,type:n}=i,o=0,s=0;if(1===n)for(let i of(r.writeVarint(U(1,a.length)),a)){let a=i[0]-o,n=i[1]-s;r.writeVarint(V(a)),r.writeVarint(V(n)),o+=a,s+=n}else for(let i of a){if(0===i.length)continue;r.writeVarint(U(1,1));let a=i.length-(3===n);for(let n=0;n<a;n++){1===n&&r.writeVarint(U(2,a-1));let l=i[n][0]-o,h=i[n][1]-s;r.writeVarint(V(l)),r.writeVarint(V(h)),o+=l,s+=h}3===n&&r.writeVarint(U(7,1))}}function G(i,r){let a=typeof i;"string"===a?r.writeStringField(1,i):"boolean"===a?r.writeBooleanField(7,i):"number"===a&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}let H={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},q=Math.fround||(a=new Float32Array(1),i=>(a[0]=+i,a[0]));class ${constructor(i){this.options=Object.assign(Object.create(H),i),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(i){let{log:r,minZoom:a,maxZoom:n}=this.options;r&&console.time("total time");let o=`prepare ${i.length} points`;r&&console.time(o),this.points=i;let s=[];for(let r=0;r<i.length;r++){let a=i[r];if(!a.geometry)continue;let[n,o]=a.geometry.coordinates,l=q(X(n)),h=q(Y(o));s.push(l,h,1/0,r,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[n+1]=this._createTree(s);r&&console.timeEnd(o);for(let i=n;i>=a;i--){let a=+Date.now();l=this.trees[i]=this._createTree(this._cluster(l,i)),r&&console.log("z%d: %d clusters in %dms",i,l.numItems,Date.now()-a)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let a=((i[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,i[1])),o=180===i[2]?180:((i[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)a=-180,o=180;else if(a>o){let i=this.getClusters([a,n,180,s],r),l=this.getClusters([-180,n,o,s],r);return i.concat(l)}let l=this.trees[this._limitZoom(r)],h=l.range(X(a),Y(s),X(o),Y(n)),u=l.data,c=[];for(let i of h){let r=this.stride*i;c.push(u[r+5]>1?Z(u,r,this.clusterProps):this.points[u[r+3]])}return c}getChildren(i){let r=this._getOriginId(i),a=this._getOriginZoom(i),n="No cluster with the specified id.",o=this.trees[a];if(!o)throw Error(n);let s=o.data;if(r*this.stride>=s.length)throw Error(n);let l=this.options.radius/(this.options.extent*Math.pow(2,a-1)),h=o.within(s[r*this.stride],s[r*this.stride+1],l),u=[];for(let r of h){let a=r*this.stride;s[a+4]===i&&u.push(s[a+5]>1?Z(s,a,this.clusterProps):this.points[s[a+3]])}if(0===u.length)throw Error(n);return u}getLeaves(i,r,a){let n=[];return this._appendLeaves(n,i,r=r||10,a=a||0,0),n}getTile(i,r,a){let n=this.trees[this._limitZoom(i)],o=Math.pow(2,i),{extent:s,radius:l}=this.options,h=l/s,u=(a-h)/o,c=(a+1+h)/o,d={features:[]};return this._addTileFeatures(n.range((r-h)/o,u,(r+1+h)/o,c),n.data,r,a,o,d),0===r&&this._addTileFeatures(n.range(1-h/o,u,1,c),n.data,o,a,o,d),r===o-1&&this._addTileFeatures(n.range(0,u,h/o,c),n.data,-1,a,o,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){let a=this.getChildren(i);if(r++,1!==a.length)break;i=a[0].properties.cluster_id}return r}_appendLeaves(i,r,a,n,o){for(let s of this.getChildren(r)){let r=s.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(i,r.cluster_id,a,n,o):o<n?o++:i.push(s),i.length===a)break}return o}_createTree(i){let a=new r.a6(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<i.length;r+=this.stride)a.add(i[r],i[r+1]);return a.finish(),a.data=i,a}_addTileFeatures(i,r,a,n,o,s){for(let l of i){let i,h,u,c,d=l*this.stride,f=r[d+5]>1;if(f)i=W(r,d,this.clusterProps),h=r[d],u=r[d+1];else{let a=this.points[r[d+3]];i=a.properties;let[n,o]=a.geometry.coordinates;h=X(n),u=Y(o)}let p={type:1,geometry:[[Math.round(this.options.extent*(h*o-a)),Math.round(this.options.extent*(u*o-n))]],tags:i};void 0!==(c=f||this.options.generateId?r[d+3]:this.points[r[d+3]].id)&&(p.id=c),s.features.push(p)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(Math.floor(+i),this.options.maxZoom+1))}_cluster(i,r){let{radius:a,extent:n,reduce:o,minPoints:s}=this.options,l=a/(n*Math.pow(2,r)),h=i.data,u=[],c=this.stride;for(let a=0;a<h.length;a+=c){if(h[a+2]<=r)continue;h[a+2]=r;let n=h[a],d=h[a+1],f=i.within(h[a],h[a+1],l),p=h[a+5],m=p;for(let i of f){let a=i*c;h[a+2]>r&&(m+=h[a+5])}if(m>p&&m>=s){let i,s=n*p,l=d*p,_=-1,g=(a/c<<5)+(r+1)+this.points.length;for(let n of f){let u=n*c;if(h[u+2]<=r)continue;h[u+2]=r;
7let d=h[u+5];s+=h[u]*d,l+=h[u+1]*d,h[u+4]=g,o&&(i||(i=this._map(h,a,!0),_=this.clusterProps.length,this.clusterProps.push(i)),o(i,this._map(h,u)))}h[a+4]=g,u.push(s/m,l/m,1/0,g,-1,m),o&&u.push(_)}else{for(let i=0;i<c;i++)u.push(h[a+i]);if(m>1)for(let i of f){let a=i*c;if(!(h[a+2]<=r)){h[a+2]=r;for(let i=0;i<c;i++)u.push(h[a+i])}}}}return u}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r,a){if(i[r+5]>1){let n=this.clusterProps[i[r+6]];return a?Object.assign({},n):n}let n=this.points[i[r+3]].properties,o=this.options.map(n);return a&&o===n?Object.assign({},o):o}}function Z(i,r,a){return{type:"Feature",id:i[r+3],properties:W(i,r,a),geometry:{type:"Point",coordinates:[360*(i[r]-.5),360*Math.atan(Math.exp((180-360*i[r+1])*Math.PI/180))/Math.PI-90]}}}function W(i,r,a){let n=i[r+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=i[r+6];return Object.assign(-1===s?{}:Object.assign({},a[s]),{cluster:!0,cluster_id:i[r+3],point_count:n,point_count_abbreviated:o})}function X(i){return i/360+.5}function Y(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function K(i,r,a,n){let o={id:i??null,type:r,geometry:a,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===r||"MultiPoint"===r||"LineString"===r)J(o,a);else if("Polygon"===r)J(o,a[0]);else if("MultiLineString"===r)for(let i of a)J(o,i);else if("MultiPolygon"===r)for(let i of a)J(o,i[0]);return o}function J(i,r){for(let a=0;a<r.length;a+=3)i.minX=Math.min(i.minX,r[a]),i.minY=Math.min(i.minY,r[a+1]),i.maxX=Math.max(i.maxX,r[a]),i.maxY=Math.max(i.maxY,r[a+1])}function Q(i,r,a,n){if(!r.geometry)return;let o=r.geometry.coordinates;if(o&&0===o.length)return;let s=r.geometry.type,l=Math.pow(a.tolerance/((1<<a.maxZoom)*a.extent),2),h=[],u=r.id;if(a.promoteId?u=r.properties[a.promoteId]:a.generateId&&(u=n||0),"Point"===s)ee(o,h);else if("MultiPoint"===s)for(let i of o)ee(i,h);else if("LineString"===s)et(o,h,l,!1);else if("MultiLineString"===s){if(a.lineMetrics){for(let a of o)et(a,h=[],l,!1),i.push(K(u,"LineString",h,r.properties));return}ei(o,h,l,!1)}else if("Polygon"===s)ei(o,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(let o of r.geometry.geometries)Q(i,{id:u,geometry:o,properties:r.properties},a,n);return}throw Error("Input data is not a valid GeoJSON object.")}for(let i of o){let r=[];ei(i,r,l,!0),h.push(r)}}i.push(K(u,s,h,r.properties))}function ee(i,r){r.push(i[0]/360+.5,er(i[1]),0)}function et(i,r,a,n){let o,s,l=0;for(let a=0;a<i.length;a++){let h=i[a][0]/360+.5,u=er(i[a][1]);r.push(h,u,0),a>0&&(l+=n?(o*u-h*s)/2:Math.sqrt(Math.pow(h-o,2)+Math.pow(u-s,2))),o=h,s=u}let h=r.length-3;r[2]=1,function i(r,a,n,o){let s=o,l=a+(n-a>>1),h,u=n-a,c=r[a],d=r[a+1],f=r[n],p=r[n+1];for(let i=a+3;i<n;i+=3){let a=function(i,r,a,n,o,s){let l=o-a,h=s-n;if(0!==l||0!==h){let u=((i-a)*l+(r-n)*h)/(l*l+h*h);u>1?(a=o,n=s):u>0&&(a+=l*u,n+=h*u)}return(l=i-a)*l+(h=r-n)*h}(r[i],r[i+1],c,d,f,p);if(a>s)h=i,s=a;else if(a===s){let r=Math.abs(i-l);r<u&&(h=i,u=r)}}s>o&&(h-a>3&&i(r,a,h,o),r[h+2]=s,n-h>3&&i(r,h,n,o))}(r,0,h,a),r[h+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function ei(i,r,a,n){for(let o=0;o<i.length;o++){let s=[];et(i[o],s,a,n),r.push(s)}}function er(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function ea(i,r,a,n,o,s,l,h){if(n/=r,s>=(a/=r)&&l<n)return i;if(l<a||s>=n)return null;let u=[];for(let r of i){let i=r.geometry,s=r.type,l=0===o?r.minX:r.minY,_=0===o?r.maxX:r.maxY;if(l>=a&&_<n){u.push(r);continue}if(_<a||l>=n)continue;let g=[];if("Point"===s||"MultiPoint"===s){var c=i,d=g,f=a,p=n,m=o;for(let i=0;i<c.length;i+=3){let r=c[i+m];r>=f&&r<=p&&el(d,c[i],c[i+1],c[i+2])}}else if("LineString"===s)en(i,g,a,n,o,!1,h.lineMetrics);else if("MultiLineString"===s)es(i,g,a,n,o,!1);else if("Polygon"===s)es(i,g,a,n,o,!0);else if("MultiPolygon"===s)for(let r of i){let i=[];es(r,i,a,n,o,!0),i.length&&g.push(i)}if(g.length){if(h.lineMetrics&&"LineString"===s){for(let i of g)u.push(K(r.id,s,i,r.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===g.length?(s="LineString",g=g[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===g.length?"Point":"MultiPoint"),u.push(K(r.id,s,g,r.tags))}}return u.length?u:null}function en(i,r,a,n,o,s,l){let h=eo(i),u=0===o?eh:eu,c,d,f=i.start;for(let p=0;p<i.length-3;p+=3){let m=i[p],_=i[p+1],g=i[p+2],y=i[p+3],x=i[p+4],v=0===o?m:_,b=0===o?y:x,w=!1;l&&(c=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<a?b>=a&&(d=u(h,m,_,y,x,a),l&&(h.start=f+c*d)):v>n?b<=n&&(d=u(h,m,_,y,x,n),l&&(h.start=f+c*d)):el(h,m,_,g),b<a&&v>=a&&(d=u(h,m,_,y,x,a),w=!0),b>n&&v<=n&&(d=u(h,m,_,y,x,n),w=!0),!s&&w&&(l&&(h.end=f+c*d),r.push(h),h=eo(i)),l&&(f+=c)}let p=i.length-3,m=i[p],_=i[p+1],g=0===o?m:_;g>=a&&g<=n&&el(h,m,_,i[p+2]),p=h.length-3,s&&p>=3&&(h[p]!==h[0]||h[p+1]!==h[1])&&el(h,h[0],h[1],h[2]),h.length&&r.push(h)}function eo(i){let r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function es(i,r,a,n,o,s){for(let l of i)en(l,r,a,n,o,s,!1)}function el(i,r,a,n){i.push(r,a,n)}function eh(i,r,a,n,o,s){let l=(s-r)/(n-r);return el(i,s,a+(o-a)*l,1),l}function eu(i,r,a,n,o,s){let l=(s-a)/(o-a);return el(i,r+(n-r)*l,s,1),l}function ec(i,r){let a=[];for(let n=0;n<i.length;n++){let o,s=i[n],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=ed(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l)for(let i of(o=[],s.geometry))o.push(ed(i,r));else if("MultiPolygon"===l)for(let i of(o=[],s.geometry)){let a=[];for(let n of i)a.push(ed(n,r));o.push(a)}
7a.push(K(s.id,l,o,s.tags))}return a}function ed(i,r){let a=[];a.size=i.size,void 0!==i.start&&(a.start=i.start,a.end=i.end);for(let n=0;n<i.length;n+=3)a.push(i[n]+r,i[n+1],i[n+2]);return a}function ef(i,r){if(i.transformed)return i;let a=1<<i.z,n=i.x,o=i.y;for(let s of i.features){let i=s.geometry,l=s.type;if(s.geometry=[],1===l)for(let l=0;l<i.length;l+=2)s.geometry.push(ep(i[l],i[l+1],r,a,n,o));else for(let l=0;l<i.length;l++){let h=[];for(let s=0;s<i[l].length;s+=2)h.push(ep(i[l][s],i[l][s+1],r,a,n,o));s.geometry.push(h)}}return i.transformed=!0,i}function ep(i,r,a,n,o,s){return[Math.round(a*(i*n-o)),Math.round(a*(r*n-s))]}function em(i,r,a,n,o,s){let l=n*n;if(n>0&&r.size<(o?l:n))return void(a.numPoints+=r.length/3);let h=[];for(let i=0;i<r.length;i+=3)(0===n||r[i+2]>l)&&(a.numSimplified++,h.push(r[i],r[i+1])),a.numPoints++;o&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(h,s),i.push(h)}let e_={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class eg{constructor(i,r){const a=(r=this.options=function(i,r){for(let a in r)i[a]=r[a];return i}(Object.create(e_),r)).debug;if(a&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");let n=function(i,r){let a=[];if("FeatureCollection"===i.type)for(let n=0;n<i.features.length;n++)Q(a,i.features[n],r,n);else Q(a,"Feature"===i.type?i:{geometry:i},r);return a}(i,r);this.tiles={},this.tileCoords=[],a&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(i,r){let a=r.buffer/r.extent,n=i,o=ea(i,1,-1-a,a,0,-1,2,r),s=ea(i,1,1-a,2+a,0,-1,2,r);return(o||s)&&(n=ea(i,1,-a,1+a,0,-1,2,r)||[],o&&(n=ec(o,1).concat(n)),s&&(n=n.concat(ec(s,-1)))),n}(n,r)).length&&this.splitTile(n,0,0,0),a&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(i,r,a,n,o,s,l){let h=[i,r,a,n],u=this.options,c=u.debug;for(;h.length;){n=h.pop(),a=h.pop(),r=h.pop(),i=h.pop();let d=1<<r,f=ey(r,a,n),p=this.tiles[f];if(!p&&(c>1&&console.time("creation"),p=this.tiles[f]=function(i,r,a,n,o){let s=r===o.maxZoom?0:o.tolerance/((1<<r)*o.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:a,y:n,z:r,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let r of i)!function(i,r,a,n){let o=r.geometry,s=r.type,l=[];if(i.minX=Math.min(i.minX,r.minX),i.minY=Math.min(i.minY,r.minY),i.maxX=Math.max(i.maxX,r.maxX),i.maxY=Math.max(i.maxY,r.maxY),"Point"===s||"MultiPoint"===s)for(let r=0;r<o.length;r+=3)l.push(o[r],o[r+1]),i.numPoints++,i.numSimplified++;else if("LineString"===s)em(l,o,i,a,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let r=0;r<o.length;r++)em(l,o[r],i,a,"Polygon"===s,0===r);else if("MultiPolygon"===s)for(let r=0;r<o.length;r++){let n=o[r];for(let r=0;r<n.length;r++)em(l,n[r],i,a,!0,0===r)}if(l.length){let a=r.tags||null;if("LineString"===s&&n.lineMetrics){for(let i in a={},r.tags)a[i]=r.tags[i];a.mapbox_clip_start=o.start/o.size,a.mapbox_clip_end=o.end/o.size}let h={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:a};null!==r.id&&(h.id=r.id),i.features.push(h)}}(l,r,s,o);return l}(i,r,a,n,u),this.tileCoords.push({z:r,x:a,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,a,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let i=`z${r}`;this.stats[i]=(this.stats[i]||0)+1,this.total++}if(p.source=i,null==o){if(r===u.indexMaxZoom||p.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(null!=o){let i=o-r;if(a!==s>>i||n!==l>>i)continue}}if(p.source=null,0===i.length)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,_=.5-m,g=.5+m,y=1+m,x=null,v=null,b=null,w=null,T=ea(i,d,a-m,a+g,0,p.minX,p.maxX,u),S=ea(i,d,a+_,a+y,0,p.minX,p.maxX,u);T&&(x=ea(T,d,n-m,n+g,1,p.minY,p.maxY,u),v=ea(T,d,n+_,n+y,1,p.minY,p.maxY,u)),S&&(b=ea(S,d,n-m,n+g,1,p.minY,p.maxY,u),w=ea(S,d,n+_,n+y,1,p.minY,p.maxY,u)),c>1&&console.timeEnd("clipping"),h.push(x||[],r+1,2*a,2*n),h.push(v||[],r+1,2*a,2*n+1),h.push(b||[],r+1,2*a+1,2*n),h.push(w||[],r+1,2*a+1,2*n+1)}}getTile(i,r,a){i*=1,r*=1,a*=1;let{extent:n,debug:o}=this.options;if(i<0||i>24)return null;let s=1<<i,l=ey(i,r=r+s&s-1,a);if(this.tiles[l])return ef(this.tiles[l],n);o>1&&console.log("drilling down to z%d-%d-%d",i,r,a);let h,u=i,c=r,d=a;for(;!h&&u>0;)u--,c>>=1,d>>=1,h=this.tiles[ey(u,c,d)];return h&&h.source?(o>1&&(console.log("found parent tile z%d-%d-%d",u,c,d),console.time("drilling down")),this.splitTile(h.source,u,c,d,i,r,a),o>1&&console.timeEnd("drilling down"),this.tiles[l]?ef(this.tiles[l],n):null):null}}function ey(i,r,a){return 32*((1<<i)*a+r)+i}function ex(i,a){let n=i.tileID.canonical;if(!this._geoJSONIndex)return void a(null,null);let o=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!o)return void a(null,null);let s=i=>i.tags&&"3d_elevation_id"in i.tags&&"source"in i.tags&&"elevation"===i.tags.source,l=o.features.filter(i=>s(i)),h={_geojsonTileLayer:o.features};l.length>0&&(h={_geojsonTileLayer:o.features.filter(i=>!s(i)),hd_road_elevation:l}),a(null,{vectorTile:new D(h),rawData:function(i){let a=new r.at;for(let r of Object.keys(i))a.writeMessage(3,B,{name:r,features:i[r]});return a.finish()}(h).buffer})}class ev extends T{constructor(i){super(i),this.loadVectorData=ex,this._dynamicIndex=new P}loadData(i,a){let o=i&&i.request,s=o&&o.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(i,(l,h)=>
7{if(l||!h)return a(l);if("object"!=typeof h)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{var u,c;if(i.filter){let a=r.bY(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===a.result)throw Error(a.value.map(i=>`${i.key}: ${i.message}`).join(", "));h.features=h.features.filter(i=>a.value.evaluate({zoom:0},i))}i.dynamic?("Feature"===h.type&&(h={type:"FeatureCollection",features:[h]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(h.features,this.loaded),i.cluster&&(h.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new $(function({superclusterOptions:i,clusterProperties:a}){if(!a||!i)return i;let n={},o={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(a);for(let i of h){let[s,l]=a[i],h=r.bY(l),u=r.bY("string"==typeof s?[s,["accumulated"],["get",i]]:s);n[i]=h.value,o[i]=u.value}return i.map=i=>{l.properties=i;let r={};for(let i of h)r[i]=n[i].evaluate(s,l);return r},i.reduce=(i,r)=>{for(let a of(l.properties=r,h))s.accumulated=i[a],i[a]=o[a].evaluate(s,l)},i}(i)).load(h.features):i.dynamic?this._dynamicIndex:(u=h,c=i.geojsonVtOptions,new eg(u,c))}catch(i){return a(i)}let l={};if(s){let r=n(o);r&&(l.resourceTiming={},l.resourceTiming[i.source]=JSON.parse(JSON.stringify(r)))}a(null,l)}})}reloadTile(i,r){let a=this.loaded;return a&&a[i.uid]?i.partial?r(null,void 0):super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(i,a){if(i.request)r.cT(i.request,a);else{if("string"!=typeof i.data)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return a(null,JSON.parse(i.data))}catch(r){return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(i){r(i)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(i){r(i)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(i){r(i)}}}class eb{constructor(i,a,n){this.tileID=new r.ap(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=a,this.worldview=n}parse(i,a,n,o){this.status="parsing";let s=new r.ap(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),l=[],h=a.familiesBySource[n.source],u=new r.I(s,n.promoteId);u.bucketLayerIDs=[],u.is3DTile=!0,r.e5(i).then(i=>{let a=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new r.w(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(let o in h)for(let f of h[o]){let o=f[0];u.bucketLayerIDs.push(f.map(i=>r.ea(i.id,i.scope))),o.recalculate(d,[]);let h=r.eV(i,1/r.fH(n.tileID.canonical)),p=new r.b1(f,h,s,a,c,this.brightness,u,this.worldview);a||(p.needsUpload=!0),l.push(p),p.evaluate(o)}this.status="done",o(null,{buckets:l,featureIndex:u,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(i=>o(Error(i.message)))}}class ew{constructor({actor:i,layerIndex:r,availableImages:a,availableModels:n,brightness:o,worldview:s}){this.actor=i,this.layerIndex=r,this.availableImages=a,this.availableModels=n,this.brightness=o,this.loading={},this.loaded={},this.worldview=s}loadTile(i,a){let n=i.uid,o=this.loading[n]=new eb(i,this.brightness,this.worldview);r.cG(i.request,(r,s)=>{let l=!this.loading[n];return delete this.loading[n],l||r?(o.status="done",l||(this.loaded[n]=o),a(r)):s&&0!==s.byteLength?void o.parse(s,this.layerIndex,i,(i,r)=>{o.status="done",this.loaded=this.loaded||{},this.loaded[n]=o,i||!r?a(i):a(null,r)}
7):(o.status="done",this.loaded[n]=o,a())})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.projection=i.projection,o.brightness=i.brightness;let s=(a,n)=>{o.reloadCallback&&(delete o.reloadCallback,this.loadTile(i,r)),r(a,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&this.loadTile(i,r)}}abortTile(i,r){let a=i.uid;this.loading[a]&&delete this.loading[a],r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}class eT{constructor(i){this.self=i,this.actor=new r.a(i,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=r.c$({name:"mercator"}),this.workerSourceTypes={vector:T,geojson:ev,"raster-dem":S,"raster-array":I,"batched-model":ew},this.workerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=i=>{if(r.eH.isParsed())throw Error("RTL text plugin already registered.");for(let a of(r.eH.setState({pluginStatus:r.f7.parsed,pluginURL:r.eH.getPluginURL()}),r.eH.applyArabicShaping=i.applyArabicShaping,r.eH.processBidirectionalText=i.processBidirectionalText,r.eH.processStyledBidirectionalText=i.processStyledBidirectionalText,this.rtlPluginParsingListeners))a(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(i,r,a){delete this.layerIndexes[i],delete this.availableImages[i],delete this.availableModels[i],delete this.workerSources[i],a()}checkIfReady(i,r,a){a()}setReferrer(i,r){this.referrer=r}spriteLoaded(i,a){this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={});let{scope:n,isLoaded:o}=a;if(this.isSpriteLoaded[i][n]=o,this.workerSources[i]&&this.workerSources[i][n])for(let a in this.workerSources[i][n]){let s=this.workerSources[i][n][a];for(let i in s){let a=s[i];a instanceof T&&(a.isSpriteLoaded=o,a.fire(new r.x("isSpriteLoaded")))}}}setImages(i,r,a){this.availableImages[i]||(this.availableImages[i]={});let{scope:n,images:o}=r;if(this.availableImages[i][n]=o,this.workerSources[i]&&this.workerSources[i][n]){for(let r in this.workerSources[i][n]){let a=this.workerSources[i][n][r];for(let i in a)a[i].availableImages=o}a()}else a()}setModels(i,{scope:r,models:a},n){if(this.availableModels[i]||(this.availableModels[i]={}),this.availableModels[i][r]=a,this.workerSources[i]&&this.workerSources[i][r]){for(let n in this.workerSources[i][r]){let o=this.workerSources[i][r][n];for(let i in o)o[i].availableModels=a}n()}else n()}setProjection(i,a){this.projections[i]=r.c$(a)}setBrightness(i,r,a){this.brightness=r,a()}setContextParams(i,r,a){this.maxUniformBufferBindings=r.maxBindingPoints,this.maxUniformBlockSizeDwords=r.maxUniformBlockSizeDwords,this.disableSymbolUBO=r.disableSymbolUBO,a()}setWorldview(i,r,a){this.worldview=r,a()}setLayers(i,r,a){this.getLayerIndex(i,r.scope).replace(r.layers,r.options),a()}updateLayers(i,r,a){this.getLayerIndex(i,r.scope).update(r.layers,r.removedIds,r.options),a()}loadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).loadTile(r,a)}decodeRasterArray(i,r,a){this.getWorkerSource(i,r).decodeRasterArray(r,a)}reloadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).reloadTile(r,a)}abortTile(i,r,a){this.getWorkerSource(i,r).abortTile(r,a)}removeTile(i,r,a){this.getWorkerSource(i,r).removeTile(r,a)}removeSource(i,r,a){if(!(this.workerSources[i]&&this.workerSources[i][r.scope]&&this.workerSources[i][r.scope][r.type]&&this.workerSources[i][r.scope][r.type][r.source]))return;let n=this.workerSources[i][r.scope][r.type][r.source];delete this.workerSources[i][r.scope][r.type][r.source],void 0!==n.removeSource?n.removeSource(r,a):a()}loadTileProvider(i,a,n){r.e8(a.name,a.url).then(r=>{let n=new r(a.options);return this.getWorkerSource(i,{type:a.type,source:a.source,scope:a.scope},n),n.load&&a.request?n.load({request:a.request}):null}).then(i=>n(null,i)).catch(i=>n(i instanceof Error?i:Error(String(i))))}
7async syncRTLPluginState(i,a,n){if(r.eH.isParsed())return void n(null,!0);if(r.eH.isParsing())return void this.rtlPluginParsingListeners.push(n);r.eH.setState(a);let o=r.eH.getPluginURL();if(!r.eH.isLoaded()||r.eH.isParsed()||r.eH.isParsing())n(null,!1);else{r.eH.setState({pluginStatus:r.f7.parsing,pluginURL:o});try{await import(o),r.eH.isParsed()?n(null,!0):this.rtlPluginParsingListeners.push(n)}catch(i){for(let a of(r.eH.setState({pluginStatus:r.f7.error,pluginURL:o}),n(i),this.rtlPluginParsingListeners))a(i);this.rtlPluginParsingListeners=[]}}}setConfig(i,a){Object.assign(r.bN,a)}getAvailableImages(i,r){this.availableImages[i]||(this.availableImages[i]={});let a=this.availableImages[i][r];return a||(a=[]),a}getAvailableModels(i,r){this.availableModels[i]||(this.availableModels[i]={});let a=this.availableModels[i][r];return a||(a={}),a}getLayerIndex(i,r){this.layerIndexes[i]||(this.layerIndexes[i]={});let a=this.layerIndexes[i][r];return a||((a=this.layerIndexes[i][r]=new _).scope=r),a}getWorkerSource(i,r,a){let{type:n,source:o,scope:s}=r,l=this.workerSources;if(l[i]||(l[i]={}),l[i][s]||(l[i][s]={}),l[i][s][n]||(l[i][s][n]={}),this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),l[i][s][n][o])a&&(l[i][s][n][o].tileProvider=a);else{let r={send:(r,a,n,o,s,l)=>this.actor.send(r,a,n,i,s,l),scheduler:this.actor.scheduler},h=this.workerSourceTypes[n];if(!h)throw Error(`Unknown worker source type "${n}".`);l[i][s][n][o]=new h({actor:r,layerIndex:this.getLayerIndex(i,s),availableImages:this.getAvailableImages(i,s),availableModels:this.getAvailableModels(i,s),isSpriteLoaded:this.isSpriteLoaded[i][s],tileProvider:a,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return l[i][s][n][o]}enforceCacheSizeLimit(i,a){r.cf(a)}getWorkerPerformanceMetrics(i,r,a){a(void 0,void 0)}}return r.dR(self)&&(self.worker=new eT(self)),eT}),n(["./shared"],function(i){let r,a,n,o,s,l,h,u,c;var d="3.25.0";let f={create:"create",load:"load",fullLoad:"fullLoad"},p={mark(i){performance.mark(i)},measure(i,r,a){performance.measure(i,r,a)}};function m(r){let a=r.name.split("?")[0];return i.dF(a)&&a.includes("mapbox-gl.js")?"javascript":i.dF(a)&&a.includes("mapbox-gl.css")?"css":i.dG(a)?"fontRange":i.dH(a)?"sprite":i.dI(a)?"style":i.dJ(a)?"tilejson":"other"}let _={antialias:!1,alpha:!0,stencil:!0,depth:!0};function g(i){let r,a=document.createElement("canvas"),n=Object.create(_);n.failIfMajorPerformanceCaveat=i;let o=a.getContext("webgl2",n);if(!o)return!1;try{r=o.createShader(o.VERTEX_SHADER)}catch(i){return!1}return!(!r||o.isContextLost())&&(o.shaderSource(r,"void main() {}"),o.compileShader(r),!0===o.getShaderParameter(r,o.COMPILE_STATUS))}let y=/firefox/i,x=/macintosh/i;function v(i,r,a){let n=document.createElement(i);return null!=r&&(n.className=r),a&&a.appendChild(n),n}function b(i,r,a){let n=document.createElementNS("http://www.w3.org/2000/svg",i);for(let i of Object.keys(r))n.setAttributeNS(null,i,String(r[i]));return a&&a.appendChild(n),n}let w="u">typeof document?document.documentElement&&document.documentElement.style:null,T=w&&void 0!==w.userSelect?"userSelect":"WebkitUserSelect";function S(){w&&T&&(n=w[T],w[T]="none")}function E(){w&&T&&(w[T]=n)}function I(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",I,!0)}function A(){window.addEventListener("click",I,!0),window.setTimeout(()=>{window.removeEventListener("click",I,!0)},0)}function M(i,r){let a=i.getBoundingClientRect();return R(i,a,r)}function C(i,r){let a=i.getBoundingClientRect(),n=[];for(let o=0;o<r.length;o++)n.push(R(i,a,r[o]));return n}function D(i){return y.test(navigator.userAgent)&&x.test(navigator.userAgent)&&2===i.button&&i.ctrlKey?0:i.button}function R(r,a,n){let o=r.offsetWidth===a.width?1:r.offsetWidth/a.width;return new i.au((n.clientX-a.left)*o,(n.clientY-a.top)*o)}let P=/(\.(png|jpg)\d*)(?=$)/,L=/^.+\/v4\//,z=/\.[\w]+$/,O=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,F=/^access_token=(.*)$/,B="NO_ACCESS_TOKEN";class k{constructor(i,r,a){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!a,this._createSkuToken()}_createSkuToken(){let i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}
7normalizeStyleURL(r,a){if(!i.dL(r))return r;let n=U(r);return n.params.push(`sdk=js-${d}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeGlyphsURL(r,a){if(!i.dL(r))return r;let n=U(r);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeModelURL(r,a){if(!i.dL(r))return r;let n=U(r);return n.path=`/models/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeSourceURL(r,a,n,o){if(!i.dL(r))return r;let s=U(r);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),n&&s.params.push(`language=${n}`),o&&s.params.push(`worldview=${o}`),this._makeAPIURL(s,this._customAccessToken||a)}normalizeIconsetURL(r,a){let n=U(r);return i.dL(r)?(n.path=`/styles/v1${n.path}/iconset.pbf`,this._makeAPIURL(n,this._customAccessToken||a)):V(n)}normalizeSpriteURL(r,a,n,o){let s=U(r);return i.dL(r)?(s.path=`/styles/v1${s.path}/sprite${a}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${a}${n}`,V(s))}normalizeTileURL(r,a,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),r&&!i.dL(r))return r;let o=U(r);o.path=o.path.replace(P,`${a||n&&"raster"!==o.authority&&512===n?"@2x":""}${i.cn.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${i.bN.RASTER_URL_PREFIX}${o.path}`:"rasterarrays"===o.authority?o.path=`/${i.bN.RASTERARRAYS_URL_PREFIX}${o.path}`:"3dtiles"===o.authority?o.path=`/${i.bN.TILES3D_URL_PREFIX}${o.path}`:(o.path=o.path.replace(L,"/"),o.path=`/${i.bN.TILE_URL_VERSION}${o.path}`);let s=this._customAccessToken||function(i){for(let r of i){let i=r.match(F);if(i)return i[1]}return null}(o.params)||i.bN.ACCESS_TOKEN;return i.bN.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(r,a){let n=U(r);if(!O.test(n.path)||!z.test(n.path))return r;let o="mapbox://";n.path.startsWith("/raster/v1/")?o+=`raster/${n.path.replace(`/${i.bN.RASTER_URL_PREFIX}/`,"")}`:n.path.startsWith("/rasterarrays/v1/")?o+=`rasterarrays/${n.path.replace(`/${i.bN.RASTERARRAYS_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${i.bN.TILE_URL_VERSION}/`,"")}`;let s=n.params;return a&&(s=s.filter(i=>!i.match(F))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(r,a){let n=!!a&&i.dL(a),o=[];for(let a of r.tiles||[])i.dK(a)?o.push(this.canonicalizeTileURL(a,n)):o.push(a);return o}_makeAPIURL(r,a){let n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",o=U(i.bN.API_URL);if(r.protocol=o.protocol,r.authority=o.authority,"http"===r.protocol){let i=r.params.indexOf("secure");i>=0&&r.params.splice(i,1)}if("/"!==o.path&&(r.path=`${o.path}${r.path}`),!i.bN.REQUIRE_ACCESS_TOKEN)return V(r);if(a=a||i.bN.ACCESS_TOKEN,!this._silenceAuthErrors){if(!a)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===a[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return r.params=r.params.filter(i=>!i.includes("access_token")),r.params.push(`access_token=${a||""}`),V(r)}}let N=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function U(i){let r=i.match(N);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function V(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}let j="mapbox.eventData";function G(r){if(!r)return null;let a=r.split(".");if(!a||3!==a.length)return null;try{return JSON.parse(i.bq(a[1]))}catch(i){return null}}function H(r){return!(!i.bN.EVENTS_URL||!r&&!i.bN.ACCESS_TOKEN)}let q=/^[\w.+-]+(\/[\w.+-]+)?$/,$="other";class Z{constructor(i){this.type=i,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){let a=G(i.bN.ACCESS_TOKEN),n="";return n=a&&a.u?i.br(a.u):i.bN.ACCESS_TOKEN||"",r?`${j}.${r}:${n}`:`${j}:${n}`}fetchEventData(){let r=i.fv("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp");if(r)try{let i=localStorage.getItem(a);i&&(this.eventData=JSON.parse(i));let r=localStorage.getItem(n);r&&(this.anonId=r);let s=localStorage.getItem(o);s&&(this.anonIdTimestamp=Number(s));let l=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<l)&&this.refreshUUID()}catch(r){i.f_("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=i.fX(),this.anonIdTimestamp=Date.now()}saveEventData(){let r=i.fv("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp"),s=this.anonId,l=this.anonIdTimestamp;if(r&&s)try{localStorage.setItem(n,s),Object.keys(this.eventData).length>=1&&localStorage.setItem(a,JSON.stringify(this.eventData)),l&&localStorage.setItem(o,l.toString())}catch(r){i.f_("Unable to write to LocalStorage")}}processRequests(i){}postEvent(r,a,n,o){if(!i.bN.EVENTS_URL)return;let s=U(i.bN.EVENTS_URL);s.params.push(`access_token=${o||i.bN.ACCESS_TOKEN||""}`);let l={event:this.type,created:new Date(r).toISOString()},h=a?Object.assign(l,a):l,u={url:V(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=i.eR(u,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}class W extends Z{constructor(i){super("metrics"),i&&(this.data=i)}postMetricsEvent(r){if(!H(r))return;this.anonId||this.fetchEventData(),i.fZ(this.anonId)||this.refreshUUID();let a=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:a},r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}}let X=new class extends Z{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(r,a){H(a)&&Array.isArray(r)&&r.some(r=>i.dL(r)||i.dK(r))&&this.queueRequest(Date.now(),a)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let a=G(i.bN.ACCESS_TOKEN),n=a?a.u:i.bN.ACCESS_TOKEN,s=n!==this.eventData.tokenU;i.fZ(this.anonId)||(this.refreshUUID(),s=!0);let l=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(l),a=(l-this.eventData.lastSuccess)/864e5;s=s||a>=1||a<-1||i.getDate()!==r.getDate()}else s=!0;if(!s)return void this.processRequests();let h={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:d,skuId:"01","enabled.telemetry":!1,userId:this.anonId,bundleFormat:"umd",bundleDistribution:$};o&&(h.sdkInfo=o),this.postEvent(l,h,i=>{i||(this.eventData.lastSuccess=l,this.eventData.tokenU=n)},r)}},Y=X.postTurnstileEvent.bind(X),K=new class extends Z{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(r,a,n,o){this.skuToken=a,this.errorCb=o,i.bN.EVENTS_URL&&(n||i.bN.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()}
7,n):this.errorCb(Error(B)))}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{id:a,timestamp:n}=this.queue.shift();if(a&&this.success[a])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.fZ(this.anonId)||this.refreshUUID();let s={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:d,skuId:"01",skuToken:this.skuToken,userId:this.anonId,bundleFormat:"umd",bundleDistribution:$};o&&(s.sdkInfo=o),this.postEvent(n,s,i=>{i?this.errorCb(i):a&&(this.success[a]=!0)},r)}remove(){this.errorCb=null}},J=K.postMapLoadEvent.bind(K),Q=new class extends Z{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(r){let a=this.mapInstanceIdMap.get(r);return a||(a=i.fX(),this.mapInstanceIdMap.set(r,a)),a}getEventId(i){let r=this.eventIdPerMapInstanceMap.get(i)||0;return this.eventIdPerMapInstanceMap.set(i,r+1),r}postStyleLoadEvent(i,r){let{map:a,style:n,importedStyles:o}=r;if(!H(i))return;let s=this.getMapInstanceId(a),l={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(l.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:l},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}},ee=Q.postStyleLoadEvent.bind(Q),et=new W({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),ei=et.postMetricsEvent.bind(et),er=new W({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),ea=er.postMetricsEvent.bind(er),en=new class extends Z{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){H(i)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:a,performanceData:n}=this.queue.shift(),o=function(r){let a=performance.getEntriesByType("resource"),n=performance.getEntriesByType("mark"),o=function(i){let r={};if(i){for(let a in i)if("other"!==a)for(let n of i[a]){let i=`${a}ResolveRangeMin`,o=`${a}ResolveRangeMax`,s=`${a}RequestCount`,l=`${a}RequestCachedCount`;r[i]=Math.min(r[i]||1/0,n.startTime),r[o]=Math.max(r[o]||-1/0,n.responseEnd);let h=i=>{void 0===r[i]&&(r[i]=0),++r[i]};void 0!==n.transferSize&&0===n.transferSize&&h(l),h(s)}}return r}(function(i,r){let a={};if(i)for(let n of i){let i=r(n);void 0===a[i]&&(a[i]=[]),a[i].push(n)}return a}(a,m)),s=window.devicePixelRatio,l=navigator.connection||navigator.mozConnection||navigator.webkitConnection,h=l?l.effectiveType:void 0,u={counters:[],metadata:[],attributes:[]},c=(i,r,a)=>{null!=a&&i.push({name:r,value:a.toString()})};for(let i in o)c(u.counters,i,o[i]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(c(u.counters,"interactionRangeMin",r.interactionRange[0]),c(u.counters,"interactionRangeMax",r.interactionRange[1])),n)for(let i of Object.values(f)){let r=n.find(r=>r.name===i);r&&c(u.counters,i,r.startTime)}return c(u.counters,"visibilityHidden",r.visibilityHidden),c(u.attributes,"style",function(r){if(r)for(let a of r){let r=a.name.split("?")[0];if(i.dI(r)){let i=r.split("/").slice(-2);if(2===i.length)return`mapbox://styles/${i[0]}/${i[1]}`}}}(a)),c(u.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),c(u.attributes,"fogEnabled",r.fogEnabled?"true":"false"),c(u.attributes,"projection",r.projection),c(u.attributes,"zoom",r.zoom),c(u.metadata,"devicePixelRatio",s),c(u.metadata,"connectionEffectiveType",h),c(u.metadata,"navigatorUserAgent",navigator.userAgent),c(u.metadata,"screenWidth",window.screen.width),c(u.metadata,"screenHeight",window.screen.height),c(u.metadata,"windowWidth",window.innerWidth),c(u.metadata,"windowHeight",window.innerHeight),c(u.metadata,"mapWidth",r.width/s),c(u.metadata,"mapHeight",r.height/s),c(u.metadata,"webglRenderer",r.renderer),c(u.metadata,"webglVendor",r.vendor),c(u.metadata,"sdkVersion",d),c(u.metadata,"sdkIdentifier","mapbox-gl-js"),u}(n);for(let i of o.metadata);for(let i of o.counters);for(let i of o.attributes);this.postEvent(a,o,()=>{},r)}},eo=en.postPerformanceEvent.bind(en),es=new class extends Z{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(r,a,n,o){if(!i.bN.API_URL||!i.bN.SESSION_PATH)return;let s=U(i.bN.API_URL+i.bN.SESSION_PATH);s.params.push(`sku=${a||""}`),s.params.push(`access_token=${o||i.bN.ACCESS_TOKEN||""}`);let l={url:V(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.cM(l,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}getSessionAPI(r,a,n,o){this.skuToken=a,this.errorCb=o,i.bN.EVENTS_URL&&i.bN.SESSION_PATH&&i.bN.API_URL&&(n||i.bN.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()}
7,n):this.errorCb(Error(B)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||this.getSession(a,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}remove(){this.errorCb=null}},el=es.getSessionAPI.bind(es),eh=new Set;function eu(i,r){r?eh.add(i):eh.delete(i)}class ec{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(i,r){this._updatedSourceCaches[i]=r,this.setDirty()}discardSourceCacheUpdate(i){delete this._updatedSourceCaches[i]}updateLayer(i){let r=i.scope;this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._updatedLayers[r].add(i.id),this.setDirty()}removeLayer(i){let r=i.scope;this._removedLayers[r]=this._removedLayers[r]||{},this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._removedLayers[r][i.id]=i,this._updatedLayers[r].delete(i.id),this._updatedPaintProps.delete(i.fqid),this.setDirty()}getRemovedLayer(i){return this._removedLayers[i.scope]?this._removedLayers[i.scope][i.id]:null}discardLayerRemoval(i){this._removedLayers[i.scope]&&delete this._removedLayers[i.scope][i.id]}getLayerUpdatesByScope(){let i={};for(let r in this._updatedLayers)i[r]=i[r]||{},i[r].updatedIds=Array.from(this._updatedLayers[r].values());for(let r in this._removedLayers)i[r]=i[r]||{},i[r].removedIds=Object.keys(this._removedLayers[r]);return i}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(i){this._updatedPaintProps.add(i.fqid),this.setDirty()}getUpdatedImages(i){return this._updatedImages[i]?Array.from(this._updatedImages[i].values()):[]}updateImage(r,a){this._updatedImages[a]=this._updatedImages[a]||new Set,this._updatedImages[a].add(i.a1.toString(r)),this.setDirty()}resetUpdatedImages(i){this._updatedImages[i]&&this._updatedImages[i].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}let ed=new i.i(0,0,0);function ef(i,r){let a=[],n=i[`stretch_${r}`],o=null;for(let i=0;i<n.length;i++)null===o?o=0===a.length?n[0]:a.at(-1)[1]+n[i]:(a.push([o,o+n[i]]),o=null);i[`stretch_${r}_areas`]=a}function ep(i,r){let a,n={};for(;a=i.nextField(r);)1===a?n.left=i.readVarint():2===a?n.width=i.readVarint():3===a?n.top=i.readVarint():4===a&&(n.height=i.readVarint());return n}function em(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(n.group=function(i,r){let a,n={opacity:255,children:[]};for(;a=i.nextField(r);)1===a?n.transform=e_(i,i.readVarint()+i.pos):2===a?n.opacity=i.readVarint():5===a?n.clip_path_idx=i.readVarint():6===a?n.mask_idx=i.readVarint():7===a&&n.children.push(em(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos),n.node="group"):2===a&&(n.path=function(i,r){let a,n={paint_order:1,commands:[],step:1,diffs:[],rule:1};for(;a=i.nextField(r);)1===a?n.fill=function(i,r){let a,n={rgb_color:ed,paint:"rgb_color",opacity:255};for(;a=i.nextField(r);)1===a?(n.rgb_color=eg(i.readVarint()),n.paint="rgb_color"):2===a?(n.linear_gradient_idx=i.readVarint(),n.paint="linear_gradient_idx"):3===a?(n.radial_gradient_idx=i.readVarint(),n.paint="radial_gradient_idx"):5===a&&(n.opacity=i.readVarint());return n}(i,i.readVarint()+i.pos):2===a?n.stroke=function(i,r){let a,n={rgb_color:ed,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};for(;a=i.nextField(r);)1===a?(n.rgb_color=eg(i.readVarint()),n.paint="rgb_color"):2===a?(n.linear_gradient_idx=i.readVarint(),n.paint="linear_gradient_idx"):3===a?(n.radial_gradient_idx=i.readVarint(),n.paint="radial_gradient_idx"):5===a?i.readPackedFloat(n.dasharray):6===a?n.dashoffset=i.readFloat():7===a?n.miterlimit=i.readFloat():8===a?n.opacity=i.readVarint():9===a?n.width=i.readFloat():10===a?n.linecap=i.readVarint():11===a&&(n.linejoin=i.readVarint());return n}(i,i.readVarint()+i.pos):3===a?n.paint_order=i.readVarint():5===a?i.readPackedVarint(n.commands):6===a?n.step=i.readFloat():7===a?i.readPackedSVarint(n.diffs):8===a&&(n.rule=i.readVarint());return n}(i,i.readVarint()+i.pos),n.node="path");return n}function e_(i,r){let a,n={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};for(;a=i.nextField(r);)1===a?n.sx=i.readFloat():2===a?n.ky=i.readFloat():3===a?n.kx=i.readFloat():4===a?n.sy=i.readFloat():5===a?n.tx=i.readFloat():6===a&&(n.ty=i.readFloat());return n}function eg(r){return new i.i((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function ey(i,r){let a,n={offset:0,opacity:255,rgb_color:ed};for(;a=i.nextField(r);)1===a?n.offset=i.readFloat():2===a?n.opacity=i.readVarint():3===a&&(n.rgb_color=eg(i.readVarint()));return n}class ex{static calculate(r={},a=[]){let n=new Map,o=new Map;if(0===Object.keys(r).length)return n;
7for(let[s,l]of(a.forEach(r=>{o.set(r.name,r.rgb_color||new i.i(0,0,0))}),Object.entries(r)))o.has(s)?n.set(o.get(s).toString(),l):console.warn(`Ignoring unknown image variable "${s}"`);return n}}function ev(r,a=255,n){let o=n.get(r.toString())||r;return 255===a?o.toString():new i.i(o.r,o.g,o.b,o.a*a/255).toString()}let eb=[],ew=0;function eT(r,a){if(ew>=eb.length){let n=i.eA()?new OffscreenCanvas(r,a).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});eb.push(n)}let n=eb[ew++];return n.canvas.width=r,n.canvas.height=a,n}function eS(i,r,a,n,o){for(let s of n.children)(function i(r,a,n,o,s){var l;o.group?(r.save(),function(r,a,n,o,s){var l,h;let u=null!=o.mask_idx?n.masks[o.mask_idx]:null,c=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;if(o.transform&&(a=eD(o.transform).preMultiplySelf(a)),l=null!=c,h=null!=u,255===o.opacity&&!l&&!h)return eS(r,a,n,o,s);let d=eT(r.canvas.width,r.canvas.height);eS(d,a,n,o,s),c&&function i(r,a,n,o){let s=eT(r.canvas.width,r.canvas.height);(function r(a,n,o,s){let l=s.transform?eD(s.transform).preMultiplySelf(n):n,h=eT(a.canvas.width,a.canvas.height);for(let i of s.children)if(i.group)r(h,l,o,i.group);else if(i.path){let r=i.path,a=new Path2D;a.addPath(eP(r),l),h.fill(a,eI(r))}let u=null!=s.clip_path_idx?o.clip_paths[s.clip_path_idx]:null;u&&i(h,l,o,u),a.globalCompositeOperation="source-over",a.drawImage(h.canvas,0,0),ew--})(s,a,n,o),r.globalCompositeOperation="destination-in",r.drawImage(s.canvas,0,0),ew--}(d,a,n,c),u&&function r(a,n,o,s,l){if(0===s.children.length)return;let h=null!=s.mask_idx?o.masks[s.mask_idx]:null;h&&r(a,n,o,h,l);let u=a.canvas.width,c=a.canvas.height,d=eT(u,c),f=s.width,p=s.height,m=s.left,_=s.top,g=new Path2D,y=new Path2D;for(let r of(y.rect(m,_,f,p),g.addPath(y,n),d.clip(g),s.children))i(d,n,o,r,l);let x=d.getImageData(0,0,u,c),v=x.data;if(1===s.mask_type)for(let i=0;i<v.length;i+=4)v[i+3]=v[i+3]/255*(.2126*v[i]+.7152*v[i+1]+.0722*v[i+2]);d.putImageData(x,0,0),a.globalCompositeOperation="destination-in",a.drawImage(d.canvas,0,0),ew--}(d,a,n,u,s),r.globalAlpha=o.opacity/255,r.drawImage(d.canvas,0,0),ew--}(r,a,n,o.group,s),r.restore()):o.path&&(r.save(),l=o.path,r.setTransform(a),1===l.paint_order?(eE(r,n,l,s),eA(r,n,l,s)):(eA(r,n,l,s),eE(r,n,l,s)),r.restore())})(i,r,a,s,o)}function eE(i,r,a,n){let o=a.fill;if(!o)return;let s=o.opacity/255;switch(i.save(),i.beginPath(),eR(a,i),o.paint){case"rgb_color":i.fillStyle=ev(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":{let a=r.linear_gradients[o.linear_gradient_idx];a.transform&&i.setTransform(eD(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=eM(i,a,s,n);break}case"radial_gradient_idx":{let a=r.radial_gradients[o.radial_gradient_idx];a.transform&&i.setTransform(eD(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=eC(i,a,s,n)}}i.fill(eI(a)),i.restore()}function eI(i){return 1===i.rule?"nonzero":2===i.rule?"evenodd":void 0}function eA(i,r,a,n){let o=a.stroke;if(!o)return;let s=eP(a);i.lineWidth=o.width,i.miterLimit=o.miterlimit,i.setLineDash(o.dasharray),i.lineDashOffset=o.dashoffset;let l=o.opacity/255;switch(o.paint){case"rgb_color":i.strokeStyle=ev(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":i.strokeStyle=eM(i,r.linear_gradients[o.linear_gradient_idx],l,n,!0);break;case"radial_gradient_idx":i.strokeStyle=eC(i,r.radial_gradients[o.radial_gradient_idx],l,n,!0)}switch(o.linejoin){case 2:case 1:i.lineJoin="miter";break;case 3:i.lineJoin="round";break;case 4:i.lineJoin="bevel"}switch(o.linecap){case 1:i.lineCap="butt";break;case 2:i.lineCap="round";break;case 3:i.lineCap="square"}i.stroke(s)}function eM(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return ev(i.rgb_color,i.opacity*a,n)}let{x1:s,y1:l,x2:h,y2:u}=r,c=new DOMPoint(s,l),d=new DOMPoint(h,u);if(o){let i=eD(r.transform);c=i.transformPoint(c),d=i.transformPoint(d)}let f=i.createLinearGradient(c.x,c.y,d.x,d.y);for(let i of r.stops)f.addColorStop(i.offset,ev(i.rgb_color,i.opacity*a,n));return f}function eC(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return ev(i.rgb_color,i.opacity*a,n)}let s=eD(r.transform),{fx:l,fy:h,fr:u,cx:c,cy:d,r:f}=r,p=new DOMPoint(l,h),m=new DOMPoint(c,d),_=u,g=f;if(o){p=s.transformPoint(p),m=s.transformPoint(m);let i=(s.a+s.d)/2;_=u*i,g=r.r*i}let y=i.createRadialGradient(p.x,p.y,_,m.x,m.y,g);for(let i of r.stops)y.addColorStop(i.offset,ev(i.rgb_color,i.opacity*a,n));return y}function eD(i){return i?new DOMMatrix([i.sx,i.ky,i.kx,i.sy,i.tx,i.ty]):new DOMMatrix}function eR(i,r){let a=i.step,n=i.diffs[0]*a,o=i.diffs[1]*a;r.moveTo(n,o);for(let s=0,l=2;s<i.commands.length;s++)switch(i.commands[s]){case 1:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.moveTo(n,o);break;case 2:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.lineTo(n,o);break;case 3:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a;n=s+i.diffs[l++]*a,o=h+i.diffs[l++]*a,r.quadraticCurveTo(s,h,n,o);break}case 4:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a,u=s+i.diffs[l++]*a,c=h+i.diffs[l++]*a;n=u+i.diffs[l++]*a,o=c+i.diffs[l++]*a,r.bezierCurveTo(s,h,u,c,n,o);break}case 5:r.closePath()}return r}function eP(i){return eR(i,new Path2D)}class eL{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new i.ay(r,r.data)}getFromCache(r,a,n){return this.cacheMap.has(n)||this.cacheMap.set(n,new i.a7(150)),this.cacheMap.get(n).get(i.ea(r.toString(),a))}setInCache(r,a,n,o){this.cacheDependenciesMap.has(o)||this.cacheDependenciesMap.set(o,new Map),this.cacheMap.has(o)||this.cacheMap.set(o,new i.a7(150));let s=this.cacheDependenciesMap.get(o),l=i.ea(r.id.toString(),n);s.get(l)||s.set(l,new Set);let h=this.cacheMap.get(o),u=r.toString();s.get(l).add(u),h.put(i.ea(r.toString(),n),a)}removeImagesFromCacheByIds(r,a,n=0){if(!this.cacheMap.has(n)||!this.cacheDependenciesMap.has(n))return;let o=this.cacheMap.get(n),s=this.cacheDependenciesMap.get(n);for(let n of r){let r=i.ea(n.toString(),a);if(s.has(r)){for(let i of s.get(r))o.delete(i);s.delete(r)}}}rasterize(i,r,a,n){var o;let s,l,h,u,c,d,f,p,m,_=this.getFromCache(i,a,n);if(_)return _.clone();let g=(o=r.icon,s=ex.calculate(i.params,o.metadata?o.metadata.variables:[]),h=(l=o.usvg_tree).width,u=l.height,c=Math.max(1,Math.round(h*i.sx)),f=new DOMMatrix([c/h,0,0,(d=Math.max(1,Math.round(u*i.sy)))/u,0,0]),eS(p=eT(c,d),f,l,l,s),m=p.getImageData(0,0,c,d),ew--,m),y=eL._getImage(g);return this.setInCache(i,y,a,n),y.clone()}}class ez extends i.y{constructor(r){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.imageVersions=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.imageAtlasCache=new i.$,this.dirty=!0,this.spriteFormat=r,this.imageRasterizer=new eL}addScope(r){this.loaded.set(r,!1),this.imageProviders.set(r,new Map),this.images.set(r,new Map),this.updatedImages.set(r,new Set),this.callbackDispatchedThisFrame.set(r,new Set),this.imageVersions.set(r,new Map),this.patterns.set(r,new Map),this.atlasImage.set(r,new i.ay({width:1,height:1}))}removeScope(i){this.loaded.delete(i),this.imageProviders.delete(i),this.images.delete(i),this.updatedImages.delete(i),this.callbackDispatchedThisFrame.delete(i),this.imageVersions.delete(i),this.patterns.delete(i),this.atlasImage.delete(i);let r=this.atlasTexture.get(i);r&&(r.destroy(),this.atlasTexture.delete(i))}addImageProvider(i,r){this.imageProviders.has(r)||this.imageProviders.set(r,new Map),this.imageProviders.get(r).set(i.id,i)}removeImageProvider(i,r){this.imageProviders.has(r)&&this.imageProviders.get(r).delete(i)}getPendingImageProviders(){let i=[];for(let r of this.imageProviders.values())for(let a of r.values())a.hasPendingRequests()&&i.push(a);return i}isLoaded(){for(let i of this.loaded.keys())if(!this.loaded.get(i))return!1;return!0}setLoaded(i,r){if(this.loaded.get(r)!==i&&(this.loaded.set(r,i),i)){for(let{ids:i,callback:a}of this.requestors)this._notify(i,r,a);this.requestors=[]}}hasImage(i,r){return!!this.getImage(i,r)}getImage(i,r){return this.images.get(r).get(i.toString())}
7addImage(i,r,a){if(this._validate(i,a)){this.images.get(r).set(i.toString(),a);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1)}}_validate(r,a){let n=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new i.v(Error(`Image "${r.name}" has invalid "stretchX" value`))),n=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new i.v(Error(`Image "${r.name}" has invalid "stretchY" value`))),n=!1),this._validateContent(a.content,a)||(this.fire(new i.v(Error(`Image "${r.name}" has invalid "content" value`))),n=!1),n}_validateStretch(i,r){if(!i)return!0;let a=0;for(let n of i){if(n[0]<a||n[1]<n[0]||r<n[1])return!1;a=n[1]}return!0}_validateContent(i,r){return!i||4===i.length&&(!!r.usvg||!(i[0]<0)&&!(r.data.width<i[0])&&!(i[1]<0)&&!(r.data.height<i[1])&&!(i[2]<0)&&!(r.data.width<i[2])&&!(i[3]<0)&&!(r.data.height<i[3]))&&!(i[2]<i[0]||i[3]<i[1])}updateImage(i,r,a){a.version=this.images.get(r).get(i.toString()).version+1,this.images.get(r).set(i.toString(),a),this.updatedImages.get(r).add(i);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1),this.removeFromImageRasterizerCache(i,r)}clearUpdatedImages(i){this.updatedImages.get(i).clear()}removeFromImageRasterizerCache(i,r){"raster"!==this.spriteFormat&&this.imageRasterizer.removeImagesFromCacheByIds([i],r)}removeImage(i,r){let a=this.images.get(r),n=a.get(i.toString());a.delete(i.toString());let o=this.imageVersions.get(r),s=o.get(i.toString())||0;o.set(i.toString(),s+1),this.patterns.get(r).delete(i.toString()),this.removeFromImageRasterizerCache(i,r),n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(r){return Array.from(this.images.get(r).keys()).map(r=>i.a1.from(r))}getImageVersions(i){return this.imageVersions.get(i)||new Map}getImages(i,r,a){let n=[],o=[],s=this.imageProviders.get(r);for(let a of i){if(!a.iconsetId){n.push(a);continue}let i=s.get(a.iconsetId);i&&(this.getImage(a,r)?o.push(a):i.addPendingRequest(a))}if(0===n.length)return void this._notify(o,r,a);let l=!0,h=!!this.loaded.get(r),u=this.images.get(r);if(!h)for(let i of n)u.has(i.toString())||(l=!1);h||l?this._notify(n,r,a):this.requestors.push({ids:n,scope:r,callback:a})}rasterizeImages(i,r){let a=new Map,{iconTasks:n,patternTasks:o,scope:s}=i;for(let i of[n,o])for(let[r,n]of i.entries()){let i=this.getImage(n.id,s);i&&a.set(r,{image:i,imageVariant:n})}r(null,this._rasterizeImages(s,a))}_rasterizeImages(i,r){let a=new Map;for(let[n,{image:o,imageVariant:s}]of r.entries())a.set(n,this.imageRasterizer.rasterize(s,o,i,0));return a}getUpdatedImages(i){return this.updatedImages.get(i)||new Set}_notify(r,a,n){let o=this.images.get(a),s=new Map;for(let a of r){if(!o.get(a.toString())){if(a.iconsetId)continue;this.fire(new i.x("styleimagemissing",{id:a.name}))}let r=o.get(a.toString());if(!r){i.f_(`Image "${a.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}let n={data:r.usvg?null:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,usvg:r.usvg,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,hasRenderCallback:!!(r.userImage&&r.userImage.render)};r.usvg&&Object.assign(n,{width:r.icon.usvg_tree.width,height:r.icon.usvg_tree.height}),s.set(i.a1.toString(a),n)}n(null,{images:s,versions:this.getImageVersions(a)})}getPixelSize(i){let{width:r,height:a}=this.atlasImage.get(i);return{width:r,height:a}}getPattern(r,a,n){let o=r.toString(),s=this.patterns.get(a),l=s.get(o),h=this.getImage(r,a);if(!h)return null;if(l){if(l.position.version===h.version)return l.position;l.position.version=h.version}else{if(h.usvg&&!h.data){let s=this.getPatternInFlightId(o,a);if(this.patternsInFlight.has(s))return null;this.patternsInFlight.add(s);let l=new i.a4(r).scaleSelf(i.co.devicePixelRatio),u=new Map([[l.toString(),{image:h,imageVariant:l}]]),c=this._rasterizeImages(a,u);return this.storePatternImage(l,a,h,n,c),null}this.storePattern(r,a,h)}return this._updatePatternAtlas(a,n),s.get(o).position}getPatternInFlightId(r,a){return i.ea(r,a)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(i,r,a,n,o){let s=i.toString(),l=o?o.get(s):void 0;l&&(a.data=l,this.storePattern(i.id,r,a),this._updatePatternAtlas(r,n),this.patternsInFlight.delete(this.getPatternInFlightId(i.id.toString(),r)))}storePattern(r,a,n){let o={w:n.data.width+2*i.aq,h:n.data.height+2*i.aq,x:0,y:0},s=new i.a2(o,n,i.aq);this.patterns.get(a).set(r.toString(),{bin:o,position:s})}destroyAtlasTextures(){for(let i of this.atlasTexture.values())i&&i.destroy();this.atlasTexture.clear()}bind(r,a){let n=r.gl,o=this.atlasTexture.get(a);o?this.dirty&&(o.update(this.atlasImage.get(a)),this.dirty=!1):(o=new i.a_(r,this.atlasImage.get(a),n.RGBA8),this.atlasTexture.set(a,o)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(r,a){let n=this.patterns.get(r),o=Array.from(n.values()).map(({bin:i})=>i),{w:s,h:l}=i.eT(o),h=this.atlasImage.get(r);h.resize({width:s||1,height:l||1});let u=this.images.get(r);for(let[r,{bin:o,position:s}]of n.entries()){let n=s.padding,l=o.x+n,c=o.y+n,d=u.get(r).data,f=d.width,p=d.height;n=n>
71?n-1:n,i.ay.copy(d,h,{x:0,y:0},{x:l,y:c},{width:f,height:p},a),i.ay.copy(d,h,{x:0,y:p-n},{x:l,y:c-n},{width:f,height:n},a),i.ay.copy(d,h,{x:0,y:0},{x:l,y:c+p},{width:f,height:n},a),i.ay.copy(d,h,{x:f-n,y:0},{x:l-n,y:c},{width:n,height:p},a),i.ay.copy(d,h,{x:0,y:0},{x:l+f,y:c},{width:n,height:p},a),i.ay.copy(d,h,{x:f-n,y:p-n},{x:l-n,y:c-n},{width:n,height:n},a),i.ay.copy(d,h,{x:0,y:p-n},{x:l+f,y:c-n},{width:n,height:n},a),i.ay.copy(d,h,{x:0,y:0},{x:l+f,y:c+p},{width:n,height:n},a),i.ay.copy(d,h,{x:f-n,y:0},{x:l-n,y:c+p},{width:n,height:n},a)}this.dirty=!0}beginFrame(){for(let i of this.images.keys())this.callbackDispatchedThisFrame.set(i,new Set);this.imageAtlasCache.beginFrame()}dispatchRenderCallbacks(i,r){let a=this.images.get(r);for(let n of i){if(this.callbackDispatchedThisFrame.get(r).has(n.toString()))continue;this.callbackDispatchedThisFrame.get(r).add(n.toString());let i=a.get(n.toString());(function(i){let{userImage:r}=i;return!!(r&&r.render&&r.render())&&(i.data.replace(new Uint8Array(r.data.buffer)),!0)})(i)&&this.updateImage(n,r,i)}}}class eO{constructor(i,r,a,n){this.message=(i?`${i}: `:"")+a,n&&(this.identifier=n),null!=r&&r.__line__&&(this.line=r.__line__)}}class eF extends eO{}function eB(r){let a=r.value,n=r.valueSpec,o=r.style,s=r.styleSpec,l=r.key,h=r.arrayElementValidator||e6;if(!Array.isArray(a))return[new eO(l,a,`array expected, ${i.da(a)} found`)];if(n.length&&a.length!==n.length)return[new eO(l,a,`array length ${n.length} expected, length ${a.length} found`)];if(n["min-length"]&&a.length<n["min-length"])return[new eO(l,a,`array length at least ${n["min-length"]} expected, length ${a.length} found`)];let u={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};s.$version<7&&(u.function=n.function),i.dN(n.value)&&(u=n.value);let c=[];for(let i=0;i<a.length;i++)c=c.concat(h({array:a,arrayIndex:i,value:a[i],valueSpec:u,style:o,styleSpec:s,key:`${l}[${i}]`},!0));return c}function ek(r){let a=r.key,n=r.value,o=r.valueSpec;if(!i.dM(n))return[new eO(a,n,`number expected, ${i.da(n)} found`)];if(n!=n)return[new eO(a,n,"number expected, NaN found")];if("minimum"in o){let i=o.minimum;if(Array.isArray(o.minimum)&&(i=o.minimum[r.arrayIndex]),n<i)return[new eO(a,n,`${n} is less than the minimum value ${i}`)]}if("maximum"in o){let i=o.maximum;if(Array.isArray(o.maximum)&&(i=o.maximum[r.arrayIndex]),n>i)return[new eO(a,n,`${n} is greater than the maximum value ${i}`)]}return[]}function eN(r){let a,n=r.key,o=r.value;if(!i.dN(o))return[new eO(n,o,`object expected, ${i.da(o)} found`)];let s=r.valueSpec,l=i.fT(o.type),h,u,c,d={},f="categorical"!==l&&void 0===o.property,p=Array.isArray(a=o.stops)&&Array.isArray(a[0])&&i.dN(a[0][0]),m=e8({key:r.key,value:r.value,valueSpec:r.styleSpec.function,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(i){if("identity"===l)return[new eO(i.key,i.value,'identity function may not have a "stops" property')];let r=[],a=i.value;return r=r.concat(eB({key:i.key,value:a,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:_})),Array.isArray(a)&&0===a.length&&r.push(new eO(i.key,a,"array must have at least one stop")),r},default:function(i){return e6({key:i.key,value:i.value,valueSpec:s,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===l&&f&&m.push(new eO(r.key,r.value,'missing required property "property"')),"identity"===l||o.stops||m.push(new eO(r.key,r.value,'missing required property "stops"')),"exponential"===l&&s.expression&&!i.fA(s)&&m.push(new eO(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(f||i.fC(s)?f&&!i.fD(s)&&m.push(new eO(r.key,r.value,"zoom functions not supported")):m.push(new eO(r.key,r.value,"property functions not supported"))),("categorical"===l||p)&&void 0===o.property&&m.push(new eO(r.key,r.value,'"property" property is required')),m;function _(r){let a=[],n=r.value,o=r.key;if(!Array.isArray(n))return[new eO(o,n,`array expected, ${i.da(n)} found`)];if(2!==n.length)return[new eO(o,n,`array length 2 expected, length ${n.length} found`)];if(p){if(!i.dN(n[0]))return[new eO(o,n,`object expected, ${i.da(n[0])} found`)];let s=n[0];if(void 0===s.zoom)return[new eO(o,n,"object stop key must have zoom")];if(void 0===s.value)return[new eO(o,n,"object stop key must have value")];let l=i.fT(s.zoom);if("number"!=typeof l)return[new eO(o,s.zoom,"stop zoom values must be numbers")];if(c&&c>l)return[new eO(o,s.zoom,"stop zoom values must appear in ascending order")];l!==c&&(c=l,u=void 0,d={}),a=a.concat(e8({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:r.style,styleSpec:r.styleSpec,objectElementValidators:{zoom:ek,value:g}}))}else a=a.concat(g({key:`${o}[0]`,value:n[0],style:r.style,styleSpec:r.styleSpec},n));return i.dv(i.c3(n[1]))?a.concat([new eO(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(e6({key:`${o}[1]`,value:n[1],valueSpec:s,style:r.style,styleSpec:r.styleSpec}))}function g(r,a){let n=i.da(r.value),o=i.fT(r.value),c=null!==r.value?r.value:a;if(h){if(n!==h)return[new eO(r.key,c,`${n} stop domain type must match previous stop domain type ${h}`)]}else h=n;if("number"!==n&&"string"!==n&&"boolean"!==n&&"number"!=typeof o&&"string"!=typeof o&&"boolean"!=typeof o)return[new eO(r.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==n&&"categorical"!==l){let a=`number expected, ${n} found`;
7return i.fC(s)&&void 0===l&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new eO(r.key,c,a)]}return"categorical"!==l||"number"!==n||"number"==typeof o&&isFinite(o)&&Math.floor(o)===o?"categorical"!==l&&"number"===n&&"number"==typeof o&&"number"==typeof u&&void 0!==u&&o<u?[new eO(r.key,c,"stop domain values must appear in ascending order")]:(u=o,"categorical"===l&&o in d?[new eO(r.key,c,"stop domain values must be unique")]:(d[o]=!0,[])):[new eO(r.key,c,`integer expected, found ${String(o)}`)]}}function eU(r){let a=("property"===r.expressionContext?i.b$:i.bY)(i.c3(r.value),r.valueSpec);if("error"===a.result)return a.value.map(i=>new eO(`${r.key}${i.key}`,r.value,i.message));let n=a.value.expression||a.value._styleExpression.expression;if("property"===r.expressionContext&&"text-font"===r.propertyKey&&!n.outputDefined())return[new eO(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===r.expressionContext&&"layout"===r.propertyType&&!i.dP(n))return[new eO(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===r.expressionContext)return function r(a,n){let o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)o.delete(i);if(0===o.size)return[];let s=[];return a instanceof i.j&&o.has(a.name)?[new eO(n.key,n.value,`["${a.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(a.eachChild(i=>{s.push(...r(i,n))}),s)}(n,r);if("appearance"===r.expressionContext)return function r(a,n){if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)ej.delete(i);if(0===ej.size)return[];let o=[];if(a instanceof i.j){let i=eV.has(a.name)?"feature":a.name;if(ej.has(i))return[new eO(n.key,n.value,`["${a.name}"] is not an allowed parameter`)]}return a.eachChild(i=>{o.push(...r(i,n))}),o}(n,r);if(r.expressionContext&&0===r.expressionContext.indexOf("cluster")){if(!i.dC(n,["zoom","feature-state"]))return[new eO(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===r.expressionContext&&!i.dy(n))return[new eO(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}let eV=new Set(["get","has","properties","geometry-type","id"]),ej=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function eG(r){let a=r.key,n=r.value,o=r.valueSpec,s=[];return Array.isArray(o.values)?o.values.includes(i.fT(n))||s.push(new eO(a,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(o.values).includes(i.fT(n))||s.push(new eO(a,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function eH(r){return i.dw(i.c3(r.value))?eU(Object.assign({},r,{expressionContext:"filter",valueSpec:r.styleSpec[`filter_${r.layerType||"fill"}`]})):function r(a){let n=a.value,o=a.key;if(!Array.isArray(n))return[new eO(o,n,`array expected, ${i.da(n)} found`)];if(n.length<1)return[new eO(o,n,"filter array must have at least 1 element")];let s=a.styleSpec,l=eG({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator}),h=()=>{n.length>=2&&(i.dQ(n[1])||l.push(new eO(`${o}[1]`,n[1],`string expected, ${i.da(n[1])} found`)));for(let r=2;r<n.length;r++)"$type"===i.fT(n[1])?l=l.concat(eG({key:`${o}[${r}]`,value:n[r],valueSpec:s.geometry_type})):i.dQ(n[r])||i.dM(n[r])||i.du(n[r])||l.push(new eO(`${o}[${r}]`,n[r],`string, number, or boolean expected, ${i.da(n[r])} found.`))};switch(i.fT(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===i.fT(n[1])&&l.push(new eO(o,n,`"$type" cannot be use with operator "${n[0]}"`)),3!==n.length&&l.push(new eO(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"==":case"!=":3!==n.length&&l.push(new eO(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"in":case"!in":h();break;case"any":case"all":case"none":for(let i=1;i<n.length;i++)l=l.concat(r({key:`${o}[${i}]`,value:n[i],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":2!==n.length?l.push(new eO(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):i.dQ(n[1])||l.push(new eO(`${o}[1]`,n[1],`string expected, ${i.da(n[1])} found`))}return l}(r)}let eq=/^{([^}]+)}$/;function e$(r,a){let n,o=r.key,s=r.style,l=r.layer,h=r.styleSpec,u=r.value,c=r.objectKey,d=h[`${a}_${r.layerType}`];if(!d)return[];let f=c.match(i.b3);if(f&&d[f[1]])return i.dv(i.c3(u))?[].concat(e6({key:o,value:u,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c})):e6({key:o,value:u,valueSpec:{type:"string"},style:s,styleSpec:h});let p=c.match(i.aY);
7if("paint"===a&&p&&d[p[1]]&&d[p[1]].transition)return e6({key:o,value:u,valueSpec:h.transition,style:s,styleSpec:h});let m=r.valueSpec||d[c];if(!m)return[new eF(o,u,`unknown property "${c}"`)];if(i.dQ(u)&&i.fC(m)&&!m.tokens&&(n=eq.exec(u))){let i=`\`{ "type": "identity", "property": ${n?JSON.stringify(n[1]):'"_"'} }\``;return[new eO(o,u,`"${c}" does not support interpolation syntax 8Use an identity property function instead: ${i}.`)]}let _=[];if("symbol"===r.layerType)"text-field"!==c||!s||s.glyphs||s.imports||_.push(new eO(o,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&i.dB(i.c3(u))&&"identity"===i.fT(u.type)&&_.push(new eO(o,u,'"text-font" does not support identity functions'));else if("model"===r.layerType&&"paint"===a&&l&&l.layout&&Object.hasOwn(l.layout,"model-id")&&i.fC(m)&&(i.fB(m)||i.fD(m))){let r=i.b$(i.c3(u),m).value,a="expression"in r&&r.expression||"_styleExpression"in r&&r._styleExpression&&r._styleExpression.expression;a&&!i.dC(a,["measure-light"])&&("model-emissive-strength"===c&&i.dy(a)&&i.dP(a)||_.push(new eO(o,u,`${c} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(e6({key:r.key,value:u,valueSpec:m,style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c}))}function eZ(i){return e$(i,"paint")}function eW(i){return e$(i,"layout")}function eX(r){let a=[],n=r.value,o=r.key,s=r.style,l=r.styleSpec;if(!i.dN(n))return[new eO(o,n,"object expected")];n.type||n.ref||a.push(new eO(o,n,'either "type" or "ref" is required'));let h=i.fT(n.type),u=i.fT(n.ref);if(n.id){let l=i.fT(n.id);for(let h=0;h<r.arrayIndex;h++){let r=s.layers[h];i.fT(r.id)===l&&a.push(new eO(o,n.id,`duplicate layer id "${l}", previously used at line ${r.id.__line__}`))}}if("ref"in n){let r;["type","source","source-layer","filter","layout"].forEach(i=>{i in n&&a.push(new eO(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(a=>{i.fT(a.id)===u&&(r=a)}),r?r.ref?a.push(new eO(o,n.ref,"ref cannot reference another ref layer")):h=i.fT(r.type):"string"==typeof u&&a.push(new eO(o,n.ref,`ref layer "${u}" not found`))}else if("background"!==h&&"sky"!==h&&"slot"!==h)if(n.source)if(i.dQ(n.source)){let r=s.sources&&Object.hasOwn(s.sources,n.source)?s.sources[n.source]:void 0,l=r&&i.fT(r.type);r?"vector"===l&&"raster"===h?a.push(new eO(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===l&&"raster"!==h?a.push(new eO(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==l||n["source-layer"]?"raster-dem"===l&&"hillshade"!==h?a.push(new eO(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==l||["raster","raster-particle"].includes(h)?"line"===h&&n.paint&&n.paint["line-gradient"]&&"geojson"===l&&!r.lineMetrics?a.push(new eO(o,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"line"===h&&n.paint&&n.paint["line-trim-offset"]&&"geojson"===l&&!r.lineMetrics?a.push(new eO(o,n,`layer "${n.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===h&&"raster-array"!==l&&a.push(new eO(o,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):a.push(new eO(o,n.source,"raster-array source can only be used with layer type 'raster'.")):a.push(new eO(o,n,`layer "${n.id}" must specify a "source-layer"`)):a.push(new eO(o,n.source,`source "${n.source}" not found`))}else a.push(new eO(`${o}.source`,n.source,'"source" must be a string'));else a.push(new eO(o,n,'missing required property "source"'));return a=a.concat(e8({key:o,value:n,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{"*":()=>[],type:()=>e6({key:`${o}.type`,value:n.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,object:n,objectKey:"type"}),filter:i=>eH(Object.assign({layerType:h},i)),layout:i=>e8({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>eW(Object.assign({layerType:h},i))}}),paint:i=>e8({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>eZ(Object.assign({layerType:h,layer:n},i))}}),appearances(r){let a=eB({key:r.key,value:r.value,valueSpec:r.valueSpec,style:r.style,styleSpec:r.styleSpec,arrayElementValidator:r=>(function(r){let{key:a,layer:n,layerType:o}=r,s=i.fT(r.value),l=i.fT(s.name),h=i.fT(s.condition),u=e8({key:a,value:s,valueSpec:r.styleSpec.appearance,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{condition:r=>{var a;let s;return a=Object.assign({layer:n,layerType:o},r),(s=[]).push(...eU({key:a.key,value:a.object.condition,valueSpec:i.fs.appearance.condition,expressionContext:"appearance"})),s},properties:i=>(function(i){let r=[],{styleSpec:a,layer:n,layerType:o}=i,s=a[`paint_${o}`],l=a[`layout_${o}`],h=i.object[i.objectKey];for(let a in h){let u=a in s?"paint":a in l?"layout":void 0;if(!u){r.push(new eO(i.key,a,`unknown property "${a}" for layer type "${o}"`));continue}let c=Object.assign({},i,{key:`${i.key}.${a}`,object:h,objectKey:a,layer:n,layerType:o,value:h[a],valueSpec:"paint"===u?s[a]:l[a]});r.push(...e$(c,u))}return r})(Object.assign({layer:n,layerType:o},i))}});return"hidden"!==l&&void 0===h&&u.push(new eO(r.key,"name",'Appearance with name different than "hidden" must have a condition')),u})(Object.assign({layerType:h,layer:n},r))}),o=Array.isArray(r.value)?r.value:[],s=new Set;return o.forEach((o,l)=>{let h=i.fT(o.name);if(h)if(s.has(h)){let o=i.fT(n.id);a.push(new eO(r.key,h,`Duplicated appearance name "${h}" for layer "${o}"`))}else s.add(h)}),a}}}))}function eY({key:r,value:a}){return i.dQ(a)?[]:[new eO(r,a,`string expected, ${i.da(a)} found`)]}let eK={promoteId:function r({key:a,value:n}){if(i.dQ(n))return eY({key:a,value:n});if(Array.isArray(n)){let r=[],o=i.c3(n),s=i.bY(o);return"error"===s.result?s.value.forEach(i=>
8{r.push(new eO(`${a}${i.key}`,null,`${i.message}`))}):i.dC(s.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||r.push(new eO(`${a}`,null,"promoteId expression should be only feature dependent")),r}if(!i.dN(n))return[new eO(a,n,`string, expression or object expected, "${i.da(n)}" found`)];let o=[];for(let i in n)o.push(...r({key:`${a}.${i}`,value:n[i]}));return o}};function eJ(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.dN(a))return[new eO(n,a,`object expected, ${i.da(a)} found`)];if(!("type"in a))return[new eO(n,a,'"type" is required')];let l=i.fT(a.type),h=[];switch(["vector","raster","raster-dem","raster-array"].includes(l)&&("url"in a||"tiles"in a||h.push(new eF(n,a,'Either "url" or "tiles" is required.'))),l){case"vector":case"raster":case"raster-dem":case"raster-array":return h.concat(e8({key:n,value:a,valueSpec:o[`source_${l.replace("-","_")}`],style:r.style,styleSpec:o,objectElementValidators:eK}));case"geojson":if(h=e8({key:n,value:a,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:eK}),"cluster"in a&&"clusterProperties"in a){if(!i.dN(a.clusterProperties))return[new eO(`${n}.clusterProperties`,a,`object expected, ${i.da(a)} found`)];for(let i in a.clusterProperties){let r=a.clusterProperties[i];if(!Array.isArray(r))return[new eO(`${n}.clusterProperties.${i}`,r,"array expected")];let[o,s]=r,l="string"==typeof o?[o,["accumulated"],["get",i]]:o;h.push(...eU({key:`${n}.${i}.map`,value:s,expressionContext:"cluster-map"})),h.push(...eU({key:`${n}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}}return h;case"video":return e8({key:n,value:a,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return e8({key:n,value:a,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new eO(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:var u;return eG({key:`${n}.type`,value:a.type,valueSpec:{values:(u=o).source.reduce((i,r)=>{let a=u[r];return"enum"===a.type.type&&(i=i.concat(Object.keys(a.type.values||{}))),i},[])}})}}function eQ(i,r){let a=!i.includes("://");try{return new URL(i,a&&r?"http://example.com":void 0),!0}catch(i){return!1}}function e0(r){let a=r.value;return a?i.dQ(a)?eQ(a,!0)?[]:[new eO(r.key,a,`invalid url "${a}"`)]:[new eO(r.key,a,`string expected, "${i.da(a)}" found`)]:[]}function e1(r){let a=r.value,n=r.styleSpec,o=n.light,s=r.style;if(void 0===a)return[];if(!i.dN(a))return[new eO("light",a,`object expected, ${i.da(a)} found`)];let l=[];for(let r in a){let h=r.match(i.aY),u=r.match(i.b3);l=l.concat(u&&o[u[1]]?e6({key:r,value:a[r],valueSpec:{type:"string"},style:s,styleSpec:n}):h&&o[h[1]]&&o[h[1]].transition?e6({key:r,value:a[r],valueSpec:n.transition,style:s,styleSpec:n}):o[r]?e6({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}):[new eO(r,a[r],`unknown property "${r}"`)])}return l}function e2(r){let a=r.value;if(!a)return[];let n=r.key;if(!i.dN(a))return[new eO(n,a,`object expected, ${i.da(a)} found`)];let o=[],s=r.styleSpec,l=s["light-3d"],h=r.style,u=r.style.lights;for(let i of["type","id"])if(!(i in a))return o.concat([new eO(n,a,`missing property "${i}"`)]);if(!i.dQ(a.type))return o.concat([new eO(`${n}.type`,a.type,"string expected")]);if(u)for(let s=0;s<r.arrayIndex;s++){let r=i.fT(a.type),l=u[s];i.fT(l.type)===r&&o.push(new eO(n,a.id,`duplicate light type "${a.type}", previously defined at line ${l.id.__line__}`))}let c=`properties_light_${a.type}`;if(!(c in s))return o.concat([new eO(`${n}.type`,a,`Invalid light type ${a.type}`)]);let d=s[c];for(let n in a)if("properties"===n){let l=a[n];if(!i.dN(l))return o.concat([new eO("properties",l,`object expected, ${i.da(l)} found`)]);for(let u in l){let c=u.match(i.aY),f=u.match(i.b3);o=o.concat(f&&d[f[1]]?e6({key:n,value:l[u],valueSpec:{type:"string"},style:h,styleSpec:s}):c&&d[c[1]]&&d[c[1]].transition?e6({key:n,value:a[n],valueSpec:s.transition,style:h,styleSpec:s}):d[u]?e6({key:u,value:l[u],valueSpec:d[u],style:h,styleSpec:s}
8):[new eF(r.key,l[u],`unknown property "${u}"`)])}}else o=o.concat(l[n]?e6({key:n,value:a[n],valueSpec:l[n],style:h,styleSpec:s}):[new eF(n,a[n],`unknown property "${n}"`)]);return o}function e3(r){let a=r.value,n=r.key,o=r.style,s=r.styleSpec,l=s.terrain;if(null==a)return[];if(!i.dN(a))return[new eO("terrain",a,`object expected, ${i.da(a)} found`)];let h=[];for(let r in a){let n=r.match(i.aY),u=r.match(i.b3);h=h.concat(u&&l[u[1]]?e6({key:r,value:a[r],valueSpec:{type:"string"},style:o,styleSpec:s}):n&&l[n[1]]&&l[n[1]].transition?e6({key:r,value:a[r],valueSpec:s.transition,style:o,styleSpec:s}):l[r]?e6({key:r,value:a[r],valueSpec:l[r],style:o,styleSpec:s}):[new eF(r,a[r],`unknown property "${r}"`)])}if(a.source)if(i.dQ(a.source)){let r=o.sources&&Object.hasOwn(o.sources,a.source)?o.sources[a.source]:void 0,s=r&&i.fT(r.type);r?"raster-dem"!==s&&h.push(new eO(`${n}.source`,a.source,`terrain cannot be used with a source of type ${s}, it only be used with a "raster-dem" source type`)):h.push(new eO(`${n}.source`,a.source,`source "${a.source}" not found`))}else h.push(new eO(`${n}.source`,a.source,"source must be a string"));else h.push(new eO(n,a,'terrain is missing required property "source"'));return h}function e4(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.fog;if(void 0===a)return[];if(!i.dN(a))return[new eO("fog",a,`object expected, ${i.da(a)} found`)];let l=[];for(let r in a){let h=r.match(i.aY),u=r.match(i.b3);l=l.concat(u&&s[u[1]]?e6({key:r,value:a[r],valueSpec:{type:"string"},style:n,styleSpec:o}):h&&s[h[1]]&&s[h[1]].transition?e6({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?e6({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eF(r,a[r],`unknown property "${r}"`)])}return l}let e5={"*":()=>[],array:eB,boolean:function(r){let a=r.value,n=r.key;return i.du(a)?[]:[new eO(n,a,`boolean expected, ${i.da(a)} found`)]},number:ek,color:function({key:r,value:a}){return i.dQ(a)?void 0===i.i.parse(i.fT(a))?[new eO(r,a,`color expected, "${a}" found`)]:[]:[new eO(r,a,`color expected, ${i.da(a)} found`)]},enum:eG,filter:eH,function:eN,layer:eX,object:e8,source:eJ,model:e0,light:e1,"light-3d":e2,terrain:e3,fog:e4,string:eY,formatted:function(i){return 0===eY(i).length?[]:eU(i)},resolvedImage:function(i){return 0===eY(i).length?[]:eU(i)},projection:function(r){let a=r.value,n=r.styleSpec,o=n.projection,s=r.style;if(i.dN(a)){let i=[];for(let r in a)i=i.concat(e6({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}));return i}return i.dQ(a)?[]:[new eO("projection",a,`object or string expected, ${i.da(a)} found`)]},import:function(r){let a=r.key,{value:n,styleSpec:o}=r;if(!i.dN(n))return[new eO(a,n,"import must be an object")];let{data:s,...l}=n;Object.defineProperty(l,"__line__",{value:n.__line__,enumerable:!1});let h=e8(Object.assign({},r,{value:l,valueSpec:o.import}));return""===i.fT(l.id)&&h.push(new eO(`${r.key}.id`,l,"import id can't be an empty string")),"__proto__"===i.fT(l.id)&&h.push(new eO(`${r.key}.id`,l,'import id can\'t be "__proto__"')),s&&(h=h.concat(e7(s,o,{key:`${r.key}.data`}))),h},iconset:function(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.dN(a))return[new eO(n,a,"object expected")];if(!a.type)return[new eO(n,a,'"type" is required')];let l=i.fT(a.type),h=[];if(h=h.concat(e8({key:n,value:a,valueSpec:o[`iconset_${l}`],style:s,styleSpec:o})),!("source"!==l||!a.source)){let r=s.sources&&Object.hasOwn(s.sources,a.source)?s.sources[a.source]:void 0,o=r&&i.fT(r.type);r?"raster-array"!==o&&h.push(new eO(n,a.source,`iconset cannot be used with a source of type ${String(o)}, it only be used with a "raster-array" source type`)):h.push(new eO(n,a.source,`source "${a.source}" not found`))}return h},option:function(r){let a=r.styleSpec,n=r.value,o=i.dN(n)&&!0===i.fT(n.array)||!i.dN(n)?void 0:i.fT(n.type);return e8(Object.assign({},r,{valueSpec:a.option,objectElementValidators:o?{default:i=>Array.isArray(i.value)?e6(Object.assign({},i,{valueSpec:Object.assign({},i.valueSpec,{type:o})})):e6(i)}:void 0}))}};function e6(r,a=!1){let n=r.value,o=r.valueSpec,s=r.styleSpec;if(o.expression){if(i.dB(i.fT(n)))return eN(r);if(i.dv(i.c3(n)))return eU(r)}if(o.type&&e5[o.type]){let i=e5[o.type](r);return!0===a&&i.length>0&&Array.isArray(r.value)?eU(r):i}return e8(Object.assign({},r,{valueSpec:o.type?s[o.type]:o}))}function e8(r){let a=r.key,n=r.value,o=r.valueSpec||{},s=r.objectElementValidators||{},l=r.style,h=r.styleSpec;if(!i.dN(n))return[new eO(a,n,`object expected, ${i.da(n)} found`)];let u=[];for(let i in n){let r;if(!Object.hasOwn(n,i))continue;let c=i.split(".")[0],d=Object.hasOwn(o,c),f=Object.hasOwn(o,"*"),p=d?o[c]:f?o["*"]:void 0;Object.hasOwn(s,c)?r=s[c]:d?r=e6:Object.hasOwn(s,"*")?r=s["*"]:f&&(r=e6),r?u=u.concat(r({key:(a?`${a}.`:a)+i,value:n[i],valueSpec:p,style:l,styleSpec:h,object:n,objectKey:i},n)):u.push(new eF(a,n[i],`unknown property "${i}"`))}for(let i in o){if(!Object.hasOwn(o,i)||Object.hasOwn(s,i))continue;let r=o[i];!r.required||void 0!==r.default||Object.hasOwn(n,i)&&void 0!==n[i]||u.push(new eO(a,n,`missing required property "${i}"`))}return u}function e9({key:i,value:r}){let a=eY({key:i,value:r});return a.length||(r.includes("{fontstack}")||a.push(new eO(i,r,'"glyphs" url must include a "{fontstack}" token')),r.includes("{range}")||a.push(new eO(i,r,'"glyphs" url must include a "{range}" token'))),a}function e7(r,a=i.fs,n={}){return e8({key:n.key||"",value:r,valueSpec:Object.assign({},a.$root,{"*":{type:"*"}}),styleSpec:a,style:r,objectElementValidators:{glyphs:e9}})}function te(r,a=i.fs){return tf(e7(r,a))}let tt=i=>tf(eJ(i)),ti=i=>tf(e1(i)),tr=i=>tf(e2(i)),ta=i=>tf(e3(i)),tn=i=>tf(e4(i)),to=r=>tf(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.snow;if(void 0===a)return[];if(!i.dN(a))return[new eO("snow",a,`object expected, ${i.da(a)} found`)];let l=[];for(let r in a){let h=r.match(i.aY);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?e6({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}
8):s[r]?e6({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eF(r,a[r],`unknown property "${r}"`)])}return l}(r)),ts=r=>tf(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.rain;if(void 0===a)return[];if(!i.dN(a))return[new eO("rain",a,`object expected, ${i.da(a)} found`)];let l=[];for(let r in a){let h=r.match(i.aY);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?e6({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?e6({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eF(r,a[r],`unknown property "${r}"`)])}return l}(r)),tl=i=>tf(eX(i)),th=i=>tf(eH(i)),tu=i=>tf(eZ(i)),tc=i=>tf(eW(i)),td=i=>tf(e0(i));function tf(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}function tp(r,a){let n=!1;if(a&&a.length)for(let o of a)o instanceof eF?i.f_(o.message):(r.fire(new i.v(Error(o.message))),n=!0);return n}let tm=i.fs.light;class t_ extends i.y{constructor(r,a="flat"){super(),this._transitionable=new i.b2(s||(s=new i.ax({anchor:new i.l(tm.anchor),position:new i.av(tm.position),color:new i.l(tm.color),intensity:new i.l(tm.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,r,a={}){this._validate(ti,i,a)||(this._transitionable.setTransitionOrValue(i),this.id=r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&tp(this,r.call(te,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.fs})))}}let tg=i.fs.terrain,ty=class extends i.y{constructor(r,a,n,o,s){super(),this.scope=n,this._transitionable=new i.b2(new i.ax({source:new i.l(tg.source),exaggeration:new i.l(tg.exaggeration)}),n,o),this._transitionable.setTransitionOrValue(r,o),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=a,this.worldview=s}get(){return this._transitionable.serialize()}set(i,r){this._transitionable.setTransitionOrValue(i,r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}getExaggeration(r){return this._transitioning.possiblyEvaluate(new i.w(r,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let r=this._transitionable._values.exaggeration;if(!r)return null;let a=r.value.expression;if(!a)return null;let n=-1,o=-1,s=1;for(let r of a.zoomStops)(s=a.evaluate(new i.w(r,{worldview:this.worldview})))>.01?(n=r,o=-1):o=r;return s<.01&&n>0&&o>n?[n,o]:null}isZoomDependent(){let r=this._transitionable._values.exaggeration;return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof i.bh}};function tx(r,a,n){let o=i.fq(45,65,n),[s,l]=r.range,h=1-Math.min(1,Math.exp(-((a-s)/(l-s)*6)));return h*=h*h,(h=Math.min(1,1.00747*h))*o*r.alpha}function tv(r,a,n,o,s){let l=i.fL([],[a,n,o],s.mercatorFogMatrix);return tx(r,i.dW(l),s.pitch)}function tb(r,a,n,o,s,l,h){let u=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let r of[[n,o,0],[s,o,0],[s,l,0],[n,l,0]]){let n=i.fL([],r,a),o=i.dW(n);u=Math.min(u,o),c=Math.max(c,o)}return[tx(r,u,h.pitch),tx(r,c,h.pitch)]}let tw=i.fs.fog;class tT extends i.y{constructor(r,a,n,o){super();const s=new i.ax({range:new i.l(tw.range),color:new i.l(tw.color),"color-use-theme":new i.l({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.l(tw["high-color"]),"high-color-use-theme":new i.l({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.l(tw["space-color"]),"space-color-use-theme":new i.l({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.l(tw["horizon-blend"]),"star-intensity":new i.l(tw["star-intensity"]),"vertical-range":new i.l(tw["vertical-range"])});this._transitionable=new i.b2(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new i.aw(s),this.scope=n}get state(){let r=this._transform,a="globe"===r.projection.name,n=i.dm(r.zoom),o=this.properties.get("range"),s=.5/Math.tan(.5*r._fov),l=[o[0]+s,o[1]+s];return{range:a?[i.dY(2,l[0],n),i.dY(4.5,l[1],n)]:l,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}
8){if(this._validate(tn,i,a))return;let n=Object.assign({},i);for(let i of Object.keys(tw))void 0===n[i]&&(n[i]=tw[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;let a=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.fq(45,65,r))*a.a}getOpacityAtLatLng(r,a){var n;let o,s;return this._transform.projection.supportsFog?(n=this.state,o=i.ag.fromLngLat(r),s=a.elevation?a.elevation.getAtPointOrZero(o):0,tv(n,o.x,o.y,s,a)):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];let a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return tb(this.state,a,0,0,i.r,i.r,this._transform)}getOpacityForBounds(i,r,a,n,o){return this._transform.projection.supportsFog?tb(this.state,i,r,a,n,o,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;for(let a of[4,5,6,7]){let n,o=r.points[a];if(o[2]>=0)n=o;else{let s=r.points[a-4];n=i.bo(s,o,s[2]/(s[2]-o[2]))}if(tv(this.state,n[0],n[1],0,this._transform)>=.05)return!0}return!1}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,i)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&tp(this,r.call(te,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.fs})))}}let tS,tE,tI=class extends i.y{constructor(r,a,n,o){super();const s=tS||(tS=new i.ax({density:new i.l(i.fs.snow.density),intensity:new i.l(i.fs.snow.intensity),color:new i.l(i.fs.snow.color),opacity:new i.l(i.fs.snow.opacity),vignette:new i.l(i.fs.snow.vignette),"vignette-color":new i.l(i.fs.snow["vignette-color"]),"center-thinning":new i.l(i.fs.snow["center-thinning"]),direction:new i.l(i.fs.snow.direction),"flake-size":new i.l(i.fs.snow["flake-size"])}));this._transitionable=new i.b2(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.aw(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.c4(n[0]),s=-Math.max(i.c4(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette"),u=this.properties.get("vignette-color"),c=new i.i(u.r,u.g,u.b,h);return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.i(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:c}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(to,r,n))return;let o=Object.assign({},r),s=i.fs.snow;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,i)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&tp(this,r.call(te,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.fs})))}},tA=class extends i.y{constructor(r,a,n,o){super();const s=tE||(tE=new i.ax({density:new i.l(i.fs.rain.density),intensity:new i.l(i.fs.rain.intensity),color:new i.l(i.fs.rain.color),opacity:new i.l(i.fs.rain.opacity),vignette:new i.l(i.fs.rain.vignette),"vignette-color":new i.l(i.fs.rain["vignette-color"]),"center-thinning":new i.l(i.fs.rain["center-thinning"]),direction:new i.l(i.fs.rain.direction),"droplet-size":new i.l(i.fs.rain["droplet-size"]),"distortion-strength":new i.l(i.fs.rain["distortion-strength"])}));this._transitionable=new i.b2(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.aw(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.c4(n[0]),s=-Math.max(i.c4(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette-color"),u=new i.i(h.r,h.g,h.b,this.properties.get("vignette"));return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.i(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),droplet
8Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:u}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(ts,r,n))return;let o=Object.assign({},r),s=i.fs.rain;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,i)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&tp(this,r.call(te,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.fs})))}},tM={workerUrl:"",workerClass:null,workerParams:void 0},tC="mapboxgl_preloaded_worker_pool";class tD{constructor(i){this.active={},this.name=i}acquire(i,r=tD.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<r;){var a;let r=(a=`${this.name||""}WorkerPool: ${i}-${this.workers.length}`,null!=tM.workerClass?new tM.workerClass:new self.Worker(tM.workerUrl,Object.assign({name:a},tM.workerParams)));this.workers.push(r)}return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],this.workers&&0===this.numActive()&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[tC]}numActive(){return Object.keys(this.active).length}}tD.workerCount=2;class tR{constructor(r,a,n="Worker",o=tD.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.fU();const s=this.workerPool.acquire(this.id,o);for(let i=0;i<s.length;i++){const r=new tR.Actor(s[i],a,this.id);r.name=`${n} ${i}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,a,n){i.bp(this.actors,(i,n)=>{i.send(r,a,n)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}tR.Actor=i.a;class tP extends i.y{constructor(r,a,n,o){super(),this.scope=n,this._options=r,this.properties=new i.aw(a),this._transitionable=new i.b2(a,n,o),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(i){this._transitionable.setTransitionOrValue(this._options.properties,i)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(i,r){this._options=i,this._transitionable.setTransitionOrValue(i.properties,r)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let tL=()=>l||(l=new i.ax({color:new i.l(i.fs.properties_light_ambient.color),"color-use-theme":new i.l({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.l(i.fs.properties_light_ambient.intensity)})),tz=()=>h||(h=new i.ax({direction:new i.p(i.fs.properties_light_directional.direction),color:new i.l(i.fs.properties_light_directional.color),"color-use-theme":new i.l({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.l(i.fs.properties_light_directional.intensity),"cast-shadows":new i.l(i.fs.properties_light_directional["cast-shadows"]),"shadow-quality":new i.l(i.fs.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.l(i.fs.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new i.l(i.fs.properties_light_directional["shadow-draw-before-layer"])})),tO=(i,r,a,n,o,s,l,h,u,c=[0,0,1])=>({u_matrix:i,u_normal_matrix:r,u_opacity:a,u_faux_facade_ao_intensity:n,u_camera_pos:o,u_tile_to_meter:s,u_facade_emissive_chance:l,u_flood_light_color:h,u_flood_light_intensity:u,u_front_cutoff_params:c}),tF=i=>({u_matrix:i}),tB=i=>({u_matrix:i});class tk{constructor(i,r,a){this.enable=i,this.mode=r,this.frontFace=a}}tk.disabled=new tk(!1,1029,2305),tk.backCCW=new tk(!0,1029,2305),tk.backCW=new tk(!0,1029,2304),tk.frontCW=new tk(!0,1028,2304),tk.frontCCW=new tk(!0,1028,2305);class tN{constructor(i,r,a){this.func=i,this.mask=r,this.range=a}}tN.ReadOnly=!1,tN.ReadWrite=!0,tN.disabled=new tN(519,tN.ReadOnly,[0,1]);class tU{constructor(i=0,r=0,a=0,n=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=a,this.right=n}interpolate(r,a,n){return null!=a.top&&null!=r.top&&(this.top=i.dY(r.top,a.top,n)),null!=a.bottom&&null!=r.bottom&&(this.bottom=i.dY(r.bottom,a.bottom,n)),null!=a.left&&null!=r.left&&(this.left=i.dY(r.left,a.left,n)),null!=a.right&&null!=r.right&&(this.right=i.dY(r.right,a.right,n)),this}getCenter(r,a){let n=i.bG((this.left+r-this.right)/2,0,r),o=i.bG((this.top+a-this.bottom)/2,0,a);return new i.au(n,o)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new tU(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tV(r,a){let n=i.cL(r,3);i.ct(r,a),i.fk(r,3,n)}function tj(r,a){let n=i.dp([]);return i.f5(n,n,-a),i.f2(n,n,-r),n}function tG(r,a){let n=[r[0],r[1],0],o=[a[0],a[1],0];if(i.dW(n)>=1e-15){let r=i.ex([],n);i.fa(o,r,i.c7(o,r)),a[0]=o[0],a[1]=o[1]}let s=i.c1([],a,r);if(1e-15>i.dV(s))return null;let l=Math.atan2(-s[1],s[0]);return tj(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),l)}class tH{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){if(r){let a=r instanceof i.ag?r:new i.ag(r[0],r[1],r[2]);
8this._renderWorldCopies&&(a.x=i.f$(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a,n){if(this.orientation=null,!this.position)return;let o=this.position,s=n||(this._elevation?this._elevation.getAtPointOrZero(i.ag.fromLngLat(r)):0),l=i.ag.fromLngLat(r,s),h=[l.x-o.x,l.y-o.y,l.z-o.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=tG(h,a)}setPitchBearing(r,a){this.orientation=tj(i.c4(r),i.c4(-a))}}class tq{constructor(r,a){this._transform=i.dq([]),this.orientation=a,this.position=r}get mercatorPosition(){let r=this.position;return new i.ag(r[0],r[1],r[2])}get position(){let r=i.cL(this._transform,3);return[r[0],r[1],r[2]]}set position(r){r&&i.fk(this._transform,3,[r[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||i.dp([]),r&&tV(this._transform,this._orientation)}getPitchBearing(){let i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=tj(i,r),tV(this._transform,this._orientation)}forward(){let r=i.cL(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){let r=i.cL(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){let r=i.cL(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){let n=new Float64Array(16);return i.dr(n,this.getWorldToCamera(r,a)),n}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,n){let o=this.position;i.fa(o,o,-r);let s=new Float64Array(16);return i.cv(s,[n,n,n]),i.fQ(s,s,o),s[10]*=a,s}getWorldToCamera(r,a){let n=new Float64Array(16),o=new Float64Array(4),s=this.position;return i.bO(o,this._orientation),i.fa(s,s,-r),i.ct(n,o),i.fQ(n,n,s),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=a,n[9]*=a,n[10]*=a,n[11]*=a,n}getCameraToClipPerspective(r,a,n,o){let s=new Float64Array(16);return i.eE(s,r,a,n,o),s}getCameraToClipOrthographic(r,a,n,o,s,l){let h=new Float64Array(16);return i.eB(h,r,a,n,o,s,l),h}getDistanceToElevation(r,a=!1){let n=0===r?0:i.em(r,a?i.dT(this.position[1]):this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new tq([...this.position],[...this.orientation])}}let t$=Math.tan(85*Math.PI/180);function tZ(r,a,n,o,s,l,h){let u=i.bT();if(n)if("globe"===l.name){let r=i.bw(s,a);i.er(u,u,r)}else{let r=i.ds([],h);u[0]=r[0],u[1]=r[1],u[4]=r[2],u[5]=r[3],o||i.f6(u,u,s.angle)}else i.er(u,s.labelPlaneMatrix,r);return u}function tW(i,r,a,n,o,s,l){let h=tZ(i,r,a,n,o,s,l);return"globe"===s.name&&a||(h[2]=h[6]=h[10]=h[14]=0),h}function tX(r,a,n,o,s,l,h){if(n){if("globe"===l.name){let u=tZ(r,a,n,o,s,l,h);return i.dr(u,u),i.er(u,r,u),u}{let a=i.bJ(r),[n,l,u,c]=h,[d,f,p,m,_,g,y,x]=a;return a[0]=n*d+l*_,a[1]=n*f+l*g,a[2]=n*p+l*y,a[3]=n*m+l*x,a[4]=u*d+c*_,a[5]=u*f+c*g,a[6]=u*p+c*y,a[7]=u*m+c*x,o||i.f6(a,a,-s.angle),a}}return s.glCoordMatrix}function tY(r,a,n,o){let s=[r,a,n,1];n?i.fM(s,s,o):t6(s,s,o);let l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function tK(i,r){return Math.min(.5+i/r*.5,1.5)}function tJ(r,a,n,o,s,l,h,u,c,d,f=1){let p=n.transform,m=o?r.textSizeData:r.iconSizeData,_=i.ci(m,n.transform.zoom,f),g="globe"===p.projection.name,y=[256/n.width*2+1,256/n.height*2+1],x=o?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;x.clear();let v=null;g&&(v=o?r.text.globeExtVertexArray:r.icon.globeExtVertexArray);let b=r.lineVertexArray,w=o?r.text.placedSymbolArray:r.icon.placedSymbolArray,T=n.transform.width/n.transform.height,S,E=!1;for(let f=0;f<w.length;f++){let g=w.get(f),{numGlyphs:I,writingMode:A}=g;if(A!==i.bg.vertical||E||S===i.bg.horizontal||(E=!0),S=A,(g.hidden||A===i.bg.vertical)&&!E){t5(I,x);continue}E=!1;let M=new i.au(g.tileAnchorX,g.tileAnchorY),C="road"===r.elevationType,D=!!p.elevation||C,{x:R,y:P,z:L}=p.projection.projectTilePoint(M.x,M.y,d.canonical),z=null;if(D){let i=C&&r.hdExt?r.hdExt.getElevationFeatureForPlacedSymbol(r,o?r.text:r.icon,f):null;z={getElevation:c,elevation:p.elevation,elevationFeature:i};let[a,n,s]=c(M,p.elevation,i);R+=a,P+=n,L+=s}let O=[R,P,L,1];if(i.fM(O,O,a),!function(i,r){let a=i[0]/i[3],n=i[1]/i[3];return a>=-r[0]&&a<=r[0]&&n>=-r[1]&&n<=r[1]}(O,y)){t5(I,x);continue}let F=O[3],B=tK(n.transform.getCameraToCenterDistance(p.projection),F),k=i.ch(m,_,g),N=h?k/B:k*B,U=tY(R,P,L,s);if(U[3]<=0){t5(I,x);continue}let V={},j=Math.cos(i.c4(r.layers[0].layout.get("text-max-angle"))),G=h?null:z,H=t1(g,N,!1,u,a,s,l,r.glyphOffsetArray,b,x,v,U,M,V,T,G,p.projection,d,h,j);E=H.useVertical,G&&H.needsFlipping&&(V={}),(H.notEnoughRoom||E||H.needsFlipping&&t1(g,N,!0,u,a,s,l,r.glyphOffsetArray,b,x,v,U,M,V,T,G,p.projection,d,h,j).notEnoughRoom)&&t5(I,x)}o?(r.text.dynamicLayoutVertexBuffer.updateData(x),v&&r.text.globeExtVertexBuffer&&r.text.globeExtVertexBuffer.updateData(v)):(r.icon.dynamicLayoutVertexBuffer.updateData(x),v&&r.icon.globeExtVertexBuffer&&r.icon.globeExtVertexBuffer.updateData(v))}function tQ(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y){let{lineStartIndex:x,glyphStartIndex:v,segment:b}=h,w=v+h.numGlyphs,T=x+h.lineLength,S=r.getoffsetX(v),E=r.getoffsetX(w-1),I=t4(i*S,a,n,o,s,l,b,x,T,u,c,d,f,p,!0,m,_,g,y);if(!I)return null;let A=t4(i*E,a,n,o,s,l,b,x,T,u,c,d,f,p,!0,m,_,g,y);return A?{first:I,last:A}:null}function t0(r,a,n,o){return r===i.bg.horizontal&&Math.abs(o)>Math.abs(n)?{useVertical:!0}:r===i.bg.vertical?o>0?{needsFlipping:!0}:null:0!==a&&(0===n||Math.abs(o/n)>t$)?1===a?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function t1(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w){let T=a/24,S=r.lineOffsetX*T,E=r.lineOffsetY*T,{lineStartIndex:I,glyphStartIndex:A,numGlyphs:M,segment:C,writingMode:D,flipState:R}=r,P=I+r.lineLength,L=r=>{if(f){let[a,n,o]=r.up,s=d.length;i.fW(f,s+0,a,n,o),i.fW(f,s+1,a,n,o),i.fW(f,s+2,a,n,o),i.fW(f,s+3,a,n,o)}let[a,n,o]=r.point;i.bl(d,a,n,o,r.angle)};if(M>1){let i=tQ(T,u,S,E,n,p,m,r,c,l,_,y,!1,x,v,b,w);if(!i)return{notEnoughRoom:!0};if(o&&!n){let[a,n,o]=i.first.point,[s,l,u]=i.last.point;[a,n]=tY(a,n,o,h),[s,l]=tY(s,l,u,h);let c=t0(D,R,(s-a)*g,l-n);if(r.flipState=c&&c.needsFlipping?1:2,c)return c}L(i.first);for(let i=A+1;i<A+M-1;i++){let r=t4(T*u.getoffsetX(i),S,E,n,p,m,C,I,P,c,l,_,y,!1,!1,x,v,b,w);if(!r)return d.length-=4*(i-A),{notEnoughRoom:!0};L(r)}L(i.last)}else{if(o&&!n){let a=tY(m.x,m.y,0,s),n=I+C+1,o=new i.au(c.getx(n),c.gety(n)),l=tY(o.x,o.y,0,s),h=l[3]>0?l:t3(m,o,a,1,s,void 0,x,v.canonical),u=t0(D,R,(h[0]-a[0])*g,h[1]-a[1]);if(r.flipState=u&&u.needsFlipping?1:2,u)return u}let a=t4(T*u.getoffsetX(A),S,E,n,p,m,C,I,P,c,l,_,y,!1,!1,x,v,b,w);if(!a)return{notEnoughRoom:!0};L(a)}return{}}function t2(i,r,a,n,o){let{x:s,y:l,z:h}=n.projectTilePoint(i.x,i.y,r);if(!o)return tY(s,l,h,a);let[u,c,d]=o.getElevation(i,o.elevation,o.elevationFeature);return tY(s+u,l+c,h+d,a)}function t3(r,a,n,o,s,l,h,u){let c=t2(r.sub(a)._unit()._add(r),u,s,h,l);return i.fx(c,n,c),i.ex(c,c),i.fe(c,n,c,o)}function t4(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b){let w=o?r-a:r+a,T=w>0?1:-1,S=0;o&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let E=u+h+(T>0?0:1)|0,I=s,A=s,M=0,C=0,D=Math.abs(w),R=[],P=[],L=l,z=L,O=i.g0([]),F=()=>t3(z,L,A,D-M+1,f,m,y,x.canonical);for(;M+C<=D;){if((E+=T)<u||E>=c)return null;if(A=I,z=L,R.push(A),_&&P.push(z),L=new i.au(d.getx(E),d.gety(E)),!(I=p[E])){let i=t2(L,x.canonical,f,y,m);I=i[3]>0?p[E]=i:F()}M+=C;let r=i.fx([],I,A),a=i.c5(A,I);if(n&&a>0&&C>
80&&i.c7(O,r)/(C*a)<b)return null;C=a,O=r}g&&m&&(p[E]&&(I=F(),C=i.c5(A,I),O=i.fx([],I,A)),p[E]=I);let B=(D-M)/C,k=L.sub(z)._mult(B)._add(z),N=i.fe([],A,O,B),U=[0,0,1],V=O[0],j=O[1];if(v&&(0!==(U=y.upVector(x.canonical,k.x,k.y))[0]||0!==U[1]||1!==U[2])){let r=[U[2],0,-U[0]],a=i.c1([],U,r);i.ex(r,r),i.ex(a,a),V=i.c7(O,r),j=i.c7(O,a)}if(n){let r=i.c1([],U,O);i.ex(r,r),i.fe(N,N,r,n*T)}let G=S+Math.atan2(j,V);return R.push(N),_&&P.push(k),{point:N,angle:G,path:R,tilePath:P,up:U}}function t5(i,r){let a=r.length,n=a+4*i;r.resize(n),r.float32.fill(-1/0,4*a,4*n)}function t6(i,r,a){let n=r[0],o=r[1];return i[0]=a[0]*n+a[4]*o+a[12],i[1]=a[1]*n+a[5]*o+a[13],i[3]=a[3]*n+a[7]*o+a[15],i}class t8{constructor(r,a,n,o,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=n??0,this._maxPitch=o??60,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new i.ab(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new tU,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new tq,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatrix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){let i=new t8(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
8xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.mercatorFromTransition=this.mercatorFromTransition,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._nearClipOffset=this._nearClipOffset,i._averageElevation=this._averageElevation,i._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i._allowWorldUnderZoom=this._allowWorldUnderZoom,i}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(i){this._nearClipOffset=i,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(i,r=!1){let a=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||a)&&this._updateCameraOnTerrain(),(i||a)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return i.eF(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};let a=this.projection?this.getProjection():void 0;this.projection=i.c$(this.projectionOptions);let n=this.getProjection(),o=!i.c2(a,n);return o&&this._calcMatrices(),this.mercatorFromTransition=!1,o}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){let r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.c$({name:"mercator"});let a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.em(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.au(this.width,this.height)}get bearing(){return i.f$(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;if(this.angle===r)return;this._unmodified=!1,this.angle=r,this._calcMatrices();let a=Math.sin(this.angle),n=Math.cos(this.angle);this.rotationMatrix=[n,a,-a,n]}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let a=i.bG(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=i.c4(r),this._calcMatrices())}get fovX(){return this._fov}get fovY(){let i=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/i)}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){let r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(i){this._tileCoverLift!==i&&(this._tileCoverLift=i)}_updateCameraOnTerrain(){let i=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),-1/0):-1/0,r=this.elevation&&i===-1/0&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||i===-1/0&&(!r||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let a=this._elevation;r||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&a.exaggeration()&&this._centerAltitudeValidForExaggeration!==a.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*a.exaggeration():this._centerAltitude=i||0,this._centerAltitudeValidForExaggeration=a.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;let i=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(i)}sampleAverageElevation(){if(!this._elevation)return 0;let r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop(),o=0,s=0;for(let l=0;l<a.length;l++){let h=new i.au(a[l][0]*this.width,n+a[l][1]*(this.height-n)),u=r.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);o+=u[3]*c,s+=c}return 0===s?NaN:o/s}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let i=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),a=this.pixelsPerMeter/this.worldSize*r,n=Math.max(this._mercatorZfromZoom(i)-a,this._mercatorZfromZoom(this._maxZoom));this._setZoom(this._zoomFromMercatorZ(n))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}equals(i){let r=this.elevation,a=i.elevation,n=null!=r!=(null!=a)||r&&a&&r.exaggeration()!==a.exaggeration();return this.width===i.width&&this.height===i.height&&this.center.lng===i.center.lng&&this.center.lat===i.center.lat&&this.zoom===i.zoom&&this.bearing===i.bearing&&this.pitch===i.pitch&&this.fov===i.fov&&this.projection.name===i.projection.name&&this._edgeInsets.equals(i.padding)&&!n}computeZoomRelativeTo(r){let a,n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));a=r.z<this._camera.position[2]?[n.x,n.y,n.z]:[r.x,r.y,r.z];let o=i.dW(i.fx([],this._camera.position,a));return i.bG(this._zoomFromMercatorZ(o),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let a=!1;if(r.orientation&&!i.cl(r.orientation,this._camera.orientation)&&(a=this._setCameraOrientation(r.orientation)),r.position){let n=[r.position.x,r.position.y,r.position.z];i.cm(n,this._camera.position)||(this._setCameraPosition(n),a=!0)}a&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let r=this._camera.position,a=new tH;return a.position=new i.ag(r[0],r[1],r[2]),a.orientation=this._camera.orientation,a._elevation=this.elevation,a._renderWorldCopies=this.renderWorldCopies,a}_setCameraOrientation(r){if(!i.dX(r))return!1;i.ey(r,r);let a=i.fO([],[0,0,-1],r),n=i.fO([],[0,-1,0],r);if(n[2]<0)return!1;let o=tG(a,n);return!!o&&(this._camera.orientation=o,!0)}_setCameraPosition(r){let a=this.zoomScale(this.minZoom)*this.tileSize,n=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;r[2]=i.bG(r[2],o/n,o/a),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,r,a){this._unmodified=!1,this._edgeInsets.interpolate(i,r,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize)))}getVisibleUnwrappedCoordinates(r){let a=[new i.bc(0,r)];if(this.renderWorldCopies){let n=this.pointCoordinate(new i.au(0,0)),o=this.pointCoordinate(new i.au(this.width,0)),s=this.pointCoordinate(new i.au(this.width,this.height)),l=this.pointCoordinate(new i.au(0,this.height)),h=Math.floor(Math.min(n.x,o.x,s.x,l.x)),u=Math.floor(Math.max(n.x,o.x,s.x,l.x));for(let n=h-1;n<=u+1;n++)0!==n&&a.push(new i.bc(n,r))}return a}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(r,a,n,o){let s=[],l=null!=n,h=!l;if(h&&this.zoom<a||l&&0===n[0]&&0===n[1])return s;let u=new Set,c=(r,a,n,o,l)=>{let h=i.bz(a,r,n,o,l);u.has(h)||(s.push(new i.ap(r,a,n,o,l)),u.add(h))};for(let i=0;i<r.length;i++){let s=r[i];if(h&&s.canonical.z!==a||l&&void 0!==o&&o>s.canonical.z)continue;let u=s.canonical,d=s.overscaledZ,f=s.wrap,p=1<<u.z,m=u.x+1<p,_=u.x>0,g=u.y+1<p,y=u.y>0,x=s.wrap-!_,v=s.wrap+ +!m,b=_?u.x-1:p-1,w=m?u.x+1:0;if(l)n[0]<0?(c(d,v,u.z,w,u.y),n[1]<0&&g&&(c(d,f,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)),n[1]>0&&y&&(c(d,f,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))):n[0]>0?(c(d,x,u.z,b,u.y),n[1]<0&&g&&(c(d,f,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1)),n[1]>0&&y&&(c(d,f,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))):n[1]<0&&g?c(d,f,u.z,u.x,u.y+1):y&&c(d,f,u.z,u.x,u.y-1);else{let i=s.visibleQuadrants;1&i&&(c(d,x,u.z,b,u.y),y&&(c(d,f,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))),2&i&&(c(d,v,u.z,w,u.y),y&&(c(d,f,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))),4&i&&(c(d,x,u.z,b,u.y),g&&(c(d,f,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1))),8&i&&(c(d,v,u.z,w,u.y),g&&(c(d,f,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)))}}let d=[];for(let i of s)s.some(r=>i.isChildOf(r))||d.push(i);if(s=d.filter(i=>!r.some(r=>!!(i.overscaledZ<a&&r.isChildOf(i))||i.equals(r)||i.isChildOf(r))),h){let i=1<<a,r="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),n=[i*r.x,i*r.y];s=s.filter(i=>{let r=i.canonical.x+.5-n[0],a=i.canonical.y+.5-n[1];return r*r+a*a<16})}return s}extendTileCoverToNearPlane(r,a,n){let o=[],s=new Set;for(let i of r)s.add(i.key);let l=(r,a,n,l,h)=>{let u=i.bz(a,r,n,l,h);s.has(u)||(o.push(new i.ap(r,a,n,l,h)),s.add(u))},h=r.reduce((i,r)=>
8Math.max(i,r.overscaledZ),n),u=1<<n,c=[new i.au(0,0),new i.au(i.r,0),new i.au(i.r,i.r),new i.au(0,i.r)],d=new i.au(0,0),f=new i.au(0,0),p=(r,a)=>{let o=Math.floor(r[0]),s=Math.floor(r[1]),p=(r[0]-o)*i.r,m=(r[1]-s)*i.r,_=Math.floor(a[0]),g=Math.floor(a[1]),y=(a[0]-_)*i.r,x=(a[1]-g)*i.r;for(let r=-1;r<=1;r++){let a=o+r;if(!(a<0||a>=u)){d.x=p-r*i.r,f.x=y-(a-_)*i.r;for(let r=-1;r<=1;r++){let o=s+r;d.y=m-r*i.r,f.y=x-(o-g)*i.r,i.ce(d,f,c)&&l(h,0,n,a,o)}}}},m=a.points,_=m[i.ak],g=m[i.al],y=this._projectToGround(_,m[i.F]),x=this._projectToGround(g,m[i.z]);return p(_,y),p(g,x),o}_projectToGround(r,a){return i.dZ(i.bU(),r,a,r[2]/(r[2]-a[2]))}_projectToZ(r,a,n){let o=r[2]-a[2];return 1e-6>Math.abs(o)?i.bK(r):i.dZ(i.bU(),r,a,(r[2]-n)/o)}extendTileCoverForTunnels(r,a,n,o){if(n<18)return[];let s=a.points,l=s[i.am],h=s[i.an],u=s[i.G],c=s[i.H];if(u[2]>=0&&c[2]>=0||l[2]<=0||h[2]<=0)return[];let d=u[2]<0?this._projectToZ(l,u,0):u,f=c[2]<0?this._projectToZ(h,c,0):c,p=-o,m=u[2]<p?this._projectToZ(l,u,p):u,_=c[2]<p?this._projectToZ(h,c,p):c,g=this._findExtensionTilesInQuad(r,n,[_,m,f,d],[.5*(d[0]+f[0]),.5*(d[1]+f[1])]);return g.length>3&&(g.length=3),g}_findExtensionTilesInQuad(r,a,n,o){let s=[],l=new Set;for(let i of r)l.add(i.key);let h=r.reduce((i,r)=>Math.max(i,r.overscaledZ),a),u=1<<a,c=[new i.au(n[0][0],n[0][1]),new i.au(n[1][0],n[1][1]),new i.au(n[3][0],n[3][1]),new i.au(n[2][0],n[2][1]),new i.au(n[0][0],n[0][1])],d=n[0][0],f=n[1][0],p=n[2][0],m=n[3][0],_=n[0][1],g=n[1][1],y=n[2][1],x=n[3][1],v=Math.max(0,Math.floor(Math.min(d,f,p,m))),b=Math.min(u-1,Math.ceil(Math.max(d,f,p,m))-1),w=Math.max(0,Math.floor(Math.min(_,g,y,x))),T=Math.min(u-1,Math.ceil(Math.max(_,g,y,x))-1);for(let r=w;r<=T;r++)for(let n=v;n<=b;n++){if(!i.eM(c,n,r,n+1,r+1))continue;let o=i.bz(0,h,a,n,r);l.has(o)||(s.push(new i.ap(h,0,a,n,r)),l.add(o))}let S=o[0],E=o[1];return s.sort((i,r)=>{let a=i.canonical.x+.5-S,n=i.canonical.y+.5-E,o=r.canonical.x+.5-S,s=r.canonical.y+.5-E;return a*a+n*n-(o*o+s*s)||i.canonical.x-r.canonical.x||i.canonical.y-r.canonical.y}),s}coveringTiles(r){let a,n=this.coveringZoomLevel(r),o=n,s=this.elevation&&this.elevation.exaggeration(),l=s&&!r.isTerrainDEM,h="mercator"===this.projection.name;if(void 0!==r.minzoom&&n<r.minzoom)return[];void 0!==r.maxzoom&&n>r.maxzoom&&(n=r.maxzoom);let u=this.locationCoordinate(this.center),c=this.center.lat,d=1<<n,f=[d*u.x,d*u.y,0],p="globe"===this.projection.name,m=!p,_=i.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,m),g=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),y=d*i.em(1,this.center.lat),x=this._camera.position[2]/i.em(1,this.center.lat),v=[d*g.x,d*g.y,x*(m?1:y)],b=p||s,w=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),T=this.isLODDisabled(!0)?n:0;if(this._elevation&&r.isTerrainDEM)a=1e4*this._elevation.exaggeration();else if(this._elevation){let i=this._elevation.getMinMaxForVisibleTiles();a=i?i.max:this._centerAltitude}else a=this._centerAltitude;let S=r.isTerrainDEM?-a:this._elevation?this._elevation.getMinElevationBelowMSL():0,E=this.projection.isReprojectedInTileSpace?i.d6(this):1,I=r=>{let a=1/4e4,n=new i.ag(r.x+a,r.y,r.z),o=new i.ag(r.x,r.y+a,r.z),s=r.toLngLat(),l=n.toLngLat(),h=o.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),d=this.locationCoordinate(h);return Math.sqrt(Math.hypot(c.x-u.x,c.y-u.y)*Math.hypot(d.x-u.x,d.y-u.y))*E/a},A=r=>{let n=a;return{aabb:i.fE(this,d,0,0,0,r,S,n,this.projection),zoom:0,x:0,y:0,minZ:S,maxZ:n,wrap:r,fullyVisible:!1}},M=[],C=[],D=n,R=r.reparseOverscaled?o:n,P=(x-this._centerAltitude)*y,L=i=>{if(!this._elevation||!i.tileID||!h)return;let r=this._elevation.getMinMaxForTile(i.tileID),a=i.aabb;r?(a.min[2]=r.min,a.max[2]=r.max,a.center[2]=(a.min[2]+a.max[2])/2):(i.shouldSplit=O(i),i.shouldSplit||(a.min[2]=a.max[2]=a.center[2]=this._centerAltitude))},z=(i,r)=>{if(.707*r<i)return 1;let a=r/i;return a/(1.4144271570014144+(Math.pow(1.1,a-1.4144271570014144+1)-1)/(1.1-1)-1)},O=r=>{if(r.zoom<T)return!0;if(r.zoom===D)return!1;if(null!=r.shouldSplit)return r.shouldSplit;let a=r.aabb.distanceX(v),n=r.aabb.distanceY(v),s=P,u=1;if(p){s=r.aabb.distanceZ(v);let a=Math.pow(2,r.zoom),n=Math.min(Math.max(c,i.dT((r.y+1)/a)),i.dT(r.y/a)),o=i.bF(n)/i.bF(c);if(u=n===c?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,o/this._mercatorScaleRatio),this.zoom<=i.S&&r.zoom===D-1&&o>=.9)return!0}else if(l&&(s=r.aabb.distanceZ(v)*y),this.projection.isReprojectedInTileSpace&&o<=5){let a=Math.pow(2,r.zoom),n=I(new i.ag((r.x+.5)/a,(r.y+.5)/a));u=n>.85?1:n}if(!h&&!p){let i=Math.sqrt(a*a+n*n+s*s),o=(1<<D-r.zoom)*w*u;return o*=z(Math.max(s,P),i),i<o}let d=Number.MAX_VALUE,m=0,_=r.aabb.getCorners(),g=[0,0,0];for(let r of _){i.fx(g,r,v),p||(l?g[2]*=y:g[2]=P);let a=i.c7(g,this._camera.forward());a<d&&(d=a,m=Math.abs(g[2]))}let x=(1<<D-r.zoom)*w*u;if(x*=z(Math.max(m,P),d),d<x)return!0;let b=r.aabb.closestPoint(f);return b[0]===f[0]&&b[1]===f[1]};if(this.renderWorldCopies)for(let i=1;i<=3;i++)M.push(A(-i)),M.push(A(i));for(M.push(A(0));M.length>0;){let a=M.pop(),o=a.x,s=a.y,u=a.fullyVisible,c=()=>"globe"===this.projection.name&&(0===a.y||a.y===(1<<a.zoom)-1);if(!u){let r=b?a.aabb.intersects(_):a.aabb.intersectsFlat(_);if(0===r&&c()){let n=new i.f(a.zoom,o,s);r=i.bi(this,d,n,!0).intersects(_)}if(0===r)continue;u=2===r}if(a.zoom===D||!O(a)){let l=a.zoom===D?R:a.zoom;if(r.minzoom&&r.minzoom>l)continue;let h=0;if(!u){let n=b?a.aabb.intersectsPrecise(_):a.aabb.intersectsPreciseFlat(_);if(0===n&&c()){let r=new i.f(a.zoom,o,s);n=i.bi(this,d,r,!0).intersectsPrecise(_)}if(0===n)continue;if(r.calculateQuadrantVisibility)if(_.containsPoint(a.aabb.center))h=15;else for(let i=0;i<4;i++)0!==a.aabb.quadrant(i).intersects(_)&&(h|=1<<i)}let p=f[0]-(.5+o+(a.wrap<<a.zoom))*(1<<n-a.zoom),m=f[1]-.5-s,g=a.tileID?a.tileID:new i.ap(l,a.wrap,a.zoom,o,s);r.calculateQuadrantVisibility&&(g.visibleQuadrants=h),C.push({tileID:g,distanceSq:p*p+m*m});continue}for(let r=0;r<4;r++){let n=(o<<1)+r%2,c=(s<<1)+(r>>1),f={aabb:h?a.aabb.quadrant(r):i.fE(this,d,a.zoom+1,n,c,a.wrap,a.minZ,a.maxZ,this.projection),zoom:a.zoom+1,x:n,y:c,wrap:a.wrap,fullyVisible:u,tileID:void 0,shouldSplit:void 0,minZ:a.minZ,maxZ:a.maxZ};l&&!p&&(f.tileID=new i.ap(a.zoom+1===D?R:a.zoom+1,a.wrap,a.zoom+1,n,c),L(f)),M.push(f)}}if(this.fogCullDistSq){let n=this.fogCullDistSq,o=this.horizonLineFromTop();C=C.filter(s=>{let l=[0,0,0,1],h=[i.r,i.r,0,1],u=this.calculateFogTileMatrix(s.tileID.toUnwrapped());i.fM(l,l,u),i.fM(h,h,u);let c=i.en([],l,h),d=i.ee([],l,h),f=i.cD(c,d);if(0===f)return!0;let p=!1,m=this._elevation;if(m&&f>n&&0!==o){let n,l=this.calculateProjMatrix(s.tileID.toUnwrapped());r.isTerrainDEM||(n=m.getMinMaxForTile(s.tileID)),n||(n={min:S,max:a});let h=i.cC(this.rotation),u=[h[0]*i.r,h[1]*i.r,n.max];i.fL(u,u,l),p=(1-u[1])*this.height*.5<o}return f<n||p})}return C.sort((i,r)=>i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log2(i)}project(r){let a=i.bG(r.lat,-i.ae,i.ae),n=this.projection.project(r.lng,a);return new i.au(n.x*this.worldSize,n.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/i.em(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let n,o,s=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;n=(a.x-s.x)/i,o=(a.y-s.y)/i}else{let i=this.pointCoordinate(a),r=this.pointCoordinate(s);n=i.x-r.x,o=i.y-r.y}let l=this.locationCoordinate(r);this.setLocation(new i.ag(l.x-n,l.y-o))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i,r){return this.projection.locationPoint(this,i,r)}locationPoint3D(i,r){return this.projection.locationPoint(this,i,r,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i,r){return this.coordinateLocation(this.pointCoordinate3D(i,r))}
8locationCoordinate(r,a){let n=a?i.em(a,r.lat):void 0,o=this.projection.project(r.lng,r.lat);return new i.ag(o.x,o.y,n)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,a){let n=null!=a?a:this._centerAltitude,o=[r.x,r.y,0,1],s=[r.x,r.y,1,1];i.fM(o,o,this.pixelMatrixInverse),i.fM(s,s,this.pixelMatrixInverse);let l=s[3];i.fb(o,o,1/o[3]),i.fb(s,s,1/l);let h=o[2],u=s[2];return{p0:o,p1:s,t:h===u?0:(n-h)/(u-h)}}screenPointToMercatorRay(r){let a=[r.x,r.y,0,1],n=[r.x,r.y,1,1];return i.fM(a,a,this.pixelMatrixInverse),i.fM(n,n,this.pixelMatrixInverse),i.fb(a,a,1/a[3]),i.fb(n,n,1/n[3]),a[2]=i.em(a[2],this._center.lat)*this.worldSize,n[2]=i.em(n[2],this._center.lat)*this.worldSize,i.fb(a,a,1/this.worldSize),i.fb(n,n,1/this.worldSize),new i.aB([a[0],a[1],a[2]],i.ex([],i.fx([],n,a)))}rayIntersectionCoordinate(r){let{p0:a,p1:n,t:o}=r,s=i.em(a[2],this._center.lat),l=i.em(n[2],this._center.lat);return new i.ag(i.dY(a[0],n[0],o)/this.worldSize,i.dY(a[1],n[1],o)/this.worldSize,i.dY(s,l,o))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}
8pointCoordinate3D(r,a){if(!this.elevation)return this.pointCoordinate(r,a);let n=this.projection.pointCoordinate3D(this,r.x,r.y);if(n)return new i.ag(n[0],n[1],n[2]);let o=0,s=this.horizonLineFromTop();if(r.y>s)return this.pointCoordinate(r,a);let l=.02*s,h=r.clone();for(let r=0;r<10&&s-o>l;r++){h.y=i.dY(o,s,.66);let r=this.projection.pointCoordinate3D(this,h.x,h.y);r?(s=h.y,n=r):o=h.y}return n?new i.ag(n[0],n[1],n[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=i.R)return!this.isPointAboveHorizon(r);let a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){let n=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,o=[r.x*this.worldSize,r.y*this.worldSize,n+r.toAltitude(),1];return i.fM(o,o,this.pixelMatrix),o[3]>0?new i.au(o[0]/o[3],o[1]/o[3]):new i.au(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:r,left:a}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new i.au(a,r)),l=this.pointLocation3D(new i.au(o,r)),h=this.pointLocation3D(new i.au(o,n)),u=this.pointLocation3D(new i.au(a,n)),c=Math.min(s.lng,l.lng,h.lng,u.lng),d=Math.max(s.lng,l.lng,h.lng,u.lng),f=Math.min(s.lat,l.lat,h.lat,u.lat),p=Math.max(s.lat,l.lat,h.lat,u.lat),m=Math.pow(2,-this.zoom)/16*270,_="globe"===this.projection.name?1:4,g=(r,a,n,o,s)=>{let l=(r+n)/2,h=(a+o)/2,u=new i.au(l,h),{lng:y,lat:x}=this.pointLocation3D(u),v=Math.max(0,c-y,f-x,y-d,x-p);c=Math.min(c,y),d=Math.max(d,y),f=Math.min(f,x),p=Math.max(p,x),(s<_||v>m)&&(g(r,a,l,h,s+1),g(l,h,n,o,s+1))};if(g(a,r,o,r,1),g(o,r,o,n,1),g(o,n,a,n,1),g(a,n,a,r,1),"globe"===this.projection.name){let[r,a]=i.eK(this);r?(p=90,d=180,c=-180):a&&(f=-90,d=180,c=-180)}return new i.ac(new i.ab(c,f),new i.ab(d,p))}_getBoundsRectangular(r,a){let{top:n,left:o}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,l=this.width-this._edgeInsets.right,h=new i.au(o,n),u=new i.au(l,n),c=new i.au(l,s),d=new i.au(o,s),f=this.pointCoordinate(h,r),p=this.pointCoordinate(u,r),m=this.pointCoordinate(c,a),_=this.pointCoordinate(d,a),g=(i,r)=>(r.y-i.y)/(r.x-i.x);return f.y>1&&p.y>=0?f=new i.ag((1-_.y)/g(_,f)+_.x,1):f.y<0&&p.y<=1&&(f=new i.ag(-_.y/g(_,f)+_.x,0)),p.y>1&&f.y>=0?p=new i.ag((1-m.y)/g(m,p)+m.x,1):p.y<0&&f.y<=1&&(p=new i.ag(-m.y/g(m,p)+m.x,0)),(new i.ac).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBoundsRectangularTerrain(){let i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);let r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){let a=r.dem.tree;i.min=Math.min(i.min,a.minimums[0]),i.max=Math.max(i.max,a.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){let r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,a=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,a):a}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.ae,this.maxLat=i.ae,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.ek(this.minLng)*this.tileSize,this.worldMaxX=i.ek(this.maxLng)*this.tileSize,this.worldMinY=i.el(this.maxLat)*this.tileSize,this.worldMaxY=i.el(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(r){let a=r.key,n=this._distanceTileDataCache;
8if(n[a])return n[a];let o=r.canonical,s=1/this.height,l=this.cameraWorldSize,h=l/this.zoomScale(o.z),u=(o.x+Math.pow(2,o.z)*r.wrap)*h,c=o.y*h,d=this.point;d.x*=l/this.worldSize,d.y*=l/this.worldSize;let f=this.angle,p=Math.sin(-f),m=-Math.cos(-f);return n[a]={bearing:[p,m],center:[(d.x-u)*s,(d.y-c)*s],scale:h/i.r*s},n[a]}calculateFogTileMatrix(r){let a=r.key,n=this._fogTileMatrixCache;if(n[a])return n[a];let o=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return i.er(o,this.worldToFogMatrix,o),n[a]=new Float32Array(o),n[a]}calculateProjMatrix(r,a=!1,n=!1){let o,s,l=r.key;if((o=n?this._expandedProjMatrixCache:a?this._alignedProjMatrixCache:this._projMatrixCache)[l])return o[l];let h=this.calculatePosMatrix(r,this.worldSize);return s=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.expandedFarZProjMatrix:a?this.alignedProjMatrix:this.projMatrix,i.er(h,s,h),o[l]=new Float32Array(h),o[l]}calculatePixelsToTileUnitsMatrix(r){let a=r.tileID.key,n=this._pixelsToTileUnitsCache;if(n[a])return n[a];let o=i.c_(r,this);return n[a]=o,n[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let r=1/this.worldSize,a=i.cv([],[r,r,r]);return i.er(a,a,this.globeMatrix),a}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let r=this._elevation;this._updateCameraState();let a=i.em(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=this._camera.forward(),s=i.em(1,this._center.lat);n[2]/=s,o[2]/=s,i.ex(o,o);let l=r.raycast(n,o,r.exaggeration());if(l){let r=i.fe([],n,o,l),a=new i.ag(r[0],r[1],i.em(r[2],i.dT(r[1]))),h=(a.z+i.dW([a.x-n[0],a.y-n[1],a.z-n[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=a.toAltitude(),this._center=this.coordinateLocation(a),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;let a=this._elevation,n=i.em(1,this._center.lat)*this.worldSize,o=this._computeCameraPosition(n),s=a.getAtPointOrZero(new i.ag(...o)),l=this.pixelsPerMeter/this.worldSize*s,h=this._minimumHeightOverTerrain(),u=o[2]-l;if(u<=h)if(u<0||r){let r=this.locationCoordinate(this._center,this._centerAltitude),a=[o[0],o[1],r.z-o[2]],n=i.dW(a);a[2]-=(h-u)/this._pixelsPerMercatorPixel;let s=i.dW(a);if(0===s)return;i.fa(a,a,n/s*this._pixelsPerMercatorPixel),this._camera.position=[o[0],o[1],r.z*this._pixelsPerMercatorPixel-a[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){let a=this.center;return a.lat=i.bG(a.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||r)||(a.lng=i.bG(a.lng,this.minLng,this.maxLng)),this.center=a,void(this._constraining=!1)}let a=this._unmodified,{x:n,y:o}=this.point,s=0,l=n,h=o,u=this.width/2,c=this.height/2,d=this.worldMinY*this.scale,f=this.worldMaxY*this.scale;if(o-c<d&&(h=d+c),o+c>f&&(h=f-c),f-d<this.height&&(s=Math.max(s,this.height/(f-d)),h=(f+d)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,a=this.worldSize/2-(i+r)/2;(l=(n+a+this.worldSize)%this.worldSize-a)-u<i&&(l=i+u),l+u>r&&(l=r-u),r-i<this.width&&(s=Math.max(s,this.width/(r-i)),l=(r+i)/2)}l===n&&h===o||this._allowWorldUnderZoom||(this.center=this.unproject(new i.au(l,h))),s&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=a,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){let r;if(!this.height)return;let a=this.centerOffset,n="globe"===this.projection.name,o=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.em(1,this.center.lat)/i.em(1,i.Q));let s=i.d2(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,s),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let l="meters"===this.projection.zAxisUnit?o:1,h=this._camera.getWorldToCamera(this.worldSize,l),u=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(u[8]=-(2*a.x)/this.width,u[9]=2*a.y/this.height,this.isOrthographic){let n=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),o=n*this.aspect,s=-o,l=-n;o-=a.x,s-=a.x,n+=a.y,l+=a.y,((r,a,n,o)=>{for(let s=0;s<16;s++)r[s]=i.dY(a[s],n[s],o)})(r=this._camera.getCameraToClipOrthographic(s,o,l,n,this._nearZ+this._nearClipOffset,this._farZ),r,u,i.cc(this.pitch>=15?1:this.pitch/15))}else r=u;let c=i.eo([],u,h),d=i.eo([],r,h);if(this.projection.isReprojectedInTileSpace){let r=this.locationCoordinate(this.center);i.dq(this._mat4Scratch);let a=this._mat4Scratch;i.fQ(a,a,[r.x*this.worldSize,r.y*this.worldSize,0]),i.er(a,a,i.d1(this)),i.fQ(a,a,[-r.x*this.worldSize,-r.y*this.worldSize,0]),i.er(d,d,a),i.er(c,c,a),this.inverseAdjustmentMatrix=i.d0(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(i.fc(this.mercatorMatrix,d,[this.worldSize,this.worldSize,this.worldSize/l,1]),this.projMatrix=d,i.dr(this.invProjMatrix,this.projMatrix),n){let r=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);r[8]=-(2*a.x)/this.width,r[9]=2*a.y/this.height,i.eo(this._expandedFarZProjMatrixBuf,r,h),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;i.dr(this._mat4Scratch,r),this.frustumCorners=i.O.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n),i.cv(this.skyboxMatrix,[1,-1,1]),i.f3(this.skyboxMatrix,this.skyboxMatrix,this._pitch),i.f6(this.skyboxMatrix,this.skyboxMatrix,this.angle),i.eE(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);let f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;i.bS(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=-(2*a.x)/this.width,this._mat4Scratch[9]=2*(a.y+f)/this.height,i.er(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);let p=this.point,m=p.x,_=p.y,g=this.width%2/2,y=this.height%2/2,x=Math.cos(this.angle),v=Math.sin(this.angle),b=m-Math.round(m)+x*g+v*y,w=_-Math.round(_)+x*y+v*g;if(i.bS(this.alignedProjMatrix,d),i.fQ(this.alignedProjMatrix,this.alignedProjMatrix,[b>.5?b-1:b,w>
8.5?w-1:w,0]),i.cv(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),i.fQ(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),i.cv(this.glCoordMatrix,[1,-1,1]),i.fQ(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),i.fc(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),i.er(this.pixelMatrix,this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},!i.dr(this.pixelMatrixInverse,this.pixelMatrix))throw Error("failed to invert matrix");if("globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.bx(this);let r=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.fL(r,r,h),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,n=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,s=[r,r,a];i.fa(s,s,o),i.fa(n,n,-1),i.es(n,n,s),i.cw(this.mercatorFogMatrix,n),i.fc(this.mercatorFogMatrix,this.mercatorFogMatrix,s),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,o)}_computeCameraPosition(i){let r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,a=this._camera.forward(),n=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-a[0]*o,n.y/this.worldSize-a[1]*o,i/this.worldSize*this._centerAltitude-a[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){let a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],o=r[2],s=1;this.projection.wrap&&(this.center=this.center.wrap()),o>0&&(s=Math.min((a-n)/o,1)),this._camera.position=i.fe([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){let r=this._camera.position,a=this._camera.forward(),{pitch:n,bearing:o}=this._camera.getPitchBearing(),s=i.em(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.c4(this._maxPitch)),h=Math.max((r[2]-s)/Math.cos(n),l),u=this._zoomFromMercatorZ(h);i.fe(r,r,a,h),this._pitch=i.bG(n,i.c4(this.minPitch),i.c4(this.maxPitch)),this.angle=i.f$(o,-Math.PI,Math.PI),this._setZoom(i.bG(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ag(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){let i=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,i)*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,n=i.R,o=0,s=1/0;for(;n-a>1e-6&&n>a;){let i=a+.5*(n-a),l=this.tileSize*Math.pow(2,i),h=this.getCameraToCenterDistance(this.projection,i,l),u=this.scaleZoom(h/(Math.max(0,r)*this.tileSize)),c=Math.abs(i-u);c<s&&(s=c,o=i),i<u?a=i:n=i}return o}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.f_("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,a){let n=Math.min(r.x,a.x),o=Math.max(r.x,a.x),s=Math.min(r.y,a.y),l=Math.max(r.y,a.y);if(s<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let h=[new i.au(n,s),new i.au(o,l),new i.au(n,l),new i.au(o,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let i of h){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let a=this.rayIntersectionCoordinate(r);if(a.x<u||a.y<0||a.x>c||a.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.eX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.au(0,0),new i.au(this.width,this.height))}zoomDeltaToMovement(r,a){let n=i.dW(i.fx([],this._camera.position,r)),o=this._zoomFromMercatorZ(n)+a;return n-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){let r=function([r,a,n],o){let s=[r,a,n,1];i.fM(s,s,o);let l=s[3]=Math.max(s[3],1e-6);return s[0]/=l,s[1]/=l,s[2]/=l,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.au(r[0],r[1])}{let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.au(0,r))}}getCameraToCenterDistance(r,a=this.zoom,n=this.worldSize){let o=i.d2(r,a,this.width,this.height,1024),s=r.pixelSpaceConversion(this.center.lat,n,o),l=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(l=i.dY(1,l,i.cc(this.pitch>=15?1:this.pitch/15))),l}getWorldToCameraMatrix(){let r=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&i.er(r,r,this.globeMatrix),r}getFrustum(r){return i.N.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,"meters"===this.projection.zAxisUnit)}}let t9=(r,a)=>{if(a<=0||r.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let n=r.transform,o=n.pitch,s=n.isLODDisabled(!1)?60:30;if(o<s-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let l=n._farZ-n._nearZ,h=a*n.height*1.3,u=Math.pow(2,.85*Math.max(n._zoom-r.minCutoffZoom,0)),c=1.4*n.cameraToCenterDistance*u,d=i.fq(s-15,s,o),f=i.dY(n._farZ+h,c,d),p=Math.min(h,f-n._nearZ);return{shouldRenderCutoff:d>0,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(f-n._nearZ)/l,(f-p-n._nearZ)/l]}}};class t7{constructor(i,r,a,n,o,s){this.test=i,this.ref=r,this.mask=a,this.fail=n,this.depthFail=o,this.pass=s}}t7.disabled=new t7({func:519,mask:0},0,0,7680,7680,7680);class ie{constructor(i,r,a,n){this.blendFunction=i,this.blendColor=r.toNonPremultipliedRenderColor(null),this.mask=a,this.blendEquation=n}}
8function it(r,a,n=0){let o=Math.pow(2,a.tileID.overscaledZ),s=a.tileSize*Math.pow(2,r.transform.tileZoom)/o,l=s*(a.tileID.canonical.x+a.tileID.wrap*o),h=s*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture?a.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.eG(a,1,r.transform.tileZoom),u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h],u_pattern_transition:n}}ie.Replace=[1,0,1,0],ie.disabled=new ie(ie.Replace,i.i.transparent,[!1,!1,!1,!1]),ie.unblended=new ie(ie.Replace,i.i.transparent,[!0,!0,!0,!0]),ie.alphaBlended=new ie([1,771,1,771],i.i.transparent,[!0,!0,!0,!0]),ie.alphaBlendedNonPremultiplied=new ie([770,771,770,771],i.i.transparent,[!0,!0,!0,!0]),ie.multiply=new ie([774,0,774,0],i.i.transparent,[!0,!0,!0,!0]),ie.multiplyAccumulateAlpha=new ie([774,0,1,771],i.i.transparent,[!0,!0,!0,!0]),ie.additive=new ie([1,1,1,1],i.i.transparent,[!0,!0,!0,!0]),ie.additiveAlphaWeighted=new ie([770,1,773,1],i.i.transparent,[!0,!0,!0,!0]),ie.additiveAlphaWeightedUnboundedAlpha=new ie([770,1,1,1],i.i.transparent,[!0,!0,!0,!0]);let ii={terrain:0,flat:1},ir=i.bT(),ia=(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b=[0,0,1])=>{let w=a.style.light,T=w.properties.get("position"),S=[T.x,T.y,T.z],E=i.bV();"viewport"===w.properties.get("anchor")&&(i.cu(E,-a.transform.angle),i.fK(S,S,E));let I=w.properties.get("color").toPremultipliedRenderColor(null),A=a.transform,M={u_matrix:r,u_lightpos:S,u_lightintensity:w.properties.get("intensity"),u_lightcolor:[I.r,I.g,I.b],u_vertical_gradient:+n,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ir,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:ii[d],u_base_type:ii[f],u_ao:s,u_edge_radius:l,u_width_scale:h,u_flood_light_color:g,u_vertical_scale:y,u_flood_light_intensity:x,u_ground_shadow_factor:v,u_front_cutoff_params:b};return"globe"===A.projection.name&&(M.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],M.u_zoom_transition=p,M.u_inv_rot_matrix=_,M.u_merc_center=m,M.u_up_dir=A.projection.upVector(new i.f(0,0,0),m[0]*i.r,m[1]*i.r),M.u_height_lift=c),M},io=(i,r,a,n,o,s)=>({u_matrix:i,u_edge_radius:r,u_width_scale:a,u_vertical_scale:n,u_height_type:ii[o],u_base_type:ii[s]}),is=(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x)=>{let v=ia(i,r,a,n,o,s,l,h,c,d,f,p,m,_,g,y,1,[0,0,0]),b={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return Object.assign(v,it(r,u,x),b)},il=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r}),ih=[];function iu(i){return ih[i]=ih[i]||new Float64Array(16)}let ic=[],id=new Float32Array(16);class ip{constructor(i,r){this.aabb=i,this.lastCascade=r}}class im{add(i,r){let a=this.receivers[i.key];void 0!==a?(a.aabb.min[0]=Math.min(a.aabb.min[0],r.min[0]),a.aabb.min[1]=Math.min(a.aabb.min[1],r.min[1]),a.aabb.min[2]=Math.min(a.aabb.min[2],r.min[2]),a.aabb.max[0]=Math.max(a.aabb.max[0],r.max[0]),a.aabb.max[1]=Math.max(a.aabb.max[1],r.max[1]),a.aabb.max[2]=Math.max(a.aabb.max[2],r.max[2])):this.receivers[i.key]=new ip(r,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(r,a,n){let o=i.A.fromPoints(r.points),s=0;for(let r in this.receivers){let l=this.receivers[r];if(!l||!o.intersectsAabb(l.aabb))continue;l.aabb.min=o.closestPoint(l.aabb.min),l.aabb.max=o.closestPoint(l.aabb.max);let h=l.aabb.getCorners();for(let r=0;r<n.length;r++){let o=!0;for(let s of h){let l=[s[0]*a,s[1]*a,s[2]];if(i.fL(l,l,n[r].matrix),l[0]<-1||l[0]>1||l[1]<-1||l[1]>1){o=!1;break}}if(l.lastCascade=r,s=Math.max(s,r),o)break}}return s+1}}class i_{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new im,this._depthMode=new tN(i.context.gl.LEQUAL,tN.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(let i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){let n=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!a||!a.properties)return;let o=a.properties.get("shadow-intensity"),s=a.properties.get("shadow-draw-before-layer");if(!a.shadowsEnabled()||o<=0)return;let l=-1,h=0;for(let i of n.style.order){let a=n.style._mergedLayers[i];a.hasShadowPass()&&!a.isHidden(r.zoom)&&(l=h),s&&(s===i||s===a.slot)&&(this._drawShadowAfterLayer=h>0?h-1:0),h+=1}if(this._enabled=l>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=l);let u=n.context,c=this._shadowParameters.shadowMapResolution,d=this._shadowParameters.shadowMapResolution;if(0===this._cascades.length||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let r=0;r<this._shadowParameters.cascadeCount;++r){let r=u.gl,a=u.createFramebuffer(c,d,0,"texture"),n=new i.a_(u,{width:c,height:d,data:null},r.DEPTH_COMPONENT16);a.depthAttachment.set(n.texture),this._cascades.push({framebuffer:a,texture:n,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.N,scale:0})}}this.shadowDirection=iy(a);let f=0;if(r.elevation){let i=r.elevation,a=[1e4,-1e4];i.visibleDemTiles.filter(i=>i.dem).forEach(i=>
8{let r=i.dem.tree;a[0]=Math.min(a[0],r.minimums[0]),a[1]=Math.max(a[1],r.maximums[0])}),1e4!==a[0]&&(f=(a[1]-a[0])*i.exaggeration())}let p=1.5*r.cameraToCenterDistance,m=3*p,_=new Float64Array(16);for(let a=0;a<this._cascades.length;++a){let n=this._cascades[a],o=r.height/50,s=1;1===this._shadowParameters.cascadeCount?s=m:0===a?s=p:(o=p,s=m);let[l,h]=function(r,a,n,o,s,l){let h,u,c=r.zoom,d=r.scale,f=r.worldSize,p=1/f,m=r.aspect,_=Math.sqrt(1+m*m)*Math.tan(.5*r.fovX),g=_*_,y=o-n,x=o+n;g>y/x?(h=o,u=o*_):(h=.5*x*(1+g),u=.5*Math.sqrt(y*y+2*(o*o+n*n)*g+x*x*g*g));let v=r.projection.pixelsPerMeter(r.center.lat,f),b=r._camera.getCameraToWorldMercator(),w=[0,0,-h*p];i.fL(w,w,b);let T=u*p,S=r._edgeInsets;if((0!==S.left||0!==S.top||0!==S.right||0!==S.bottom)&&(S.left!==S.right||S.top!==S.bottom)){let a=r._camera.getWorldToCamera(r.worldSize,"meters"===r.projection.zAxisUnit?v:1),s=r._camera.getCameraToClipPerspective(r._fov,r.width/r.height,n,o);s[8]=-(2*r.centerOffset.x)/r.width,s[9]=2*r.centerOffset.y/r.height;let l=new Float64Array(16);i.eo(l,s,a);let h=new Float64Array(16);for(let a of(i.dr(h,l),i.N.fromInvProjectionMatrix(h,f,c,!0).points)){let n=(a[0]/=d,a[1]/=d,a[2]=i.em(a[2],r._center.lat),a);T=Math.max(T,i.dV(i.fz([],w,n)))}}T*=s/(s-1);let E=Math.acos(a[2]),I=Math.atan2(-a[0],-a[1]),A=new tq;A.position=w,A.setPitchBearing(E,I);let M=A.getWorldToCamera(f,v),C=T*f,D=Math.min(-(r._mercatorZfromZoom(17)*f*2),-2*C),R=A.getCameraToClipOrthographic(-C,C,-C,C,D,(C+l*v)/a[2]),P=new Float64Array(16);i.er(P,R,M);let L=i.cx(Math.floor(1e6*w[0])/1e6*f,Math.floor(1e6*w[1])/1e6*f,0),z=.5*s,O=[0,0,0];i.fL(O,L,P),i.fa(O,O,z);let F=[Math.floor(O[0]),Math.floor(O[1]),Math.floor(O[2])],B=[0,0,0];i.fx(B,O,F),i.fa(B,B,-1/z);let k=new Float64Array(16);return i.dq(k),i.fQ(k,k,B),i.er(P,k,P),[P,C]}(r,this.shadowDirection,o,s,this._shadowParameters.shadowMapResolution,f);n.scale=r.scale,n.matrix=l,n.boundingSphereRadius=h,i.dr(_,n.matrix),n.frustum=i.N.fromInvProjectionMatrix(_,1,0,!0),n.far=s}let g=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[g].far,this._cascades[g].far],this._uniformValues.u_shadow_intensity=o,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=n.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let y=n.transform.elevation;for(let i of this._groundShadowTiles){let r={min:0,max:0};if(y){let a=y.getMinMaxForTile(i);a&&(r=a)}this.addShadowReceiver(i.toUnwrapped(),r.min,r.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(r,a){if(!this.enabled)return;let n=this.painter,o=n.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(n.transform.getFrustum(0),n.transform.worldSize,this._cascades),o.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let s=0;s<this._numCascadesToRender;++s)for(let l of(n.currentShadowCascade=s,o.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),o.clear({color:i.i.white,depth:1}),r.order)){let i=r._mergedLayers[l];if(!i.hasShadowPass()||i.isHidden(n.transform.zoom))continue;let o=r.getLayerSourceCache(i),s=o?a[o.id]:void 0;("model"===i.type||s&&s.length)&&n.renderLayer(n,o,i,s)}n.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let i=this.painter,r=i.style,a=i.context,n=a.gl,o=r.directionalLight,s=r.ambientLight;if(!o||!s)return;let l=[],h=t9(i,i.longestCutoffRange);h.shouldRenderCutoff&&l.push("RENDER_CUTOFF"),l.push("RENDER_SHADOWS"),this.useNormalOffset&&l.push("NORMAL_OFFSET");let u=ix(r,o,s),c=new tN(n.LEQUAL,tN.ReadOnly,i.depthRangeFor3D),d=new t7({func:n.EQUAL,mask:255},0,255,n.KEEP,n.KEEP,n.KEEP);for(let r of this._groundShadowTiles){let o=r.toUnwrapped(),s=i.isTileAffectedByFog(r),f=i.getOrCreateProgram("groundShadow",{defines:l,overrideFog:s});this.setupShadows(o,f),i.uploadCommonUniforms(a,f,o,null,h);let p=il(i.transform.calculateProjMatrix(o),u);f.draw(i,n.TRIANGLES,c,d,ie.multiply,tk.disabled,p,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(r){let a=this.painter.transform,n=a.calculatePosMatrix(r,a.worldSize);return i.er(n,this._cascades[this.painter.currentShadowCascade].matrix,n),Float32Array.from(n)}
8calculateShadowPassMatrixFromMatrix(r){return i.er(id,this._cascades[this.painter.currentShadowCascade].matrix,r)}setupShadows(r,a,n){if(!this.enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=o.calculatePosMatrix(r,o.worldSize);for(let r=0;r<this._cascades.length;r++){let a=iu(r);i.er(a,this._cascades[r].matrix,u),h[0===r?"u_light_matrix_0":"u_light_matrix_1"]=a,s.activeTexture.set(l.TEXTURE0+11+r),this._cascades[r].texture.bindExtraParam(l.LINEAR,l.LINEAR,l.CLAMP_TO_EDGE,l.CLAMP_TO_EDGE,l.GREATER)}if(this.useNormalOffset=!!n,this.useNormalOffset){var c;let a,s=i.fH(r.canonical),l=2/o.tileSize*i.r/this._shadowParameters.shadowMapResolution,u=l*this._cascades[0].boundingSphereRadius,d=l*this._cascades.at(-1).boundingSphereRadius,f=("vector-tile"===n?1:3)*(c=o.zoom,.125*(1-(a=i.bG(-((c-22)/22),0,1)))+4*a);h.u_shadow_normal_offset=[s,u*f,d*f],h.u_shadow_bias=[1e-4,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(s,h)}computeCascadeTileMatrices(r){let a=this._shadowParameters.cascadeCount;for(let n=0;n<a;n++){let a=ic[n]=ic[n]||new Float64Array(16);i.er(a,this._cascades[n].matrix,r)}return ic.length=a,ic}setupShadowsFromMatrix(r,a,n=!1){if(!this.enabled)return;let o=this._shadowParameters.cascadeCount;for(let a=0;a<o;a++)i.er(iu(a),this._cascades[a].matrix,r);ih.length=o,this.setupShadowsFromCascadeMatrices(ih,a,n)}setupShadowsFromCascadeMatrices(i,r,a=!1){if(!this.enabled)return;let n=this.painter.context,o=n.gl,s=this._uniformValues;for(let r=0;r<this._shadowParameters.cascadeCount;r++)s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=i[r],n.activeTexture.set(o.TEXTURE0+11+r),this._cascades[r].texture.bindExtraParam(o.LINEAR,o.LINEAR,o.CLAMP_TO_EDGE,o.CLAMP_TO_EDGE,o.GREATER);if(this.useNormalOffset=a,a){let i=this._shadowParameters.normalOffset;s.u_shadow_normal_offset=[1,i,i],s.u_shadow_bias=[6e-5,.0012,.012]}else s.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,a,n,o){let s;if(o[2]>=0)return{};let l=(s=n/(1<<r.canonical.z),new i.A([r.canonical.x*s+r.wrap*n,r.canonical.y*s+r.wrap*n,0],[(r.canonical.x+1)*s+r.wrap*n,(r.canonical.y+1)*s+r.wrap*n,a])).getCorners(),h=-(a/o[2]);o[0]<0?(i.bj(l[0],l[0],[o[0]*h,0,0]),i.bj(l[3],l[3],[o[0]*h,0,0])):o[0]>0&&(i.bj(l[1],l[1],[o[0]*h,0,0]),i.bj(l[2],l[2],[o[0]*h,0,0])),o[1]<0?(i.bj(l[0],l[0],[0,o[1]*h,0]),i.bj(l[1],l[1],[0,o[1]*h,0])):o[1]>0&&(i.bj(l[2],l[2],[0,o[1]*h,0]),i.bj(l[3],l[3],[0,o[1]*h,0]));let u={};return u.vertices=l,u.planes=[ig(l[1],l[0],l[4]),ig(l[2],l[1],l[5]),ig(l[3],l[2],l[6]),ig(l[0],l[3],l[7])],u}addShadowReceiver(r,a,n){this._receivers.add(r,i.A.fromTileIdAndHeight(r,a,n))}getMaxCascadeForTile(i){let r=this._receivers.get(i);return r&&r.lastCascade?r.lastCascade:0}}function ig(r,a,n){let o=i.fx([],n,a),s=i.fx([],r,a),l=i.c1([],o,s),h=i.dW(l);return 0===h?[0,0,1,0]:(i.fa(l,l,1/h),[l[0],l[1],l[2],-i.c7(l,a)])}function iy(r){let a=r.properties.get("direction"),n=i.bB(a.x,a.y,a.z);n[2]=i.bG(n[2],0,75);let o=i.ft([n[0],n[1],n[2]]);return i.cx(o.x,o.y,o.z)}function ix(r,a,n){let o="none"===a.properties.get("color-use-theme"),s=a.properties.get("color"),l=a.properties.get("intensity"),h=a.properties.get("direction"),u=[h.x,h.y,h.z],c="none"===n.properties.get("color-use-theme"),d=n.properties.get("color"),f=n.properties.get("intensity"),p=Math.max(i.c7([0,0,1],u),0),m=[0,0,0];i.fa(m,d.toPremultipliedRenderColor(c?null:r.getLut(a.scope)).toArray01Linear().slice(0,3),f);let _=[0,0,0];return i.fa(_,s.toPremultipliedRenderColor(o?null:r.getLut(n.scope)).toArray01Linear().slice(0,3),p*l),i.e4([m[0]>0?m[0]/(m[0]+_[0]):0,m[1]>0?m[1]/(m[1]+_[1]):0,m[2]>0?m[2]/(m[2]+_[2]):0])}let iv=new Float32Array(16);function ib(r,a,n,o,s,l,h,u){let c;n.resetLayerRenderingStats(r);let d=r.context,f=d.gl,p=r.transform,m=n.paint.get("fill-extrusion-pattern"),_=n.paint.get("fill-extrusion-pattern-cross-fade"),g=m.constantOr(null),y=m.constantOr(1),x=n.paint.get("fill-extrusion-opacity"),v=r.style.enable3dLights(),b=n.paint.get(v&&!y?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),w=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),b],T=n.layout.get("fill-extrusion-edge-radius"),S=T>0&&!n.paint.get("fill-extrusion-rounded-roof"),E=S?0:T,I="globe"===p.projection.name?i.cq():0,A="globe"===p.projection.name,M=A?i.dm(p.zoom):0,C=[i.ek(p.center.lng),i.el(p.center.lat)],D="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
8constantOr("default"),R=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(D?null:n.lut).toArray01().slice(0,3),P=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-vertical-scale"),z=0!==n.paint.get("fill-extrusion-line-width").constantOr(1),O=n.paint.get("fill-extrusion-height-alignment"),F=n.paint.get("fill-extrusion-base-alignment"),B=t9(r,n.paint.get("fill-extrusion-cutoff-fade-range")),k=n.paint.get("fill-extrusion-front-cutoff"),N=iT(p.pitch,k,!!r.terrain),U=N[2]<1;U&&(r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,k[0]));let V=[];A&&V.push("PROJECTION_GLOBE_VIEW"),w[0]>0&&V.push("FAUX_AO"),S&&V.push("ZERO_ROOF_RADIUS"),u&&V.push("HAS_CENTROID"),P>0&&V.push("FLOOD_LIGHT"),B.shouldRenderCutoff&&V.push("RENDER_CUTOFF"),U&&V.push("RENDER_FRONT_CUTOFF"),z&&V.push("RENDER_WALL_MODE");let j="shadow"===r.renderPass,G=r.shadowRenderer,H=j&&!!G,q=j?tk.disabled:tk.backCCW;r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!0);let $=[0,0,0];if(G){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&($=ix(r.style,i,a)),j||(V.push("RENDER_SHADOWS"),G.useNormalOffset&&V.push("NORMAL_OFFSET")),c=V.concat(["SHADOWS_SINGLE_CASCADE"])}let Z=H?"fillExtrusionDepth":y?"fillExtrusionPattern":"fillExtrusion",W=n.getLayerRenderingStats();for(let m of o){let o,v=a.getTile(m),b=v.getBucket(n);if(!b||b.projection.name!==p.projection.name)continue;let T=!1;G&&(T=0===G.getMaxCascadeForTile(m.toUnwrapped()));let S=r.isTileAffectedByFog(m),D=b.programConfigurations.get(n.id),k=!1;if(g&&v.imageAtlas){let r=v.imageAtlas,a=i.aG.from(g),n=a.getPrimary().scaleSelf(i.co.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.co.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&D.setConstantPatternPositions(s,l)}_>0&&(k||D.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&V.push("FILL_EXTRUSION_PATTERN_TRANSITION");let U=r.getOrCreateProgram(Z,{config:D,defines:T?c:V,overrideFog:S});if(r.terrain&&r.terrain.setupElevationDraw(v,U,{useMeterToDem:!0}),!b.centroidVertexBuffer){let i=U.getAttributeLocation(f,"a_centroid_pos");-1!==i&&f.vertexAttribI4ui(i,0,0,0,0)}!j&&G&&G.setupShadows(v.tileID.toUnwrapped(),U,"vector-tile"),y&&(r.context.activeTexture.set(f.TEXTURE0),v.imageAtlasTexture&&v.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),D.updatePaintBuffers());let H=n.paint.get("fill-extrusion-vertical-gradient"),X=1/b.tileToMeter;if(j&&G){if(iM(v.tileID,b.maxHeight,r))continue;o=io(G.calculateShadowPassMatrixFromTile(v.tileID.toUnwrapped()),E,X,L,O,F)}else{let i=r.translatePosMatrix(m.expandedProjMatrix,v,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),a=p.projection.createInversionMatrix(p,m.canonical);o=y?is(i,r,H,x,w,E,X,m,v,I,O,F,M,C,a,R,L,_):ia(i,r,H,x,w,E,X,m,I,O,F,M,C,a,R,L,P,$,N)}r.uploadCommonUniforms(d,U,m.toUnwrapped(),null,B);let Y=b.segments;if("mercator"===p.projection.name&&!j&&!(Y=b.getVisibleSegments(v.tileID,r.terrain,r.transform.getFrustum(0))).get().length)continue;if(W)if(j)for(let i of Y.get())W.numRenderedVerticesInShadowPass+=i.primitiveLength;else for(let i of Y.get())W.numRenderedVerticesInTransparentPass+=i.primitiveLength;let K=[];(r.terrain||u)&&K.push(b.centroidVertexBuffer),A&&K.push(b.layoutVertexExtBuffer),z&&K.push(b.wallVertexBuffer),U.draw(r,d.gl.TRIANGLES,s,l,h,q,o,n.id,b.layoutVertexBuffer,b.indexBuffer,Y,n.paint,r.transform.zoom,D,K)}r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!1)}class iw{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function iT(i,r,a){if(!(r[2]<1)||a)return[0,0,1];let n=180*i/Math.PI;if(n<15)return[-.5,r[1],r[2]];let o=Math.min(1,Math.max(0,(n-15)/5)),s=o*o*(3-2*o);return[-.5*(1-s)+r[0]*s,r[1],r[2]]}function iS(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T){let S=a.context,E=S.gl,I=a.transform,A=a.transform.zoom,M=[],C=r.translate,D=r.translateAnchor,R=r.edgeRadius,P=t9(a,r.cutoffFadeRange);"clear"===f?(M.push("CLEAR_SUBPASS"),w&&(M.push("CLEAR_FROM_TEXTURE"),S.activeTexture.set(E.TEXTURE0),w.bind(E.LINEAR,E.CLAMP_TO_EDGE))):"sdf"===f?M.push("SDF_SUBPASS"):"emissive"===f&&(M.push("USE_MRT1"),S.activeTexture.set(E.TEXTURE0),w.bind(E.LINEAR,E.CLAMP_TO_EDGE)),v&&M.push("HAS_CENTROID"),P.shouldRenderCutoff&&M.push("RENDER_CUTOFF");let L=(i,r,n,s,f)=>{let b=M;null!=r.groundRadiusBuffer&&(b=M.concat("HAS_ATTRIBUTE_a_flood_light_ground_radiu
8s"));let T=r.programConfigurations.get(o.id),E=a.isTileAffectedByFog(i),I=a.getOrCreateProgram("fillExtrusionGroundEffect",{config:T,defines:b,overrideFog:E}),C={u_matrix:s,u_opacity:p,u_ao_pass:+!!d,u_meter_to_tile:f,u_ao:[m,_*f],u_flood_light_intensity:g,u_flood_light_color:y,u_attenuation:x,u_edge_radius:A>=17?0:R*f,u_fb:0,u_fb_size:w?w.size[0]:0,u_dynamic_offset:1},D=[];v&&D.push(r.hiddenByLandmarkVertexBuffer),null!=r.groundRadiusBuffer&&D.push(r.groundRadiusBuffer),a.uploadCommonUniforms(S,I,i.toUnwrapped(),null,P),I.draw(a,S.gl.TRIANGLES,l,h,u,c,C,o.id,r.vertexBuffer,r.indexBuffer,n,o.paint,A,T,D)};for(let r of s){let s=n.getTile(r),l=s.getBucket(o);if(!l||l.projection.name!==I.projection.name||!l.groundEffect||l.groundEffect&&!l.groundEffect.hasData())continue;let h=l.groundEffect,u=1/l.tileToMeter;{let i=a.translatePosMatrix(r.projMatrix,s,C,D),n=h.getDefaultSegment();L(r,h,n,i,u)}if(b)for(let l=0;l<4;l++){let h,c,d=i.ev[l](r),f=n.getTile(d);if(!f)continue;let p=f.getBucket(o);if(!p||p.projection.name!==I.projection.name||!p.groundEffect||p.groundEffect&&!p.groundEffect.hasData())continue;let m=p.groundEffect;0===l?(h=[-i.r,0,0],c=1):1===l?(h=[i.r,0,0],c=0):2===l?(h=[0,-i.r,0],c=3):(h=[0,i.r,0],c=2);let _=m.regionSegments[c];_&&(i.fQ(iv,r.projMatrix,h),L(r,m,_,a.translatePosMatrix(iv,s,C,D),u))}}}let iE=[1,0,0],iI=[0,1,0],iA=[0,0,1];function iM(r,a,n){let o=n.transform,s=n.shadowRenderer;if(!s)return!0;let l=n.frameCounter,h=n.currentShadowCascade,u=n._shadowCullCache;if(!u||u.frame!==l||u.cascade!==h){let r=o.tileSize*s._cascades[h].scale,a=o.scaleZoom(r),c=s.shadowDirection,d=[c[0],c[1],-c[2]],f=[iE,iI,iA,d,[d[0],0,d[2]],[0,d[1],d[2]]];n._shadowCullCache=u={frame:l,cascade:h,cameraFrustum:i.N.fromInvProjectionMatrix(o.invProjMatrix,o.worldSize,a,"globe"!==o.projection.name),edges:f,shadowDir:d,ws:r,zoom:a}}let{cameraFrustum:c,edges:d,shadowDir:f,ws:p,zoom:m}=u,_=a;if(o.elevation){let i=o.elevation.getMinMaxForTile(r);i&&(_+=i.max)}_/=i.cX(o.center.lat,m);let g=s.computeSimplifiedTileShadowVolume(r.toUnwrapped(),_,p,f);if(!g)return!1;let{vertices:y,planes:x}=g;return 0===c.intersectsPrecise(y,x,d)||0===s.getCurrentCascadeFrustum().intersectsPrecise(y,x,d)}let iC=new Float32Array(16),iD=new Float32Array(16);function iR(r){let{painter:a,source:n,layer:o,coords:s}=r,l=r.defines,h=a.context,u="shadow"===a.renderPass,c="light-beam"===a.renderPass,d=a.shadowRenderer,f=i.cX(a.transform.center.lat,a.transform.zoom),p=t9(a,o.paint.get("building-cutoff-fade-range"));p.shouldRenderCutoff&&(l=l.concat("RENDER_CUTOFF"));let m=o.paint.get("building-front-cutoff"),_=m[2]<1&&!a.terrain,g=iT(a.transform.pitch,m,!!a.terrain);for(let y of(_&&(l=l.concat("RENDER_FRONT_CUTOFF"),a.maxFrontCutoffRawStart=Math.max(a.maxFrontCutoffRawStart,m[0])),r.floodLightIntensity>0&&(l=l.concat("FLOOD_LIGHT")),s)){let s,m,_,x=n.getTile(y),v=x.getBucket(o);if(!v)continue;d&&0===d.getMaxCascadeForTile(y.toUnwrapped())&&(l=l.concat("SHADOWS_SINGLE_CASCADE"));let b=v.programConfigurations.get(o.id),w=a.translatePosMatrix(y.expandedProjMatrix,x,[0,0],"map");if(i.fc(iC,w,[1,1,r.verticalScale]),u&&d){if(iM(x.tileID,v.maxHeight*f,a))continue;let n=d.calculateShadowPassMatrixFromTile(x.tileID.toUnwrapped());i.fc(n,n,[1,1,r.verticalScale]),_=tB(n),s=m=a.getOrCreateProgram("buildingDepth",{config:b,defines:l,overrideFog:!1})}else if(c)s=m=a.getOrCreateProgram("buildingBloom",{config:b,defines:l,overrideFog:!1}),_=tF(iC);else{let n=a.transform.calculatePosMatrix(y.toUnwrapped(),a.transform.worldSize);i.fc(n,n,[1,1,r.verticalScale]),i.fc(iD,n,[1,-1,1/f]),i.dr(iD,iD),i.fR(iD,iD);let o=a.transform.getFreeCameraOptions().position,u=1<<y.canonical.z;if(_=tO(iC,iD,r.opacity,r.facadeAOIntensity,[((o.x-y.wrap)*u-y.canonical.x)*i.r,(o.y*u-y.canonical.y)*i.r,o.z*u*i.r],v.tileToMeter,r.facadeEmissiveChance,r.floodLightColor,r.floodLightIntensity,g),m=a.getOrCreateProgram("building",{config:b,defines:l,overrideFog:!1}),!0===r.depthOnly)s=m;else{let i=l.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);s=a.getOrCreateProgram("building",{config:b,defines:i,overrideFog:!1})}
8d&&(d.setupShadowsFromMatrix(n,m,!0),s!==m&&s.setShadowUniformValues(h,d.getShadowUniformValues()))}let T=(i,n)=>{if(c){let s=i.entranceBloom;n.draw(a,h.gl.TRIANGLES,r.depthMode,t7.disabled,r.blendMode,tk.disabled,_,o.id,s.layoutVertexBuffer,s.indexBuffer,s.segmentsBucket,o.paint,a.transform.zoom,b,[s.layoutAttenuationBuffer,s.layoutColorBuffer])}else{let s=i.segmentsBucket,l=[i.layoutNormalBuffer,i.layoutCentroidBuffer,i.layoutColorBuffer,i.layoutFloodLightDataBuffer];i.layoutFacadePaintBuffer&&(l=l.concat([i.layoutFacadeDataBuffer,i.layoutFacadeVerticalRangeBuffer,i.layoutFacadePaintBuffer])),n.draw(a,h.gl.TRIANGLES,r.depthMode,t7.disabled,r.blendMode,u?tk.disabled:tk.backCW,_,o.id,i.layoutVertexBuffer,i.indexBuffer,s,o.paint,a.transform.zoom,b,l)}};a.uploadCommonUniforms(h,m,y.toUnwrapped(),null,p),v.buildingWithoutFacade&&T(v.buildingWithoutFacade,m),v.buildingWithFacade&&(s!==m&&a.uploadCommonUniforms(h,s,y.toUnwrapped(),null,p),T(v.buildingWithFacade,s))}}function iP(r,a,n,o,s,l,h,u,c,d,f,p,m,_){let g=r.context.gl,y=r.depthModeForSublayer(1,tN.ReadOnly,g.LEQUAL,!0),x=i.dY(.1,3,f),v=r._showOverdrawInspector,b=new iw;v||iS(b,r,a,n,o,y,new t7({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),new ie([g.ONE,g.ONE,g.ONE,g.ONE],i.i.transparent,[!1,!1,!1,!0],g.MIN),tk.disabled,s,"sdf",l,h,u,c,d,x,p,!1,void 0);{let f=v?t7.disabled:new t7({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),m=v?r.colorModeForRenderPass():new ie([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],i.i.transparent,[!0,!0,!0,!0]);iS(b,r,a,n,o,y,f,m,tk.disabled,s,"color",l,h,u,c,d,x,p,!1,void 0)}}class iL{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(i,r,a,n,o){if(a<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let s=null,l=Number.MAX_VALUE,h=Number.MAX_VALUE,u=!1,c=this._previousClosestBuildingId?i[this._previousClosestBuildingId]:null;for(let[a,d]of(this._previousClosestBuildingId&&c&&this._isBuildingVisible(c,n,o)&&(u=!0,h=this._calculateDistance(r,c)),Object.entries(i))){if(!this._isBuildingVisible(d,n,o))continue;let i=this._calculateDistance(r,d);i<l&&(l=i,s=a)}return u&&s&&this._previousClosestBuildingId&&s!==this._previousClosestBuildingId?l>h*this._hysteresisRatio&&(s=this._previousClosestBuildingId):u&&!s&&(s=this._previousClosestBuildingId),this._previousClosestBuildingId=s,s}_calculateDistance(i,r){if(!r.center)return Number.MAX_VALUE;let a=i.lat-r.center[1],n=i.lng-r.center[0];return a*a+n*n}_isBuildingVisible(r,a,n){if(!n)return!1;for(let a of r.floorIds){let o=r.floors[a];if(!o.geometry)continue;let s=o.geometry;if("Polygon"===s.type){let r=this._convertRingToPoints(s.coordinates[0]);if(i.eO(r,n))return!0}else if("MultiPolygon"===s.type){let r=this._convertMultiPolygonToPoints(s.coordinates);if(i.eN(n,r))return!0}}return!1}_convertRingToPoints(r){return r.map(r=>new i.au(r[0],r[1]))}_convertMultiPolygonToPoints(r){return r.map(r=>0===r.length?[]:r[0].map(r=>new i.au(r[0],r[1])))}}let iz=(i,r,a,n,o,s,l,h,u,c,d,f)=>({u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity,u_image0:0,u_image1:1,u_raster_elevation:f,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u}),iO=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:n,u_color_ramp:s,u_velocity_res:o,u_max_speed:l,u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),iF=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:n,u_max_speed:o,u_speed_factor:s,u_reset_rate:l,u_rand_seed:Math.random(),u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]});function iB(i,[r,a,n,o],[s,l]){if(s===l)return[0,0,0,0];let h=255*(i-1)/(i*(l-s));return[r*h,a*h,n*h,o*h]}function ik(i,r,[a,n]){return a===n?0:.5/i+(r-a)*(i-1)/(i*(n-a))}i.af.setPbf(i.as);class iN extends i.b0{constructor(i,r,a,n,o){super(i,r,a,n,o),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
8getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(i){return this._mrt&&this._mrt.getLayer(i)}setTexturePerLayer(r,a,n){let o=n.context,s=o.gl,l=this.texturePerLayer.get(r)||n.getTileTexture(a.width);l&&l instanceof i.a_?l.update(a,{premultiply:!1}):l=new i.a_(o,a,s.RGBA8,{premultiply:!1}),this.texturePerLayer.has(r)||this.texturePerLayer.set(r,l)}flushQueues(i){let r=this._workQueuePerLayer.get(i)||[],a=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()();for(;a.length;)a.pop()()}flushAllQueues(){for(let i of this._workQueuePerLayer.keys()){let r=this._workQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}for(let i of this._fetchQueuePerLayer.keys()){let r=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}}fetchHeader(r=16384,a){let n=this._mrt=new i.af(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=i.cG(o,(i,o,s)=>{if(i)a(i);else try{let i=n.getHeaderLength(o);if(i>r)return void(this.request=this.fetchHeader(i,a));n.parseHeader(o),this._isHeaderLoaded=!0;let l=0;for(let i of Object.values(n.layers))l=Math.max(l,i.dataIndex.at(-1).lastByte);o.byteLength>=l&&(this.entireBuffer=o),a(null,this.entireBuffer||o,s)}catch(i){a(i)}}),this.request}fetchBandForRender(i,r,a,n){this.fetchBand(i,r,a,o=>{if(o)return void n(o);this.updateTextureDescriptor(i,r,a);let s=this.textureDescriptorPerLayer.get(r);n(null,s?s.img:null)})}fetchBand(r,a,n,o,s=!0){let l,h,u=this._mrt;if(!this._isHeaderLoaded||!u)return void o(Error("Tile header is not ready"));let c=this.actor;if(!c)return void o(Error("Can't fetch tile band without an actor"));let d=i.ea(String(n),i.ea(this.tileID.key,r)),f=this._taskQueue.get(d);f?f.add(o):((f=new Set).add(o),this._taskQueue.set(d,f));let p=(i,r)=>{l.complete(i,r),i?o(i):(f.forEach(i=>i(null,r)),this._taskQueue.delete(d))},m=(i,r)=>{if(i)return o(i);let n=c.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:r,task:l},p,void 0,!0);if(null!==a){let i=this._workQueuePerLayer.get(a)||[];i.push(()=>{n&&n.cancel(),l.cancel()}),this._workQueuePerLayer.has(a)||this._workQueuePerLayer.set(a,i)}};try{h=u.getLayer(r)}catch(i){if("reloading"===this.state)return;throw i}if(!h)return void o(Error(`Unknown sourceLayer "${r}"`));if(h.hasDataForBand(n))return f.forEach(i=>i(null,null)),void this._taskQueue.delete(d);let _=h.getDataRange([n]);if(!(l=u.createDecodingTask(_))||l.tasks.length)if(null!==a&&this.flushQueues(a),this.entireBuffer)m(null,this.entireBuffer.slice(_.firstByte,_.lastByte+1));else{let r=Object.assign({},this.requestParams,{headers:{Range:`bytes=${_.firstByte}-${_.lastByte}`}}),n=i.cG(r,m);if(null!==a){let i=this._fetchQueuePerLayer.get(a)||[];i.push(()=>{n.cancel(),l.cancel()}),this._fetchQueuePerLayer.has(a)||this._fetchQueuePerLayer.set(a,i)}}}updateNeeded(i,r){return(!this.textureDescriptorPerLayer.get(i)||this.textureDescriptorPerLayer.get(i).band!==r||this.refreshedUponExpiration)&&"errored"!==this.state}updateTextureDescriptor(r,a,n){if(!this._mrt)return;let o=this._mrt.getLayer(r);if(!o||!o.hasBand(n)||!o.hasDataForBand(n))return;let{bytes:s,tileSize:l,buffer:h,offset:u,scale:c}=o.getBandView(n),d=l+2*h,f=new i.ay({width:d,height:d},s),p=this.texturePerLayer.get(a);p&&p instanceof i.a_&&p.update(f,{premultiply:!1}),this.textureDescriptorPerLayer.set(a,{layer:r,band:n,img:f,buffer:h,offset:u,tileSize:l,format:o.pixelFormat,mix:[c,256*c,65536*c,0x1000000*c]})}destroy(r=!1){if(super.destroy(r),delete this._mrt,!r)for(let r of this.texturePerLayer.values())r&&r instanceof i.a_&&r.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}function iU(r,a){let n=Math.pow(2,a.z),o=Math.floor(i.ek(r.getWest())*n),s=Math.floor(i.el(r.getNorth())*n),l=Math.ceil(i.ek(r.getEast())*n),h=Math.ceil(i.el(r.getSouth())*n);return a.x>=o&&a.x<l&&a.y>=s&&a.y<h}class iV{constructor(r,a,n){this.bounds=r?i.ac.convert(this.validateBounds(r)):null,this.minzoom=a||0,this.maxzoom=n||24}
8validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}addExtraBounds(r){if(r)for(let a of(this.extraBounds||(this.extraBounds=[]),r))this.extraBounds.push(i.ac.convert(this.validateBounds(a)))}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!iU(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(let r of this.extraBounds)if(iU(r,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;let r=new iV(i.bounds,i.minzoom,i.maxzoom);return r.addExtraBounds(i.extra_bounds),r}}class ij extends i.y{constructor(r,a,n,o){super(),this.id=r,this.dispatcher=n,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},a),Object.assign(this,i.eF(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new i.x("dataloading",{dataType:"source"}));let a=this.map.getWorldview(),n=(a,n)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.v(a)):n&&(Object.assign(this,n),n.raster_layers&&(this.rasterLayers=n.raster_layers,this.rasterLayerIds=this.rasterLayers.map(i=>i.id)),this.tileBounds=iV.fromTileJSON(n),Y(n.tiles),this.fire(new i.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.x("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)};this.provider="string"==typeof this._options.provider?this._options.provider:void 0,this._tileProvider=void 0;let o=i.f1(this._options);return o instanceof Error?(this._loaded=!0,this.fire(new i.v(o)),void(r&&r())):this.provider&&!o?(this._loaded=!0,this.fire(new i.v(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=o?this.loadTileJSONWithProvider(o,n):i.e7(this._options,this.map._requestManager,null,a,n))}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.eC(this._options,this.map._requestManager),s=new AbortController;return i.e8(r.name,r.url).then(i=>{if(s.signal.aborted)return;let r=new i(o);return r.load&&n?r.load({request:n}).then(i=>(this._tileProvider=r,i)):(this._tileProvider=r,null)}).then(r=>{if(s.signal.aborted)return;let n=i.eW(this._options,r,this.map._requestManager);n instanceof Error?a(n):a(null,n)}).catch(i=>{s.signal.aborted||a(i instanceof Error?i:Error(String(i)))}),{cancel:()=>s.abort()}}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,a){let n=i.co.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize),s=this.map._requestManager.transformRequest(o,i.aH.Tile);if(this._tileProvider){let i=new AbortController;r.request={cancel:()=>i.abort()},this.loadTileWithProvider(r,this._tileProvider,s,i,a)}else r.request=i.cQ(s,(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n)return r.state="errored",a(n);if(!o)return a(null);let l=i.cO(s);this.map._refreshExpiredTiles&&r.setExpiryData(l),r.setTexture(o,this.map.painter),r.state="loaded",i.bv(this.dispatcher),a(null)})}async loadTileWithProvider(i,r,a,n,o){let{z:s,x:l,y:h}=i.tileID.canonical;try{let u=await r.loadTile({z:s,x:l,y:h},{request:a,signal:n.signal});if(n.signal.aborted)return i.state="unloaded",o(null);if(null==u){let r=Error("Tile not found");return r.status=404,i.state="errored",o(r)}if(null==u.data)return i.state="loaded",o(null);let c=u.data instanceof ImageBitmap?u.data:await createImageBitmap(new Blob([u.data]));if(n.signal.aborted)return i.state="unloaded",o(null);i.setTexture(c,this.map.painter),i.state="loaded",this.map._refreshExpiredTiles&&i.setExpiryData({cac
8heControl:u.cacheControl,expires:u.expires}),o(null)}catch(r){if(n.signal.aborted||r instanceof DOMException&&"AbortError"===r.name)return i.state="unloaded",o(null);i.state="errored",o(r instanceof Error?r:Error(String(r)))}finally{delete i.request}}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r&&r()}unloadTile(r,a){r.texture&&r.texture instanceof i.a_?(r.destroy(!1),r.texture&&r.texture instanceof i.a_&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class iG extends ij{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},r)}triggerRepaint(i){let r=this.map.painter._terrain,a=this.map.style.getSourceCache(this.id);r&&r.enabled&&a&&r._clearRenderCacheForTile(a.id,i.tileID),this.map.triggerRepaint()}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.aH.Tile),s={request:o,uid:r.uid,tileID:r.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};r.source=this.id,r.scope=this.scope,r.requestParams=o,r.actor||(r.actor=this.dispatcher.getActor());let l=(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n){if("AbortError"===n.name)return;return r.state="errored",a(n)}if(this.map._refreshExpiredTiles&&o){let a=i.cO(s);r.setExpiryData(a)}if(this.partial&&"expired"!==r.state)r.state="empty";else if(!this.partial){if(!o)return a(null);r.state="loaded",r._isHeaderLoaded=!0,r._mrt=o}a(null)};r.request=this.partial?r.fetchHeader(void 0,l.bind(this)):r.actor.send("loadTile",s,l.bind(this),void 0,!0)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(i,r){let a=i.texturePerLayer;if(i.flushAllQueues(),a.size)for(let r of(i.destroy(!1),a.values()))this.map.painter.saveTileTexture(r);else i.destroy()}prepareTile(r,a,n,o){r._isHeaderLoaded&&("empty"!==r.state&&(r.state="reloading"),r.fetchBandForRender(a,n,o,(a,o)=>{a?(r.state="errored",this.fire(new i.v(a))):o&&(r._isHeaderLoaded=!0,r.setTexturePerLayer(n,o,this.map.painter),r.state="loaded"),this.triggerRepaint(r)}))}getInitialBand(i){if(!this.rasterLayers)return 0;let r=this.rasterLayers.find(({id:r})=>r===i),a=r&&r.fields,n=a&&a.bands&&a.bands;return n?n[0]:0}getTextureDescriptor(r,a,n){if(!r)return;let o=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!o)return;let s=null;a instanceof i.aA?s=a.paint.get("raster-array-band"):a instanceof i.az&&(s=a.paint.get("raster-particle-array-band"));let l=s||this.getInitialBand(o);return null==l?void 0:r.textureDescriptorPerLayer.get(a.id)?!r.updateNeeded(a.id,l)||n?Object.assign({},r.textureDescriptorPerLayer.get(a.id),{texture:r.texturePerLayer.get(a.id)}):void 0:void this.prepareTile(r,o,a.id,l)}getImages(r,a){let n=new Map;for(let o of r)for(let r of a){let[a,s]=r.split("/"),l=o.getLayer(a);if(!l||!l.hasBand(s)||!l.hasDataForBand(s))continue;let{bytes:h,tileSize:u,buffer:c}=l.getBandView(s),d=u+2*c,f={data:new i.ay({width:d,height:d},h),pixelRatio:2,sdf:!1,usvg:!1,version:0};n.set(r,f)}return n}queryRasterArrayValueByBandId(r,a,n){let o=a._mrt;return new Promise(s=>{let l={},h=new Set;for(let[u,c]of Object.entries(o.layers)){if(n.layerName&&u!==n.layerName)continue;let d={};for(let{bands:f}of(l[u]=d,c.dataIndex))for(let p of f)n.bands&&!n.bands.includes(p)||(h.add(i.ea(u,p)),a.fetchBand(u,null,p,a=>{i.co.frame(()=>{d[p]=a?null:function([r,a],n,o,{scaled:s=!0}={}){let{tileSize:l,buffer:h}=o,{x:u,y:c,z:d}=n;if(!isFinite(u)||!isFinite(c)||!isFinite(d))throw Error("Invalid MRT header");let f=2**d;return function([i,r],a,{scaled:n=!0}={}){if(!a)throw Error("bandView is undefined");let{data:o,tileSize:s,buffer:l,offset:h,scale:u,dimension:c}=a;if(i<-l||i>s+l||r<-l||r>s+l)throw Error(`Point (${i}, ${r}) out of bounds for tileSize=${s}, buffer=${l}`);let d=(r+l)*(s+2*l)+(i+l);if(0xffffffff===new Uint32Array(o.buffer)[d])return null;let f=[];f=n?[]:new a.data.constructor(c);for(let i=0;i<c;i++)f[i]=Math.round(1e12*(o[c*d+i]*u+h))/1e12;return f}([Math.min(Math.max(-h,Math.floor((f*i.ek(r)-u)*l)),l-1+h),Math.min(Math.max(-h,Math.floor((f*i.el(a)-c)*l)),l-1+h)],o,{scaled:s})}([r.lng,r.lat],o,c.getBandView(p)),h.delete(i.ea(u,p)),0===h.size&&s(l)})},!1))}0===h.size&&s(l)})}_loadTileForQuery(r,a){if(this._loadTileLoaded[r.uid])return void a(null,r._mrt);if(this._loadTilePending[r.uid])return void this._loadTilePending[r.uid].push(a);this._loadTilePending[r.uid]=[a];let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.aH.Tile);r.actor.send("loadTile",{request:o,uid:r.uid,tileID:r.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(a,n,o)=>{if(a)return this._loadTilePending[r.uid].forEach(i=>i(a,null)),void delete this._loadTilePending[r.uid];if(!n)return this._loadTilePending[r.uid].forEach(i=>i(null,null)),void delete this._loadTilePending[r.uid];if(this.map._refreshExpiredTiles&&n){let a=i.cO(o);r.setExpiryData(a)}r._mrt=n,r._isHeaderLoaded=!0,r.state="loaded",this._loadTilePending[r.uid].forEach(i=>i(null,n)),this._loadTileLoaded[r.uid]=!0,delete this._loadTilePending[r.uid]},void 0,!0)}queryRasterArrayValueByAllBands(i,r,a){return new Promise((n,o)=>{this._loadTileForQuery(r,(s,l)=>{s?o(s):n(l?this.queryRasterArrayValueByBandId(i,r,a):null)})})}queryRasterArrayValue(r,a){let n=i.ab.convert(r),o=this.findLoadedParent(n);return o&&o._mrt?a.bands||!this.partial?this.queryRasterArrayValueByBandId(n,o,a):this.queryRasterArrayValueByAllBands(n,o,a):Promise.resolve(null)}findLoadedParent(r){let a=i.ag.fromLngLat(r,this.map.transform.tileSize),n=this.maxzoom+1,o=1<<n,s=Math.floor(a.x),l=Math.floor((a.x-s)*o),h=Math.floor(a.y*o),u=this.map.style.getSourceCache(this.id),c=new i.ap(n,s,n,l,h);return u.findLoadedParent(c,this.minzoom)}}var iH=i.b_([{name:"a_index",type:"Int16",components:1}]);class iq{constructor(r,a,n,o){const s={width:n[0],height:n[1],data:null},l=r.gl;this.targetColorTexture=new i.a_(r,s,l.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.a_(r,s,l.RGBA8,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,o),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let n=this.context.gl,o=a.width*a.height;this.particleTexture0=new i.a_(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.a_(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1});let s=new i.aL;s.reserve(o);for(let i=0;i<o;i++)s.emplaceBack(i);this.particleIndexBuffer=this.context.createVertexBuffer(s,iH.members,!0),this.particleSegment=i.aJ.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=i.co.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function i$(r,a,n,o,s){if(s>0){let l=i.co.now(),h=(l-r.timeAdded)/s,u=a?(l-a.timeAdded)/s:-1,c=n.getSource(),d=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),f=!a||Math.abs(a.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),p=f&&r.refreshedUponExpiration?1:i.bG(f?h:1-u,0,1);return a?{opacity:1,mix:1-p,isFading:h<1}:{opacity:p,mix:0,isFading:h<1}}return{opacity:1,mix:0,isFading:!1}}var iZ="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",iW="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",iX="\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#elif defined(FLOAT_RENDER_TARGET)\nlayout(location=0) out highp vec4 glFragColor;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nconst float DITHER_THRESHOLDS[16]=float[16](\n1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0
8/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\n);vec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}float cutoutGroundRoofOpacity(vec4 groundRoof) {\n#ifdef INDICATOR_CUTOUT\nfloat fadeStartX=u_indicator_cutout_params.w;float holeRadius=u_indicator_cutout_params.y;float holeMinOpacity=mix(u_indicator_cutout_params.x,1.0,smoothstep(u_indicator_cutout_params.z,u_indicator_cutout_centers.z,groundRoof.y));float distX=abs(u_indicator_cutout_centers.x-groundRoof.x);float roofOpacity=mix(holeMinOpacity,1.0,smoothstep(fadeStartX,holeRadius,u_indicator_cutout_centers.y-groundRoof.w));float groundOpacity=min(smoothstep(fadeStartX,holeRadius,distX)+holeMinOpacity,1.0);return max(roofOpacity,groundOpacity);\n#else\nreturn 1.0;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}",iY="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
8return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n#endif",iK="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",iJ="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
8\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
8size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nint NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nhighp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif",iQ="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",i0="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
8vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",i1="\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif",i2="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}
8vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",i3="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif",i4="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";
8let i5=/#include\s+"([^"]+)"/g,i6=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,i8=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,i9=new Set(["ifdef","ifndef","elif","if","defined"]),i7=new Set;rh(iW,i7),rh(iY,i7),rh(iX,i7);let re={"_prelude_fog.vertex.glsl":iQ,"_prelude_terrain.vertex.glsl":iJ,"_prelude_shadow.vertex.glsl":i3,"_prelude_material_table.vertex.glsl":"#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define MATERIAL_TABLE_DEBUG 0\nuniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;\n#if MATERIAL_TABLE_DEBUG\nvec4 colorDebug;\n#endif\n};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { \nif (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; \n}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { \niRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;\n#if MATERIAL_TABLE_DEBUG\nconst vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;\n#endif\nuint offset=0u;\n#if MATERIAL_TABLE_DEBUG\nbool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}\n#endif\noffset++;\n#if MATERIAL_TABLE_DEBUG\nuint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}\n#endif\noffset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}\n#endif\nuint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding)\n{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}\n#endif\noffset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}\n#endif\ninfo.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)\n{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)\n#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));\n#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;\n#endif","_prelude_fog.fragment.glsl":i0,"_prelude_shadow.fragment.glsl":i4,"_prelude_lighting.glsl":i1,"_prelude_raster_array.glsl":i2},rt={},ri="precision highp float;",rr="precision mediump float;",ra="\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif",rn={preludeTerrain:rc("",iJ),preludeFog:rc(i0,iQ),preludeShadow:rc(i4,i3),preludeRasterArray:rc(i2,""),preludeLighting:rc(i1,i1),preludePrecisionQualifiers:rc(rr,ri),prelude:rc(iX,iY),preludeExtensions:rc(ra,"")},ro=[ra,rr,iW,rn.prelude.fragmentSource].join("\n"),rs=[ri,iW,rn.prelude.vertexSource].join("\n");var rl={background:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;
8\n#ifdef FEATURE_CUTOUT\nvec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nfloat factorTex=min(texture(u_cutout_factor_image,uv).r,1.0);float cutoutFactor=(1.0-u_feature_cutout_params.x)*factorTex;out_color=u_color*(1.0-cutoutFactor);\n#else\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifndef FEATURE_CUTOUT\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\n}'),backgroundPattern:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),circle:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
8iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nsurface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:rc("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:rc('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:rc("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:rc("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}'),collisionCircle:rc("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));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(\n0.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=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:rc("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
8\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\n#endif\n}'),fill:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(opacity*u_opacity_multiplier);\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fillOutlinePattern:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillPattern:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),lineBlendComposite:rc("uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;\n#define ADDITIVE 1\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:rc("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
8s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}\n#else\ncolor=applyCutout(color,h);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;
vendor: 9,210 bytes, line 8
8uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\nout vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\n#else\nh=t > 0.0 ? height : base;\n#endif\npos=vec3(pos_nx.xy,h);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\n#endif\n#ifdef RENDER_CUTOFF\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_FRONT_CUTOFF\nv_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 pos_ground=u_matrix*vec4(pos.xy,ele,1.0);vec4 pos_roof=u_matrix*vec4(pos.xy,ele+height,1.0);v_ground_roof=vec4(pos_ground.xy/pos_ground.w,pos_roof.xy/pos_roof.w);\n#endif\n#endif\n}'),fillExtrusion
8Depth:rc("void main() {}",'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}'),fillExtrusionPattern:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:rc('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\n#ifdef FEATURE_CUTOUT\nshadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:rc("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
8\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=float(a_hidden_by_landmark);\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:rc("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),line:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;in vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 v_elevation_id_col;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\npxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=ANTIALIASING/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {if (border_color.a==0.0) {\n#ifndef RENDER_LINE_GRADIENT\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;
8float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}\n#else\nout_color.rgb*=(0.6+0.4*alpha2);\n#endif\n} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}out_color*=v_width2_dilute.w;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*diluted_opacity*u_opacity_multiplier);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef LINE_BLEND_ADDITIVE\n{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}\n#else\n#ifdef LINE_BLEND_MULTIPLY\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);\n#else\nglFragColor=out_color;\n#endif\n#endif\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef DEBUG_ELEVATION_ID\nglFragColor=vec4(v_elevation_id_col,1.0);\n#endif\nif (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)\nin vec4 a_z_offset_width;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 a_elevation_id_col;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nout vec3 v_elevation_id_col;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_floor_width_scale;\n#ifdef RENDER_LINE_CURVE\nuniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;\n#endif\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;out vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\n#ifdef RENDER_LINE_CURVE\nvec3 getCurvePoint(int index) {int row=index/3;int col=index-row*3;float x=u_curve_points_x[row][col];float y=u_curve_points_y[row][col];float z=u_curve_points_z[row][col];return vec3(x,y,z);}vec3 catmullRom(vec3 p0,vec3 p1,vec3 p2,vec3 p3,float t) {float t2
8=t*t;float t3=t2*t;return 0.5*(\n2.0*p1+(-p0+p2)*t+(2.0*p0-5.0*p1+4.0*p2-p3)*t2+(-p0+3.0*p1-3.0*p2+p3)*t3\n);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(\n(-p0+p2)+(2.0*p0-5.0*p1+4.0*p2-p3)*2.0*t+(-p0+3.0*p1-3.0*p2+p3)*3.0*t2\n);}struct CurveResult {vec3 point;vec2 tangent;};CurveResult calculateCurve(float line_progress) {float curve_progress=line_progress*(u_curve_point_count-1.0);float curve_progress_local=fract(curve_progress);float curve_segment=floor(curve_progress);int seg=int(curve_segment);vec3 p1=getCurvePoint(seg);vec3 p2=getCurvePoint(seg+1);float is_first_seg=step(curve_segment,0.5);vec3 p0_extrapolated=p1-(p2-p1);vec3 p0_fetched=getCurvePoint(max(seg-1,0));vec3 p0=mix(p0_fetched,p0_extrapolated,is_first_seg);int last_seg=int(u_curve_point_count)-2;float is_last_seg=step(float(last_seg)-0.5,curve_segment);vec3 p3_extrapolated=p2+(p2-p1);vec3 p3_fetched=getCurvePoint(min(seg+2,int(u_curve_point_count)-1));vec3 p3=mix(p3_fetched,p3_extrapolated,is_last_seg);vec3 point=catmullRom(p0,p1,p2,p3,curve_progress_local);vec2 tangent=catmullRomTangent(p0.xy,p1.xy,p2.xy,p3.xy,curve_progress_local)*(u_curve_point_count-1.0);CurveResult result;result.point=point;result.tangent=tangent;return result;}\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\n#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH\nemissive_strength=a_z_offset_width.w;\n#endif\nfloat a_z_offset=u_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset+=a_z_offset_width.x;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nv_elevation_id_col=a_elevation_id_col;\n#endif\nhighp float line_progress=0.0;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nline_progress=a_packed[2];\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\nvec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;\n#ifdef RENDER_LINE_CURVE\nCurveResult curve=calculateCurve(line_progress);pos=curve.point.xy*8192.0;a_extrude=length(a_extrude)*normalize(curve.tangent);a_extrude=left ? vec2(-a_extrude.y,a_extrude.x) : vec2(a_extrude.y,-a_extrude.x);a_z_offset+=curve.point.z;\n#endif\ngapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=u_width_scale*(left ? left_width : right_width);if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;symmetric_outset=zero_right_width ? u_width_scale*left_width : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
8vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\nv_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\nv_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);\n#endif\n#endif\n#ifndef ELEVATED\n#ifndef VARIABLE_LINE_WIDTH\n#ifndef RENDER_TO_TEXTURE\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else\n{\n#ifdef RENDER_LINE_BORDER\nfloat border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);\n#endif\n}}\n#endif\n#endif\nv_tile_pos=(v_tile_pos+extrude)/EXTENT;\n#ifdef ELEVATED_ROADS\ngl_Position=gl_Position+projected_extrude;\n#else\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nvec4 dashf=vec4(dash);float totalLength=dashf.z+dashf.w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dashf.y+dashf.x+0.5)/u_texsize.y);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef VARIABLE_LINE_WIDTH\nv_width2_dilute.x=symmetric_outset;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow
vendor: 12,103 bytes, line 8
8.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec4 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:
8rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;
vendor: 5,542 bytes, line 8
8\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;\n#endif\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;in uvec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT);\n#endif\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nvec4 world_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nfloat tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\n#endif\nvec4 merc_world_pos=vec4(0.0); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\n#ifdef ELEVATION_REFERENCE_GROUND\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\n#else\nuv=vec2(a_texture_pos)/8192.0;\n#endif\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\n#ifdef FOG\nv_fog_pos=fog_position(decodedPos);\n#endif\n#endif\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef ELEVATED\nfloat z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);\n#endif\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),symbol:
8rc('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\nin lowp float v_opacity;\n#ifdef RENDER_SDF\nin lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nin lowp float v_emissive_strength;\n#endif\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#endif\nvoid main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nlowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;\n#ifdef RENDER_SDF\nfill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;\n#endif\nlowp float emissive_strength=0.0;\n#ifdef LIGHTING_3D_MODE\nemissive_strength=v_emissive_strength;\n#endif\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#endif\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity*u_opacity_multiplier;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin uvec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\n#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_VEC4 3u\n#define DWORDS_PER_VEC4 4u\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;float zoomFactor;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_fill_color_zoom_factor;uniform highp float u_spp_halo_color_zoom_factor;uniform highp float u_spp_opacity_zoom_factor;uniform highp float u_spp_halo_width_zoom_factor;uniform highp float u_spp_halo_blur_zoom_factor;uniform highp float u_spp_emissive_strength_zoom_factor;uniform highp float u_spp_occlusion_opacity_zoom_factor;uniform highp float u_spp_z_offset_zoom_factor;uniform highp float u_spp_translate_zoom_factor;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;\n#ifdef RENDER_SDF\nout lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nout lowp float v_emissive_strength;\n#endif\nPropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords,float zoomFactor) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;type.zoomFactor=zoomFactor;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask =u_spp_header.header[0][0];uint zoomDependentMask =u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3],u_spp_fill_color_zoom_factor);header.halo_np_color =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0],u_spp_halo_color_zoom_factor);header.opacity =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1],u_spp_opacity_zoom_factor);header.halo_width =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2],u_spp_halo_width_zoom_factor);header.halo_blur =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3],u_spp_halo_blur_zoom_factor);header.emissive_strength=getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0],u_spp_emissive_strength_zoom_factor);header.occlusion_opacity=getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1],u_spp_occlusion_opacity_zoom_factor);header.z_offset =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2],u_spp_z_offset_zoom_factor);header.translate =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3],u_spp_translate_zoom_factor);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,propertyType.zoomFactor);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {return mix(slot.xy,slot.zw,propertyType.zoomFactor);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,propertyType.zoomFactor);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color =header.fill_np_color.isDataDriven ? readColorProperty(header.fill_np_color,sizeVec4) : u_spp_fill_np_color;props.halo_np_color =header.halo_np_color.isDataDriven ? readColorProperty(header.halo_np_color,sizeVec4) : u_spp_halo_np_color;props.opacity =header.opacity.isDataDriven ? readFloatProperty(header.opacity,sizeVec4) : u_spp_opacity;props.halo_width =header.halo_width.isDataDriven ? readFloatProperty(header.halo_width,sizeVec4) : u_spp_halo_width;props.halo_blur =header.halo_blur.isDataDriven ? readFloatProperty(header.halo_blur,sizeVec4) : u_spp_halo_blur;props.emissive_strength =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset =header.z_offset.isDataDriven ? readFloatProperty(header.z_offset,sizeVec4) : u_spp_z_offset;props.translate =header.translate.isDataDriven ? readVec2Property(header.translate,sizeVec4) : vec2(0.0);return props;}\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define highp float z_offset\n#endif\nvec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}
8void main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nSymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;\n#ifdef RENDER_SDF\nv_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_emissive_strength=paint_properties.emissive_strength;\n#endif\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize highp float z_offset\n#endif\nvec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\n#ifdef Z_TEST_OCCLUSION\nout_fade_opacity*=occlusion_opacity;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
8\n#ifdef USE_PAINT_PROPERTIES_UBO\n{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\nu_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=vec2(a_texb)/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'),terrainRaster:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:rc("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:rc('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
8nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iK),skyboxGradient:rc('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iK),skyboxCapture:rc
vendor: 3,689 bytes, line 8
8("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
8v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:rc('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),stars:rc("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),occlusion:rc("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function rh(i,r){for(let a of i.split("\n")){if("#"!==(a=a.trimStart())[0]||!a.includes("if")||a.startsWith("#endif"))continue;let i=a.match(i8);if(i)for(let a of i)i9.has(a)||r.add(a)}}function ru(i){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(i)}function rc(i,r){let a=new Set,n=[],o=[];i=i.replace(i5,(i,r)=>(o.push(r),"")),r=r.replace(i5,(i,r)=>(n.push(r),""));let s=new Set(i7);for(let a of(rh(i,s),rh(r,s),[...n,...o]))rt[a]||(rt[a]=new Set,rh(re[a],rt[a])),s=new Set([...s,...rt[a]]);return{fragmentSource:i=i.replace(i6,(i,r,n,o,s)=>(a.add(s),"define"===r?` 9#ifndef HAS_UNIFORM_u_${s} 10${ru(o)?"flat ":""}in ${n} ${o} ${s}; 11#else 12uniform ${n} ${o} u_${s}; 13#endif 14`:"initialize"===r?` 15#ifdef HAS_UNIFORM_u_${s} 16 ${n} ${o} ${s} = u_${s}; 17#endif 18`:"define-attribute"===r?` 19#ifdef HAS_ATTRIBUTE_a_${s} 20 in ${n} ${o} ${s}; 21#endif 22`:"initialize-attribute"===r?"":void 0)),vertexSource:r=r.replace(i6,(i,r,n,o,s)=>{let l=`MATERIAL_ATTRIBUTE_OFFSET_${s}`,h="float"===o?"vec2":o,u=`GET_ATTRIBUTE_${h}(a_${s}, materialInfo, ${l})`,c=s.includes("color")?"color":h;return"define-attribute-vertex-shader-only"===r?` 23#ifdef HAS_ATTRIBUTE_a_${s} 24in ${n} ${o} a_${s}; 25#endif 26`:a.has(s)?"define"===r?` 27#ifndef HAS_UNIFORM_u_${s} 28uniform lowp float u_${s}_t; 29 #if !defined(${l}) 30 in ${n} ${h} a_${s}; 31 #endif 32${ru(o)?"flat ":""}out ${n} ${o} ${s}; 33#else 34uniform ${n} ${o} u_${s}; 35#endif 36`:"initialize"===r?"vec4"===c||"uvec4"===c?` 37#ifndef HAS_UNIFORM_u_${s} 38 ${s} = a_${s}; 39#else 40 ${n} ${o} ${s} = u_${s}; 41#endif 42`:` 43#if !defined(HAS_UNIFORM_u_${s}) 44 #ifdef ${l} 45 ${s} = unpack_mix_${c}(${u}, u_${s}_t); 46 #else 47 ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 48 #endif 49#else 50 ${n} ${o} ${s} = u_${s}; 51#endif 52`:"define-attribute"===r?` 53#ifdef HAS_ATTRIBUTE_a_${s} 54 in ${n} ${o} a_${s}; 55 out ${n} ${o} ${s}; 56#endif 57`:"initialize-attribute"===r?` 58#ifdef HAS_ATTRIBUTE_a_${s} 59 ${s} = a_${s}; 60#endif 61`:void 0:"define"===r?` 62#ifndef HAS_UNIFORM_u_${s} 63uniform lowp float u_${s}_t; 64 #if !defined(${l}) 65 in ${n} ${h} a_${s}; 66 #endif 67#else 68uniform ${n} ${o} u_${s}; 69#endif 70`:"define-instanced"===r?"mat4"===c?` 71#ifdef INSTANCED_ARRAYS 72in vec4 a_${s}0; 73in vec4 a_${s}1; 74in vec4 a_${s}2; 75in vec4 a_${s}3; 76#else 77uniform ${n} ${o} u_${s}; 78#endif 79`:` 80#ifdef INSTANCED_ARRAYS 81in ${n} ${h} a_${s}; 82#else 83uniform ${n} ${o} u_${s}; 84#endif 85`:"initialize-attribute-custom"===r?` 86#ifdef HAS_ATTRIBUTE_a_${s} 87 ${n} ${o} ${s} = a_${s}; 88#endif 89`:"vec4"===c||"uvec4"===c?` 90#ifndef HAS_UNIFORM_u_${s} 91 #ifdef ${l} 92 ${n} ${o} ${s} = ${u}; 93 #else 94 ${n} ${o} ${s} = a_${s}; 95 #endif 96#else 97 ${n} ${o} ${s} = u_${s}; 98#endif 99`:` 100#ifndef HAS_UNIFORM_u_${s} 101 #ifdef ${l} 102 ${n} ${o} ${s} = unpack_mix_${c}(${u}, u_${s}_t); 103 #else 104 ${n} ${o} ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 105 #endif 106#else 107 ${n} ${o} ${s} = u_${s}; 108#endif 109`}),usedDefines:s,vertexIncludes:n,fragmentIncludes:o}}re["_prelude_raster_particle.glsl"]||(re["_prelude_raster_particle.glsl"]=iZ);var rd={building:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
109\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nhighp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;\n#if 0\nif (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;\n#else\nif (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;\n#endif\nreturn out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat flood_radiance=(1.0-min(v_pos.z/v_flood_radiu
109s,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}\n#else\ncolor=applyCutout(color,v_pos.z);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=color;\n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;\n#ifdef FLOOD_LIGHT\nin int a_flood_light_wall_radius_1i16;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nout vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);\n#endif\nvec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);\n#ifdef BUILDING_FAUX_FACADE\nvec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}\n#endif\nv_pos=a_pos_3f;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nfloat halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;
109vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nv_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 ic_ground=u_matrix*vec4(v_pos.xy,0.0,1.0);vec4 ic_roof=u_matrix*vec4(v_pos.xy,v_pos.z,1.0);v_ground_roof=vec4(ic_ground.xy/ic_ground.w,ic_roof.xy/ic_roof.w);\n#endif\n#endif\n}'),buildingBloom:rc("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"),buildingDepth:rc("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
109\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=vec2(a_texture_pos)/8192.0;gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:rc("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:rc("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:rc('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:rc("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);
109simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:rc("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:rc("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),elevatedStructuresDepth:rc("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructures:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
109vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;uniform float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nout_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),elevatedStructuresDepthReconstruct:rc("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#ifdef FEATURE_CUTOUT\napply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}")};rc(iZ,"");let rf=i.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),rp=i.b_([{type:"Float32",name:"a_pos_2f",components:2}]);class rm{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,a){var n;let o=r.getOrCreateProgram("vignette");
109if(!this.vignetteVx||!this.vignetteIdx){let a=new i.aO,n=new i.aT;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1),n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(a,rp.members),this.vignetteIdx=r.context.createIndexBuffer(n)}let s=i.aJ.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,o);let i={u_vignetteShape:(n={vignetteShape:[a.start,a.range,Math.pow(10,a.fadePower)],vignetteColor:[a.color.r,a.color.g,a.color.b,a.color.a*a.strength]}).vignetteShape,u_vignetteColor:n.vignetteColor};o.draw(r,r.context.gl.TRIANGLES,tN.disabled,t7.disabled,ie.alphaBlended,tk.disabled,i,"vignette",this.vignetteVx,this.vignetteIdx,s)}}}class r_{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,a){let n=r.getFreeCameraOptions().position,o=n.toAltitude(),s=n.toLngLat(),l=i.c4(s.lng),h=i.c4(s.lat),u=r.pixelsPerMeter/a,c=l*i.c9,d=i.c9*Math.log(Math.tan(Math.PI/4+h/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{let i=-this._offsetYPrev+d,r=-this._elevationPrev+o;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*u,this._accumulatedOffsetY+=i*u,this._accumulatedElevation+=r*u,this._offsetXPrev=c,this._offsetYPrev=d,this._elevationPrev=o}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function rg(i,r){return[-(i[0]-Math.floor(i[0]/r)*r),-(i[1]-Math.floor(i[1]/r)*r),-(i[2]-Math.floor(i[2]/r)*r)]}function ry(r){let a=i.eq(0x134104da55e),n=[];for(let o=0;o<r;++o){let r=2*a()-1,o=2*a()-1,s=2*a()-1;n.push(i.cx(r,o,s))}return n}function rx(r,a,n,o,s){let l=i.bG((s-n)/(o-n),0,1);return i.dY(r,a,l)}class rv{constructor(i){this._movement=new r_,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new rm,this._ppmScaleFactor=i}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,a){let n=r.transform;this._movement.update(n,this._ppmScaleFactor);let o=n.starsProjMatrix,s=i.dp([]);i.f2(s,s,i.c4(90)-n._pitch),i.f5(s,s,-n.angle);let l=i.ct(new Float32Array(16),s),h=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),u=i.fR([],h),c=i.er([],u,l),d=Date.now()/1e3;return this._accumulatedTimeFromStart+=(d-this._prevTime)*a,this._prevTime=d,{projectionMatrix:o,modelviewMatrix:c}}}let rb=i.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]),rw=(i,r)=>({u_matrix:i,u_depth_bias:r}),rT=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r,u_opacity_multiplier:1}),rS=(i,r,a,n,o)=>({u_matrix:i,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:a,u_height_scale:n,u_reset_depth:o});function rE(r,a){let n=1<<r.canonical.z,o=(a.x*n-r.canonical.x-r.wrap*n)*i.r,s=(a.y*n-r.canonical.y)*i.r,l=i.bn(a.z,a.y);return i.cx(o,s,l)}class rI{constructor(i=[]){this.tiles=i}getTile(i){for(let r of this.tiles)if(r.tileId.z===i.z&&r.tileId.x===i.x&&r.tileId.y===i.y)return r;return null}getTileOrParent(i){for(let r=i.z;r>0;--r){let a=Math.floor(i.x/(1<<i.z-r)),n=Math.floor(i.y/(1<<i.z-r));for(let i of this.tiles)if(i.tileId.z===r&&i.tileId.x===a&&i.tileId.y===n&&0!==i.frcMask)return i}return null}getFullCoverageMask(r){let a=null,n=0;for(let i=r.z;i>0;--i){let o=Math.floor(r.x/(1<<r.z-i)),s=Math.floor(r.y/(1<<r.z-i));for(let r of this.tiles)if(r.tileId.z===i&&r.tileId.x===o&&r.tileId.y===s){a=r,n=i;break}if(a)break}if(!a||0===a.frcMask)return null;let o=1<<r.z-n,s=i.r/o,l=r.x%o*s,h=r.y%o*s,u=l+s,c=h+s,d=0;for(let i of a.polygons)0!==i.frcMask&&(i.hasGeometry()?0===i.rings.length||r.z<=n||function(i,r,a,n,o){let s=[0,0,0,0],l=[r,n,n,r],h=[a,a,o,o];for(let u of i){let i=u.length;if(!(i<2))for(let c=0,d=i-1;c<i;d=c++){let i=u[d].x,f=u[d].y,p=u[c].x,m=u[c].y;for(let r=0;r<4;++r)f>h[r]!=m>h[r]&&l[r]<i+(p-i)*(h[r]-f)/(m-f)&&s[r]++;let _=0,g=0;if(i<r?_|=1:i>n&&(_|=2),f<a?_|=4:f>o&&(_|=8),p<r?g|=1:p>n&&(g|=2),m<a?g|=4:m>o&&(g|=8),!(_&g)&&(0===_||0===g||function(i,r,a,n,o,s,l,h){let u=(i,r,a,n,o,s,l,h)=>{let u=(a-i)*(s-r)-(n-r)*(o-i),c=(a-i)*(h-r)-(n-r)*(l-i);if(u>0&&c>0||u<0&&c<0)return!1;let d=(l-o)*(r-s)-(h-s)*(i-o),f=(l-o)*(n-s)-(h-s)*(a-o);return!(d>0&&f>0||d<0&&f<0)};return!!(u(i,r,a,n,o,s,l,s)||u(i,r,a,n,l,s,l,h)||u(i,r,a,n,o,h,l,h)||u(i,r,a,n,o,s,o,h))}(i,f,p,m,r,a,n,o)))return!1}}for(let i=0;i<4;++i)if(!(1&s[i]))return!1;return!0}(i.rings,l,h,u,c)&&(d|=i.frcMask):d|=i.frcMask);return 0!==d?d:null}equals(i){if(this.tiles.length!==i.length)return!1;for(let r=0;r<this.tiles.length;++r){let a=this.tiles[r],n=i[r];if(a.tileId.z!==n.tileId.z||a.tileId.x!==n.tileId.x||a.tileId.y!==n.tileId.y||a.frcMask!==n.frcMask||a.polygons.length!==n.polygons.length)return!1}return!0}empty(){return 0===this.tiles.length}}class rA{constructor(){this._tileCoverages=[],this._snapshot=new rI}clear(){this._tileCoverages=[]}addTileCoverage(i,r){this._tileCoverages.push({tileId:i,polygons:r,frcMask:function(i){let r=0;for(let a of i)r|=a.frcMask;return r}(r)})}empty(){return 0===this._tileCoverages.length}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;let i=this._tileCoverages.map(i=>({tileId:i.tileId,polygons:i.polygons,frcMask:i.frcMask}));return this._snapshot=new rI(i),this._snapshot}}class rM{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(let i in this.data)for(let r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,a){let n=i.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);let o={value:r,timeout:void 0};if(void 0!==a&&(o.timeout=setTimeout(()=>{this.remove(i,o)},a)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){let r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){let r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;let a=i.wrapped().key,n=void 0===r?0:this.data[a].indexOf(r),o=this.data[a][n];return this.data[a].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(o.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(i){let r=[];for(let a in this.data)for(let n of this.data[a])i(n.value)||r.push(n);for(let i of r)this.remove(i.value.tileID,i)}}class rC{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||Object.create(null),this.stateChanges[i][n]=this.stateChanges[i][n]||Object.create(null),Object.assign(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let r in this.deletedStates[i]=Object.create(null),this.state[i])r!==n&&(this.deletedStates[i][r]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let r in this.deletedStates[i][n]=Object.create(null),this.state[i][n])a[r]||(this.deletedStates[i][n][r]=null);else for(let r in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][r]&&delete this.deletedStates[i][n][r]}removeFeatureState(i,r,a){if(null===this.deletedStates[i])return;let n=String(r);if(this.deletedStates[i]=this.deletedStates[i]||Object.create(null),a&&void 0!==r)null!==this.deletedStates[i][n]&&(this.deletedStates[i][n]=this.deletedStates[i][n]||Object.create(null),this.deletedStates[i][n][a]=null);else if(void 0!==r)if(this.stateChanges[i]&&this.stateChanges[i][n])for(a in this.deletedStates[i][n]=Object.create(null),this.stateChanges[i][n])this.deletedStates[i][n][a]=null;else this.deletedStates[i][n]=null;else this.deletedStates[i]=null}getState(i,r){let a=this.state[i]||Object.create(null),n=this.stateChanges[i]||Object.create(null),o=this.deletedStates[i];if(null===o)return Object.create(null);if(void 0!==r){let i=String(r),s=Object.assign(Object.create(null),a[i],n[i]);if(o){let i=o[r];if(null===i)return Object.create(null);for(let r in i)delete s[r]}return s}let s=Object.assign(Object.create(null),a,n);if(o)for(let i in o)delete s[i];return s}initializeTileState(i,r){i.refreshFeatureState(r)}coalesceChanges(i,r){let a=Object.create(null);for(let i in this.stateChanges){this.state[i]=this.state[i]||Object.create(null);let r=Object.create(null);for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]=Object.create(null)),Object.assign(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||Object.create(null);let r=Object.create(null);
vendor: 1,907 bytes, line 109
109if(null===this.deletedStates[i])for(let a in this.state[i])r[a]=Object.create(null),this.state[i][a]=Object.create(null);else for(let a in this.deletedStates[i]){if(null===this.deletedStates[i][a])this.state[i][a]=Object.create(null);else if(this.state[i][a])for(let r of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][r];r[a]=this.state[i][a]}a[i]=a[i]||Object.create(null),Object.assign(a[i],r)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),0!==Object.keys(a).length)for(let n in i)i[n].refreshFeatureState(r,a)}}class rD extends i.y{constructor(i,r,a){super(),this.id=i,this._renderSourceType=a,this._maxzoomOverride=null,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new rM(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new rC,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"_dataType"in this._source&&"raster"===this._source._dataType,this._supportsFading="raster"===this._source.type||"raster-array"===this._source.type||"image"===this._source.type||"video"===this._source.type||"custom"===this._source.type,this._isRasterElevatedOverTerrain=!1}onAdd(i){this.map=i,this._minTileCacheSize=void 0===this._minTileCacheSize&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&i?i._maxTileC
109acheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let i in this._tiles)if(!this._tiles[i].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(i){this._maxzoomOverride=i}_loadTile(i,r){return i.renderSourceType=this._renderSourceType,i.isExtraShadowCaster=this._shadowCasterTiles[i.tileID.key],this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i)}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i)}serialize(){return this._source.serialize()}prepare(i){for(let r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let a=this._tiles[r];a.upload(i,this.map?this.map.painter:void 0),a.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(rR).map(i=>i.key)}getRenderableIds(r,a){let n=[];for(let i in this._tiles)this._isIdRenderable(+i,r,a)&&n.push(this._tiles[i]);return r?n.sort((r,a)=>{let n=r.tileID,o=a.tileID,s=new i.au(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),l=new i.au(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(i=>i.tileID.key):n.map(i=>i.tileID).sort(rR).map(i=>i.key)}hasRenderableParent(i){let r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r,a){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())&&(a||!this._shadowCasterTiles[i])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){let a=this._tiles[i];a&&("loading"!==a.state&&(a.state=r),this._loadTile(a,this._tileLoaded.bind(this,a,i,r)))}_tileLoaded(r,a,n,o,s){if(o){if(r.state="errored",i.dD(o)){if(this._source.fire(new i.x("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:r})),!(r.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let i=this.map.painter.terrain;this.update(this.transform,i.getScaledDemTileSize(),!0),i.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new i.v(o,{tile:r}));return}r.timeAdded=i.co.now(),"expired"===n&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(a,r),"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null);let l=new Map;s&&s.responseHeaders&&(l=s.responseHeaders),this._source.fire(new i.x("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id,responseHeaders:l}))}_hasTunnelGeometry(){for(let i in this._tiles){let r=this._tiles[i];if(r&&r.hasTunnelGeometry)return!0}return!1}_backfillDEM(i){let r=this.getRenderableIds();for(let n=0;n<r.length;n++){let o=r[n];if(i.neighboringTiles&&i.neighboringTiles[o]){let r=this.getTileByID(o);a(i,r),a(r,i)}}function a(i,r){if(!i.dem||i.dem.borderReady)return;i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0;let a=r.tileID.canonical.x-i.tileID.canonical.x,n=r.tileID.canonical.y-i.tileID.canonical.y,o=Math.pow(2,i.tileID.canonical.z),s=r.tileID.key;0===a&&0===n||Math.abs(n)>1||(Math.abs(a)>1&&(1===Math.abs(a+o)?a+=o:1===Math.abs(a-o)&&(a-=o)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,a,n),i.neighboringTiles&&i.neighboringTiles[s]&&(i.neighboringTiles[s].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,a,n){for(let o in this._tiles){let s=this._tiles[o];if(n[o]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>a)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>
109r+1;){let i=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[i.key])&&s.hasData()&&(l=i)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){n[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){let a=this._loadedParentTiles[i.key];return a&&a.tileID.overscaledZ>=r?a:null}for(let a=i.overscaledZ-1;a>=r;a--){let r=i.scaledTo(a),n=this._getLoadedTile(r);if(n)return n}}_getLoadedTile(i){let r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;let a=Math.floor((Math.ceil(i.width/r)+1)*(Math.ceil(i.height/r)+1)*5),n="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,a):a,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(i){let r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){let i={};for(let a in this._tiles){let n=this._tiles[a];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+r),i[n.tileID.key]=n}for(let r in this._tiles=i,this._timers)clearTimeout(this._timers[r]),delete this._timers[r];for(let i in this._tiles)this._setTileReloadTimer(+i,this._tiles[i])}}update(r,a,n,o,s){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(r,a),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let l="batched-model"===this._source.type,h,u=this._source.maxzoom;null!==this._maxzoomOverride&&(u=Math.min(u,this._maxzoomOverride));let c=this.map&&this.map.painter?this.map.painter._terrain:null;if(c&&c.sourceCache===this&&c.attenuationRange()){let i=Math.floor(c.attenuationRange()[0])-Math.log2(c.getDemUpscale());u>i&&(u=i)}let d=null===this._maxzoomOverride&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)h=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(r=>new i.ap(r.canonical.z,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y));else if(0!==this.tileCoverLift){let o=r.clone();o.tileCoverLift=this.tileCoverLift,h=o.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.minzoom<=1&&"globe"===r.projection.name&&(h.push(new i.ap(1,0,1,0,0)),h.push(new i.ap(1,0,1,1,0)),h.push(new i.ap(1,0,1,0,1)),h.push(new i.ap(1,0,1,1,1)))}else if(h=r.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.hasTile){let i=this._source.hasTile.bind(this._source);h=h.filter(r=>i(r))}}else h=[];if(h.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!this._supportsFading){let i=Math.min(r.coveringZoomLevel({tileSize:a||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),u);if(l)for(let a of r.extendTileCover(h,i))h.push(a);else if(s){let a=this.transform.getFrustum(i);for(let n of r.extendTileCoverToNearPlane(h,a,i))h.push(n);if(i>=18&&this._hasTunnelGeometry())for(let n of r.extendTileCoverForTunnels(h,a,i,20))h.push(n)}else if(this.castsShadows&&o)for(let a of r.extendTileCover(h,i,o,16))this._shadowCasterTiles[a.key]=!0,h.push(a)}let f=this._updateRetainedTiles(h);if(this._supportsFading&&0!==h.length){let r={},a={},n=i.co.now();for(let i of Object.keys(f)){let o=f[i],s=this._tiles[i];if(!s||void 0!==s.fadeEndTime&&s.fadeEndTime<=n)continue;let l=this.findLoadedParent(o,Math.max(o.overscaledZ-rD.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),r[l.tileID.key]=l.tileID),a[i]=o}let o=h.at(-1).overscaledZ;for(let i in this._tiles){let r=this._tiles[i];if(f[i]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>o;){n=n.scaledTo(n.overscaledZ-1);let o=this._tiles[n.key];
109if(o&&o.hasData()&&a[n.key]){f[i]=r.tileID;break}}}for(let i in r)f[i]||(this._coveredTiles[i]=!0,f[i]=r[i])}for(let i in f)this._tiles[i].clearFadeHold();for(let r of i.dS(this._tiles,f)){let i=this._tiles[r];i.hasSymbolBuckets&&!i.holdingForFade()?i.setHoldDuration(this.map._fadeDuration):i.hasSymbolBuckets&&!i.symbolFadeFinished()||this._removeTile(+r)}this._updateLoadedParentTileCache(),this._renderSourceType===i.aC.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){let r={};if(0===i.length)return r;let a={},n=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-rD.maxOverzooming,this._source.minzoom),l=Math.max(o+rD.maxUnderzooming,this._source.minzoom),h={};for(let a of i){let i=this._addTile(a);r[a.key]=a,i.hasData()||n<this._source.maxzoom&&(h[a.key]=a)}for(let o of(this._retainLoadedChildren(h,n,l,r),i)){let i=this._tiles[o.key];if(i.hasData())continue;if(o.canonical.z>=this._source.maxzoom){let i=o.children(this._source.maxzoom)[0],a=this.getTile(i);if(a&&a.hasData()){r[i.key]=i;continue}}else{let i=o.children(this._source.maxzoom);if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let n=i.wasRequested();for(let l=o.overscaledZ-1;l>=s;--l){let s=o.scaledTo(l);if(a[s.key]||(a[s.key]=!0,(i=this.getTile(s))||!n||(i=this._addTile(s)),i&&(r[s.key]=s,n=i.wasRequested(),i.hasData())))break}}return r}_updateLoadedParentTileCache(){for(let i in this._loadedParentTiles={},this._tiles){let r=[],a,n=this._tiles[i].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){a=this._loadedParentTiles[n.key];break}r.push(n.key);let i=n.scaledTo(n.overscaledZ-1);if(a=this._getLoadedTile(i))break;n=i}for(let i of r)this._loadedParentTiles[i]=a}}_addTile(r){let a=this._tiles[r.key];if(a)return!0!==a.isExtraShadowCaster||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),a;(a=this._cache.getAndRemove(r))&&(this._setTileReloadTimer(r.key,a),a.tileID=r,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,a)));let n=!!a;if(!n){let n=this.map?this.map.painter:null,o=this._source.tileSize*r.overscaleFactor();a="raster-array"===this._source.type?new iN(r,o,this.transform.tileZoom,n,this._isRaster):new i.b0(r,o,this.transform.tileZoom,n,this._isRaster,this._source.worldview),this._loadTile(a,this._tileLoaded.bind(this,a,r.key,a.state))}return a.uses++,this._tiles[r.key]=a,n||this._source.fire(new i.x("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);let a=r.getExpiryTimeout();a&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},a))}_removeTile(i){let r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state||"empty"===r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(let i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,a,n){let o=[],s=this.transform;if(!s)return o;let l="globe"===s.projection.name,h=i.ek(s.center.lng);for(let u in this._tiles){let c,d=this._tiles[u];if(n&&d.clearQueryDebugViz(),!d.holdingForFade()){if(l){let r=d.tileID.canonical;if(0===r.z){let a=[Math.abs(i.bG(h,...rP(r,-1))-h),Math.abs(i.bG(h,...rP(r,1))-h)];c=[0,2*a.indexOf(Math.min(...a))-1]}else{let a=[Math.abs(i.bG(h,...rP(r,-1))-h),Math.abs(i.bG(h,...rP(r,0))-h),Math.abs(i.bG(h,...rP(r,1))-h)];c=[a.indexOf(Math.min(...a))-1]}}else c=[0];for(let i of c){let n=r.containsTile(d,s,a,i);n&&o.push(n)}}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,r){if(!this.transform)return[];let a=this.getRenderableIds(i,r).map(i=>this._tiles[i].tileID),n="globe"===this.transform.projection.name;for(let i of a)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped()),i.expandedProjMatrix=n?this.transform.calculateProjMatrix(i.toUnwrapped(),!1,!0):i.projMatrix;return a}sortCoordinatesByDistance(i){let r=i.slice(),a=this.transform._camera.position,n=this.transform._camera.forward(),o={};for(let i of r){let r=1/(1<<i.canonical.z);o[i.key]=((i.canonical.x+.5)*r+i.wrap-a[0])*n[0]+((i.canonical.y+.5)*r-a[1])*n[1]-a[2]*n[2]}return r.sort((i,r)=>o[i.key]-o[r.key]),r}hasTransition(){if(this._source.hasTransition())return!0;
109if(this._supportsFading){let r=i.co.now();for(let i in this._tiles){let a=this._tiles[i];if(void 0!==a.fadeEndTime&&a.fadeEndTime>=r)return!0}}return!1}setFeatureState(i,r,a){this._state.updateState(i=i||"_geojsonTileLayer",r,a)}removeFeatureState(i,r,a){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,a)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,a){let n=this._tiles[i];n&&n.setDependencies(r,a)}reloadTilesForDependencies(i,r){for(let a in this._tiles)this._tiles[a].hasDependency(i,r)&&this._reloadTile(+a,"reloading");this._cache.filter(a=>!a.hasDependency(i,r))}_preloadTiles(r,a){if(!this._sourceLoaded){let i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(r,a))};return void this._source.on("data",i)}let n=new Map,o=Array.isArray(r)?r:[r],s=this.map.painter.terrain,l=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(let i of o){for(let r of i.coveringTiles({tileSize:l,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))n.set(r.key,r);this.usedForTerrain&&i.updateElevation(!1)}let h=Array.from(n.values());i.bp(h,(r,a)=>{let n=new i.b0(r,this._source.tileSize*r.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),a(i,n)})},a)}}function rR(i,r){let a=Math.abs(2*i.wrap)-(i.wrap<0),n=Math.abs(2*r.wrap)-(r.wrap<0);return i.overscaledZ-r.overscaledZ||n-a||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function rP(i,r){let a=1<<i.z;return[i.x/a+r,(i.x+1)/a+r]}rD.maxOverzooming=10,rD.maxUnderzooming=3;let rL=i=>({u_matrix:i});function rz(r,a){if(!r.frcCoverageSnapshot||!r.frcCoverageRenderer)return null;let n=r.frcCoverageSnapshot.getTileOrParent(a.canonical);if(!n||0===n.frcMask)return null;let o=r.frcCoverageRenderer.getBuffers(n.tileId);if(!o)return null;let s=new i.f(n.tileId.z,n.tileId.x,n.tileId.y),l=new i.bc(a.wrap,s);return{buffers:o,projMatrix:r.transform.calculateProjMatrix(l),coverageTile:n}}function rO(i,r,a,n,o){if(0===r.length)return;let s=0;for(let i of r)s|=i.frcMask;let l=r.map(i=>i.coord);for(let h=0;h<9;++h)if(s&1<<h){if(function(i,r,a){if(!i.frcCoverageSnapshot)return;let n=i.context,o=n.gl,s=i.getOrCreateProgram("clippingMask");for(let l of(n.setColorMode(ie.disabled),n.setDepthMode(tN.disabled),r)){let r=rz(i,l);if(!r)continue;let n=r.buffers.frcLevelSegments[a];n&&s.draw(i,o.TRIANGLES,tN.disabled,new t7({func:o.EQUAL,mask:255},i._tileClippingMaskIDs[l.key]||0,255,o.KEEP,o.KEEP,o.INVERT),ie.disabled,tk.disabled,rL(r.projMatrix),`$frc_coverage_${a}`,r.buffers.vertexBuffer,r.buffers.indexBuffer,n)}}(i,l,h),n)for(let a of r)a.frcMask&1<<h&&n(a,h,function(i,r){let a=i.context.gl;return new t7({func:a.EQUAL,mask:255},i._tileClippingMaskIDs[r.key]||0,0,a.KEEP,a.KEEP,a.KEEP)}(i,a.coord));if(a>0&&o)for(let a of r)a.frcMask&1<<h&&o(a,h,function(i,r){let a=i.context.gl;return new t7({func:a.EQUAL,mask:255},255&~(i._tileClippingMaskIDs[r.key]||0),0,a.KEEP,a.KEEP,a.KEEP)}(i,a.coord));!function(i,r,a){if(!i.frcCoverageSnapshot)return;let n=i.context,o=n.gl,s=i.getOrCreateProgram("clippingMask");for(let l of(n.setColorMode(ie.disabled),n.setDepthMode(tN.disabled),r)){let r=rz(i,l);if(!r)continue;let n=r.buffers.frcLevelSegments[a];n&&s.draw(i,o.TRIANGLES,tN.disabled,new t7({func:o.EQUAL,mask:255},255&~(i._tileClippingMaskIDs[l.key]||0),255,o.KEEP,o.KEEP,o.INVERT),ie.disabled,tk.disabled,rL(r.projMatrix),`$frc_coverage_restore_${a}`,r.buffers.vertexBuffer,r.buffers.indexBuffer,n)}}(i,l,h)}}function rF(i){for(let r of i)if(r.rings.length>0&&r.rings[0].length>0)return!0;return!1}function rB(i){let r=i.frcCoverageFadeRange;return!r||r[1]<=r[0]?0:1-Math.max(0,Math.min(1,(i.transform.zoom-r[0])/(r[1]-r[0])))}let rk=function(i,r,a,n){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);let o=a.paint.get("building-ambient-occlusion-ground-intensity"),s=a.paint.get("building-ambient-occlusion-ground-radius"),l=a.paint.get("building-ambient-occlusion-ground-attenuation"),h=a.paint.get("building-opacity");if(h<=0)return;let u=o>0&&s>0,c=!0,d=a.paint.get("building-vertical-scale");if(d<=0)return;i.shadowRenderer||(c=!1);let f=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),p=i.style.order.indexOf(a.fqid);if(function(i,r,a,n,o,s){for(let l of s){let s=r.getTile(l).getBucket(a);s&&(o&&s.updateReplacement(l,i.replacementSource,n),s.uploadUpdatedIndexBuffer(i.context))}}(i,r,a,p,f,n),function(i,r,a,n){for(let o of n){let n=r.getTile(o).getBucket(a);n&&n.needsEvaluation()&&n.uploadUpdatedColorBuffer(i.context)}}(i,r,a,n),a.resetLayerRenderingStats(i),i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0),"shadow"===i.renderPass&&i.shadowRenderer){let o=i.shadowRenderer.getShadowPassDepthMode();iR({painter:i,source:r,layer:a,coords:n,defines:[],blendMode:ie.disabled,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===i.renderPass){let p=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(p=p.concat("RENDER_SHADOWS")),i.shadowRenderer&&i.shadowRenderer.useNormalOffset&&(p=p.concat("NORMAL_OFFSET"));let m=a.paint.get("building-facade-emissive-chance"),_=a.paint.get("building-ambient-occlusion-intensity"),g=a.paint.get("building-flood-light-intensity"),y="none"===a.paint.get("building-flood-light-color-use-theme").
109constantOr("default"),x=a.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(y?null:a.lut).toArray01().slice(0,3),v=a.paint.get("building-flood-light-ground-attenuation"),b=g>0,w=new tN(i.context.gl.LEQUAL,tN.ReadWrite,i.depthRangeFor3D);h<1&&iR({painter:i,source:r,layer:a,coords:n,defines:p,blendMode:ie.disabled,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x,depthOnly:!0});let T=i.colorModeForRenderPass();iR({painter:i,source:r,layer:a,coords:n,defines:p,blendMode:T,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x});let S=a.paint.get("building-front-cutoff");iT(i.transform.pitch,S,!!i.terrain),u&&iP(i,r,a,n,!0,h,o,s,g,x,l,f),b&&iP(i,r,a,n,!1,h,o,s,g,x,v,f)}else if("light-beam"===i.renderPass){let o=new tN(i.context.gl.LEQUAL,tN.ReadOnly,i.depthRangeFor3D);iR({painter:i,source:r,layer:a,coords:n,defines:["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],blendMode:ie.alphaBlended,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1),i.resetStencilClippingMasks()},rN=function(r,a,n,o,s,l){"offscreen"===r.renderPass&&function(r,a,n,o){if(!o.length)return;let s=r.context,l=s.gl,h=a.getSource();if(!(h instanceof iG))return;let u=Math.ceil(Math.sqrt(n.paint.get("raster-particle-count"))),c=n.particlePositionRGBAImage;if(!c||c.width!==u){let r=function(r){let a=r*r,n=new Uint8Array(4*a);for(let r=0;r<a;r++){let a=.9090909090909091*(i.cg(2*r+0)+.05),o=.9090909090909091*(i.cg(2*r+1)+.05),s=255*a%1,l=255*o%1,h=o-l/255;n[4*r+0]=255*(a-s/255),n[4*r+1]=255*s,n[4*r+2]=255*h,n[4*r+3]=255*l}return n}(u);c=n.particlePositionRGBAImage=new i.ay({width:u,height:u},r)}let d=n.particleFramebuffer;d?d.width!==u&&(d.destroy(),d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null)):d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null);let f=[];for(let r of o){let o=a.getTile(r);if(!(o instanceof iN))continue;let l=function(r,a,n){if(!r)return null;let o=a.getTextureDescriptor(r,n,!0);if(!o)return null;let{texture:s,mix:l,offset:h,tileSize:u,buffer:c,format:d}=o;if(!s||!d)return null;let f=!1;return"uint32"===d&&(f=!0,l[3]=0,l=iB(i.d,l,[0,n.paint.get("raster-particle-max-speed")]),h=ik(i.d,h,[0,n.paint.get("raster-particle-max-speed")])),{texture:s,textureOffset:[c/(u+2*c),u/(u+2*c)],tileSize:u,scalarData:f,scale:l,offset:h,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[d]]}}(o,h,n);if(!l)continue;let d=[o.tileSize,o.tileSize],p=n.tileFramebuffer;p||(p=n.tileFramebuffer=s.createFramebuffer(d[0],d[1],1,null));let m=o.rasterParticleState;m||(m=o.rasterParticleState=new iq(s,r,d,c));let _=m.update(n.lastInvalidatedAt);m.particleTextureDimension!==u&&m.updateParticleTexture(r,c);let g=m.targetColorTexture;m.targetColorTexture=m.backgroundColorTexture,m.backgroundColorTexture=g;let y=m.particleTexture0;m.particleTexture0=m.particleTexture1,m.particleTexture1=y,f.push([r,l,m,_])}if(0===f.length)return;let p=i.co.now(),m=n.previousDrawTimestamp?.001*(p-n.previousDrawTimestamp):.0167;if(n.previousDrawTimestamp=p,n.hasColorMap()){s.activeTexture.set(l.TEXTURE0+2);let r=n.colorRampTexture;r||(r=n.colorRampTexture=new i.a_(s,n.colorRamp,l.RGBA8)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE)}s.bindFramebuffer.set(n.tileFramebuffer.framebuffer),function(r,a,n){var o;let s=r.context,l=s.gl,h=a.tileFramebuffer;s.activeTexture.set(l.TEXTURE0);let u={u_texture:0,u_opacity:1.05*(o=a.paint.get("raster-particle-fade-opacity-factor"))/(o+.05)},c=r.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let o of n){let[,,n,d]=o;h.colorAttachment0.set(n.targetColorTexture.texture),s.viewport.set([0,0,h.width,h.height]),s.clear({color:i.i.transparent}),d&&(n.backgroundColorTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.draw(r,l.TRIANGLES,tN.disabled,t7.disabled,ie.alphaBlended,tk.disabled,u,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments))}}(r,n,f),function(r,a,n,o){let s=r.context,l=s.gl,h=n.tileFramebuffer,u="globe"===r.transform.projection.name,c=n.paint.get("raster-particle-max-speed");for(let d of o){let[o,f,p]=d;s.activeTexture.set(l.TEXTURE0+0),f.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h.colorAttachment0.set(p.targetColorTexture.texture);let m=r.getOrCreateProgram("rasterParticleDraw",{defines:f.defines,overrideFog:!1});s.activeTexture.set(l.TEXTURE0+1);let _=f.scalarData?[]:[0,1,2,3].map(r=>i.ev[r](o));_.push(o);let g=o.canonical.x,y=o.canonical.y;for(let i of _){let s=a.getTile(u?i.wrapped():i);if(!s)continue;let h=s.rasterParticleState;if(!h)continue;let d=i.canonical.x+(1<<i.canonical.z)*(i.wrap-o.wrap),p=i.canonical.y;h.particleTexture0.bind(l.NEAREST,l.CLAMP_TO_EDGE);let _=iO(1,h.particleTexture0.size[0],[d-g,p-y],0,f.texture.size,2,c,f.textureOffset,f.scale,f.offset);m.draw(r,l.POINTS,tN.disabled,t7.disabled,ie.alphaBlended,tk.disabled,_,n.id,h.particleIndexBuffer,void 0,h.particleSegment)}}}(r,a,n,f),s.bindFramebuffer.set(n.particleFramebuffer.framebuffer),function(r,a,n,o){let s=r.context,l=s.gl,h=a.paint.get("raster-particle-max-speed"),u=o*a.paint.get("raster-particle-speed-factor")*.15,c=Math.pow(.01+ +a.paint.get("raster-particle-reset-rate-factor"),6),d=a.particleFramebuffer;
109for(let o of(s.viewport.set([0,0,d.width,d.height]),n)){let[,n,f]=o;s.activeTexture.set(l.TEXTURE0+0),n.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE0+1);let p=f.particleTexture0;p.bind(l.NEAREST,l.CLAMP_TO_EDGE);let m=iF(1,p.size[0],0,n.texture.size,h,u,c,n.textureOffset,n.scale,n.offset);d.colorAttachment0.set(f.particleTexture1.texture),s.clear({color:i.i.transparent}),r.getOrCreateProgram("rasterParticleUpdate",{defines:n.defines}).draw(r,l.TRIANGLES,tN.disabled,t7.disabled,ie.unblended,tk.disabled,m,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}}(r,n,f,m)}(r,a,n,o),"translucent"===r.renderPass&&(function(r,a,n,o){let s=r.context,l=s.gl,h=a.getSource().tileSize,u=5*(1-i.fq(i.R,i.R+1,r.transform.zoom))*h+n.paint.get("raster-particle-elevation"),c=!r.options.moving,d="globe"===r.transform.projection.name;if(!o.length)return;let[f,p]=r.stencilConfigForOverlap(o),m=[];d&&m.push("PROJECTION_GLOBE_VIEW");let _=r.stencilModeFor3D();for(let o of p){let h,p,g,y,x,v,b,w=o.toUnwrapped(),T=a.getTile(o);if(!T.rasterParticleState)continue;let S=T.rasterParticleState;T.registerFadeDuration(100);let E=a.findLoadedParent(o,0),I=i$(T,E,a,r.transform,100);r.terrain&&r.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),E&&E.rasterParticleState?(E.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=Math.pow(2,E.tileID.overscaledZ-T.tileID.overscaledZ),p=[T.tileID.canonical.x*h%1,T.tileID.canonical.y*h%1]):S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let A=d?r.transform.expandedFarZProjMatrix:r.transform.calculateProjMatrix(w,c),M=r.transform,C=function(i){let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(M),D=i.fF(o.canonical),R=i.cU(D.getCenter().lat);d?(g=Float32Array.from(i.dh(i.dk(o.canonical))),y=Float32Array.from(M.globeMatrix),x=Float32Array.from(i.by(M)),v=[i.ek(M.center.lng),i.el(M.center.lat)],b=Float32Array.from(i.cP(o.canonical,D,R,M.worldSize/M._pixelsPerMercatorPixel))):(g=new Float32Array(16),y=new Float32Array(9),x=new Float32Array(16),v=[0,0],b=new Float32Array(9));let P=iz(A,g,y,x,b,p||[0,0],i.dm(r.transform.zoom),v,C,h||1,I,u),L=r.isTileAffectedByFog(o),z=r.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:L});if(r.uploadCommonUniforms(s,z,w),d){let i=new tN(l.LEQUAL,tN.ReadOnly,r.depthRangeFor3D),a=r.globeSharedBuffers;if(a){let[o,s,h]=a.getGridBuffers(R,!1);z.draw(r,l.TRIANGLES,i,_,ie.alphaBlended,r.renderElevatedRasterBackface?tk.frontCCW:tk.backCCW,P,n.id,o,s,h)}}else{let i=r.depthModeForSublayer(0,tN.ReadOnly),a=f[o.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=r.getTileBoundsBuffers(T);z.draw(r,l.TRIANGLES,i,a,ie.alphaBlended,tk.disabled,P,n.id,s,h,u)}}r.resetStencilClippingMasks()}(r,a,n,o),r.style.map.triggerRepaint())},rU=function(i,r,a){let n=r.getSource();if(!(n instanceof iG&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-particle-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)},rV=class extends rv{constructor(){super(4.25),this._params={intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(r){let a=r.context;if(!this.particlesVx){let r=ry(this.particlesCount),n=new i.aW,o=new i.aT,s=0,l=i.eq(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=[2*l()-1,l(),l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,1,...h),n.emplaceBack(a[0],a[1],a[2],-1,1,...h),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,rf.members),this.particlesIdx=a.createIndexBuffer(o)}}getDrawParams(i){if(!i.style.rain)return null;let r=i.style.rain.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.droplet
109SizeX=r.dropletSize[0],a.dropletSizeYScale=r.dropletSize[1]/r.dropletSize[0],a.distortionStrength=100*r.distortionStrength;let n=structuredClone(this._vignetteParams);return n.strength=1,n.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:n,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(r){let a=this.getDrawParams(r);if(!a)return;let{params:n,revealParams:o,direction:s,vignetteParams:l}=a,h=r.transform.zoom;if(o.revealStart>h)return;let u=rx(0,1,o.revealStart,o.revealStart+o.revealRange,h);if(!this.particlesVx||!this.particlesIdx)return;l.strength*=u;let c=this.updateOnRender(r,n.timeFactor),d=r.context,f=d.gl,p=r.transform;this.screenTexture&&this.screenTexture.size[0]===r.width&&this.screenTexture.size[1]===r.height||(this.screenTexture=new i.a_(d,{width:r.width,height:r.height,data:null},f.RGBA8)),n.distortionStrength>0&&(d.activeTexture.set(f.TEXTURE0),this.screenTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.copyTexSubImage2D(f.TEXTURE_2D,0,0,0,0,0,r.width,r.height));let m=r.getOrCreateProgram("rainParticle");r.uploadCommonUniforms(d,m),d.activeTexture.set(f.TEXTURE0),this.screenTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);let _=[n.color.r,n.color.g,n.color.b,n.color.a],g=(a,o)=>{var l;let h=rg(this._movement.getPosition(),a),u=n.dropletSizeX,d=n.dropletSizeX*n.dropletSizeYScale,g=r.width/2,y=r.height/2,x=rx(0,n.screenThinning.start,0,1,n.screenThinning.intensity),v=rx(.001,n.screenThinning.range,0,1,n.screenThinning.intensity),b=rx(0,n.screenThinning.particleOffset,0,1,n.screenThinning.intensity),w=(l={modelview:c.modelviewMatrix,projection:c.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:h,velocityConeAperture:n.velocityConeAperture,velocity:n.velocity,boxSize:a,rainDropletSize:[u,d],distortionStrength:n.distortionStrength,rainDirection:s,color:_,screenSize:[p.width,p.height],thinningCenterPos:[g,y],thinningShape:[x,v,Math.pow(10,n.screenThinning.fadePower)],thinningAffectedRatio:n.screenThinning.affectedRatio,thinningParticleOffset:b,shapeDirectionalPower:n.shapeDirPower,shapeNormalPower:n.shapeNormalPower,mode:+!o},{u_modelview:Float32Array.from(l.modelview),u_projection:Float32Array.from(l.projection),u_time:l.time,u_cam_pos:l.camPos,u_texScreen:0,u_velocityConeAperture:l.velocityConeAperture,u_velocity:l.velocity,u_boxSize:l.boxSize,u_rainDropletSize:l.rainDropletSize,u_distortionStrength:l.distortionStrength,u_rainDirection:l.rainDirection,u_color:l.color,u_screenSize:l.screenSize,u_thinningCenterPos:l.thinningCenterPos,u_thinningShape:l.thinningShape,u_thinningAffectedRatio:l.thinningAffectedRatio,u_thinningParticleOffset:l.thinningParticleOffset,u_shapeDirectionalPower:l.shapeDirectionalPower,u_shapeNormalPower:l.shapeNormalPower,u_mode:l.mode}),T=Math.round(n.intensity*this.particlesCount),S=i.aJ.simpleSegment(0,0,4*T,2*T);m.draw(r,f.TRIANGLES,tN.disabled,t7.disabled,ie.alphaBlended,tk.disabled,w,"rain_particles",this.particlesVx,this.particlesIdx,S)};n.distortionStrength>0&&g(n.boxSize,!0),g(n.boxSize,!1),this._vignette.draw(r,l)}},rj=class extends rv{constructor(){super(2.25),this._params={intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(r){let a=r.context;if(!this.particlesVx){let r=ry(this.particlesCount),n=new i.aK,o=new i.aT,s=0,l=i.eq(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=l(),u=l(),c=l(),d=[i/r.length,h,u,c],f=[l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...d,...f),n.emplaceBack(a[0],a[1],a[2],1,-1,...d,...f),n.emplaceBack(a[0],a[1],a[2],1,1,...d,...f),n.emplaceBack(a[0],a[1],a[2],-1,1,...d,...f),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,rb.members),this.particlesIdx=a.createIndexBuffer(o)}}getDrawParams(i){if(!i.style.snow)return null;let r=i.style.snow.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.billboardSize=2.79*r.flakeSize;
109let n=structuredClone(this._vignetteParams);return n.strength=1,n.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:n,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(r){var a,n;let o,s,l,h,u,c,d,f,p,m=this.getDrawParams(r);if(!m)return;let{params:_,revealParams:g,direction:y,vignetteParams:x}=m,v=r.transform.zoom;if(g.revealStart>v)return;let b=rx(0,1,g.revealStart,g.revealStart+g.revealRange,v);x.strength*=b;let w=this.updateOnRender(r,_.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;let T=r.context,S=T.gl,E=r.transform,I=r.getOrCreateProgram("snowParticle");r.uploadCommonUniforms(T,I),a=_.boxSize,o=rg(this._movement.getPosition(),a),s=E.width/2,l=E.height/2,h=rx(0,_.screenThinning.start,0,1,_.screenThinning.intensity),u=rx(.001,_.screenThinning.range,0,1,_.screenThinning.intensity),c=rx(0,_.screenThinning.particleOffset,0,1,_.screenThinning.intensity),n={modelview:w.modelviewMatrix,projection:w.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:o,velocityConeAperture:_.velocityConeAperture,velocity:_.velocity,horizontalOscillationRadius:_.horizontalOscillationRadius,horizontalOscillationRate:_.horizontalOscillationRate,boxSize:a,billboardSize:+_.billboardSize,simpleShapeParameters:[_.shapeFadeStart,_.shapeFadePower],screenSize:[E.width,E.height],thinningCenterPos:[s,l],thinningShape:[h,u,Math.pow(10,_.screenThinning.fadePower)],thinningAffectedRatio:_.screenThinning.affectedRatio,thinningParticleOffset:c,color:[_.color.r,_.color.g,_.color.b,_.color.a],direction:y},d={u_modelview:Float32Array.from(n.modelview),u_projection:Float32Array.from(n.projection),u_time:n.time,u_cam_pos:n.camPos,u_velocityConeAperture:n.velocityConeAperture,u_velocity:n.velocity,u_horizontalOscillationRadius:n.horizontalOscillationRadius,u_horizontalOscillationRate:n.horizontalOscillationRate,u_boxSize:n.boxSize,u_billboardSize:n.billboardSize,u_simpleShapeParameters:n.simpleShapeParameters,u_screenSize:n.screenSize,u_thinningCenterPos:n.thinningCenterPos,u_thinningShape:n.thinningShape,u_thinningAffectedRatio:n.thinningAffectedRatio,u_thinningParticleOffset:n.thinningParticleOffset,u_particleColor:n.color,u_direction:n.direction},f=Math.round(_.intensity*this.particlesCount),p=i.aJ.simpleSegment(0,0,4*f,2*f),this.particlesVx&&this.particlesIdx&&I.draw(r,S.TRIANGLES,tN.disabled,t7.disabled,ie.alphaBlended,tk.disabled,d,"snow_particles",this.particlesVx,this.particlesIdx,p),this._vignette.draw(r,x)}},rG=rd,rH={building:r=>({u_matrix:new i.bb(r),u_normal_matrix:new i.bb(r),u_opacity:new i.b4(r),u_faux_facade_ao_intensity:new i.b4(r),u_camera_pos:new i.b7(r),u_tile_to_meter:new i.b4(r),u_facade_emissive_chance:new i.b4(r),u_flood_light_color:new i.b7(r),u_flood_light_intensity:new i.b4(r),u_front_cutoff_params:new i.b7(r)}),buildingBloom:r=>({u_matrix:new i.bb(r)}),buildingDepth:r=>({u_matrix:new i.bb(r)}),elevatedStructuresDepth:r=>({u_matrix:new i.bb(r),u_depth_bias:new i.b4(r)}),elevatedStructures:r=>({u_matrix:new i.bb(r),u_ground_shadow_factor:new i.b7(r),u_opacity_multiplier:new i.b4(r)}),elevatedStructuresDepthReconstruct:r=>({u_matrix:new i.bb(r),u_camera_pos:new i.b7(r),u_depth_bias:new i.b4(r),u_height_scale:new i.b4(r),u_reset_depth:new i.b4(r)}),rasterParticle:r=>({u_matrix:new i.bb(r),u_normalize_matrix:new i.bb(r),u_globe_matrix:new i.bb(r),u_merc_matrix:new i.bb(r),u_grid_matrix:new i.ba(r),u_tl_parent:new i.b6(r),u_scale_parent:new i.b4(r),u_fade_t:new i.b4(r),u_opacity:new i.b4(r),u_image0:new i.b5(r),u_image1:new i.b5(r),u_raster_elevation:new i.b4(r),u_zoom_transition:new i.b4(r),u_merc_center:new i.b6(r),u_cutoff_params:new i.b8(r)}),rasterParticleTexture:r=>({u_texture:new i.b5(r),u_opacity:new i.b4(r)}),rasterParticleDraw:r=>({u_particle_texture:new i.b5(r),u_particle_texture_side_len:new i.b4(r),u_tile_offset:new i.b6(r),u_velocity:new i.b5(r),u_color_ramp:new i.b5(r),u_velocity_res:new i.b6(r),u_max_speed:new i.b4(r),u_uv_offset:new i.b6(r),u_data_scale:new i.b6(r),u_data_offset:new i.b4(r),u_particle_pos_scale:new i.b4(r),u_particle_pos_offset:new i.b6(r)}),rasterParticleUpdate:r=>({u_particle_texture:new i.b5(r),u_particle_texture_side_len:new i.b4(r),u_velocity:new i.b5(r),u_velocity_res:new i.b6(r),u_max_speed:new i.b4(r),u_speed_factor:new i.b4(r),u_reset_rate:new i.b4(r),u_rand_seed:new i.b4(r),u_uv_offset:new i.b6(r),u_data_scale:new i.b6(r),u_data_offset:new i.b4(r),u_particle_pos_scale:new i.b4(r),u_particle_pos_offset:new i.b6(r)}),snowParticle:r=>({u_modelview:new i.bb(r),u_projection:new i.bb(r),u_time:new i.b4(r),u_cam_pos:new i.b7(r),u_velocityConeAperture:new i.b4(r),u_velocity:new i.b4(r),u_horizontalOscillationRadius:new i.b4(r),u_horizontalOscillationRate:new i.b4(r),u_boxSize:new i.b4(r),u_billboardSize:new i.b4(r),u_simpleShapeParameters:new i.b6(r),u_screenSize:new i.b6(r),u_thinningCenterPos:new i.b6(r),u_thinningShape:new i.b7(r),u_thinningAffectedRatio:new i.b4(r),u_thinningParticleOffset:new i.b4(r),u_particleColor:new i.b8(r),u_direction:new i.b7(r)}),rainParticle:r=>({u_modelview:new i.bb(r),u_projection:new i.bb(r),u_time:new i.b4(r),u_cam_pos:new i.b7(r),u_texScreen:new i.b5(r),u_velocityConeAperture:new i.b4(r),u_velocity:new i.b4(r),u_boxSize:new i.b4(r),u_rainDropletSize:new i.b6(r),u_distortionStrength:new i.b4(r),u_rainDirection:new i.b7(r),u_color:new i.b8(r),u_screenSize:new i.b6(r),u_thinningCenterPos:new i.b6(r),u_thinningShape:new i.b7(r),u_thinningAffectedRatio:new i.b4(r),u_thinningParticleOffset:new i.b4(r),u_shapeDirectionalPower:new i.b4(r),u_shapeNormalPower:new i.b4(r),u_mode:new i.b4(r)}),vignette:r=>({u_vignetteShape:new i.b7(r),u_vignetteColor:new i.b8(r)})},rq=function(i){let{painter:r,sourceCache:a,layer:n,coords:o,colorMode:s}=i,l=r.context.gl,h=i.painter.shadowRenderer,u=!!h&&h.enabled,c=new tN(r.context.gl.LEQUAL,tN.ReadOnly,r.depthRangeFor3D),d=[0,0,0];if(u){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(d=ix(r.style,i,a))}let f=i=>{for(let f of o){let o,p,m=a.getTile(f),_=m.getBucket(n);if(!_)continue;let g=_.hdExt?_.hdExt.elevatedStructures:void 0;if(!g||(i?(o=g.renderableBridgeSegments,p=g.bridgeProgramConfigurations.get(n.id)):(o=g.renderableTunnelSegments,p=g.tunnelProgramConfigurations.get(n.id)),!o||0===o.segments[0].primitiveLength))continue;p.updatePaintBuffers(),r.prepareDrawTile();let y=r.isTileAffectedByFog(f),x=[];u&&x.push("RENDER_SHADOWS","NORMAL_OFFSET");let v=r.getOrCreateProgram("elevatedStructures",{config:p,overrideFog:y,defines:x}),b=r.translatePosMatrix(f.projMatrix,m,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));u&&h.setupShadows(m.tileID.toUnwrapped(),v,"vector-tile");let w=rT(b,d);r.uploadCommonUniforms(r.context,v,f.toUnwrapped()),v.draw(r,l.TRIANGLES,c,t7.disabled,s,tk.backCCW,w,n.id,g.vertexBuffer,g.indexBuffer,o,n.paint,r.transform.zoom,p,[g.vertexBufferNormal])}};f(!0),f(!1)},r$=function(i){let{painter:r,sourceCache:a,layer:n,coords:o}=i,s=r.context.gl,l=i.painter.shadowRenderer;for(let i of o){let o=a.getTile(i),h=o.getBucket(n);if(!h)continue;let u=h.hdExt?h.hdExt.elevatedStructures:void 0;if(!u||!u.shadowCasterSegments||0===u.shadowCasterSegments.segments[0].primitiveLength)continue;r.prepareDrawTile();let c=h.bufferData.programConfigurations.get(n.id),d=r.isTileAffectedByFog(i),f=r.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:d}),p=l.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped());r.uploadCommonUniforms(r.context,f,i.toUnwrapped());let m=rw(p,0);f.draw(r,s.TRIANGLES,l.getShadowPassDepthMode(),t7.disabled,ie.disabled,tk.disabled,m,n.id,u.vertexBuffer,u.indexBuffer,u.shadowCasterSegments,n.paint,r.transform.zoom,c)}},rZ=function(r,a,n,o,s){var l;let h;if(!a||!n.layout||"none"===n.layout.get("fill-elevation-reference")||0===n.paint.get("fill-opacity").constantOr(1))return;let u=r.context.gl,c=new tN(r.context.gl.LEQUAL,tN.ReadWrite,r.depthRangeFor3D),d=new tN(r.context.gl.GREATER,tN.ReadWrite,r.depthRangeFor3D),f=(l=r.transform,h=.01,l.isOrthographic&&(h=i.dY(1e-4,h,i.cc(l.pitch>=15?1:l.pitch/15))),2*h),p=r.transform.getFreeCameraOptions().position,m="elevatedStructuresDepthReconstruct",_=r.getOrCreateProgram(m,{defines:["DEPTH_RECONSTRUCTION"]}),g=r.getOrCreateProgram(m);for(let i of o){let o,l,h,m,y=a.getTile(i),x=y.getBucket(n);if(!x||!x.hdExt)continue;let v=x.hdExt.elevatedStructures,b=x.hdExt.elevationBufferData;if(!v||!v.depthSegments||!b)continue;let w=b.heightRange,T=rE(i.toUnwrapped(),p),S=r.translatePosMatrix(i.projMatrix,y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if("initialize"===s){if(!w||w.min>=1||0===v.depthSegments.segments[0].primitiveLength)continue;o=rS(S,T,f,1,0),l=c,h=v.depthSegments,m=_}else if("reset"===s){if(!w||w.min>=0||0===v.maskSegments.segments[0].primitiveLength)continue;o=rS(S,T,0,0,1),l=d,h=v.maskSegments,m=_}else if("geometry"===s){if(0===v.depthSegments.segments[0].primitiveLength)continue;o=rS(S,T,f,1,0),l=c,h=v.depthSegments,m=g}m.draw(r,u.TRIANGLES,l,t7.disabled,ie.disabled,tk.disabled,o,n.id,v.vertexBuffer,v.indexBuffer,h,n.paint,r.transform.zoom)}},rW=function(i,r,a,n){if(!r||!a.layout||"none"===a.layout.get("fill-elevation-reference")||0===a.paint.get("fill-opacity").constantOr(1))return;let o=i.context.gl,s=new tN(o.LEQUAL,tN.ReadOnly,i.depthRangeFor3D),l=new t7({func:o.ALWAYS,mask:255},255,255,o.KEEP,o.KEEP,o.REPLACE),h=i.transform.getFreeCameraOptions().position,u=i.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(let c of n){let n=r.getTile(c),d=n.getBucket(a);if(!d)continue;let f=d.hdExt?d.hdExt.elevatedStructures:void 0;if(!f||!f.depthSegments||0===f.depthSegments.segments[0].primitiveLength)continue;let p=rE(c.toUnwrapped(),h),m=rS(i.translatePosMatrix(c.projMatrix,n,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),p,0,1,0);u.draw(i,o.TRIANGLES,s,l,ie.disabled,tk.disabled,m,a.id,f.vertexBuffer,f.indexBuffer,f.depthSegments,a.paint,i.transform.zoom)}},rX=class extends i.y{constructor(r,a=!1){super(),this._style=r,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indo
109orState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new iL,this._initialLoadDone=!1,i.bs(["_updateUI"],this);const n=()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))};a?(this._initialLoadDone=!0,n()):this._style.on("style.load",n)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(i){i===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=i,this._recalculateActiveFloors())}setActiveFloorsVisibility(i){this._updateActiveFloors(i),this._updateIndoorSelector()}setIndoorData(i){let r=!1;for(let[a,n]of Object.entries(i.buildings))if(this._buildings[a])for(let i of n.floorIds)this._buildings[a].floorIds.add(i),this._buildings[a].floors[i]?this._mergeFloors(this._buildings[a].floors[i],n.floors[i]):(this._buildings[a].floors[i]=n.floors[i],r=!0);else this._buildings[a]=n,r=!0;r&&this._recalculateActiveFloors()}getIndoorTileOptions(i,r){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(i,r),indoorState:this._indoorState}:null}getControlState(){let i=this._buildings,r=this._closestBuildingId,a=r&&i?i[r]:void 0;if(!a)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let n=null;for(let i of a.floorIds)if(this._activeFloors&&this._activeFloors.has(i)){n=i;break}let o=Array.from(a.floorIds).map(i=>({id:i,name:a.floors[i].name,zIndex:a.floors[i].zIndex})).sort((i,r)=>r.zIndex-i.zIndex).filter((i,r,a)=>0===r||i.zIndex!==a[r-1].zIndex);return{selectedFloorId:n,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:o}}_updateUI(){this._initialLoadDone=!0;let i=this._style.map.transform,r=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,i.center,i.zoom,i.getBounds(),this._makeViewportPolygon());if(r!==this._closestBuildingId){let i=this._closestBuildingId;this._closestBuildingId=r,this._onBuildingTransition(i,r),this._updateIndoorSelector()}}_onBuildingTransition(i,r){this._indoorState&&(!r&&i?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):r&&!i&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0)))}_updateIndoorSelector(){this.fire(new i.x("selector-update",this.getControlState()))}_updateActiveFloors(i){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:i,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;let r=i.a5.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(i,r){if(i===r)return!0;if(!i||!r||i.size!==r.size)return!1;for(let a of i)if(!r.has(a))return!1;return!0})(r,this._activeFloors)||(this._activeFloors=r,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(i,r){r.geometry&&(i.geometry?("Polygon"===i.geometry.type&&(i.geometry={type:"MultiPolygon",coordinates:[i.geometry.coordinates]}),"Polygon"===r.geometry.type?i.geometry.coordinates.push(r.geometry.coordinates):"MultiPolygon"===r.geometry.type&&i.geometry.coordinates.push(...r.geometry.coordinates)):i.geometry=r.geometry)}_makeViewportPolygon(){let r=this._style.map.transform,a=r.width,n=r.height;return[r.pointLocation(new i.au(0,0)),r.pointLocation(new i.au(a,0)),r.pointLocation(new i.au(a,n)),r.pointLocation(new i.au(0,n))].map(r=>new i.au(r.lng,r.lat))}},rY=class{constructor(){this.coverageSourceCaches={},this.manager=new rA}},rK=function(i,r){for(let a in r.manager.clear(),i._mergedHdRoadCoverageSourceCaches){let n=i._mergedHdRoadCoverageSourceCaches[a]._tiles;for(let i in n){let a=n[i];if(!a||!a.loaded())continue;let o=a.frcCoveragePolygons;r.manager.addTileCoverage(a.tileID.canonical,o&&o.length>0?o:[])}}let a=r.manager.updateSnapshotIfNeeded();if(i.map.painter&&(i.map.painter.frcCoverageSnapshot=a.empty()?null:a),!a.empty())for(let r of[i._mergedOtherSourceCaches,i._mergedSymbolSourceCaches])for(let i in r){let a=r[i];for(let i in a._tiles){let r=a._tiles[i];r&&r.hasDeferredRoadStructure&&(r.hasDeferredRoadStructure=!1,a._reloadTile(+i,"reloading"))}}}
109,rJ=function(r,a,n){if("fill"!==n.type||n.sourceLayer!==i.X||a.coverageSourceCaches[n.source])return;let o=r.getOwnSource(n.source);if(!o||"vector"!==o.type)return;let s=`hd-road-coverage:${n.source}`,l=i.ea(s,r.scope),h=r._sourceCaches[s]=new rD(l,o,i.aC.HdRoadCoverage);a.coverageSourceCaches[n.source]=h,h.setMaxzoomOverride(14),h.onAdd(r.map);let u=r._otherSourceCaches[n.source];u&&u._sourceLoaded&&(h._sourceLoaded=!0)},rQ=function(r,a){let n=null,o=null,s={globals:{zoom:0}};r.forEachFragmentStyle(a=>{if(n)return;let l=a.stylesheet?a.stylesheet.schema:null;if(!l||!l.sdCoverageFadeRange)return;let h=i.ea("sdCoverageFadeRange",a.scope),u=a.options?a.options.get(h):void 0,c=u?u.value||u.default:null;if(c){let i=c.evaluate(s);Array.isArray(i)&&2===i.length&&(i[0]>0||i[1]>0)&&(n=[i[0],i[1]])}let d=i.ea("sdCoverageSourceLayers",a.scope),f=a.options?a.options.get(d):void 0,p=f?f.value||f.default:null;if(p){let i=p.evaluate(s);Array.isArray(i)&&i.length>0&&(o=i)}else for(let i of r.stylesheet&&r.stylesheet.imports||[])if(i.id===a.scope){let r=i.config?i.config.sdCoverageSourceLayers:void 0;Array.isArray(r)&&r.length>0&&(o=r);break}}),a.frcCoverageFadeRange=n,a.frcCoverageSourceLayers=null!=n?o||["road","structure"]:[]},r0=class{constructor(){this.tileBuffers=new Map,this._context=null}update(i,r){this._context=i;let a=new Set;for(let n of r){if(0===n.frcMask)continue;let r=!1;for(let i of n.polygons)if(i.hasGeometry()){r=!0;break}if(!r)continue;let o=`${n.tileId.z}/${n.tileId.x}/${n.tileId.y}`;if(a.add(o),!this.tileBuffers.has(o)){let r=this._createBuffers(i,n);r&&this.tileBuffers.set(o,r)}}for(let i of this.tileBuffers.keys())if(!a.has(i)){let r=this.tileBuffers.get(i);for(let i of(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.frcLevelSegments))i&&i.destroy();this.tileBuffers.delete(i)}}getBuffers(i){return this.tileBuffers.get(`${i.z}/${i.x}/${i.y}`)||null}destroy(){for(let i of this.tileBuffers.values())for(let r of(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.frcLevelSegments))r&&r.destroy();this.tileBuffers.clear()}_createBuffers(r,a){let n=new i.aQ,o=new i.aT,s=[];for(let r of a.polygons){if(!r.hasGeometry()||0===r.rings.length)continue;let a=n.length,l=o.length,h=n.length,u=[],c=[],d=0;for(let i=0;i<r.rings.length;i++){let a=r.rings[i];if(!(a.length<3))for(let r of(i>0&&c.push(d),a))n.emplaceBack(r.x,r.y),u.push(r.x,r.y),d++}let f=i.c8(u,c.length>0?c:void 0);for(let i=0;i<f.length;i+=3)o.emplaceBack(h+f[i],h+f[i+1],h+f[i+2]);s.push({vertexOffset:a,indexOffset:l,vertexCount:n.length-a,indexCount:o.length-l,frcMask:r.frcMask})}if(0===n.length)return null;let l=Array(9).fill(null);for(let r=0;r<9;++r){let n=1<<r;if(0==(a.frcMask&n))continue;let o=1/0,h=0,u=0,c=!1;for(let i of s)0!=(i.frcMask&n)&&(o=Math.min(o,i.indexOffset),h=Math.max(h,i.indexOffset+i.indexCount),u=Math.max(u,i.vertexOffset+i.vertexCount),c=!0);c&&(l[r]=i.aJ.simpleSegment(0,o,u,h-o))}return{vertexBuffer:r.createVertexBuffer(n,i.eQ.members),indexBuffer:r.createIndexBuffer(o),frcLevelSegments:l}}},r1=function(i){let{painter:r,bucket:a,coord:n,elevatedGeometry:o}=i,s="road"===a.sourceLayerName,l="structure"===a.sourceLayerName;if(!s&&!l||!r.frcCoverageSnapshot||o)return"fallthrough";let h=r.frcCoverageSnapshot.getTileOrParent(n.canonical);if(!h||0===h.frcMask)return"fallthrough";let u=a.hdExt&&a.hdExt.frcData,c=!!u&&!u.empty(),d=rF(h.polygons);if(l&&!d)return"skip";if(l&&d)return i.polygonCoverageTiles.push({coord:i.coord,bufferData:i.bufferData,program:i.program,programConfiguration:i.programConfiguration,uniformValues:i.uniformValues,depthMode:i.depthMode,dynamicBuffers:i.dynamicBuffers,indexBuffer:i.indexBuffer,segments:i.segments,frcMask:h.frcMask}),"deferred";if(s&&c&&u){let a=h.frcMask,n=r.transform.zoom;for(let[o,s]of u.frcPerLevel)a&1<<o||0!==s.segments.length&&i.program.draw(r,i.drawMode,i.depthMode,i.stencilMode,i.colorMode,tk.disabled,i.uniformValues,i.layer.id,i.bufferData.layoutVertexBuffer,i.indexBuffer,s,i.layer.paint,n,i.programConfiguration,i.dynamicBuffers);return u.frcNonRoadSegments.segments.length>0&&i.program.draw(r,i.drawMode,i.depthMode,i.stencilMode,i.colorMode,tk.disabled,i.uniformValues,i.layer.id,i.bufferData.layoutVertexBuffer,i.indexBuffer,u.frcNonRoadSegments,i.layer.paint,n,i.programConfiguration,i.dynamicBuffers),"drawn"}return"fallthrough"},r2=function(i,r,a,n,o){if(0===a.length)return;let s=rB(i),l=i.transform.zoom,h=(a,s,h)=>
109{1!==h&&(a.uniformValues.u_opacity_multiplier=h),a.program.draw(i,n,a.depthMode,s,o,tk.disabled,a.uniformValues,r.id,a.bufferData.layoutVertexBuffer,a.indexBuffer,a.segments,r.paint,l,a.programConfiguration,a.dynamicBuffers),1!==h&&(a.uniformValues.u_opacity_multiplier=1)};rO(i,a,s,(i,r,a)=>h(i,a,1),(i,r,a)=>h(i,a,s))},r3=function(i,r,a,n,o,s,l,h,u,c){let d=r.hdExt&&r.hdExt.frcData;if(!d||0===d.frcPerLevel.size||!i.frcCoverageSnapshot||n)return null;let f=i.frcCoverageSnapshot.getTileOrParent(a.canonical);if(!f||0===f.frcMask)return null;let p=rF(f.polygons),m=i.frcCoverageFadeRange,_=null!=m&&i.transform.zoom>=m[0];if(p&&_){let i=!1;for(let r of d.frcPerLevel.keys())if(f.frcMask&1<<r){i=!0;break}i&&c.push({coord:a,bucket:r,uniformValues:o,programConfiguration:s,program:l,depthMode:h,colorMode:u,frcMask:f.frcMask})}return{coverageTile:f,frcMask:f.frcMask,active:_,hasPolygonGeometry:p}},r4=function(i,r,a,n){let o=i.hdExt&&i.hdExt.frcData;if(!o)return;let s=r.frcMask;for(let[i,r]of o.frcPerLevel)s&1<<i||n(a,r);let l=o.frcNonRoadSegments;l.segments.length>0&&n(a,l)},r5=function(i,r,a,n,o,s,l){if(n.hasPolygonGeometry)return;let h=r.hdExt&&r.hdExt.frcData;if(!h||!i.frcCoverageFadeRange)return;let[u,c]=i.frcCoverageFadeRange;if(u>=c)return;let d=1-Math.max(0,Math.min(1,(i.transform.zoom-u)/(c-u)));if(d<=0)return;let f=o?s:i.stencilModeForClipping(a),p=n.frcMask;for(let[i,r]of h.frcPerLevel)p&1<<i&&l(f,r,d)},r6=function(i,r,a){if(0===a.length)return;let n=i.context.gl,o=rB(i),s=i.transform.zoom,l=(a,o,l,h)=>{let u=a.bucket.hdExt&&a.bucket.hdExt.frcData,c=u&&u.frcPerLevel.get(o);c&&0!==c.segments.length&&(1!==h&&(a.uniformValues.u_opacity_multiplier=h),a.program.draw(i,n.TRIANGLES,a.depthMode,l,a.colorMode,tk.disabled,a.uniformValues,r.id,a.bucket.layoutVertexBuffer,a.bucket.indexBuffer,c,r.paint,s,a.programConfiguration,[a.bucket.layoutVertexBuffer2,a.bucket.patternVertexBuffer,a.bucket.zOffsetVertexBuffer,a.bucket.elevationIdColVertexBuffer,a.bucket.elevationGroundScaleVertexBuffer]),1!==h&&(a.uniformValues.u_opacity_multiplier=1))};rO(i,a,o,(i,r,a)=>l(i,r,a,1),(i,r,a)=>l(i,r,a,o))};async function r8(){return Promise.resolve()}let r9=new Float32Array(i.dq([])),r7=(r,a,n,o,s,l,h,u,c,d,f,p,m,_=[0,0,0],g,y,x,v=1)=>{let b=s.style.light,w=b.properties.get("position"),T=[-w.x,-w.y,w.z],S=i.bV();"viewport"===b.properties.get("anchor")&&(i.cu(S,-s.transform.angle),i.fK(T,T,S));let E="MASK"===f.alphaMode,I=b.properties.get("color").toNonPremultipliedRenderColor(null),A=m.paint.get("model-ambient-occlusion-intensity"),M=m.paint.get("model-color").constantOr(i.i.white).toNonPremultipliedRenderColor(null);return M.a=m.paint.get("model-color-mix-intensity").constantOr(0),x&&(M.r=x[0],M.g=x[1],M.b=x[2],M.a=x[3]),y&&(M.r=y.color.r,M.g=y.color.g,M.b=y.color.b,M.a=y.colorMix,p=y.emissionStrength,l*=y.opacity),{u_matrix:r,u_lighting_matrix:a,u_normal_matrix:n,u_node_matrix:o||r9,u_lightpos:T,u_lightintensity:b.properties.get("intensity"),u_lightcolor:[I.r,I.g,I.b],u_camera_pos:_,u_opacity:l,u_baseTextureIsAlpha:0,u_alphaMask:+E,u_alphaCutoff:f.alphaCutoff,u_baseColorFactor:h.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:u.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:d,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:M.toArray01(),u_aoIntensity:A,u_emissive_strength:p,u_occlusionTextureTransform:g||[0,0,0,0],u_dithered_discard_threshold:v}},ae=(i,r=r9,a=r9)=>({u_matrix:i,u_instance:r,u_node_matrix:a}),at=(i,r,a=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:a}),ai=new Float64Array(16),ar=new Float64Array(16),aa=new Float64Array(16),an=new Float64Array(16),ao=new Float64Array(16),as=new Float64Array(16),al=new Float64Array(16),ah=[0,0,0],au=new Float32Array(16),ac=[0,0,0],ad=[0,0,0],af=[];function ap(r,a,n){let o=n.cameraWorldSizeForFog/n.worldSize;return i.fc(r,n.worldToFogMatrix,[o,o,1]),i.er(r,r,a),r}function am(r,a,n,o){return i.fQ(r,a,n),i.cm(o,i.n)||i.fc(r,r,o),r}function a_(r,a,n,o,s){let l=n.material,h=o.context,{baseColorTexture:u,metallicRoughnessTexture:c}=l.pbrMetallicRoughness,{normalTexture:d,occlusionTexture:f,emissionTexture:p}=l;
109function m(i,a,n){if(i&&(r.push(a),h.activeTexture.set(h.gl.TEXTURE0+n),i.gfxTexture)){let{minFilter:r,magFilter:a,wrapS:n,wrapT:o}=i.sampler;i.gfxTexture.bindExtraParam(r,a,n,o)}}m(u,"HAS_TEXTURE_u_baseColorTexture",5),m(c,"HAS_TEXTURE_u_metallicRoughnessTexture",6),m(d,"HAS_TEXTURE_u_normalTexture",7),m(f,"HAS_TEXTURE_u_occlusionTexture",8),m(p,"HAS_TEXTURE_u_emissionTexture",9),s&&(s.texture||(s.texture=new i.a$(o.context,s.image,[s.image.height,s.image.height,s.image.height],h.gl.RGBA8)),h.activeTexture.set(h.gl.TEXTURE0+10),s.texture&&s.texture.bind(h.gl.LINEAR,h.gl.CLAMP_TO_EDGE),r.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(r.push("HAS_ATTRIBUTE_a_uv_2f"),a.push(n.texcoordBuffer)),n.colorBuffer&&(r.push(12===n.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),a.push(n.colorBuffer)),n.normalBuffer&&(r.push("HAS_ATTRIBUTE_a_normal_3f"),a.push(n.normalBuffer)),n.pbrBuffer&&(r.push("HAS_ATTRIBUTE_a_pbr"),r.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),a.push(n.pbrBuffer)),"OPAQUE"!==l.alphaMode&&"MASK"!==l.alphaMode||r.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||r.push("DIFFUSE_SHADED");let _=o.shadowRenderer;_&&(r.push("RENDER_SHADOWS"),_.useNormalOffset&&r.push("NORMAL_OFFSET"))}function ag(r,a,n,o,s,l){let h=r.modelOpacity,u=a.context,c=new tN(a.context.gl.LEQUAL,r.isLightMesh?tN.ReadOnly:tN.ReadWrite,a.depthRangeFor3D),d=a.transform,f=r.mesh,p=f.material,m=p.pbrMetallicRoughness,_=a.style.fog;"pixels"===a.transform.projection.zAxisUnit?ai.set(r.nodeModelMatrix):i.er(ai,o.zScaleMatrix,r.nodeModelMatrix),i.er(ai,o.negCameraPosMatrix,ai),i.dr(ar,ai),i.fR(ar,ar);let g="none"===n.paint.get("model-color-use-theme").constantOr("default"),y=n.paint.get("model-emissive-strength").constantOr(0),x=r7(r.worldViewProjection,ai,ar,null,a,h,m.baseColorFactor,p.emissiveFactor,m.metallicFactor,m.roughnessFactor,p,y,n,void 0,void 0,r.materialOverride,r.modelColor),v={defines:[]},b=[],w=a.shadowRenderer;w&&(w.useNormalOffset=!1),a_(v.defines,b,f,a,g?null:n.lut);let T=null;if(_&&(T=ap(aa,r.nodeModelMatrix,a.transform),"globe"!==d.projection.name)){let i=f.aabb.min,r=f.aabb.max,[a,n]=_.getOpacityForBounds(T,i[0],i[1],r[0],r[1]);v.overrideFog=a>=.05||n>=.05}let S=t9(a,n.paint.get("model-cutoff-fade-range"));S.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");let E=a.getOrCreateProgram("model",v);a.uploadCommonUniforms(u,E,null,T,S),"shadow"!==a.renderPass&&w&&w.setupShadowsFromMatrix(r.nodeModelMatrix,E),E.draw(a,u.gl.TRIANGLES,c,s,l,f.material.doubleSided?tk.disabled:tk.backCCW,x,n.id,f.vertexBuffer,f.indexBuffer,f.segments,n.paint,a.transform.zoom,void 0,b)}function ay(i,r){return i.style._importedAsBasemap?"basemap":r.scope}function ax(r,a,n,o,s,l,h,u,c,d){let f=r.transform,p=!!a.isGeometryBloom&&a.isGeometryBloom;if(void 0!==a.minZoom&&r.transform.zoom<a.minZoom||void 0!==a.maxZoom&&r.transform.zoom>a.maxZoom||p&&"shadow"===r.renderPass)return;let m="globe"===f.projection.name?i.bR(n,f):[...n];i.er(m,m,a.globalMatrix);let _=i.er([],o,m);if(a.meshes)for(let r of a.meshes){let o=u.get(r.material.name);if(o&&o.opacity<=0)continue;if("BLEND"!==r.material.alphaMode){h.push({mesh:r,depth:0,modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:p,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n});continue}let g=i.fL([],r.centroid,_);!f.isOrthographic&&g[2]<=0||l.push({mesh:r,depth:g[2],modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:p,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n})}if(a.children)for(let i of a.children)ax(r,i,n,o,s,l,h,u,c,d)}function av(i,r,a,n,o){let s=a.shadowRenderer;if(!s)return;let l=s.getShadowPassDepthMode(),h=ae(o||s.calculateShadowPassMatrixFromMatrix(r));a.getOrCreateProgram("modelDepth").draw(a,a.context.gl.TRIANGLES,l,t7.disabled,ie.disabled,tk.disabled,h,n.id,i.vertexBuffer,i.indexBuffer,i.segments,n.paint,a.transform.zoom,void 0,void 0)}function ab(r,a,n,o){let s=function(r,a){let n;if(a.footprintDebugMesh)return a.footprintDebugMesh;if(!a.footprint)return null;let o=r.context,s=a.footprint.vertices,l=a.footprint.indices,h=new i.aQ;for(let i of(h.reserve(s.length),s))h.emplaceBack(i.x,i.y);let u=new i.aT;u.reserve(l.length);for(let i=0;i<l.length;i+=3)u.emplaceBack(l[i],l[i+1],l[i+2]);let c=o.createVertexBuffer(h,i.eQ.members),d=o.createIndexBuffer(u),f=i.aJ.simpleSegment(0,0,s.length,l.length),p=a.id||a.name||"footprint",m=parseInt(p,10);n=isNaN(m)?function(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a)|0;return r}(p):m;let _=i.cg(n),g=i.cg(n+1),y=i.cg(n+2);return a.footprintDebugMesh={vertexBuffer:c,indexBuffer:d,segments:f,color:new i.i(_,g,y,.5)},a.footprintDebugMesh}(r,n);if(!s)return;let l=r.context,h=l.gl,u=r.getOrCreateProgram("debug"),c=s.color,d=tN.disabled;l.activeTexture.set(h.TEXTURE0),r.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),u.draw(r,h.TRIANGLES,d,t7.disabled,ie.alphaBlended,tk.disabled,at(o,c.toPremultipliedRenderColor(null)),"$debug",s.vertexBuffer,s.indexBuffer,s.segments)}function aw(i,r,a,n,o){let s=!1;for(let a of n)1!==a.modelOpacity&&(ag(a,i,r,o[a.modelIndex],t7.disabled,ie.disabled),s=!0);
109for(let a of n)ag(a,i,r,o[a.modelIndex],1!==a.modelOpacity?i.stencilModeFor3D():t7.disabled,i.colorModeForRenderPass());s&&i.resetStencilClippingMasks();let l=ie.additive;for(let n of a)ag(n,i,r,o[n.modelIndex],t7.disabled,n.isLightMesh?l:i.colorModeForRenderPass())}let aT={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new i.A([0,0,0],[i.r,i.r,0])},aS={drawModels:function(r,a,n,o){if("opaque"===r.renderPass)return;let s=n.paint.get("model-opacity").constantOr(1),l=n.paint.get("model-elevation-reference"),h="ground"===l,u="ground"===l;if(0===s)return;let c=n.paint.get("model-cast-shadows");if("shadow"===r.renderPass&&(!c||r.terrain&&s<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof i.bh))return;let d=r.shadowRenderer,f=n.paint.get("model-receive-shadows");d&&(d.useNormalOffset=!0,f||(d.enabled=!1));let p=()=>{d&&(d.useNormalOffset=!0,f||(d.enabled=!0))},m=a.getSource();if("light-beam"===r.renderPass&&"batched-model"!==m.type)return;if("vector"===m.type||"geojson"===m.type)return function(r,a,n,o,s){let l=r.transform,h="globe"===l.projection.name,u=l.getFreeCameraOptions().position;if(!r.modelManager)return;let c=r.modelManager;n.modelManager=c;let d=r.shadowRenderer;if(!Object.hasOwn(n._unevaluatedLayout._values,"model-id"))return;let f=n._unevaluatedLayout._values["model-id"],p=Object.assign({},n.layout.get("model-id").parameters),m=r.style.order.indexOf(n.fqid),_=n.paint.get("model-opacity").constantOr(1);for(let g of o){let o=a.getTile(g).getBucket(n);if(!o||o.projection.name!==l.projection.name)continue;let y=o.getModelUris();(y&&!o.modelsRequested&&(c.addModelsFromBucket(y,s),o.modelsRequested=!0),h)?p.zoom=g.overscaledZ:p.zoom=function(r,a){let n=1<<r.canonical.z,o=a.getFreeCameraOptions().position,s=a.elevation,l=r.canonical.x/n,h=(r.canonical.x+1)/n,u=r.canonical.y/n,c=(r.canonical.y+1)/n,d=a._centerAltitude;if(s){let i=s.getMinMaxForTile(r);i&&i.max>d&&(d=i.max)}let f=i.bG(o.x,l,h)-o.x,p=i.bG(o.y,u,c)-o.y,m=i.em(d,a.center.lat)-o.z;return a._zoomFromMercatorZ(Math.sqrt(f*f+p*p+m*m))}(g,l);let x=f.possiblyEvaluate(p);if(function(r,a,n){let o=a.updateZoomBasedPaintProperties(),s=function(r,a,n){let o,s,l,h=r.terrain?r.terrain.exaggeration():0;if(r.terrain&&h>0){let a=r.terrain,s=a.findDEMTileFor(n);s&&s.dem?o=i.k.create(a,n,s):h=0}if(0===h&&(a.terrainElevationMin=0,a.terrainElevationMax=0),h===a.validForExaggeration&&(0===h||o&&o._demTile&&o._demTile.tileID===a.validForDEMTile.id&&o._dem._timestamp===a.validForDEMTile.timestamp))return!1;for(let i in a.instancesPerModel){let r=a.instancesPerModel[i];for(let i=0;i<r.instancedDataArray.length;++i){let n=(o?h*o.getElevationAt(0|r.instancedDataArray.float32[16*i],0|r.instancedDataArray.float32[16*i+1],!0,!0):0)+r.instancesEvaluatedElevation[i];r.instancedDataArray.float32[16*i+6]=n,s=s?Math.min(a.terrainElevationMin,n):n,l=l?Math.max(a.terrainElevationMax,n):n}}return a.terrainElevationMin=s||0,a.terrainElevationMax=l||0,a.validForExaggeration=h,a.validForDEMTile=o&&o._demTile?{id:o._demTile.tileID,timestamp:o._dem._timestamp}:{id:void 0,timestamp:0},!0}(r,a,n);(o||s)&&(a.uploaded=!1,a.upload(r.context))}(r,o,g),aT.shadowUniformsInitialized=!1,aT.useSingleShadowCascade=!!d&&0===d.getMaxCascadeForTile(g.toUnwrapped()),"shadow"===r.renderPass&&d){if(1===r.currentShadowCascade&&o.isInsideFirstShadowMapFrustum)continue;let a=l.calculatePosMatrix(g.toUnwrapped(),l.worldSize);if(aT.tileMatrix.set(a),aT.shadowTileMatrix.set(d.calculateShadowPassMatrixFromMatrix(a)),aT.aabb.min=[0,0,0],aT.aabb.max[0]=aT.aabb.max[1]=i.r,aT.aabb.max[2]=0,function(r,a,n,o){if(!n.modelManager)return!0;let s=n.modelManager;if(!n.shadowRenderer)return!0;let l=n.shadowRenderer,h=a.aabb,u=!0,c=r.maxHeight;if(0===c){let i=0;for(let a in r.instancesPerModel){let r=s.getModel(a,o);r?i=Math.max(i,Math.max(Math.max(r.aabb.max[0],r.aabb.max[1]),r.aabb.max[2])):u=!1}c=r.maxScale*i*1.41+r.maxVerticalOffset,u&&(r.maxHeight=c)}h.max[2]=c,h.min[2]+=r.terrainElevationMin,h.max[2]+=r.terrainElevationMax,i.fL(h.min,h.min,a.tileMatrix),i.fL(h.max,h.max,a.tileMatrix);let d=h.intersects(l.getCurrentCascadeFrustum());return 0===n.currentShadowCascade&&(r.isInsideFirstShadowMapFrustum=2===d),0===d}(o,aT,r,n.scope))continue}let v=1<<g.canonical.z,b=[((u.x-g.wrap)*v-g.canonical.x)*i.r,(u.y*v-g.canonical.y)*i.r,u.z*v*i.r];r.conflationActive&&Object.keys(o.instancesPerModel).length>0&&r.style.isLayerClipped(n,a.getSource())&&o.updateReplacement(g,r.replacementSource,m,n.scope)&&(o.uploaded=!1,o.upload(r.context));let w=0,T=[],S=[],E=[];for(let a in o.instancesPerModel){let l=o.instancesPerModel[a];l.features.length>0&&!h&&(a=x.evaluate(l.features[0].feature,{}));let d=c.getModel(a,s);if(d||c.hasURLBeenRequested(a)||o.modelUris.includes(a)||(o.modelUris.push(a),o.modelsRequested=!1),d&&d.uploaded)if(h){let a=i.fa([],[u.x,u.y,u.z],r.transform.worldSize);i.eu(a,a);for(let n=0;n<l.instancedDataArray.length;++n){let s=[0,0,0],h=[1,1,1],u=i.bW(),c=l.tileCoordinatesForInstance(n),f=l.transformForInstance(n);i.d7(h,f),i.d5(u,f),i.cH(s,u);let p=l.translationForInstance(n),m=new i.ab(0,0);i.fG(o.canonical,m,c.x,c.y);let g=i.bT();i.bA(g,d,r.transform,m,s,h,p,!0,!1,!1);let y=l.colorForInstance(n),x=i.cw([],a),v=i.cX(m.lat,r.transform.zoom),b=i.cv([],[1,1,1/v]);for(let i of(E.push({zScaleMatrix:b,negCameraPosMatrix:x}),d.nodes))ax(r,i,g,r.transform.expandedFarZProjMatrix,w,T,S,d.materialOverrides,_,y);++w}}else for(let i of d.nodes)!function i(r,a,n,o,s,l,h){let u=r.context,c="shadow"===r.renderPass,d=r.shadowRenderer,f=c&&d?d.get
109ShadowPassDepthMode():new tN(u.gl.LEQUAL,tN.ReadWrite,r.depthRangeFor3D),p=r.isTileAffectedByFog(l),m="globe"===r.transform.projection.name;if(n.meshes)for(let i of n.meshes){let _,g,y,x=m?[]:["MODEL_POSITION_ON_GPU"],v=[],b=!m&&o.instancedDataArray.length>20;b&&x.push("INSTANCED_ARRAYS");let w=t9(r,a.paint.get("model-cutoff-fade-range"));if(w.shouldRenderCutoff&&x.push("RENDER_CUTOFF"),c&&d)_=r.getOrCreateProgram("modelDepth",{defines:x}),g=ae(h.shadowTileMatrix,h.shadowTileMatrix,n.globalMatrix),y=ie.disabled;else{a_(x,v,i,r,"none"===a.paint.get("model-color-use-theme").constantOr("default")?null:a.lut),_=r.getOrCreateProgram("model",{defines:x,overrideFog:p});let o=i.material,c=o.pbrMetallicRoughness,f=a.paint.get("model-opacity").constantOr(1),m=a.paint.get("model-emissive-strength").constantOr(0);g=r7(l.expandedProjMatrix,n.globalMatrix,au,null,r,f,c.baseColorFactor,o.emissiveFactor,c.metallicFactor,c.roughnessFactor,o,m,a,s),d&&(h.shadowUniformsInitialized?_.setShadowUniformValues(u,d.getShadowUniformValues()):(d.setupShadows(l.toUnwrapped(),_,"model-tile"),h.shadowUniformsInitialized=!0)),y=w.shouldRenderCutoff||f<1||"OPAQUE"!==o.alphaMode?ie.alphaBlended:ie.unblended}r.uploadCommonUniforms(u,_,l.toUnwrapped(),null,w);let T=i.material.doubleSided?tk.disabled:tk.backCCW;if(b)v.push(o.instancedDataBuffer),_.draw(r,u.gl.TRIANGLES,f,t7.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v,o.instancedDataArray.length);else{let n=c?"u_instance":"u_normal_matrix";for(let s=0;s<o.instancedDataArray.length;++s)g[n]=new Float32Array(o.instancedDataArray.arrayBuffer,64*s,16),_.draw(r,u.gl.TRIANGLES,f,t7.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v)}}if(n.children)for(let u of n.children)i(r,a,u,o,s,l,h)}(r,n,i,l,b,g,aT)}if(h)if("shadow"===r.renderPass){for(let i of S)av(i.mesh,i.nodeModelMatrix,r,n);for(let i of T)av(i.mesh,i.nodeModelMatrix,r,n)}else aw(r,n,T,S,E)}}(r,a,n,o,ay(r,n)),void p();if(!m.loaded())return;if("batched-model"===m.type)return function(r,a,n,o){n.resetLayerRenderingStats(r);let s=r.context,l=r.transform,h=r.style.fog,u=r.shadowRenderer;if("mercator"!==l.projection.name)return i.f_(`Drawing 3D landmark models for ${l.projection.name} projection is not yet implemented`);let c=r.transform.getFreeCameraOptions().position,d=i.fa([],[c.x,c.y,c.z],r.transform.worldSize),f=i.eu([],d),p=i.cw([],f),m=i.cX(l.center.lat,l.zoom),_=i.cv([],[1,1,1/m]),g=i.er([],p,_),y=n.paint.get("model-opacity").constantOr(1),x=new tN(s.gl.LEQUAL,tN.ReadWrite,r.depthRangeFor3D),v=new tN(s.gl.LEQUAL,tN.ReadOnly,r.depthRangeFor3D),b=new i.A([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),w="shadow"===r.renderPass,T="light-beam"===r.renderPass,S="none"===n.paint.get("model-color-use-theme").constantOr("default"),E=w&&u?u.getCurrentCascadeFrustum():l.getFrustum(l.scaleZoom(l.worldSize)),I=n.paint.get("model-front-cutoff"),A=I[2]<1,M=t9(r,n.paint.get("model-cutoff-fade-range")),C=n.getLayerRenderingStats();(function(i,r,a,n){let o=i.terrain?i.terrain.exaggeration():0,s=i.transform.zoom;for(let l of n){let n=r.getTile(l).getBucket(a);n&&(n.setFilter(a.filter),i.conflationActive&&n.updateReplacement(l,i.replacementSource),n.evaluateTransform(i,a),i.terrain&&o>0&&n.elevationUpdate(i.terrain,o,l,a.source),n.needsReEvaluation(i,s,a)&&n.evaluate(a))}})(r,a,n,o),function(){let c,f,p,_=new Map;A?(c=o.length-1,f=-1,p=-1):(c=0,f=o.length,p=1);let D=i.bU(),R=new i.au(0,0);for(let P=c;P!==f;P+=p){let c=o[P],f=a.getTile(c).getBucket(n);if(!f||!f.uploaded)continue;let p=!1;u&&(p=0===u.getMaxCascadeForTile(c.toUnwrapped()));let L=l.calculatePosMatrix(c.toUnwrapped(),l.worldSize),z=!!(f.modelTraits&i.aj.HasMapboxMeshFeatures);i.er(an,g,L),i.er(ao,l.expandedFarZProjMatrix,L),i.dr(as,an),i.fR(as,as);let O=!w&&u&&u.enabled?u.computeCascadeTileMatrices(L):null;!w&&A&&(i.dr(ar,L),i.fL(D,d,ar),R.x=D[0],R.y=D[1]);let F=[];for(let a of(f.setFilter(n.filter),f.getNodesInfo())){if(a.hiddenByReplacement||!
109a.node.meshes)continue;let n=a.node,o=0;r.terrain&&n.elevation&&(o=n.elevation*r.terrain.exaggeration());let s=(()=>{let r=a.aabb,n=b.min,s=b.max;return n[0]=r.min[0],n[1]=r.min[1],n[2]=r.min[2]+o,s[0]=r.max[0],s[1]=r.max[1],s[2]=r.max[2]+o,i.fL(n,n,L),i.fL(s,s,L),b})(),h=a.evaluatedScale;if(h[0]<=1&&h[1]<=1&&h[2]<=1&&0===s.intersects(E))continue;if(!w){let n=s.min,o=s.max;ac[0]=.5*(n[0]+o[0]),ac[1]=.5*(n[1]+o[1]),ac[2]=.5*(n[2]+o[2]),function(r,a,n,o,s){let l=r.node;if(l.lodMeshes&&l.lodMeshes.length>0)if(r.targetLod<0)r.targetLod=+(a>o);else{let l=s>0?n/1e3/s:1;r.targetLod=i.bG(a>o?r.targetLod+l:r.targetLod-l,0,1)}else r.targetLod=0}(a,i.c5(d,ac)*m,Math.min(r._debugParams.dt,1e3/30),r._debugParams.lodSwitchDistance,r._debugParams.lodSwitchFadeDuration)}if(!w&&A){let r=1/6;a.cameraCollisionOpacity=d[0]>s.min[0]&&d[0]<s.max[0]&&d[1]>s.min[1]&&d[1]<s.max[1]&&d[2]*m<s.max[2]&&n.footprint&&i.eI(R,n.footprint)?Math.max(a.cameraCollisionOpacity-r,0):Math.min(1,a.cameraCollisionOpacity+r)}let u=1/i.fH(c.canonical),f=n.anchor?n.anchor[0]:0,p=n.anchor?n.anchor[1]:0,_=[f*(h[0]-1)+a.evaluatedTranslation[0]*u,p*(h[1]-1)+a.evaluatedTranslation[1]*u,o+a.evaluatedTranslation[2]],g=am(new Float64Array(16),L,_,h),x=i.er([],g,n.globalMatrix),v=i.er([],l.expandedFarZProjMatrix,x),T=v[2]*f+v[6]*p+v[10]*o+v[14];n.hidden=!1;let S=y;w||(A&&(S*=a.cameraCollisionOpacity*function(r,a,n,o){if(a.pitch<20)return 1;let s=a.getWorldToCameraMatrix();i.er(s,s,r);let l=i.cy(n.min[0],n.min[1],n.min[2],1),h=i.fM(i.bX(),l,s),u=h,c=h;l[1]=n.max[1],u=(h=i.fM(i.bX(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[0]=n.max[0],u=(h=i.fM(i.bX(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[1]=n.min[1],u=(h=i.fM(i.bX(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c;let d=i.bG(o[0],0,1),f=100*a.pixelsPerMeter*i.bG(o[1],0,1),p=i.bG(o[2],0,1),m=i.d_(i.bX(),u,c,d),_=Math.tan(.5*a.fovX),g=-m[2]*_;if(0===f)return m[1]<-Math.abs(g)?p:1;let y=(-Math.abs(g)-m[1])/f,x=i.bG(i.dY(1,p,y),p,1);return i.dY(1,x,i.bG((a.pitch-20)/20,0,1))}(g,l,a.aabb,I)),S*=function(r,a){let n=r.uniformValues.u_cutoff_params[0],o=r.uniformValues.u_cutoff_params[1],s=r.uniformValues.u_cutoff_params[2],l=r.uniformValues.u_cutoff_params[3];return o===n||l===s?1:i.bG(((a-n)/(o-n)-s)/(l-s),0,1)}(M,T)),0!==S?F.push({nodeInfo:a,depth:T,opacity:S,wvpForNode:v,nodeModelMatrix:x,tileModelMatrix:g,tileTranslation:_}):n.hidden=!0}for(let a of(w||F.sort((i,r)=>A&&(1!==i.opacity||1!==r.opacity)?1===i.opacity?-1:1===r.opacity?1:i.depth>r.depth?-1:1:i.depth<r.depth?-1:1),F)){let o=a.nodeInfo,c=o.node,d=null;if(r._debugParams.show3DModelFootprints&&c.footprint){let i=c.id||c.name||"footprint";if(!_.has(i)){let r=am(new Float64Array(16),ao,a.tileTranslation,a.nodeInfo.evaluatedScale);_.set(i,{node:c,mvp:r})}}let f=a.nodeInfo.evaluatedScale;am(ai,an,a.tileTranslation,f),ah[0]=1/f[0],ah[1]=-1/f[1],ah[2]=1/f[2],i.fc(ar,as,ah),i.er(ai,ai,c.globalMatrix);let m=z?0:o.evaluatedRMEA[0][2],g=o.targetLod,y=c.lodMeshes&&c.lodMeshes.length>0,b=y&&g>0&&g<1;if(w&&y&&1===Math.round(g))continue;let E=!w&&h?ap(aa,a.nodeModelMatrix,r.transform):null,I=w&&u?u.calculateShadowPassMatrixFromMatrix(a.nodeModelMatrix):null,A=b?2:1,M=y&&1===Math.round(g);for(let i=0;i<A;++i){let f=b?1===i:M,_=f?c.lodMeshes:c.meshes,y=b?f?-g:1-g:1;for(let i=0;i<_.length;++i){let g,A=_[i],M=!f&&i===c.lightMeshIndex,D=a.wvpForNode;if(M){if(!T&&!r.terrain&&r.shadowRenderer){r.currentLayer<r.firstLightBeamLayer&&(r.firstLightBeamLayer=r.currentLayer);continue}D=am(al,ao,a.tileTranslation,a.nodeInfo.evaluatedScale)}else if(T)continue;let R={defines:[]},P=[],L=!!A.normalBuffer;if(!w&&u&&(u.useNormalOffset=L),a_(R.defines,P,A,r,S?null:n.lut),z||R.defines.push("DIFFUSE_SHADED"),p&&R.defines.push("SHADOWS_SINGLE_CASCADE"),C&&(w?C.numRenderedVerticesInShadowPass+=A.vertexArray.length:C.numRenderedVerticesInTransparentPass+=A.vertexArray.length),w){av(A,a.nodeModelMatrix,r,n,I);continue}if(h&&"globe"!==l.projection.name){let i=A.aabb.min,r=A.aabb.max,[a,n]=h.getOpacityForBounds(E,i[0],i[1],r[0],r[1]);R.overrideFog=a>=.05||n>=.05}let F=A.material;F.occlusionTexture&&F.occlusionTexture.offsetScale&&(g=F.occlusionTexture.offsetScale,R.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),b&&R.defines.push("DITHERED_DISCARD");let B=r.getOrCreateProgram("model",R);if(!w&&u&&u.enabled)if(d!==L){for(let i=0;i<O.length;i++)am(af[i]=af[i]||new Float64Array(16),O[i],a.tileTranslation,a.nodeInfo.evaluatedScale);u.setupShadowsFromCascadeMatrices(af,B,L),d=L}else B.setShadowUniformValues(s,u.getShadowUniformValues());r.uploadCommonUniforms(s,B,null,E);let k=F.pbrMetallicRoughness;k.metallicFactor=.9,k.roughnessFactor=.5;let N=r7(D,ai,ar,c.globalMatrix,r,a.opacity,k.baseColorFactor,F.emissiveFactor,k.metallicFactor,k.roughnessFactor,F,m,n,ad,g,void 0,void 0,y);!M&&(o.hasTranslucentParts||a.opacity<1)&&B.draw(r,s.gl.TRIANGLES,x,t7.disabled,ie.disabled,tk.backCCW,N,n.id,A.vertexBuffer,A.indexBuffer,A.segments,n.paint,r.transform.zoom,void 0,P),B.draw(r,s.gl.TRIANGLES,M?v:x,t7.disabled,M||a.op
109acity<1||o.hasTranslucentParts?ie.alphaBlended:ie.unblended,tk.backCCW,N,n.id,A.vertexBuffer,A.indexBuffer,A.segments,n.paint,r.transform.zoom,void 0,P)}}}}if(r._debugParams.show3DModelFootprints&&_.size>0)for(let i of Array.from(_.keys()).sort()){let{node:a,mvp:n}=_.get(i);ab(r,0,a,n)}}()}(r,a,n,o),void p();if("model"!==m.type)return;let _=m.getModels(),g=[],y=r.transform.getFreeCameraOptions().position,x=i.fa([],[y.x,y.y,y.z],r.transform.worldSize);i.eu(x,x);let v=[],b=[],w=0;for(let o of _){let s=a.getFeatureState("",o.id),l={type:"Unknown",id:o.id,properties:o.featureProperties},c=n.paint.get("model-rotation").evaluate(l,s),d=n.paint.get("model-scale").evaluate(l,s),f=n.paint.get("model-translation").evaluate(l,s),p=n.paint.get("model-opacity").evaluate(l,s);(function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={orientation:i.paint.get("model-rotation").evaluate(h,a)};s.set(l,u)}})(n,o.id,s,o.featureProperties,o.nodeOverrideNames,o.nodeOverrides),function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={color:i.paint.get("model-color").evaluate(h,a),colorMix:i.paint.get("model-color-mix-intensity").evaluate(h,a),opacity:i.paint.get("model-opacity").evaluate(h,a),emissionStrength:i.paint.get("model-emissive-strength").evaluate(h,a)};s.set(l,u)}}(n,o.id,s,o.featureProperties,o.materialOverrideNames,o.materialOverrides),o.nodeOverrides.size>0&&o.computeBoundsAndApplyParent(),o.computeModelMatrix(r,c,d,f,u,h,!1);let m=i.cw([],x),_=i.cX(o.position.lat,r.transform.zoom),y=i.cv([],[1,1,1/_]);for(let i of(g.push({zScaleMatrix:y,negCameraPosMatrix:m}),o.nodes))ax(r,i,o.matrix,r.transform.expandedFarZProjMatrix,w,v,b,o.materialOverrides,p);w++}if(v.sort((i,r)=>r.depth-i.depth),"shadow"!==r.renderPass){if(r._debugParams.show3DModelFootprints){let a=r.transform.projMatrix,n=new Map,o=(r,o)=>{if(r.footprint){let s=r.id||r.name||"footprint";if(!n.has(s)){let l=i.er([],a,o);n.set(s,{node:r,mvp:l})}}};for(let i of b)o(i.node,i.modelMatrix);for(let i of v)o(i.node,i.modelMatrix);for(let i of Array.from(n.keys()).sort()){let{node:a,mvp:o}=n.get(i);ab(r,0,a,o)}}aw(r,n,v,b,g),p()}else{for(let i of b)av(i.mesh,i.nodeModelMatrix,r,n);for(let i of v)av(i.mesh,i.nodeModelMatrix,r,n);p()}},prepare:function(i,r,a){let n=r.getSource();if(n.loaded()){if("vector"===n.type||"geojson"===n.type)return void(a.modelManager&&a.modelManager.upload(a,ay(a,i)));if("batched-model"!==n.type&&"model"===n.type)for(let i of n.getModels())i.upload(a.context)}},shaders:{model:rc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;
vendor: 10,615 bytes, line 109
109uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef FEATURE_CUTOUT_VERTEX\nin highp float v_cutout_factor;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef FLIP_Y\ncoord.y=1.0-coord.y;\n#endif\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\ntexColor=vec4(unpremultiplyColor(texColor),1.0);\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir
109=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
109y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT_VERTEX\napply_feature_cutout_dither(gl_FragCoord,v_cutout_factor);\n#else\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef FEATURE_CUTOUT_VERTEX\nout highp float v_cutout_factor;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp uvec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\n#ifdef FEATURE_CUTOUT_VERTEX\nv_cutout_factor=1.0;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#ifdef FEATURE_CUTOUT_VERTEX\nhighp vec4 ground_pos=vec4(pos_a.xy,0.0,1.0);highp vec4 cutout_clip_pos=mix(u_matrix*ground_pos,AWAY,hidden);highp vec3 cutout_ndc=cutout_clip_pos.xyz/cutout_clip_pos.w;vec2 uv=cutout_ndc.xy*0.5+0.5;highp float fragDepthNDC=cutout_ndc.z*0.5+0.5;\n#ifdef FLIP_Y\nfragDepthNDC=cutout_ndc.z;\n#endif\nhighp float cutoutFactor=get_cutout_factors_vert(uv).x;highp float cutoutDepthNDC=sample_cutout_depth(u_cutout_depth_image,uv);highp float groundThreshold=0.001;
109highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);v_cutout_factor=mix(1.0-cutoutFactor,1.0,groundLimit);\n#endif\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(float(pbr.z));vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#ifdef CLIP_ZERO_TO_ONE\nv_depth=-1.0+2.0*v_depth; \n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:rc("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
109rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\n}")},programUniforms:{model:r=>({u_matrix:new i.bb(r),u_lighting_matrix:new i.bb(r),u_normal_matrix:new i.bb(r),u_node_matrix:new i.bb(r),u_lightpos:new i.b7(r),u_lightintensity:new i.b4(r),u_lightcolor:new i.b7(r),u_camera_pos:new i.b7(r),u_opacity:new i.b4(r),u_baseColorFactor:new i.b8(r),u_emissiveFactor:new i.b8(r),u_metallicFactor:new i.b4(r),u_roughnessFactor:new i.b4(r),u_baseTextureIsAlpha:new i.b5(r),u_alphaMask:new i.b5(r),u_alphaCutoff:new i.b4(r),u_baseColorTexture:new i.b5(r),u_metallicRoughnessTexture:new i.b5(r),u_normalTexture:new i.b5(r),u_occlusionTexture:new i.b5(r),u_emissionTexture:new i.b5(r),u_lutTexture:new i.b5(r),u_color_mix:new i.b8(r),u_aoIntensity:new i.b4(r),u_emissive_strength:new i.b4(r),u_occlusionTextureTransform:new i.b8(r),u_dithered_discard_threshold:new i.b4(r)}),modelDepth:r=>({u_matrix:new i.bb(r),u_instance:new i.bb(r),u_node_matrix:new i.bb(r)})}};async function aE(){return Promise.resolve()}class aI{constructor(i,r,a){this.screenBounds=i,this.cameraPoint=a.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(r,a){let n,o;if(r instanceof i.au||"number"==typeof r[0]){let s=i.au.convert(r);n=[s],o=a.isPointAboveHorizon(s)}else{let s=i.au.convert(r[0]),l=i.au.convert(r[1]),h=s.add(l)._div(2);n=[s,l],o=i.eP(s,l).every(i=>a.isPointAboveHorizon(i))&&a.isPointAboveHorizon(h)}return new aI(n,o,a)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.eP(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.au(1,1)):this.screenBounds[1],o=i.eP(a,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<n.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=n.x?o[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(o[3]=this.cameraPoint)),i.bu(o,r)}bufferedCameraGeometryGlobe(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.au(1,1)):this.screenBounds[1],o=i.eP(a,n,r),s=this.cameraPoint.clone(),l=Number(s.x>a.x)+Number(s.x>n.x);switch(3*(Number(s.y>a.y)+Number(s.y>n.y))+l){case 0:o[0]=s,o[4]=s.clone();break;case 1:o.splice(1,0,s);break;case 2:o[1]=s;break;case 3:o.splice(4,0,s);break;case 5:o.splice(2,0,s);break;case 6:o[3]=s;break;case 7:o.splice(3,0,s);break;case 8:o[2]=s}return o}containsTile(r,a,n,o=0){var s;let l=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,h=n?this._bufferedCameraMercator(l,a):this._bufferedScreenMercator(l,a),u=r.tileID.wrap+(h.unwrapped?o:0),c=h.polygon.map(a=>i.d8(r.tileTransform,a,u));if(!i.eM(c,0,0,i.r,i.r))return;u=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let d=this.screenGeometryMercator.polygon.map(a=>i.d9(r.tileTransform,a,u)),f=d.map(r=>new i.au(r[0],r[1])),p=a.getFreeCameraOptions().position||new i.ag(0,0,0),m=i.d9(r.tileTransform,p,u),_=d.map(r=>{let a=i.fx(r,r,m);return i.ex(a,a),new i.aB(m,a)}),g=i.eG(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:f,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.cI(c)).min.x=i.bG(s.min.x,0,i.r),s.min.y=i.bG(s.min.y,0,i.r),s.max.x=i.bG(s.max.x,
1090,i.r),s.max.y=i.bG(s.max.y,0,i.r),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(i,r){let a=100*i|0;if(this._screenRaycastCache[a])return this._screenRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedScreenGeometry(i),r):{polygon:this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._screenRaycastCache[a]=n,n}}_bufferedCameraMercator(i,r){let a=100*i|0;if(this._cameraRaycastCache[a])return this._cameraRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),r):{polygon:this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._cameraRaycastCache[a]=n,n}}_projectAndResample(r,a){let n=function(r,a){let n=i.er([],a.pixelMatrix,a.globeMatrix),o=[0,-i.P,0,1],s=[0,i.P,0,1],l=[0,0,0,1];i.fM(o,o,n),i.fM(s,s,n),i.fM(l,l,n);let h=new i.au(o[0]/o[3],o[1]/o[3]),u=new i.au(s[0]/s[3],s[1]/s[3]),c=i.eL(r,h)&&o[3]<l[3],d=i.eL(r,u)&&s[3]<l[3];if(!c&&!d)return null;let f=function(i,r,a){for(let n=1;n<i.length;n++){let o=aM(r.pointCoordinate3D(i[n-1]).x),s=aM(r.pointCoordinate3D(i[n]).x);if(a<0){if(o<s)return{idx:n,t:-o/(s-1-o)}}else if(s<o)return{idx:n,t:(1-o)/(s+1-o)}}return null}(r,a,c?-1:1);if(!f)return null;let{idx:p,t:m}=f,_=p>1?aA(r.slice(0,p),a):[],g=p<r.length?aA(r.slice(p),a):[];_=_.map(r=>new i.au(aM(r.x),r.y)),g=g.map(r=>new i.au(aM(r.x),r.y));let y=[..._];0===y.length&&y.push(g.at(-1));let x=y.at(-1),v=i.dY(x.y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new i.au(0,v),new i.au(0,0),new i.au(1,0),new i.au(1,v)]:[new i.au(1,v),new i.au(1,1),new i.au(0,1),new i.au(0,v)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(r=>new i.ag(r.x,r.y)),unwrapped:!1}}(r,a);if(n)return n;let o=function(r,a){let n=!1,o=-1/0,s=0;for(let i=0;i<r.length-1;i++)r[i].x>o&&(o=r[i].x,s=i);for(let i=0;i<r.length-1;i++){let a=(s+i)%(r.length-1),o=r[a],l=r[a+1];Math.abs(o.x-l.x)>.5&&(o.x<l.x?(o.x+=1,0===a&&(r.at(-1).x+=1)):(l.x+=1,a+1===r.length-1&&(r[0].x+=1)),n=!0)}let l=i.ek(a.center.lng);return n&&l<Math.abs(l-1)&&r.forEach(i=>{i.x-=1}),{polygon:r,unwrapped:n}}(aA(r,a).map(r=>new i.au(aM(r.x),r.y)),a);return{polygon:o.polygon.map(r=>new i.ag(r.x,r.y)),unwrapped:o.unwrapped}}}function aA(r,a){return i.f0(r,i=>{let r=a.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function aM(i){return i<0?1+i%1:i%1}class aC extends i.y{constructor(r,a,n,o){if(super(),this.id=r,this.dispatcher=n,this.type="vector",this.provider=a.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,i.eF(a,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o),this._tileWorkers={},this._deduped=new i.m}load(r){this._loaded=!1,this.fire(new i.x("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview(),o=(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.v(o))):s&&(this._setTileJSON(s),Y(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.x("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)};this.provider=this._options.provider;let s=i.f1(this._options);return s instanceof Error?(this._loaded=!0,this.fire(new i.v(s)),void(r&&r())):this.provider&&!s?(this._loaded=!0,this.fire(new i.v(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=s?this.loadTileJSONWithProvider(s,o):i.e7(this._options,this.map._requestManager,a,n,o))}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.eC(this._options,this.map._requestManager),s=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.t
109ype,options:o,request:n},(r,n)=>{if(s.signal.aborted)return;if(r)return void a(r);let o=n?n.find(i=>null!=i):null,l=i.eW(this._options,o,this.map._requestManager);l instanceof Error?a(l):a(null,l)}),{cancel:()=>s.abort()}}_setTileJSON(i){if(Object.assign(this,i),this.hasWorldviews=!!i.worldview_options,i.worldview_default&&(this.worldviewDefault=i.worldview_default),i.vector_layers)for(let r of(this.vectorLayers=i.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,i.vector_layers))this.vectorLayerIds.push(r.id),i.worldview&&i.worldview[r.source]&&this.localizableLayerIds.add(r.id);this.tileBounds=iV.fromTileJSON(i)}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(r,a){let n=r.tileID.canonical.url(this.tiles,this.scheme),o=this.map._requestManager.normalizeTileURL(n),s=this.map._requestManager.transformRequest(o,i.aH.Tile),l=this.map.style?this.map.style.getLut(this.scope):null,h=l?{image:l.image.clone()}:null,u={request:s,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:h,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
109ype,source:this.id,scope:this.scope,pixelRatio:i.co.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:r.renderSourceType,frcCoverage:(()=>{let i=this.map.painter,a=i?i.frcCoverageFadeRange:null;if(null==a)return null;let n=i?i.frcCoverageSnapshot:null,o=this.map.transform.zoom<a[0],s=n?n.getTileOrParent(r.tileID.canonical):null,l=r.tileID.overscaledZ>=Math.ceil(a[1]),h=n&&l?n.getFullCoverageMask(r.tileID.canonical):null;return{frcMask:l&&null!=h?h:null,resolved:o||null!=n,polygons:s&&0!==s.frcMask?s.polygons:null,tileZoom:s&&0!==s.frcMask?s.tileId.z:null,sourceLayers:i?i.frcCoverageSourceLayers:["road","structure"]}})(),brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&i.dL(n)&&(u.localizableLayerIds=this.localizableLayerIds),u.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=a:r.request=r.actor.send("reloadTile",u,c.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)r.request=r.actor.send("loadTile",u,c.bind(this),void 0,!0);else{let a=i.e9.call({deduped:this._deduped},u,(a,n)=>{if(a||!n)c.call(this,a);else{let a=i.cO(n.responseHeaders);u.data={rawData:n.rawData.slice(0),expires:a.expires,cacheControl:a.cacheControl},r.actor&&r.actor.send("loadTile",u,c.bind(this),void 0,!0)}},!0);r.request={cancel:a}}function c(n,o){return delete r.request,r.aborted?a(null):n?a(n):(o&&o.resourceTiming&&(r.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&r.setExpiryData(o),void(function(){if(r.aborted)return a(null);r.loadVectorData(o,this.map.painter),i.bv(this.dispatcher),a(null,o),r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)}).call(this))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
109ype,source:this.id,scope:this.scope})}unloadTile(i,r){i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}let aD={vector:aC,raster:ij,"raster-dem":class extends ij{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.eC(this._options,this.map._requestManager),s=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:o,request:n},(r,n)=>{if(s.signal.aborted)return;if(r)return void a(r);let o=n?n.find(i=>null!=i):null,l=i.eW(this._options,o,this.map._requestManager);l instanceof Error?a(l):a(null,l)}),{cancel:()=>s.abort()}}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.aH.Tile),s={uid:r.uid,tileID:r.tileID,source:this.id,type:this.t
109ype,scope:this.scope,request:o,encoding:this.encoding};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.request=r.actor.send("loadTile",s,(function(i,n){return delete r.request,r.aborted?(r.state="unloaded",a(null)):i?(r.state="errored",a(i)):(n&&(this.map._refreshExpiredTiles&&r.setExpiryData(n),n.borderReady||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID)),r.dem=n.dem,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0),r.state="loaded",void a(null))}).bind(this),void 0,!0))}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),r&&r()}_getNeighboringTiles(r){let a=r.canonical,n=Math.pow(2,a.z),o=(a.x-1+n)%n,s=0===a.x?r.wrap-1:r.wrap,l=(a.x+1+n)%n,h=a.x+1===n?r.wrap+1:r.wrap,u={};return u[new i.ap(r.overscaledZ,s,a.z,o,a.y).key]={backfilled:!1},u[new i.ap(r.overscaledZ,h,a.z,l,a.y).key]={backfilled:!1},a.y>0&&(u[new i.ap(r.overscaledZ,s,a.z,o,a.y-1).key]={backfilled:!1},u[new i.ap(r.overscaledZ,r.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},u[new i.ap(r.overscaledZ,h,a.z,l,a.y-1).key]={backfilled:!1}),a.y+1<n&&(u[new i.ap(r.overscaledZ,s,a.z,o,a.y+1).key]={backfilled:!1},u[new i.ap(r.overscaledZ,r.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},u[new i.ap(r.overscaledZ,h,a.z,l,a.y+1).key]={backfilled:!1}),u}},"raster-array":iG,geojson:class extends i.y{constructor(r,a,n,o){super(),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(o),this._data=a.data,this._options=Object.assign({},a),this._collectResourceTiming=a.collectResourceTiming,void 0!==a.maxzoom&&(this.maxzoom=a.maxzoom),void 0!==a.minzoom&&(this.minzoom=a.minzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const s=i.r/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(void 0!==a.buffer?a.buffer:128)*s,tolerance:(void 0!==a.tolerance?a.tolerance:.375)*s,extent:i.r,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:void 0!==a.clusterMaxZoom?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:i.r,radius:(void 0!==a.clusterRadius?a.clusterRadius:50)*s,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter,dynamic:a.dynamic},a.workerOptions)}onAdd(i){this.map=i,this.setData(this._data)}setData(i){return this._data=i,this._updateWorkerData(),this}updateData(r){if(!this._options.dynamic)return this.fire(new i.v(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof r&&("Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),"FeatureCollection"!==r.type))return this.fire(new i.v(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof r&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let i=new Map;for(let r of this._data.features)i.set(r.id,r);for(let a of r.features)i.set(a.id,a);this._data.features=[...i.values()]}else this._data=r;return this._updateWorkerData(!0),this}getClusterExpansionZoom(i,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterLeaves(i,r,a,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:i,limit:r,offset:a},n),this}_updateWorkerData(r=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.x("dataloading",{dataType:"source"})),this._loaded=!1;let a=Object.assign({append:r},this.workerOptions);a.scope=this.scope;let n=this._data;"string"==typeof n?(a.request=this.map._requestManager.transformRequest(i.co.resolveURL(n),i.aH.Source),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,a,(a,n)=>{if(this._loaded=!0,this._pendingLoad=null,a)this.fire(new i.v(a));else{let a={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(a.resourceTiming=n.resourceTiming[this.id]),r&&(this._partialReload=!0),this.fire(new i.x("data",a)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(r),this._coalesce=!1)})}loaded(){return this._loaded}reload(){let r=i.ea(this.id,this.scope);this.map.style.clearSource(r),this._updateWorkerData()}loadTile(r,a){let n=r.actor?"reloadTile":"loadTile";r.actor=this.actor;let o=this.map.style?this.map.style.getLut(this.scope):null,s=o?{image:o.image.clone()}
109:null,l=this._partialReload,h={type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:s,scope:this.scope,pixelRatio:i.co.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:l,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};r.request=this.actor.send(n,h,(i,o)=>l&&!o?(r.state="loaded",a(null)):(delete r.request,r.destroy(!1),r.aborted?a(null):i?a(i):(r.loadVectorData(o,this.map.painter,"reloadTile"===n),a(null))),void 0,"loadTile"===n)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i,r){this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}onRemove(i){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
109,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.a3{constructor(i,r,a,n){super(i,r,a,n),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;let r=this.options;for(let a of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(a,i.aH.Source).url);i.db(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new i.v(r)):a&&(this.video=a,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){let a=this.video.seekable;r<a.start(0)||r>a.end(0)?this.fire(new i.v(new eO(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let r=this.map.painter.context,a=r.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new i.a_(r,this.video,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(r)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.a3,model:i.ai,"batched-model":class extends i.y{constructor(i,r,a,n){super(),this.type="batched-model",this.id=i,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(n)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.ea(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(r){this._loaded=!1,this.fire(new i.x("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=i.e7(this._options,this.map._requestManager,a,n,(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.v(o))):s&&(Object.assign(this,s),s.bounds&&(this.tileBounds=new iV(s.bounds,this.minzoom,this.maxzoom)),Y(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.x("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}hasTransition(){return!1}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loaded(){return this._loaded}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(n,i.aH.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
109ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:r.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.co.devicePixelRatio,promoteId:this.promoteId};if(r.actor&&"expired"!==r.state)if("loading"===r.state)r.reloadCallback=a;else{if(r.buckets){for(let i of Object.values(r.buckets))i.dirty=!0;return void(r.state="loaded")}r.request=r.actor.send("reloadTile",o,s.bind(this))}else r.actor=this.dispatcher.getActor(),r.request=r.actor.send("loadTile",o,s.bind(this),void 0,!0);function s(i,n){return r.aborted?a(null):i&&404!==i.status?a(i):(this.map._refreshExpiredTiles&&n&&r.setExpiryData(n),r.loadModelData(n,this.map.painter),r.state="loaded",void a(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.a3{constructor(r,a,n,o){super(r,a,n,o),a.coordinates?Array.isArray(a.coordinates)&&4===a.coordinates.length&&!a.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.v(new eO(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.v(new eO(`sources.${r}`,null,'missing required property "coordinates"'))),a.animate&&"boolean"!=typeof a.animate&&this.fire(new i.v(new eO(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),a.canvas?"string"==typeof a.canvas||a.canvas instanceof HTMLCanvasElement||this.fire(new i.v(new eO(`sources.${r}`,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 i.v(new eO(`sources.${r}`,null,'missing required property "canvas"'))),this.options=a,this.animate=void 0===a.animate||a.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 i.v(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(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(i){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let a=this.map.painter.context;this.texture?!r&&!this._playing||this.texture instanceof i.bd||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.a_(a,this.canvas,a.gl.RGBA8,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}},custom:class extends i.y{constructor(r,a,n,o){super(),this.id=r,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=a,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.v(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.v(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new iV(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,i.eF(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.eF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this.map=r,this._loaded=!1,this.fire(new i.x("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(r),this.load()}onRemove(i){this._implementation.onRemove&&this._implementation.onRemove(i)}hasTile(i){if(this._implementation.hasTile){let{x:r,y:a,z:n}=i.canonical;return this._implementation.hasTile({x:r,y:a,z:n})}
109return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,r){let{x:a,y:n,z:o}=i.tileID.canonical,s=new AbortController,l=Promise.resolve(this._implementation.loadTile({x:a,y:n,z:o},{signal:s.signal})).then((function(a){return delete i.request,i.aborted?(i.state="unloaded",r(null)):void 0===a?(i.state="errored",r(null)):null===a?(this.loadTileData(i,{width:this.tileSize,height:this.tileSize,data:null}),i.state="loaded",r(null)):a instanceof ImageData||a instanceof HTMLCanvasElement||a instanceof ImageBitmap||a instanceof HTMLImageElement?(this.loadTileData(i,a),i.state="loaded",void r(null)):(i.state="errored",r(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(a=>{"AbortError"!==a.name&&(i.state="errored",r(a))});l.cancel=()=>s.abort(),i.request=l}loadTileData(i,r){i.setTexture(r,this.map.painter)}unloadTile(r,a){if(r.texture&&r.texture instanceof i.a_?(r.destroy(!1),r.texture&&r.texture instanceof i.a_&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),this._implementation.unloadTile){let{x:i,y:a,z:n}=r.tileID.canonical;this._implementation.unloadTile({x:i,y:a,z:n})}a&&a()}abortTile(i,r){i.request&&i.request.cancel&&(i.request.cancel(),delete i.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(i=>({x:i.canonical.x,y:i.canonical.y,z:i.canonical.z}))}_clearTiles(){let r=i.ea(this.id,this.scope);this.map.style.clearSource(r)}_update(){this.fire(new i.x("data",{dataType:"source",sourceDataType:"content"}))}}},aR=function(r,a,n,o){let s=new aD[a.type](r,a,n,o);if(s.id!==r)throw Error(`Expected Source id to be ${r} instead of ${s.id}`);return i.bs(["load","abort","unload","serialize","prepare"],s),s};function aP(i,r,a=""){return`${a}:${r.id||""}:${r.layer.id}:${function(i){if("layerId"in i)return`layer:${i.layerId}`;{let{featuresetId:r,importId:a}=i;return`featureset:${r}${a?`:import:${a}`:""}`}}(i.target)}`}function aL(i,r,a,n=""){if(i.uniqueFeatureID){let o=aP(i,r,n);if(a.has(o))return!0;a.add(o)}return!1}function az(i,r){let a=i.tileID,n=r.tileID;return a.overscaledZ-n.overscaledZ||a.canonical.y-n.canonical.y||a.wrap-n.wrap||a.canonical.x-n.canonical.x}class aO{constructor(i){this.style=i,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let i in this.layers=[],this.style._mergedLayers){let r=this.style._mergedLayers[i];if("fill-extrusion"===r.type||"building"===r.type)this.layers.push({layer:r,visible:!1,visibilityChanged:!1});else if("model"===r.type){let i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:!1,visibilityChanged:!1})}}}onNewFrame(i){for(let r of(this.layersGotHidden=!1,this.layers)){let a=r.layer,n=!1;"fill-extrusion"===a.type?n=!a.isHidden(i)&&a.paint.get("fill-extrusion-opacity")>0:"building"===a.type?n=!a.isHidden(i)&&a.paint.get("building-opacity")>0:"model"===a.type&&(n=!a.isHidden(i)&&a.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!n&&r.visible,r.visible=n}}updateZOffset(i,r){for(let i of(this.currentBuildingBuckets=[],this.layers)){let a=i.layer,n=this.style.getLayerSourceCache(a),o=1;"fill-extrusion"===a.type?o=i.visible?a.paint.get("fill-extrusion-vertical-scale"):0:"building"===a.type&&(o=i.visible?a.paint.get("building-vertical-scale"):0);let s=n?n.getTile(r):null;if(!s&&n)for(let i in n._tiles){let a=n._tiles[i];if(r.canonical.isChildOf(a.tileID.canonical)){s=a;break}}this.currentBuildingBuckets.push({bucket:s?s.getBucket(a):null,tileID:s?s.tileID:r,verticalScale:o})}i.hasAnyZOffset=!1;let a=!1;for(let n=0;n<i.symbolInstances.length;n++){let o=i.symbolInstances.get(n),s=o.zOffset,l=this._getHeightAtTileOffset(r,o.tileAnchorX,o.tileAnchorY);o.zOffset=l!==-1/0?l:s,a||s===o.zOffset||(a=!0),i.hasAnyZOffset||0===o.zOffset||(i.hasAnyZOffset=!0)}a&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,a,n,o){let s=a,l=n;if(r.canonical.z!==o.canonical.z){let h=o.canonical,u=1/(1<<r.canonical.z-h.z);s=(a+r.canonical.x*i.r)*u-h.x*i.r|0,l=(n+r.canonical.y*i.r)*u-h.y*i.r|0}return{tileX:s,tileY:l}}_getHeightAtTileOffset(i,r,a){let n,o;for(let s=0;s<this.layers.length;++s){let l=this.layers[s].layer;if("fill-extrusion"!==l.type&&"building"!==l.type)continue;let{bucket:h,tileID:u,verticalScale:c}=this.currentBuildingBuckets[s];if(!h)continue;let{tileX:d,tileY:f}=this._mapCoordToOverlappingTile(i,r,a,u),p=h.getHeightAtTileCoord(d,f);p&&void 0!==p.height&&(p.hidden?n=p.height:o=Math.max(p.height*c,o||0))}if(void 0!==o)return o;for(let o=0;o<this.layers.length;++o){let s=this.layers[o];if("model"!==s.layer.type||!s.visible)continue;let{bucket:l,tileID:h}=this.currentBuildingBuckets[o];if(!l)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(i,r,a,h),d=l.getHeightAtTileCoord(u,c);if(d&&!d.hidden)return void 0===d.height&&void 0!==n?Math.min(d.maxHeight,n)*d.verticalScale:d.height?d.height*d.verticalScale:-1/0}return this.layersGotHidden?0:-1/0}}function aF(){return u||(u=new tD),u}function aB(r){r=r.slice();let a=Object.create(null);for(let i of r)a[i.id]=i;for(let n=0;n<r.length;n++){let o=r[n];if(o&&"ref"in o){let s=a[o.ref];
109s&&(r[n]=function(r,a){let n={};for(let i in r)"ref"!==i&&(n[i]=r[i]);return i.eY.forEach(i=>{i in a&&(n[i]=a[i])}),n}(o,s))}}return r}let ak={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function aN(i,r,a){a.push({command:ak.addSource,args:[i,r[i]]})}function aU(i,r,a){r.push({command:ak.removeSource,args:[i]}),a[i]=!0}function aV(r,a,n,o,s,l){let h;for(h in a=a||{},r=r||{})Object.hasOwn(r,h)&&(i.c2(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}));for(h in a)Object.hasOwn(a,h)&&!Object.hasOwn(r,h)&&(i.c2(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}))}function aj(i){return i.id}function aG(i,r){return i[r.id]=r,i}function aH(r,a,n){let o=a.createTileMatrix(r,r.worldSize,n.toUnwrapped());return i.er(new Float32Array(16),r.projMatrix,o)}function aq(i,r,a){return r.name===a.projection.name?i.projMatrix:aH(a,r,i)}class a${constructor(i,r,a,n){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?r:-r))):n&&a?1:0,this.placed=a}isHidden(){return 0===this.opacity&&!this.placed}}class aZ{constructor(i,r,a,n,o,s=!1){this.text=new a$(i?i.text:null,r,a,o),this.icon=new a$(i?i.icon:null,r,n,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class aW{constructor(i,r,a,n=!1){this.text=i,this.icon=r,this.skipFade=a,this.clipped=n}}class aX{constructor(){this.invProjMatrix=i.bT(),this.viewportMatrix=i.bT(),this.circles=[]}}class aY{constructor(i,r,a,n,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=a,this.bucketIndex=n,this.tileID=o}}class aK{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){let r=++this.maxGroupID;this.collisionGroups[i]={ID:r,predicate:i=>i.collisionGroupID===r}}return this.collisionGroups[i]}}function aJ(r,a,n,o,s){let{horizontalAlign:l,verticalAlign:h}=i.cE(r),u=i.cj(r,o);return new i.au(-(l-.5)*a+u[0]*s,-(h-.5)*n+u[1]*s)}function aQ(r,a,n,o,s){let l=new i.au(r,a);return n&&l._rotate(o?s:-s),l}function a0(r,a,n,o){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}
109=n,d=i.cF(a),f=o===i.bg.vertical?u:"left"===d?s:"center"===d?l:"right"===d?h:-1;s>=0&&(r.text.placedSymbolArray.get(s).crossTileID=f>=0&&s!==f?0:c),l>=0&&(r.text.placedSymbolArray.get(l).crossTileID=f>=0&&l!==f?0:c),h>=0&&(r.text.placedSymbolArray.get(h).crossTileID=f>=0&&h!==f?0:c),u>=0&&(r.text.placedSymbolArray.get(u).crossTileID=f>=0&&u!==f?0:c)}function a1(r,a,n){let o=a===i.bg.horizontal||a===i.bg.horizontalOnly?a:0,s=a===i.bg.vertical?a:0,{leftJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,rightJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:c}=n,d=r.text.placedSymbolArray;l>=0&&(d.get(l).placedOrientation=o),h>=0&&(d.get(h).placedOrientation=o),u>=0&&(d.get(u).placedOrientation=o),c>=0&&(d.get(c).placedOrientation=s)}class a2{constructor(i,r,a,n,o,s,l,h){this.transform=i.clone(),this.projection=i.projection.name,this.algorithm=n,this.collisionIndex=this.algorithm.createCollisionDetector(this.transform,s,h),this.buildingIndex=l,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new aK(a),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,a,n,o,s=1){var l,h,u;let c=n.getBucket(a),d=n.latestFeatureIndex;if(!c||!d||a.fqid!==c.layerIds[0])return;let f=c.layers[0].layout,p=c.layers[0].paint,m=n.collisionBoxArray,_=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),g=n.tileSize/i.r,y=n.tileID.toUnwrapped();this.transform.setProjection(c.projection);let x=(l=n.tileID,h=c.getProjection(),u=this.transform,h.name===this.projection?u.calculateProjMatrix(l.toUnwrapped()):aH(u,h,l)),v="map"===f.get("text-pitch-alignment"),b="map"===f.get("text-rotation-alignment");a.compileFilter(a.options);let w=a.dynamicFilter(),T=a.dynamicFilterNeedsFeature(),S=a.dynamicFilterNeedsGeometry(),E=this.transform.calculatePixelsToTileUnitsMatrix(n),I=tW(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),E),A=null,M=c.getProjection().createInversionMatrix(this.transform,n.tileID.canonical);if(v){let r=tX(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),E);A=i.er([],this.transform.labelPlaneMatrix,r)}let C=null;w&&n.latestFeatureIndex&&(C={unwrappedTileID:y,dynamicFilter:w,dynamicFilterNeedsFeature:T,needGeometry:S}),this.retainedQueryData[c.bucketInstanceId]=new aY(c.bucketInstanceId,d,c.sourceLayerIndex,c.index,n.tileID);let[D,R]=c.layers[0].layout.get("text-size-scale-range"),P=i.bG(s,D,R),[L,z]=f.get("icon-size-scale-range"),O=i.bG(s,L,z),F={bucket:c,layout:f,paint:p,posMatrix:x,invMatrix:M,mercatorCenter:[i.ek(this.transform.center.lng),i.el(this.transform.center.lat)],textLabelPlaneMatrix:I,labelToScreenMatrix:A,clippingData:C,scale:_,textPixelRatio:g,holdingForFade:n.holdingForFade(),collisionBoxArray:m,partiallyEvaluatedTextSize:i.ci(c.textSizeData,this.transform.zoom,P),partiallyEvaluatedIconSize:i.ci(c.iconSizeData,this.transform.zoom,O),collisionGroup:this.collisionGroups.get(c.sourceID),latestFeatureIndex:n.latestFeatureIndex};if(o)for(let i of c.sortKeyRanges){let{sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o}=i;r.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:F})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:F})}placeLayerBucketPart(i,r,a,n,o=1){this.algorithm.placeLayerBucketPart(this,i,r,a,n,o)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,a=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let n=r?r.symbolFadeChange(i):1,o=r?r.opacities:{},s=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(let i in this.placements){let r=this.placements[i],s=o[i];s?(this.opacities[i]=new aZ(s,n,r.text,r.icon,null,r.clipped),a=a||r.text!==s.text.placed||r.icon!==s.icon.placed):(this.opacities[i]=new aZ(null,n,r.text,r.icon,r.skipFade,r.clipped),a=a||r.text||r.icon)}for(let i in o){let r=o[i];if(!this.opacities[i]){let o=new aZ(r,n,!1,!1);o.isHidden()||(this.opacities[i]=o,a=a||r.text.placed||r.icon.placed)}}for(let i in s)this.variableOffsets[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.variableOffsets[i]=s[i]);for(let i in l)this.placedOrientations[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.placedOrientations[i]=l[i]);a?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r,a,n){n&&(this.lastReplacementSourceUpdateTime=n.updateTime);let o=new Set;for(let s of r){let r=s.getBucket(i);r&&s.latestFeatureIndex&&i.fqid===r.layerIds[0]&&(this.updateBucketOpacities(r,o,s,s.collisionBoxArray,a,n,s.tileID,i.scope),"offset"===r.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(r,s.tileID),"road"===r.elevationType&&r.hdExt&&r.hdExt.updateRoadElevation(r,s.tileID.canonical),r.updateZOffset())}}updateBucketOpacities(r,a,n,o,s,l,h,u){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();let c=r.layers[0].layout,d=r.layers[0].paint,f=!!r.layers[0].dynamicFilter(),p=new aZ(null,0,!1,!1,
109!0),m=c.get("text-allow-overlap"),_=c.get("icon-allow-overlap"),g=c.get("text-variable-anchor"),y="map"===c.get("text-rotation-alignment"),x="map"===c.get("text-pitch-alignment"),v=d.get("symbol-z-offset"),b="sea"===c.get("symbol-elevation-reference"),w=!v.isConstant(),T=new aZ(null,0,m&&(_||!r.hasIconData()||c.get("icon-optional")),_&&(m||!r.hasTextData()||c.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);let S=(i,r,a)=>{for(let n=0;n<r/4;n++)i.opacityVertexArray.emplaceBack(a)},E=0;l&&r.updateReplacement(h,l),this.collisionIndex.clearClippedSymbolsForBucket(r.bucketInstanceId);for(let o=0;o<r.symbolInstances.length;o++){let c=r.symbolInstances.get(o),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:m,crossTileID:_,numIconVertices:I,tileAnchorX:A,tileAnchorY:M}=c,C=null,D=this.retainedQueryData[r.bucketInstanceId];w&&c&&D&&(C=n.latestFeatureIndex.loadFeature({featureIndex:c.featureIndex,bucketIndex:D.bucketIndex,sourceLayerIndex:D.sourceLayerIndex,layoutVertexArrayOffset:0}));let R=v.evaluate(C,{}),P=a.has(_),L=this.opacities[_];P?L=p:L||(L=T,this.opacities[_]=L),a.add(_);let z=d>0||m>0,O=I>0,F=this.placedOrientations[_],B=F===i.bg.vertical,k=F===i.bg.horizontal||F===i.bg.horizontalOnly;!z&&!O||L.isHidden()||E++;let N=!1;if((z||O)&&l)for(let a of r.activeReplacements){if(i.fp(a,s,i.a8.Symbol,u)||a.min.x>A||A>a.max.x||a.min.y>M||M>a.max.y)continue;let r=i.fN(A,M,h.canonical,a.footprintTileId.canonical);if(N=i.eI(r,a.footprint))break}if(N&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,c.featureIndex),z){let i=N?a5:a4(L.text);S(r.text,d,B?a5:i),S(r.text,m,k?a5:i);let a=L.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:l}=c,h=r.text.placedSymbolArray,u=a||B?1:0;n>=0&&(h.get(n).hidden=u),o>=0&&(h.get(o).hidden=u),s>=0&&(h.get(s).hidden=u),l>=0&&(h.get(l).hidden=a||k?1:0);let f=this.variableOffsets[_];f&&a0(r,f.anchor,c,F);let p=this.placedOrientations[_];p&&(a0(r,"left",c,p),a1(r,p,c))}if(O){let i=N?a5:a4(L.icon),{placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:n}=c,o=r.icon.placedSymbolArray,s=+!!L.icon.isHidden();a>=0&&(S(r.icon,I,B?a5:i),o.get(a).hidden=s),n>=0&&(S(r.icon,c.numVerticalIconVertices,k?a5:i),o.get(n).hidden=s)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){let a=r.collisionArrays[o];if(a){let n=new i.au(0,0),o=!0;if(a.textBox||a.verticalTextBox){if(g){let i=this.variableOffsets[_];i?(n=aJ(i.anchor,i.width,i.height,i.textOffset,i.textScale),y&&n._rotate(x?this.transform.angle:-this.transform.angle)):o=!1}f&&(o=!L.clipped),a.textBox&&a3(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||B,R,b,n.x,n.y),a.verticalTextBox&&a3(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||k,R,b,n.x,n.y)}let s=o&&!!(!k&&a.verticalIconBox);a.iconBox&&a3(r.iconCollisionBox.collisionVertexArray,L.icon.placed,s,R,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0),a.verticalIconBox&&a3(r.iconCollisionBox.collisionVertexArray,L.icon.placed,!s,R,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0)}}}if(r.fullyClipped=0===E,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=i.invProjMatrix,r.placementViewportMatrix=i.viewportMatrix,r.collisionCircleArray=i.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,r){let a=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*a>i}isStale(){return this.stale}setStale(){this.stale=!0}}function a3(i,r,a,n,o,s,l){i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o)}function a4(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 0xffffffff;let r=+!!i.placed,a=Math.floor(127*i.opacity);
109return 0x2000000*a+0x1000000*r+131072*a+65536*r+512*a+256*r+2*a+r}let a5=0;class a6{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances.at(-1),this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(1===this.points.length)return this.points[0];r=i.bG(r,0,1);let a=1,n=this._distances[a],o=r*this.paddedLength+this.padding;for(;n<o&&a<this._distances.length;)n=this._distances[++a];let s=a-1,l=this._distances[s],h=n-l,u=h>0?(o-l)/h:0;return this.points[s].mult(1-u).add(this.points[a].mult(u))}}class a8{constructor(i,r){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(i,r)}reset(r,a){let n=r.width+200,o=r.height+200;n!==this.gridRightBoundary||o!==this.gridBottomBoundary?(this.grid=new i.V(n,o,25),this.ignoredGrid=new i.V(n,o,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=r,this.fogState=a,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+100,this.screenBottomBoundary=r.height+100,this.gridRightBoundary=n,this.gridBottomBoundary=o,this.clippedSymbols.clear()}clearClippedSymbolsForBucket(i){this.clippedSymbols.delete(i)}markSymbolAsClipped(i,r){let a=this.clippedSymbols.get(i);a||(a=new Set,this.clippedSymbols.set(i,a)),a.add(r)}placeCollisionBox(r,a,n,o,s,l,h,u,c,d,f){let p=n.projectedAnchorX,m=n.projectedAnchorY,_=n.projectedAnchorZ,g=n.tileAnchorX,y=n.tileAnchorY,x=n.elevation,v=n.tileID,b=r.getProjection();if(x&&v){let[i,r,a]=b.upVector(v.canonical,n.tileAnchorX,n.tileAnchorY),o=b.upVectorScale(v.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;p+=i*x*o,m+=r*x*o,_+=a*x*o}let w="globe"===r.projection.name,T="globe"===r.projection.name?i.dm(this.transform.zoom):0;if(v&&w&&T<1&&!l){let r=1<<v.canonical.z,a=i.cz(g,y);i.fd(a,a,1/i.r),i.bk(a,a,i.cz(v.canonical.x,v.canonical.y)),i.fd(a,a,1/r),i.fy(a,a,i.cz(o[0],o[1])),a[0]=i.f$(a[0],-.5,.5),i.fd(a,a,i.r);let n=i.cy(a[0],a[1],i.r/(2*Math.PI),1);i.fM(n,n,s),p=i.dY(p,n[0],T),m=i.dY(m,n[1],T),_=i.dY(_,n[2],T)}let S=this.projectAndGetPerspectiveRatio(d,p,m,_,n.tileID,"globe"===b.name||!!x||this.transform.pitch>0,b),E=c*S.perspectiveRatio,I=(n.x1*a+h.x-n.padding)*E+S.point.x,A=(n.y1*a+h.y-n.padding)*E+S.point.y,M=(n.x2*a+h.x+n.padding)*E+S.point.x,C=(n.y2*a+h.y+n.padding)*E+S.point.y,D=S.perspectiveRatio<=.55||S.occluded;return!this.isInsideGrid(I,A,M,C)||!u&&this.grid.hitTest(I,A,M,C,f)||D?{box:[],offscreen:!1,occluded:S.occluded}:{box:[I,A,M,C],offscreen:this.isOffscreen(I,A,M,C),occluded:!1}}placeCollisionCircles(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y){let x=[],v=this.transform.elevation,b=r.getProjection(),w="road"===r.elevationType,T=!!v||w,S=i.s.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,b),E=new i.au(n.tileAnchorX,n.tileAnchorY),I=new i.au(n.tileAnchorX,n.tileAnchorY),{x:A,y:M,z:C}=b.projectTilePoint(I.x,I.y,y.canonical),D=null;if(T){let i=w&&r.hdExt?r.hdExt.getElevationFeatureForPlacedSymbol(r,r.text,o):null;D={getElevation:S,elevation:v,elevationFeature:i};let[a,n,s]=S(E,v,i);A+=a,M+=n,C+=s}let R="globe"===b.name,P=this.projectAndGetPerspectiveRatio(u,A,M,C,y,R||!!v||this.transform.pitch>0,b),{perspectiveRatio:L}=P,z=(p?h/L:h*L)/i.ao,O=tY(A,M,C,c),F=n.lineOffsetX*z,B=n.lineOffsetY*z,k=Math.cos(i.c4(r.layers[0].layout.get("text-max-angle"))),N=P.signedDistanceFromCamera>0?tQ(z,l,F,B,w&&1===n.flipState,O,I,n,s,c,{},T&&!p?D:null,p&&T,b,y,p,k):null,U=!1,V=!1,j=!0;if(N&&!P.occluded){let r=.5*_*L+g,n=new i.au(-100,-100),o=new i.au(this.screenRightBoundary,this.screenBottomBoundary),s=new a6,{first:l,last:h}=N,u=l.path.length,c=[];for(let i=u-1;i>=1;i--)c.push(l.path[i]);for(let i=1;i<h.path.length;i++)c.push(h.path[i]);let p=2.5*r;d&&(c=c.map(([i,r,a],n)=>(T&&!R&&(a=S(n<u-1?l.tilePath[u-1-n]:h.tilePath[n-u+2],v,D.elevationFeature)[2]),tY(i,r,a,d)))).some(i=>i[3]<=0)&&(c=[]);let y=[];if(c.length>0){let r=1/0,a=-1/0,s=1/0,l=-1/0;for(let i of c)r=Math.min(r,i[0]),s=Math.min(s,i[1]),a=Math.max(a,i[0]),l=Math.max(l,i[1]);a>=n.x&&r<=o.x&&l>=n.y&&s<=o.y&&(y=[c.map(r=>new i.au(r[0],r[1]))],(r<n.x||a>o.x||s<n.y||l>o.y)&&(y=i.bI(y,n.x,n.y,o.x,o.y)))}for(let i of y){s.reset(i,.25*r);let n=0;n=s.length<=.5*r?1:Math.ceil(s.paddedLength/p)+1;for(let i=0;i<n;i++){let o=i/Math.max(n-1,1),l=s.lerp(o),h=l.x+100,u=l.y+100;x.push(h,u,r,0);let c=h-r,d=u-r,p=h+r,_=u+r;if(j=j&&this.isOffscreen(c,d,p,_),V=V||this.isInsideGrid(c,d,p,_),!a&&this.grid.hitTestCircle(h,u,r,m)&&(U=!0,!f))return{circles:[],offscreen:!1,collisionDetected:U,occluded:!1}}}}return{circles:(f||!U)&&V?x:[],offscreen:j,collisionDetected:U,occluded:P.occluded}}queryRenderedSymbols(r){if(0===r.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let a=[],n=1/0,o=1/0,s=-1/0,l=-1/0;for(let h of r){let r=new i.au(h.x+100,h.y+100);n=Math.min(n,r.x),o=Math.min(o,r.y),s=Math.max(s,r.x),l=Math.max(l,r.y),a.push(r)}let h=this.grid.query(n,o,s,l).concat(this.ignoredGrid.query(n,o,s,l)),u={},c={};for(let r of h){let n=r.key;if(void 0===u[n.bucketInstanceId]&&(u[n.bucketInstanceId]={}),u[n.bucketInstanceId][n.featureIndex])continue;
109let o=this.clippedSymbols.get(n.bucketInstanceId);if(o&&o.has(n.featureIndex))continue;let s=[new i.au(r.x1,r.y1),new i.au(r.x2,r.y1),new i.au(r.x2,r.y2),new i.au(r.x1,r.y2)];i.eO(a,s)&&(u[n.bucketInstanceId][n.featureIndex]=!0,void 0===c[n.bucketInstanceId]&&(c[n.bucketInstanceId]=[]),c[n.bucketInstanceId].push(n.featureIndex))}return c}insertCollisionBox(i,r,a,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:n,collisionGroupID:o},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,r,a,n,o){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:n,collisionGroupID:o};for(let r=0;r<i.length;r+=4)s.insertCircle(l,i[r],i[r+1],i[r+2])}projectAndGetPerspectiveRatio(r,a,n,o,s,l,h){let u=[a,n,o,1],c=!1;if(o||this.transform.pitch>0){if(i.fM(u,u,r),this.fogState&&s&&"globe"!==h.name){var d,f,p;let r,l;d=this.fogState,f=s.toUnwrapped(),r=(p=this.transform).calculateFogTileMatrix(f),l=[a,n,o],i.fL(l,l,r),c=tx(d,i.dW(l),p.pitch)>.9}}else t6(u,u,r);let m=u[3];return{point:new i.au((u[0]/m+1)/2*this.transform.width+100,(-u[1]/m+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(h)/m*.5,1.5),signedDistanceFromCamera:m,occluded:l&&u[2]>m||c}}isOffscreen(i,r,a,n){return a<100||i>=this.screenRightBoundary||n<100||r>this.screenBottomBoundary}isInsideGrid(i,r,a,n){return a>=0&&i<this.gridRightBoundary&&n>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let r=i.dq([]);return i.fQ(r,r,[-100,-100,0]),r}}let a9={default:new class{createCollisionDetector(i,r,a){return a instanceof a8?(a.reset(i,r),a):new a8(i,r)}shouldPause(i){return i>2}placeLayerBucketPart(r,a,n,o,s,l=1){let{bucket:h,layout:u,paint:c,posMatrix:d,textLabelPlaneMatrix:f,labelToScreenMatrix:p,clippingData:m,textPixelRatio:_,mercatorCenter:g,invMatrix:y,holdingForFade:x,collisionBoxArray:v,partiallyEvaluatedTextSize:b,partiallyEvaluatedIconSize:w,collisionGroup:T,latestFeatureIndex:S}=a.parameters,E=u.get("text-optional"),I=u.get("icon-optional"),A=u.get("text-allow-overlap"),M=u.get("icon-allow-overlap"),C="map"===u.get("text-rotation-alignment"),D="map"===u.get("icon-rotation-alignment"),R="map"===u.get("text-pitch-alignment"),P=c.get("symbol-z-offset"),L="sea"===u.get("symbol-elevation-reference"),z=u.get("symbol-placement"),[O,F]=u.get("text-size-scale-range"),[B,k]=u.get("icon-size-scale-range"),N=i.bG(l,O,F),U=i.bG(l,B,k),V=u.get("text-variable-anchor"),j=C&&"point"!==z,G=V&&h.hasTextData(),H=h.hasIconTextFit()&&G&&h.hasIconData();r.transform.setProjection(h.projection);let q=G||j,$=D&&"point"!==z||H,Z=A&&(M||!h.hasIconData()||I),W=M&&(A||!h.hasTextData()||E),X=!P.isConstant();!h.collisionArrays&&v&&h.deserializeCollisionBoxes(v),o&&s&&h.updateCollisionDebugBuffers(r.transform.zoom,v,N,U);let Y=(a,s,l)=>{let{crossTileID:c,numVerticalGlyphVertices:v}=a,D=null;if(m&&m.dynamicFilterNeedsFeature||X){let n=r.retainedQueryData[h.bucketInstanceId],o=S.loadFeature({featureIndex:a.featureIndex,bucketIndex:n.bucketIndex,sourceLayerIndex:n.sourceLayerIndex,layoutVertexArrayOffset:0}),s=o.properties?o.properties.worldview:null;if(h.localizable&&h.worldview&&"string"==typeof s)if("all"===s)o.properties.$localized=!0;else{if(!s.split(",").includes(h.worldview))return;o.properties.$localized=!0,o.properties.worldview=h.worldview}D=m&&m.needGeometry?i.fJ(o,!0):o}if(m&&!(0,m.dynamicFilter)({zoom:r.transform.zoom,pitch:r.transform.pitch,worldview:h.worldview},D,r.retainedQueryData[h.bucketInstanceId].tileID.canonical,new i.au(a.tileAnchorX,a.tileAnchorY),r.transform.calculateDistanceTileData(m.unwrappedTileID)))return r.placements[c]=new aW(!1,!1,!1,!0),void n.add(c);let z=P.evaluate(D,{});if((a.zOffset||0)+(z||0)>0&&r.frontCutoffStart>0){let o=2*r.frontCutoffStart-1,s=[a.tileAnchorX,a.tileAnchorY,0,1],l=i.fM(i.bX(),s,d);if(l[1]/l[3]<o)return r.placements[c]=new aW(!1,!1,!1,!0),void n.add(c)}if(n.has(c))return;if(x)return void(r.placements[c]=new aW(!1,!1,!1));let O=!1,F=!1,B=!0,k=!1,N=!1,U=null,j={box:null,offscreen:null,occluded:null},G={box:null},H=null,Y=null,K=null,J=0,Q=0,ee=0;l.textFeatureIndex?J=l.textFeatureIndex:a.useRuntimeCollisionCircles&&(J=a.featureIndex),l.verticalTextFeatureIndex&&(Q=l.verticalTextFeatureIndex);let et=h.hdExt?h.hdExt.elevationFeatures[a.elevationFeatureIndex]:void 0,ei=n=>{n.tileID=r.retainedQueryData[h.bucketInstanceId].tileID;let o=r.transform.elevation;n.elevation=L?z:z+i.s.getAtTileOffset(n.tileID,new i.au(n.tileAnchorX,n.tileAnchorY),o,et),n.elevation+=a.zOffset},er=l.textBox;if(er){ei(er);let n=n=>{let o=i.bg.horizontal;if(h.allowVerticalPlacement&&!n&&r.prevPlacement){let i=r.prevPlacement.placedOrientations[c];i&&(r.placedOrientations[c]=i,a1(h,o=i,a))}return o},o=(r,a)=>{if(h.allowVerticalPlacement&&v>0&&l.verticalTextBox){for(let n of h.writingModes)if(n===i.bg.vertical?G=j=a():j=r(),j&&j.box&&j.box.length)break}else j=r()};if(V){let u=V;
109if(r.prevPlacement&&r.prevPlacement.variableOffsets[c]){let i=r.prevPlacement.variableOffsets[c];u.indexOf(i.anchor)>0&&(u=u.filter(r=>r!==i.anchor)).unshift(i.anchor)}let f=(i,n,o)=>{let l=h.getSymbolInstanceTextSize(b,a,r.transform.zoom,s),c=(i.x2-i.x1)*l+2*i.padding,f=(i.y2-i.y1)*l+2*i.padding,p=a.hasIconTextFit&&!M?n:null;p&&ei(p);let m={box:[],offscreen:!1,occluded:!1},x=A?2*u.length:u.length;for(let n=0;n<x;++n){let x=this.attemptAnchorPlacement(r,u[n%u.length],i,g,y,q,c,f,l,C,R,_,d,T,n>=u.length,a,s,h,o,p,b,w);if(x&&(m=x.placedGlyphBoxes)&&m.box&&m.box.length){O=!0,U=x.shift;break}}return m};o(()=>f(er,l.iconBox,i.bg.horizontal),()=>{let r=l.verticalTextBox;return r&&ei(r),h.allowVerticalPlacement&&!(j&&j.box&&j.box.length)&&v>0&&r?f(r,l.verticalIconBox,i.bg.vertical):{box:null,offscreen:null,occluded:null}}),j&&(O=j.box,B=j.offscreen,k=j.occluded);let p=n(!(!j||!j.box));if(!O&&r.prevPlacement){let i=r.prevPlacement.variableOffsets[c];i&&(r.variableOffsets[c]=i,a0(h,i.anchor,a,p))}}else{let u=(n,o)=>{let l=h.getSymbolInstanceTextSize(b,a,r.transform.zoom,s),u=r.collisionIndex.placeCollisionBox(h,l,n,g,y,q,new i.au(0,0),A,_,d,T.predicate);return u&&u.box&&u.box.length&&(a1(h,o,a),r.placedOrientations[c]=o),u};o(()=>u(er,i.bg.horizontal),()=>{let r=l.verticalTextBox;return h.allowVerticalPlacement&&v>0&&r?(ei(r),u(r,i.bg.vertical)):{box:null,offscreen:null,occluded:null}}),n(!!(j&&j.box&&j.box.length))}}if(O=(H=j)&&H.box&&H.box.length>0,B=H&&H.offscreen,k=H&&H.occluded,a.useRuntimeCollisionCircles){let n=a.centerJustifiedTextSymbolIndex>=0?a.centerJustifiedTextSymbolIndex:a.verticalPlacedTextSymbolIndex,s=h.text.placedSymbolArray.get(n),l=i.ch(h.textSizeData,b,s),c=u.get("text-padding");Y=r.collisionIndex.placeCollisionCircles(h,A,s,n,h.lineVertexArray,h.glyphOffsetArray,l,d,f,p,o,R,T.predicate,a.collisionCircleDiameter*l/i.ao,c,r.retainedQueryData[h.bucketInstanceId].tileID),O=A||Y.circles.length>0&&!Y.collisionDetected,B=B&&Y.offscreen,k=Y.occluded}if(l.iconFeatureIndex&&(ee=l.iconFeatureIndex),l.iconBox){let n=n=>{ei(n);let o=a.hasIconTextFit&&U?aQ(U.x,U.y,C,R,r.transform.angle):new i.au(0,0),s=h.getSymbolInstanceIconSize(w,r.transform.zoom,a.placedIconSymbolIndex);return r.collisionIndex.placeCollisionBox(h,s,n,g,y,$,o,M,_,d,T.predicate)};F=G&&G.box&&G.box.length&&l.verticalIconBox?(K=n(l.verticalIconBox)).box.length>0:(K=n(l.iconBox)).box.length>0,B=B&&K.offscreen,N=K.occluded}let ea=E||0===a.numHorizontalGlyphVertices&&0===v,en=I||0===a.numIconVertices;if(ea||en?en?ea||(F=F&&O):O=F&&O:F=O=F&&O,O&&H&&H.box&&r.collisionIndex.insertCollisionBox(H.box,u.get("text-ignore-placement"),h.bucketInstanceId,G&&G.box&&Q?Q:J,T.ID),F&&K&&r.collisionIndex.insertCollisionBox(K.box,u.get("icon-ignore-placement"),h.bucketInstanceId,ee,T.ID),Y&&(O&&r.collisionIndex.insertCollisionCircles(Y.circles,u.get("text-ignore-placement"),h.bucketInstanceId,J,T.ID),o)){let i=h.bucketInstanceId,a=r.collisionCircleArrays[i];void 0===a&&(a=r.collisionCircleArrays[i]=new aX);for(let i=0;i<Y.circles.length;i+=4)a.circles.push(Y.circles[i+0]),a.circles.push(Y.circles[i+1]),a.circles.push(Y.circles[i+2]),a.circles.push(+!!Y.collisionDetected)}let eo="globe"!==h.projection.name;Z=Z&&(eo||!k),W=W&&(eo||!N),r.placements[c]=new aW(O||Z,F||W,B||h.justReloaded),n.add(c)},K=r.retainedQueryData[h.bucketInstanceId].tileID;if("offset"===h.elevationType&&r.buildingIndex&&r.buildingIndex.updateZOffset(h,K),"road"===h.elevationType&&h.hdExt&&h.hdExt.updateRoadElevation(h,K.canonical),h.updateZOffset(),h.sortFeaturesByY){let a=h.getSortedSymbolIndexes(r.transform.angle);for(let i=a.length-1;i>=0;--i){let r=a[i];Y(h.symbolInstances.get(r),r,h.collisionArrays[r])}h.hasAnyZOffset&&i.f_(`${h.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(h.hasAnyZOffset){let i=h.getSortedIndexesByZOffset();for(let r=0;r<i.length;++r){let a=i[r];Y(h.symbolInstances.get(a),a,h.collisionArrays[a])}}else for(let i=a.symbolInstanceStart;i<a.symbolInstanceEnd;i++)Y(h.symbolInstances.get(i),i,h.collisionArrays[i]);if(o&&h.bucketInstanceId in r.collisionCircleArrays){let a=r.collisionCircleArrays[h.bucketInstanceId];i.dr(a.invProjMatrix,d),a.viewportMatrix=r.collisionIndex.getViewportMatrix()}h.justReloaded=!1}attemptAnchorPlacement(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T){let{textOffset0:S,textOffset1:E,crossTileID:I}=g,A=[S,E],M=aJ(r,l,h,A,u),C=i.collisionIndex.placeCollisionBox(x,u,a,n,o,s,aQ(M.x,M.y,c,d,i.transform.angle),_,f,p,m.predicate);if(b){let r=x.getSymbolInstanceIconSize(T,i.transform.zoom,g.placedIconSymbolIndex);if(0===i.collisionIndex.placeCollisionBox(x,r,b,n,o,s,aQ(M.x,M.y,c,d,i.transform.angle),_,f,p,m.predicate).box.length)return}if(C.box.length>0){let a;return i.prevPlacement&&i.prevPlacement.variableOffsets[I]&&i.prevPlacement.placements[I]&&i.prevPlacement.placements[I].text&&(a=i.prevPlacement.variableOffsets[I].anchor),i.variableOffsets[I]={textOffset:A,width:l,height:h,anchor:r,textScale:u,prevAnchor:a},a0(x,r,g,v),x.allowVerticalPlacement&&(a1(x,v,g),i.placedOrientations[I]=v),{shift:M,placedGlyphBoxes:C}}}}};class a7{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(i,r,a,n,o,s){let l=this._bucketParts;for(;this._currentTileIndex<i.length;)if(r.getBucketParts(l,n,i[this._currentTileIndex],this._sortAcrossTiles,s),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,l.sort((i,r)=>i.sortKey-r.sortKey));this._currentPartIndex<l.length;){let i=l[this._currentPartIndex];if(r.placeLayerBucketPart(i,this._seenCrossTileIDs,a,0===i.symbolInstanceStart,s),this._currentPartIndex++,o())return!0}return!1}}class ne{constructor(){this._retiredCI=null}startNewPlacement(i,r,a,n,o,s,l,h,u){return this.placement=new a2(i,n,o,a9[u||"default"],s,l,h,this._retiredCI),this._retiredCI=null,this._currentPlacementIndex=r.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=a,this._fadeDuration=n,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(r,a,n,o,s){let l=i.co.now(),h=()=>!this.isFullPlacementRequested()&&0!==this._fadeDuration&&this.placement.algorithm.shouldPause(i.co.now()-l);for(;this._currentPlacementIndex>=0;){let l=a[r[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&"none"!==l.visibility&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){let r=l.layout.get("symbol-z-elevate"),a=void 0!==l.layout.get("symbol-sort-key").constantOr(1),u=l.layout.get("symbol-z-order"),c="viewport-y"===u||"auto"===u&&!("viewport-y"!==u&&a),d=l.layout.get("text-allow-overlap")||l.layout.get("icon-allow-overlap")||l.layout.get("text-ignore-placement")||l.layout.get("icon-ignore-placement"),f=c&&d,p=this._inProgressLayer=this._inProgressLayer||new a7(l),m=i.ea(l.source,l.scope);if(p.continuePlacement(r||f?o[m]:n[m],this.placement,this._showCollisionBoxes,l,h,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(i){return this._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(i),this.placement}}let nt=512/i.r/2;class ni{constructor(r,a,n){this.tileID=r,this.bucketInstanceId=n,this.index=new i.a6(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const o=r.canonical.x*i.r,s=r.canonical.y*i.r;for(let i=0;i<a.length;i++){const{key:r,crossTileID:n,tileAnchorX:l,tileAnchorY:h}
109=a.get(i),u=Math.floor((o+l)*nt),c=Math.floor((s+h)*nt);this.index.add(u,c),this.keys.push(r),this.crossTileIDs.push(n)}this.index.finish()}findMatches(r,a,n){let o=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z),s=nt/Math.pow(2,a.canonical.z-this.tileID.canonical.z),l=a.canonical.x*i.r,h=a.canonical.y*i.r;for(let i=0;i<r.length;i++){let a=r.get(i);if(a.crossTileID)continue;let{key:u,tileAnchorX:c,tileAnchorY:d}=a,f=Math.floor((l+c)*s),p=Math.floor((h+d)*s);for(let i of this.index.range(f-o,p-o,f+o,p+o).sort((i,r)=>i-r)){let r=this.crossTileIDs[i];if(this.keys[i]===u&&!n.has(r)){n.add(r),a.crossTileID=r;break}}}}}class nr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class na{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){let r=Math.round((i-this.lng)/360);if(0!==r)for(let i in this.indexes){let a=this.indexes[i],n={};for(let i in a){let o=a[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=i}addBucket(i,r,a){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let i=0;i<r.symbolInstances.length;i++)r.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]=new Set);let n=this.usedCrossTileIDs[i.overscaledZ];for(let a in this.indexes){let o=this.indexes[a];if(Number(a)>i.overscaledZ)for(let a in o){let s=o[a];s.tileID.isChildOf(i)&&s.findMatches(r.symbolInstances,i,n)}else{let s=o[i.scaledTo(Number(a)).key];s&&s.findMatches(r.symbolInstances,i,n)}}for(let i=0;i<r.symbolInstances.length;i++){let o=r.symbolInstances.get(i);o.crossTileID||(o.crossTileID=a.generate(),n.add(o.crossTileID))}return void 0===this.indexes[i.overscaledZ]&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new ni(i,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(i,r){for(let a of r.crossTileIDs)this.usedCrossTileIDs[i].delete(a)}removeStaleBuckets(i){let r=!1;for(let a in this.indexes){let n=this.indexes[a];for(let o in n)i[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,n[o]),delete n[o],r=!0)}return r}}class nn{constructor(){this.layerIndexes={},this.crossTileIDs=new nr,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,r,a,n){let o=this.layerIndexes[i.fqid];void 0===o&&(o=this.layerIndexes[i.fqid]=new na);let s=!1,l={};for(let h of("globe"!==n.name&&o.handleWrapJump(a),r)){let r=h.getBucket(i);r&&i.fqid===r.layerIds[0]&&(r.bucketInstanceId||(r.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(h.tileID,r,this.crossTileIDs)&&(s=!0),l[r.bucketInstanceId]=!0)}return o.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(i){let r={};for(let a in i.forEach(i=>{r[i]=!0}),this.layerIndexes)r[a]||delete this.layerIndexes[a]}}class no extends i.y{constructor(i){super(),this.requestManager=i,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}loadModel(r,a){return i.e6(this.requestManager.transformRequest(a,i.aH.Model).url).then(n=>{let o=i.bQ(n),s=new i.ah(r,a,void 0,void 0,o);return s.computeBoundsAndApplyParent(),s}).catch(n=>{if(n&&404===n.status)return null;this.fire(new i.v(Error(`Could not load model ${r} from ${a}: ${n.message}`)))})}load(r,a,n={forceReload:!1}){this.models[a]||(this.models[a]=Object.create(null));let o=Object.keys(r),s=[],l=[];for(let i of o){let o=r[i];this.hasURLBeenRequested(o)&&!n.forceReload||(this.modelByURL[o]={modelId:i,scope:a},s.push(this.loadModel(i,o)),l.push(i)),this.models[a][i]||(this.models[a][i]={model:null,numReferences:1})}this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+l.length,Promise.allSettled(s).then(r=>{for(let i=0;i<r.length;i++){let{status:n}=r[i];if("rejected"===n)continue;let{value:o}=r[i];this.models[a][l[i]]||(this.models[a][l[i]]={model:null,numReferences:1}),this.models[a][l[i]].model=o}this.numModelsLoading[a]-=l.length,this.fire(new i.x("data",{dataType:"style"}))}).catch(r=>{this.fire(new i.v(Error(`Could not load models: ${r.message}`)))})}isLoaded(){for(let i in this.numModelsLoading)if(this.numModelsLoading[i]>0)return!1;return!0}hasModel(i,r,a={exactIdMatch:!1}){return!!(a.exactIdMatch?this.getModel(i,r):this.getModelByURL(this.modelUris[r][i]))}getModel(i,r){return this.models[r]||(this.models[r]=Object.create(null)),this.models[r][i]?this.models[r][i].model:void 0}getModelByURL(i){if(!i)return null;let r=this.modelByURL[i];return r?this.models[r.scope][r.modelId].model:null}hasModelBeenAdded(i,r){return this.models[r]&&void 0!==this.models[r][i]}getModelURIs(i){return this.modelUris[i]||Object.create(null)}addModel(i,r,a){this.models[a]||(this.models[a]=Object.create(null)),this.modelUris[a]||(this.modelUris[a]=Object.create(null));let n=this.requestManager.normalizeModelURL(r);if((this.hasModel(i,a,{exactIdMatch:!0})||this.hasModelBeenAdded(i,a))&&this.modelUris[a][i]===n)this.models[a][i].numReferences++;else if(this.hasURLBeenRequested(n)){let{scope:i,modelId:r}=this.modelByURL[n];this.models[i][r].numReferences++}else this.modelUris[a][i]=n,this.load({[i]:this.modelUris[a][i]},a)}
109addModelURLs(i,r){this.models[r]||(this.models[r]=Object.create(null)),this.modelUris[r]||(this.modelUris[r]=Object.create(null));let a=this.modelUris[r];for(let r of Object.keys(i))a[r]=this.requestManager.normalizeModelURL(i[r])}reloadModels(i){this.load(this.modelUris[i],i,{forceReload:!0})}addModelsFromBucket(i,r){this.models[r]||(this.models[r]=Object.create(null)),this.modelUris[r]||(this.modelUris[r]=Object.create(null));let a=Object.create(null);for(let n of i)this.hasModel(n,r,{exactIdMatch:!0})||this.hasURLBeenRequested(n)?this.models[r][n].numReferences++:this.modelUris[r][n]&&!this.hasURLBeenRequested(n)?a[n]=this.modelUris[r][n]:!this.hasURLBeenRequested(n)&&eQ(n,!1)&&(this.modelUris[r][n]=this.requestManager.normalizeModelURL(n),a[n]=this.modelUris[r][n]);this.load(a,r)}hasURLBeenRequested(i){return void 0!==this.modelByURL[i]}removeModel(i,r,a=!1,n=!1){if(this.models[r]&&this.models[r][i]&&(this.models[r][i].numReferences--,0===this.models[r][i].numReferences||n)){let n=this.modelUris[r][i];a||delete this.modelUris[r][i],delete this.modelByURL[n];let o=this.models[r][i].model;o&&(delete this.models[r][i],o.destroy())}}destroy(){for(let i of Object.keys(this.models))for(let r of Object.keys(this.models[i])){let a=this.models[i][r].model;delete this.models[i][r],a&&a.destroy()}this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(i){return this.models[i]||(this.models[i]=Object.create(null)),Object.keys(this.models[i])}upload(i,r){for(let a in this.models[r]||(this.models[r]=Object.create(null)),this.models[r])this.models[r][a].model&&this.models[r][a].model.upload(i.context)}}let ns=["RENDER_SHADOWS","NORMAL_OFFSET"],nl=new Set(["symbol","circle"]),nh=class r{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(i,r,a){null!=this._idleHandle&&"u">typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;let n=a.stylesheet,o=!!a.fog,s=!!(a.getTerrain()||n&&n.terrain),l=!(!a.projection||"globe"!==a.projection.name),h=s||l,u=!(!a.directionalLight||!a.directionalLight.shadowsEnabled()),c=a.map&&a.map.painter,d=!c||!c.context.extParallelShaderCompile,f=!!c&&"mrt-fallback"===c.emissiveMode,p=(i,r=[],a={})=>{this._queue.push({programId:i,params:Object.assign({},a.params,{defines:r,overrideFog:!!a.fog,overrideTerrain:!!a.terrain,overrideGlobe:!!a.globe,overrideRtt:!!a.rtt,precompiled:!0})})};for(let n of i){if("none"===n.visibility)continue;let i=n.getProgramIds();if(i)for(let m of i){if(nl.has(m))continue;let i=n.getDefaultProgramParams(m,r.zoom,a._styleColorTheme.lut);if(!i)continue;let _=c?c.getShaderSource(m):null,g=h&&(!_||_.usedDefines.has("RENDER_TO_TEXTURE")),y=f&&g?(i.defines||[]).concat("USE_MRT1"):i.defines;if(d){p(m,i.defines,{params:i}),g&&p(m,y,{params:i,rtt:!0});continue}let x=o&&(!_||_.usedDefines.has("FOG")),v=s&&!n.isDraped()&&(!_||_.usedDefines.has("TERRAIN")),b=l&&(!_||_.usedDefines.has("GLOBE"));for(let r of u&&n.hasElevation()&&(!_||_.usedDefines.has("RENDER_SHADOWS"))?[!1,!0]:[!1]){let a=r?(i.defines||[]).concat(ns):i.defines||[];for(let r of v?[!1,!0]:[!1])for(let n of b?[!1,!0]:[!1])for(let o of x?[!1,!0]:[!1])p(m,a,{params:i,fog:o,terrain:r,globe:n})}g&&p(m,y,{params:i,rtt:!0})}}if(p("clippingMask"),s)for(let i of[!1,!0])p("terrainRaster",i?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:o});if(!d){if(i.some(i=>"hillshade"===i.type)&&p("hillshadePrepare"),u)for(let i of[!1,!0])for(let r of[!1,!0]){let a=[];i&&a.push("RENDER_CUTOFF"),a.push("RENDER_SHADOWS"),r&&a.push("NORMAL_OFFSET"),p("groundShadow",a),o&&p("groundShadow",a,{fog:!0})}if(l){for(let i of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(let r of[!1,!0]){let a=[...i,"PROJECTION_GLOBE_VIEW"];r&&a.push("CUSTOM_ANTIALIASING"),p("globeRaster",a,{terrain:s,globe:!0,fog:o})}for(let i of[!1,!0]){let r=i?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];p("globeAtmosphere",r,{fog:!0,terrain:s,globe:i}),p("globeAtmosphere",[...r,"ALPHA_PASS"],{fog:!0,terrain:s,globe:i})}p("stars",[],{fog:o,terrain:s,globe:!0})}}}_executeBatch(a,n,o){if(o.map&&o.map.isMoving())return void(this._idleHandle=i.co.requestIdleCallback(i=>this._executeBatch(i,n,o)));n.context.sweepPendingPrograms();let s=n.context.extParallelShaderCompile?r.DEADLINE_MARGIN_KHR_MS:r.DEADLINE_MARGIN_SYNC_MS,l=0;for(;this._queue.length>0;){let i=this._queue.shift();if(!i||(n.style=o,n._fogVisible=!!i.params.overrideFog,n.getOrCreateProgram(i.programId,i.params),l++,a.timeRemaining()<=s))break}let h=0===this._queue.length||a.timeRemaining()>s;l>0&&h&&n.context.gl.flush(),this._idleHandle=this._queue.length>0||n.context._pendingPrograms.size>0?i.co.requestIdleCallback(i=>this._executeBatch(i,n,o)):null}processQueue(r,a){0!==this._queue.length&&(null!=this._idleHandle&&"u">typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=i.co.requestIdleCallback(i=>this._executeBatch(i,r,a)))}reset(){null!=this._idleHandle&&"u">typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};nh.DEADLINE_MARGIN_KHR_MS=5,nh.DEADLINE_MARGIN_SYNC_MS=25;let nu=i.fs.colorTheme,nc=new i.ax({data:new i.l(nu.data)});
109function nd(r){if(r)return r.map(([r,a])=>[r*i.co.devicePixelRatio,a*i.co.devicePixelRatio])}class nf{constructor(i,r,a){this.id=i,this.scope=r,this.sourceCache=a,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(i){this.missingRequests.has(i.name)||this.pendingRequests.has(i.name)||this.pendingRequests.add(i.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){let r=new Map;if(!this.sourceCache.loaded())return r;let a=this.sourceCache.getVisibleCoordinates();if(0===a.length)return r;let n=this.sourceCache.getSource();if(!(n instanceof iG))return r;let o=a.map(i=>this.sourceCache.getTile(i));for(let[a,s]of n.getImages(o,Array.from(this.pendingRequests)))r.set(i.a1.from({name:a,iconsetId:this.id}),s),this.pendingRequests.delete(a);for(let i of this.pendingRequests)this.missingRequests.add(i);return this.pendingRequests.clear(),r}}let np=(i,r)=>tp(i,r&&r.filter(i=>"source.canvas"!==i.identifier)),nm=(r,a)=>{let n=r.type&&!r.array&&Array.isArray(a)?{type:r.type,"property-type":"data-constant"}:void 0;return i.bY(a,n)},n_=i.eF(ak,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),ng=i.eF(ak,["setCenter","setZoom","setBearing","setPitch"]),ny=new Set(["background","sky","slot","custom"]),nx={version:8,layers:[],sources:{}},nv={duration:300,delay:0};class nb extends i.y{constructor(r,a={}){if(super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=Object.assign({},nv),this._buildingIndex=new aO(this),this.crossTileSymbolIndex=new nn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._hdCoverage=null,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=a.styleChanges||new ec,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=a.dispatcher?a.dispatcher:new tR(aF(),this),this.map.painter&&this.map.painter.context){const i=this.map.painter.context.maxUniformBufferBindings,r=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:i,maxUniformBlockSizeDwords:r,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new ez(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new i.U(r._requestManager,a.localFontFamily?i.ad.all:a.localIdeographFontFamily?i.ad.ideographs:i.ad.none,a.localFontFamily||a.localIdeographFontFamily,a.fontstackCompositing),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new no(r._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new nh:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._indo
109orDependentLayers=a.indoorDependentLayers?a.indoorDependentLayers:new Set,this._config=a.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:a.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",i.d4()),this.dispatcher.broadcast("setConfig",i.cJ());const n=this;this._rtlTextPluginCallback=nb.registerForPluginStateChange(r=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,a)=>{if(i.fS(r),a&&a.every(i=>i))for(let i in n._sourceCaches){let r=n._sourceCaches[i],a=r.getSource().type;"vector"!==a&&"geojson"!==a||r.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;let r=this.getOwnSource(i.sourceId);if(r&&r.vectorLayerIds)for(let i in this._layers){let a=this._layers[i];a.source===r.id&&this._validateLayer(a)}})}load(i){return i&&("string"==typeof i?this.loadURL(i):this.loadJSON(i)),this}_getGlobalId(r){if(!r)return null;if("string"==typeof r){if(i.dL(r))return r;let a=i.fw(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch(i){}return a}return`json://${i.et(JSON.stringify(r))}`}_diffStyle(r,a,n){this.globalId=this._getGlobalId(r);let o=(i,r)=>{try{r(null,this.setState(i,n))}catch(i){r(i,!1)}};if("string"==typeof r){let n=this.map._requestManager.normalizeStyleURL(r),s=this.map._requestManager.transformRequest(n,i.aH.Style);i.cT(s,(r,n)=>{r?this.fire(new i.v(r)):n&&o(n,a)})}else"object"==typeof r&&o(r,a)}loadURL(r,a={}){this.fire(new i.x("dataloading",{dataType:"style"}));let n="boolean"==typeof a.validate?a.validate:!i.dL(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);let o=this.importsCache.get(r);if(o)return this._load(o,n);let s=this.map._requestManager.transformRequest(r,i.aH.Style);this._request=i.cT(s,(a,o)=>{if(this._request=null,a)this.fire(new i.v(a));else if(o)return this.importsCache.set(r,o),this._load(o,n)})}loadJSON(r,a={}){this.fire(new i.x("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=i.co.frame(()=>{this._request=null,this._load(r,!1!==a.validate)})}loadEmpty(){this.fire(new i.x("dataloading",{dataType:"style"})),this._load(nx,!1)}_loadImports(r,a,n){if(this.importDepth>=4)return i.f_("Style doesn't support nesting deeper than 5"),Promise.resolve();let o=[];for(let s of r){let r=this._createFragmentStyle(s),l=new Promise(i=>{r.once("style.import.load",i),r.once("error",i)}).then(()=>{this.mergeAll(),this.fire(new i.x("data",{dataType:"style"}))});if(o.push(l),this.resolvedImports.has(s.url)){r.loadEmpty();continue}let h=s.data||this.importsCache.get(s.url);h?(s.data?(r.fire(new i.x("dataloading",{dataType:"style"})),r.globalId=r._getGlobalId(h),queueMicrotask(()=>r._load(h,a))):r.loadJSON(h,{validate:a}),this._isInternalStyle(h)&&(r.globalId=null)):s.url?r.loadURL(s.url,{validate:a}):r.loadEmpty();let u={style:r,id:s.id,config:s.config};if(n){let i=this.fragments.findIndex(({id:i})=>i===n);this.fragments=this.fragments.slice(0,i).concat(u).concat(this.fragments.slice(i))}else this.fragments.push(u)}return Promise.allSettled(o)}getImportGlobalIds(i=this,r=new Set){for(let a of i.fragments)a.style.globalId&&r.add(a.style.globalId),this.getImportGlobalIds(a.style,r);return[...r.values()]}_createFragmentStyle(r){let a,n=this.scope?i.ea(r.id,this.scope):r.id,o=this._initialConfig&&this._initialConfig[n];(r.config||o)&&(a=Object.assign({},r.config,o));let s=new nb(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:a,configOptions:this.options,colorThemeOverride:r["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(i=!1){this.mergeAll(),this._updateMapProjection(),i||this.updateConfigDependencies(),this._updateLayers(this._indo
109orDependentLayers),this.map._triggerCameraUpdate(this.camera),(!i||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(i&&this.isRootStyle()?(this.forEachFragmentStyle(i=>{this.dispatcher.broadcast("setLayers",{layers:i._serializeLayers(i._order),scope:i.scope,options:i.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(i){return this.isRootStyle()&&(i.fragment||!!i.schema&&!1!==i.fragment)}_load(r,a){if(this._isInternalStyle(r)){let i=Object.assign({},nx,{imports:[{id:"basemap",data:r,url:""}]},r.center?{center:r.center}:{},r.bearing?{bearing:r.bearing}:{},r.pitch?{pitch:r.pitch}:{},r.zoom?{zoom:r.zoom}:{},r.light?{light:r.light}:{});return this._importedAsBasemap=!0,void this._load(i,a)}if(this.updateConfig(this._config,r.schema),a&&np(this,te(r)))return;for(let i in this._loaded=!0,r.sources)this.addSource(i,r.sources[i],{validate:!1,isInitialLoad:!0});this.stylesheet=i.bL(r);let n=()=>{if(r.iconsets)for(let i in r.iconsets)this.addIconset(i,r.iconsets[i]);r.sprite?this._loadIconset(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);let n=aB(this.stylesheet.layers);if(this._order=n.map(i=>i.id),this.stylesheet.light&&i.f_("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let i=this.stylesheet.lights[0];this.light=new t_(i.properties,i.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new t_(this.stylesheet.light)),this._layers=Object.create(null);let o=!1;for(let r of n){let a=i.c0(r,this.scope,this._styleColorTheme.lut,this.options);0!==a.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(a.fqid),a.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(a.fqid),this._hasAppearances=this._hasAppearances||0!==a.getAppearances().length,a.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._updateHdCoverageSourceCache(a)&&(o=!0);let n=this.getOwnLayerSourceCache(a),s=!!this.directionalLight&&this.directionalLight.shadowsEnabled();n&&a.canCastShadows()&&s&&(n.castsShadows=!0)}if(o&&r8().then(()=>{if(!this.map)return;for(let i in this._layers)this._updateHdCoverageSourceCache(this._layers[i]);this.map.style.mergeAll();let i=this.map.transform;for(let r in this.map.style._mergedHdRoadCoverageSourceCaches){let a=this.map.style._mergedHdRoadCoverageSourceCaches[r];a.used=!0,i&&a.update(i)}this.map._update()}),this.glyphManager.url){let i=new Set;for(let r in this._layers){let a=this._layers[r];if("symbol"===a.type&&a.layout){let r=a.layout.get("text-font");r&&r.value&&"constant"===r.value.kind&&i.add(r.value.value.join(","))}}for(let r of i)this.glyphManager.prefetchRange(r,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);let s=this.stylesheet.terrain;s&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(s,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new i.x("data",{dataType:"style"}));let l=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(!0),this.fire(new i.x(l?"style.load":"style.import.load"))}).catch(r=>{this.fire(new i.v(Error("Failed to load imports",r))),this.fire(new i.x(l?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new i.x(l?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];let o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){let r=this._evaluateColorThemeData(o);this._loadColorTheme(r).then(()=>{n()}).catch(r=>{i.f_(`Couldn't load color theme from the stylesheet: ${r}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}hasAppearances(){return this._hasAppearances||this.fragments.some(i=>i.style.hasAppearances())}mergeAll(){let i,r,a,n,o,s,l,h,u,c,d={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(f=>{if(f.stylesheet){if(f.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),null!=f.light&&(i=f.light),f.stylesheet.lights)for(let i of f.stylesheet.lights)"ambient"===i.type&&null!=f.ambientLight&&(r=f.ambientLight),"directional"===i.type&&null!=f.directionalLight&&(a=f.directionalLight);n=this._prioritizeTerrain(n,f.terrain,f.stylesheet.terrain),f.stylesheet.fog&&null!=f.fog&&(o=f.fog),f.stylesheet.snow&&null!=f.snow&&(s=f.snow),f.stylesheet.rain&&null!=f.rain&&(l=f.rain),null!=f.stylesheet.camera&&(c=f.stylesheet.camera),null!=f.stylesheet.projection&&(h=f.stylesheet.projection),null!=f.stylesheet.transition&&(u=f.stylesheet.transition),d[f.scope]=f._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,this.snow=s,this.rain=l,this._styleColorThemeForScope=d,null===n?delete this.terrain:this.terrain=n,this.camera=c||{"camera-projection":"perspective"},this.projection=h||{name:"mercator"},this.transition=Object.assign({},nv,u),this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(i){let r=a=>{for(let i of a.fragments)r(i.style);i(a)};r(this)}_prioritizeTerrain(i,r,a){let n=i&&0===i.drapeRenderMode;return null===a?r&&0===r.drapeRenderMode?r:n?i:null:null!=r&&(!i||n||r&&1===r.drapeRenderMode)?r:i}mergeTerrain(){let i;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(r=>{i=this._prioritizeTerrain(i,r.terrain,r.stylesheet.terrain)}),null===i?delete this.terrain:this.terrain=i,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let i;this.forEachFragmentStyle(r=>{null!=r.stylesheet.projection&&(i=r.stylesheet.projection)}),this.projection=i||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){let r={},a=Object.create(null),n=Object.create(null),o=Object.create(null),s=Object.create(null);this.forEachFragmentStyle(l=>{for(let a in l._sourceCaches)r[i.ea(a,l.scope)]=l._sourceCaches[a];for(let r in l._otherSourceCaches)a[i.ea(r,l.scope)]=l._otherSourceCaches[r];for(let r in l._symbolSourceCaches)n[i.ea(r,l.scope)]=l._symbolSourceCaches[r];for(let r in l._fillExtrusionSourceCaches)o[i.ea(r,l.scope)]=l._fillExtrusionSourceCaches[r];if(l._hdCoverage){let r=l._hdCoverage.coverageSourceCaches;for(let a in r)s[i.ea(a,l.scope)]=r[a]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=n,this._mergedFillExtrusionSourceCaches=o,this._mergedHdRoa
109dCoverageSourceCaches=s,Object.keys(s).length>0&&!this._hdCoverage&&rY&&(this._hdCoverage=new rY)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(let a of Object.values(r.stylesheet.indoor)){let n=i.ea(a.sourceId,r.scope);this._mergedIndoor[n]=new Set(a.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){let r=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(let r of this._mergedOrder){let a=this._mergedLayers[r];if("none"!==a.visibility&&this._mergedIndoor[i.ea(a.source,a.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||r||this.indoorManager||r8().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&rX&&this.isRootStyle()&&0!==Object.keys(this._mergedIndoor).length&&(this.indoorManager=new rX(this,this._loaded),this._loaded))for(let i of Object.keys(this._mergedIndoor)){let r=this._mergedSourceCaches[i]||this._mergedOtherSourceCaches[i];r&&r.reload()}}mergeLayers(){let r={},a=[],n=Object.create(null);this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(n=>{for(let o of n._order){let s=n._layers[o];if("slot"===s.type){let a=i.cY(o);if(r[a])continue;r[a]=[]}s.slot&&r[s.slot]?r[s.slot].push(s):a.push(s)}}),this._mergedOrder=[];let o=-1,s=(a=[])=>{for(let l of a)if("slot"===l.type){let a=i.cY(l.id);r[a]&&s(r[a]),this._mergedSlots.push(a)}else{let r=i.ea(l.id,l.scope);this._mergedOrder.push(r),n[r]=l,l.is3D(!!this.terrain)&&(this._has3DLayers=!0,o=this._mergedOrder.length-1),"circle"===l.type&&(this._hasCircleLayers=!0),"symbol"===l.type&&(this._hasSymbolLayers=!0),"clip"===l.type&&(this._clipLayerPresent=!0)}};if(s(a),this._has3DLayers){let i={};for(let r=0;r<this._mergedOrder.length;++r){let a=this._mergedOrder[r];i[a]=r===o?1:r<o?2*!!n[a].hasOcclusionOpacityProperties:4}this._mergedOrder.sort((r,a)=>i[r]-i[a])}this._mergedLayers=n,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?(function(r,a,n){let o=Object.assign({},a);for(let i of Object.keys(nu))void 0===o[i]&&(o[i]=nu[i].default);let s=new i.b2(nc,r,new Map(n));return s.setTransitionOrValue(o,n),s.untransitioned().possiblyEvaluate(new i.w(0,{worldview:void 0}))})(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((n,o)=>{let s="data:image/png;base64,";if(!r||0===r.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void n();let l=r;l.startsWith(s)||(l=s+l);let h=i.a1.from("mapbox-reserved-lut"),u=new Image;u.src=l,u.onerror=()=>{this._styleColorTheme.lutLoading=!1,o(Error("Failed to load image data"))},u.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void n();this._styleColorTheme.lutLoading=!1;let{width:s,height:l,data:c}=i.co.getImageData(u);if(l>32)return void o(Error("The height of the image must be less than or equal to 32 pixels."));if(s!==l*l)return void o(Error("The width of the image must be equal to the height squared."));this.getImage(h)&&this.removeImage(h),this.addImage(h,{data:new i.ay({width:s,height:l},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});let d=this.imageManager.getImage(h,this.scope);d?(this._styleColorTheme.lut={image:d.data,data:r},n()):o(Error("Missing LUT image."))}})}getLut(i){let r=this._styleColorThemeForScope[i];return r?r.lut:null}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(r,a,n){let o,s,l,h=i.co.devicePixelRatio>1?"@2x":"",u=i.cT(a.transformRequest(a.normalizeSpriteURL(r,h,".json"),i.aH.SpriteJSON),(i,r)=>{u=null,l||(l=i,o=r,d())}),c=i.cQ(a.transformRequest(a.normalizeSpriteURL(r,h,".png"),i.aH.SpriteImage),(i,r)=>{c=null,l||(l=i,s=r,d())});function d(){if(l)n(l);else if(o&&s){let r=i.co.getImageData(s),a={};for(let n in o){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:f,stretchY:p,content:m}=o[n],_=new i.ay({width:s,height:l});i.ay.copy(r,_,{x:h,y:u},{x:0,y:0},{width:s,height:l},null),a[n]={data:_,pixelRatio:void 0!==d?d:1,sdf:void 0!==c&&c,stretchX:f,stretchY:p,content:m,usvg:!1,version:0}}n(null,a)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(r,this.map._requestManager,(r,a)=>{if(this._spriteRequest=null,r)this.fire(new i.v(r));else if(a){let r=new Map;for(let n in a)r.set(i.a1.from(n),a[n]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.x("data",{dataType:"style"}))})}addIconset(r,a){if("sprite"===a.type)return void this._loadSprite(a.url);let n=this.getOwnSourceCache(a.source);if(!n)return void this.fire(new i.v(Error(`Source "${a.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));
109let o=n.getSource();if("raster-array"!==o.type)return void this.fire(new i.v(Error(`Source "${a.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));o.partial=!1;let s=new nf(r,this.scope,n);this.imageManager.addImageProvider(s,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(r){var a,n;if(!i.dL(r)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(r);let o="auto"===this.map._spriteFormat;this._spriteRequest=(n=(a,n)=>{if(this._spriteRequest=null,a)o?this._loadSprite(r):this.fire(new i.v(a));else if(n){let r=new Map;for(let a in n)r.set(i.a1.from(a),n[a]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.x("data",{dataType:"style"}))},i.cG((a=this.map._requestManager).transformRequest(a.normalizeIconsetURL(r),i.aH.Iconset),(r,a)=>{if(r)return void n(r);let o={};for(let r of function(i){let r,a={icons:[]};for(;r=i.nextField(void 0);)1===r&&a.icons.push(function(i,r){let a,n={name:void 0};for(;a=i.nextField(r);)1===a?n.name=i.readString():2===a?n.metadata=function(i,r){let a,n={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};for(;a=i.nextField(r);)1===a?n.stretch_x=i.readPackedVarint():2===a?n.stretch_y=i.readPackedVarint():3===a?n.content_area=ep(i,i.readVarint()+i.pos):4===a?n.variables.push(function(i,r){let a,n={name:void 0};for(;a=i.nextField(r);)1===a?n.name=i.readString():2===a&&(n.rgb_color=eg(i.readVarint()),n.value="rgb_color");return n}(i,i.readVarint()+i.pos)):5===a&&(n.text_placeholder=ep(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos):3===a&&(n.usvg_tree=function(i,r){let a,n={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};for(;a=i.nextField(r);)1===a?n.width=n.height=i.readVarint():2===a?n.height=i.readVarint():3===a?n.children.push(em(i,i.readVarint()+i.pos)):4===a?n.linear_gradients.push(function(i,r){let a,n={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};for(;a=i.nextField(r);)1===a?n.transform=e_(i,i.readVarint()+i.pos):2===a?n.spread_method=i.readVarint():3===a?n.stops.push(ey(i,i.readVarint()+i.pos)):4===a?n.x1=i.readFloat():5===a?n.y1=i.readFloat():6===a?n.x2=i.readFloat():7===a&&(n.y2=i.readFloat());return n}(i,i.readVarint()+i.pos)):5===a?n.radial_gradients.push(function(i,r){let a,n={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};for(;a=i.nextField(r);)1===a?n.transform=e_(i,i.readVarint()+i.pos):2===a?n.spread_method=i.readVarint():3===a?n.stops.push(ey(i,i.readVarint()+i.pos)):4===a?n.cx=i.readFloat():5===a?n.cy=i.readFloat():6===a?n.r=i.readFloat():7===a?n.fx=i.readFloat():8===a?n.fy=i.readFloat():9===a&&(n.fr=i.readFloat());return n}(i,i.readVarint()+i.pos)):7===a?n.clip_paths.push(function(i,r){let a,n={children:[]};for(;a=i.nextField(r);)1===a?n.transform=e_(i,i.readVarint()+i.pos):2===a?n.clip_path_idx=i.readVarint():3===a&&n.children.push(em(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos)):8===a&&n.masks.push(function(i,r){let a,n={left:0,width:20,mask_type:1,children:[]};for(;a=i.nextField(r);)1===a?n.left=n.top=i.readFloat():2===a?n.width=n.height=i.readFloat():3===a?n.top=i.readFloat():4===a?n.height=i.readFloat():5===a?n.mask_type=i.readVarint():6===a?n.mask_idx=i.readVarint():7===a&&n.children.push(em(i,i.readVarint()+i.pos));return null==n.height&&(n.height=n.width),null==n.top&&(n.top=n.left),n}(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos),n.data="usvg_tree");return function(i){if(i.usvg_tree.height||(i.usvg_tree.height=i.usvg_tree.width),!i.metadata)return i;let{metadata:r}=i;if(r.content_area){let{content_area:a}=r;null==a.left&&(a.left=0),null==a.top&&(a.top=a.left),null==a.width&&(a.width=i.usvg_tree.width),null==a.height&&(a.height=a.width)}if(r.text_placeholder){let{text_placeholder:i}=r;null==i.top&&(i.top=i.left),null==i.height&&(i.height=i.width)}return r.stretch_x&&r.stretch_x.length&&ef(r,"x"),r.stretch_y&&r.stretch_y.length&&ef(r,"y"),i}(n)}(i,i.readVarint()+i.pos));return a}(new i.as(a)).icons){let a={version:1,pixelRatio:i.co.devicePixelRatio,content:function(r){if(!r.metadata||!r.metadata.content_area)return;let a=i.co.devicePixelRatio,{left:n,top:o,width:s,height:l}=r.metadata.content_area,h=n*a,u=o*a;return[h,u,h+s*a,u+l*a]}(r),stretchX:r.metadata?nd(r.metadata.stretch_x_areas):void 0,stretchY:r.metadata?nd(r.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:r};o[r.name]=a}n(null,o)}))}_validateLayer(r){let a=this.getOwnSource(r.source);if(!a)return;let n=r.sourceLayer;n&&("geojson"===a.type||a.vectorLayerIds&&!a.vectorLayerIds.includes(n))&&this.fire(new i.v(Error(`Source layer "${n}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}
109loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(let{style:i}of this.fragments)if(!i.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((i,r)=>{let a=this.fragments[r];return a&&a.style&&(i.data=a.style.serialize()),i})}_serializeSources(){let i={};for(let r in this._sourceCaches){let a=this._sourceCaches[r].getSource();i[a.id]||(i[a.id]=a.serialize())}return i}_serializeLayers(i){let r=[];for(let a of i){let i=this._layers[a];i&&"custom"!==i.type&&r.push(i.serialize())}return r}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(let i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];if(r._transitionablePaint&&r._transitionablePaint._values){let i=r._transitionablePaint._values["line-emissive-strength"];if(i&&i.value&&i.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(i){return i?this.order:this._mergedOrder}isLayerDraped(i){return!!this.terrain&&i.isDraped(this.getLayerSourceCache(i))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(r){let a=this.getOwnLayer(r);if(a)return a;this.fire(new i.v(Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){let a=this.getOwnSource(r);if(a)return a;this.fire(new i.v(Error(`The source '${r}' does not exist in the map's style.`)))}handleIdle(){let i=this.map.painter;i&&(i.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(i,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);let a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a)),r.worldview!==this._worldview&&(this._worldview=r.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));let n=this._changes.isDirty(),o=!1;if(this._changes.isDirty()){let i=this._changes.getLayerUpdatesByScope();for(let r in i){let{updatedIds:a,removedIds:n}=i[r];(a||n)&&(this._updateWorkerLayers(r,a,n),o=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this.snow&&this.snow.updateTransitions(r),this.rain&&this.rain.updateTransitions(r),this._changes.reset()}let s={};for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];s[i]=r.used,r.used=!1,r.tileCoverLift=0}let l={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if(("none"!==n.visibility||n.hasTransition())&&n.recalculate(r,this._availableImages),!n.isHidden(r.zoom)){n.mayUse("HD")&&(n.prepare(),r8()),n.mayUse("Standard")&&(n.prepare(),aE());let i=this.getLayerSourceCache(n);i&&(i.used=!0,i.tileCoverLift=Math.max(i.tileCoverLift,n.tileCoverLift()))}
109if(n.source){let r=i.ea(n.source,n.scope),a=this._mergedHdRoadCoverageSourceCaches[r];a&&!a.used&&(a.used=!0)}if("fill-extrusion"===n.type){let r=i.ea(n.source,n.scope);if(r in this._mergedFillExtrusionSourceCaches){let i=n.layout&&n.layout.get("source-max-zoom");if(null!=i){let a=l[r];l[r]=null==a?i:Math.min(a,i)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){let i=this._mergedOrder.map(i=>this._mergedLayers[i]);this._programPrecompiler.buildQueue(i,r,this)}for(let i in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[i].setMaxzoomOverride(null!=l[i]?l[i]:null);for(let i of(this.terrain&&o&&this.mergeLayers(),this.imageManager.getPendingImageProviders()))i.sourceCache.used=!0;for(let r in s){let a=this._mergedSourceCaches[r];s[r]!==a.used&&a.getSource().fire(new i.x("data",{sourceDataType:"visibility",dataType:"source",sourceId:a.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.snow&&this.snow.recalculate(r),this.rain&&this.rain.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),n&&this.fire(new i.x("data",{dataType:"style"}))}updateImageProviders(){for(let i of this.imageManager.getPendingImageProviders()){let r=i.resolvePendingRequests(),a=this.getFragmentStyle(i.scope);a&&a.addImages(r)}}_updateTilesForChangedImages(){let i={};for(let r in this._mergedSourceCaches){let a=this._mergedSourceCaches[r].getSource().scope;i[a]=i[a]||this._changes.getUpdatedImages(a),0!==i[a].length&&this._mergedSourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i[a])}for(let r in i)this._changes.resetUpdatedImages(r)}_updateWorkerLayers(i,r,a){let n=this.getFragmentStyle(i);n&&this.dispatcher.broadcast("updateLayers",{layers:r?n._serializeLayers(r):[],scope:i,removedIds:a||[],options:n.options})}setState(r,a){if(this._checkLoaded(),np(this,te(r)))return!1;(r=i.bL(r)).layers=aB(r.layers);let n=(function(r,a){if(!r)return[{command:ak.setStyle,args:[a]}];let n=[];try{if(!i.c2(r.version,a.version)||(i.c2(r.center,a.center)||n.push({command:ak.setCenter,args:[a.center]}),i.c2(r.zoom,a.zoom)||n.push({command:ak.setZoom,args:[a.zoom]}),i.c2(r.bearing,a.bearing)||n.push({command:ak.setBearing,args:[a.bearing]}),i.c2(r.pitch,a.pitch)||n.push({command:ak.setPitch,args:[a.pitch]}),i.c2(r.sprite,a.sprite)||n.push({command:ak.setSprite,args:[a.sprite]}),i.c2(r.glyphs,a.glyphs)||n.push({command:ak.setGlyphs,args:[a.glyphs]}),i.c2(r.imports,a.imports)||function(r=[],a=[],n){let o,s,l,h;a=a||[];let u=(r=r||[]).map(aj),c=a.map(aj),d=r.reduce(aG,{}),f=a.reduce(aG,{}),p=u.slice();for(o=0,s=0;o<u.length;o++)l=u[o],Object.hasOwn(f,l)?s++:(n.push({command:ak.removeImport,args:[l]}),p.splice(p.indexOf(l,s),1));for(o=0,s=0;o<c.length;o++)l=c[c.length-1-o],p[p.length-1-o]!==l&&(Object.hasOwn(d,l)?(n.push({command:ak.removeImport,args:[l]}),p.splice(p.lastIndexOf(l,p.length-s),1)):s++,h=p[p.length-o],n.push({command:ak.addImport,args:[f[l],h]}),p.splice(p.length-o,0,l));for(let r of a){let a=d[r.id];a&&(delete a.data,i.c2(a,r)||n.push({command:ak.updateImport,args:[r.id,r]}))}}(r.imports,a.imports,n),i.c2(r.transition,a.transition)||n.push({command:ak.setTransition,args:[a.transition]}),i.c2(r.light,a.light)||n.push({command:ak.setLight,args:[a.light]}),i.c2(r.fog,a.fog)||n.push({command:ak.setFog,args:[a.fog]}),i.c2(r.snow,a.snow)||n.push({command:ak.setSnow,args:[a.snow]}),i.c2(r.rain,a.rain)||n.push({command:ak.setRain,args:[a.rain]}),i.c2(r.projection,a.projection)||n.push({command:ak.setProjection,args:[a.projection]}),i.c2(r.lights,a.lights)||n.push({command:ak.setLights,args:[a.lights]}),i.c2(r.camera,a.camera)||n.push({command:ak.setCamera,args:[a.camera]}),i.c2(r.iconsets,a.iconsets)||function(r,a,n){let o;for(o in a=a||{},r=r||{})Object.hasOwn(r,o)&&(Object.hasOwn(a,o)||n.push({command:ak.removeIconset,args:[o]}));for(o in a){if(!Object.hasOwn(a,o))continue;let s=a[o];Object.hasOwn(r,o)?i.c2(r[o],s)||(n.push({command:ak.removeIconset,args:[o]}),n.push({command:ak.addIconset,args:[o,s]})):n.push({command:ak.addIconset,args:[o,s]})}}(r.iconsets,a.iconsets,n),!i.c2(r["color-theme"],a["color-theme"])))return[{command:ak.setStyle,args:[a]}];let o={},s=[];!function(r,a,n,o){let s;for(s in a=a||{},r=r||{})Object.hasOwn(r,s)&&(Object.hasOwn(a,s)||aU(s,n,o));for(s in a){var l;if(!Object.hasOwn(a,s))continue;let h=a[s];Object.hasOwn(r,s)?i.c2(r[s],h)||("geojson"===r[s].type&&"geojson"===h.type&&function(r,a,n){let o;for(o in r[n])if(Object.hasOwn(r[n],o)&&"data"!==o&&!i.c2(r[n][o],a[n][o]))return!1;for(o in a[n])if(Object.hasOwn(a[n],o)&&"data"!==o&&!i.c2(r[n][o],a[n][o]))return!1;return!0}(r,a,s)?n.push({command:ak.setGeoJSONSourceData,args:[s,h.data]}):(l=a,aU(s,n,o),aN(s,l,n))):aN(s,a,n)}}(r.sources,a.sources,s,o);let l=[];
109r.layers&&r.layers.forEach(i=>{i.source&&o[i.source]?n.push({command:ak.removeLayer,args:[i.id]}):l.push(i)});let h=r.terrain;h&&o[h.source]&&(n.push({command:ak.setTerrain,args:[void 0]}),h=void 0),n=n.concat(s),i.c2(h,a.terrain)||n.push({command:ak.setTerrain,args:[a.terrain]}),function(r,a,n){let o,s,l,h,u,c,d;a=a||[];let f=(r=r||[]).map(aj),p=a.map(aj),m=r.reduce(aG,{}),_=a.reduce(aG,{}),g=f.slice(),y=Object.create(null);for(o=0,s=0;o<f.length;o++)l=f[o],Object.hasOwn(_,l)?s++:(n.push({command:ak.removeLayer,args:[l]}),g.splice(g.indexOf(l,s),1));for(o=0,s=0;o<p.length;o++)l=p[p.length-1-o],g[g.length-1-o]!==l&&(Object.hasOwn(m,l)?(n.push({command:ak.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-s),1)):s++,c=g[g.length-o],n.push({command:ak.addLayer,args:[_[l],c]}),g.splice(g.length-o,0,l),y[l]=!0);for(o=0;o<p.length;o++)if(h=m[l=p[o]],u=_[l],!y[l]&&!i.c2(h,u))if(i.c2(h.source,u.source)&&i.c2(h["source-layer"],u["source-layer"])&&i.c2(h.type,u.type)){for(d in aV(h.layout,u.layout,n,l,null,ak.setLayoutProperty),aV(h.paint,u.paint,n,l,null,ak.setPaintProperty),i.c2(h.slot,u.slot)||n.push({command:ak.setSlot,args:[l,u.slot]}),i.c2(h.filter,u.filter)||n.push({command:ak.setFilter,args:[l,u.filter]}),i.c2(h.minzoom,u.minzoom)&&i.c2(h.maxzoom,u.maxzoom)||n.push({command:ak.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)Object.hasOwn(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?aV(h[d],u[d],n,l,d.slice(6),ak.setPaintProperty):i.c2(h[d],u[d])||n.push({command:ak.setLayerProperty,args:[l,d,u[d]]}));for(d in u)Object.hasOwn(u,d)&&!Object.hasOwn(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?aV(h[d],u[d],n,l,d.slice(6),ak.setPaintProperty):i.c2(h[d],u[d])||n.push({command:ak.setLayerProperty,args:[l,d,u[d]]}))}else n.push({command:ak.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:ak.addLayer,args:[u,c]})}(l,a.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:ak.setStyle,args:[a]}]}return n})(this.serialize(),r).filter(i=>!(i.command in ng));if(0===n.length)return!1;let o=n.filter(i=>!(i.command in n_));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);let s=[];return n.forEach(i=>{s.push(this[i.command](...i.args))}),a&&Promise.all(s).then(a).catch(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(r){if(0===r.size)return this;for(let[a,n]of r.entries()){if(this.getImage(a))return this.fire(new i.v(Error(`An image with the name "${a.name}" already exists.`)));this.imageManager.addImage(a,this.scope,n),this._changes.updateImage(a,this.scope)}return this._updateWorkerImages(),this.fire(new i.x("data",{dataType:"style"})),this}addImage(r,a){return this.getImage(r)?this.fire(new i.v(Error(`An image with the name "${r.name}" already exists.`))):(this.imageManager.addImage(r,this.scope,a),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.x("data",{dataType:"style"})),this)}updateImage(r,a,n=!1){this.imageManager.updateImage(r,this.scope,a),n&&(this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.x("data",{dataType:"style"})))}getImage(i){return this.imageManager.getImage(i,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.x("data",{dataType:"style"})),this):this.fire(new i.v(Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(r){return this.modelManager.addModelURLs(r,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.x("data",{dataType:"style"})),this}addModel(r,a,n={}
109){return this._checkLoaded(),this._validate(td,`models.${r}`,a,null,n)||(this.modelManager.addModel(r,a,this.getActualScope()),this.fire(new i.x("data",{dataType:"style"}))),this}hasModel(i){return this.modelManager.hasModel(i,this.getActualScope())}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.getActualScope(),!1,!0),this.fire(new i.x("data",{dataType:"style"})),this):this.fire(new i.v(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(r,a,n={}){if(this._checkLoaded(),void 0!==this.getOwnSource(r))throw Error(`There is already a source with ID "${r}".`);if(!a.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(a.type)&&this._validate(tt,`sources.${r}`,a,null,n))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);let o=aR(r,a,this.dispatcher,this);o.scope=this.scope,o.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(o.id),source:o.serialize(),sourceId:o.id}));let s=r=>{let a=(r===i.aC.Symbol?"symbol:":r===i.aC.FillExtrusion?"fill-extrusion:":"other:")+o.id,n=i.ea(a,this.scope),s=this._sourceCaches[a]=new rD(n,o,r);r===i.aC.Symbol?this._symbolSourceCaches[o.id]=s:r===i.aC.FillExtrusion?this._fillExtrusionSourceCaches[o.id]=s:this._otherSourceCaches[o.id]=s,s.onAdd(this.map)};s(i.aC.Other),"vector"!==a.type&&"geojson"!==a.type||(s(i.aC.Symbol),"vector"===a.type&&s(i.aC.FillExtrusion)),o.onAdd&&o.onAdd(this.map),n.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();let a=this.getOwnSource(r);if(!a)throw Error("There is no source with this ID");for(let a in this._layers)if(this._layers[a].source===r)return this.fire(new i.v(Error(`Source "${r}" cannot be removed while layer "${a}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new i.v(Error(`Source "${r}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){let a=Object.entries(this.stylesheet.iconsets).find(([i,a])=>"source"===a.type&&a.source===r);if(a)return this.fire(new i.v(Error(`Source "${r}" cannot be removed while iconset "${a[0]}" is using it.`)))}for(let a of this.getOwnSourceCaches(r)){let r=i.cY(a.id);delete this._sourceCaches[r],this._changes.discardSourceCacheUpdate(a.id),a.fire(new i.x("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],delete this._fillExtrusionSourceCaches[r],this._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getOwnSource(i).setData(r),this._changes.setDirty()}getOwnSource(i){let r=this.getOwnSourceCache(i);return r&&r.getSource()}getOwnSources(){let i=[];for(let r in this._otherSourceCaches){let a=this.getOwnSourceCache(r);a&&i.push(a.getSource())}return i}areTilesLoaded(){let i=this._mergedSourceCaches;for(let r in i){let a=i[r]._tiles;for(let i in a){let r=a[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0}setLights(r){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!r)return delete this.ambientLight,void delete this.directionalLight;let a=this._getTransitionParameters();for(let i of r){if(this._validate(tr,"lights",i))return;switch(i.type){case"ambient":if(this.ambientLight){let r=this.ambientLight;r.set(i),r.updateTransitions(a)}else this.ambientLight=new tP(i,tL(),this.scope,this.options);break;case"directional":if(this.directionalLight){let r=this.directionalLight;r.set(i),r.updateTransitions(a)}else this.directionalLight=new tP(i,tz(),this.scope,this.options)}}let n=Object.assign(a,{worldview:this.map.getWorldview()}),o=new i.w(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;let n=i=>.2126*(i[0]<=.03928?i[0]/12.92:Math.pow((i[0]+.055)/1.055,2.4))+.7152*(i[1]<=.03928?i[1]/12.92:Math.pow((i[1]+.055)/1.055,2.4))+.0722*(i[2]<=.03928?i[2]/12.92:Math.pow((i[2]+.055)/1.055,2.4)),o=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=1-i.bB(l.x,l.y,l.z)[2]/90,u=n(o)*s*h,c=a.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),d=a.properties.get("intensity");return Number(((u+n(c)*d)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let i=[];return this.directionalLight&&i.push(this.directionalLight.get()),this.ambientLight&&i.push(this.ambientLight.get()),i}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(null==r||""===r&&this.isRootStyle())return this;if(i.dx(r)){let a=i.cS(r),n=this.fragments.find(({id:i})=>i===a);if(!n)return;let o=i.cY(r);return n.style.getFragmentStyle(o)}{let i=this.fragments.find(({id:i})=>i===r);return i?i.style:void 0}}setFeaturesetSelectors(r){if(!r)return;let a=(i,r="")=>`${i}::${r}`;for(let n in this._featuresetSelectors={},r){let o={},s=this._featuresetSelectors[n]=[];for(let l of r[n].selectors){let r;if(l.featureNamespace){let r=this.getOwnLayer(l.layer);if(!r){i.f_(`Layer is undefined for selector: ${l.layer}`);continue}let s=a(r.source,r.sourceLayer);
109if(s in o&&o[s]!==l.featureNamespace){i.f_(`"featureNamespace ${l.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}o[s]=l.featureNamespace}if(l.properties)for(let a in l.properties){let n=i.bY(l.properties[a]);"success"===n.result&&((r=r||{})[a]=n.value)}s.push({layerId:l.layer,namespace:l.featureNamespace,properties:r,uniqueFeatureID:l._uniqueFeatureID})}}}getFeaturesetDescriptors(i){let r=this.getFragmentStyle(i);if(!r||!r.stylesheet.featuresets)return[];let a=[];for(let i in r.stylesheet.featuresets)a.push({featuresetId:i,importId:r.scope?r.scope:void 0});return a}getFeaturesetLayers(r,a){let n=this.getFragmentStyle(a),o=n.stylesheet.featuresets;if(!o||!o[r])return this.fire(new i.v(Error(`The featureset '${r}' does not exist in the map's style and cannot be queried.`))),[];let s=[];for(let i of o[r].selectors){let r=n.getOwnLayer(i.layer);r&&s.push(r)}return s}getConfigProperty(r,a){let n=this.getFragmentStyle(r);if(!n)return null;let o=i.ea(a,n.scope),s=n.options.get(o),l=s?s.value||s.default:null;return l?l.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(r,a){let n=i.ea(r,a);return this._mergedIndoor[n]}setIndoorData(i,r){this.indoorManager&&this.indoorManager.setIndoorData(r)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(r,a,n){let o,s=this.getFragmentStyle(r);if(!s)return;let l=s.stylesheet.schema;if(!l||!l[a])return;let h=nm(l[a],n);if("success"!==h.result)return void np(this,h.value);let u=h.value.expression,c=i.ea(a,s.scope),d=s.options.get(c);if(!d)return;let{minValue:f,maxValue:p,stepValue:m,type:_,values:g}=l[a],y=nm(l[a],l[a].default);"success"===y.result&&(o=y.value.expression),o?(this.options.set(c,Object.assign({},d,{value:u,default:o,minValue:f,maxValue:p,stepValue:m,type:_,values:g})),this.updateConfigDependencies(a)):this.fire(new i.v(Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){let a=this.getFragmentStyle(r);if(!a)return null;let n=a.stylesheet.schema;if(!n)return null;let o={};for(let r in n){let n=i.ea(r,a.scope),s=a.options.get(n),l=s?s.value||s.default:null;o[r]=l?l.serialize():null}return o}setConfig(i,r){let a=this.getFragmentStyle(i);a&&(a.updateConfig(r,a.stylesheet.schema),this.updateConfigDependencies())}getSchema(i){let r=this.getFragmentStyle(i);return r?r.stylesheet.schema:null}setSchema(i,r){let a=this.getFragmentStyle(i);a&&(a.stylesheet.schema=r,a.updateConfig(a._config,r),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(let n in a){let o,s,l=nm(a[n],a[n].default);if("success"===l.result&&(o=l.value.expression),r&&void 0!==r[n]){let i=nm(a[n],r[n]);"success"===i.result&&(s=i.value.expression)}let{minValue:h,maxValue:u,stepValue:c,type:d,values:f}=a[n];if(o){let r=i.ea(n,this.scope);this.options.set(r,{default:o,value:s,minValue:h,maxValue:u,stepValue:c,type:d,values:f})}else this.fire(new i.v(Error(`No schema defined for config option "${n}".`)))}else this.fire(new i.v(Error("Attempting to set config for a style without schema.")))}_updateLayers(i,r=()=>!0){for(let a of i){let i=this.getLayer(a);i&&r(i)&&(i.possiblyEvaluateVisibility(),this._updateLayer(i),this._changes.setDirty())}}updateConfigDependencies(i){this._updateLayers(this._configDependentLayers,r=>!i||r.expressionDependencies.configDependencies.has(i)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(i=>{let r=i._styleColorTheme.colorThemeOverride?i._styleColorTheme.colorThemeOverride:i._styleColorTheme.colorTheme;if(r){let a=i._evaluateColorThemeData(r);(!i._styleColorTheme.lut&&""!==a||i._styleColorTheme.lut&&a!==i._styleColorTheme.lut.data)&&i.setColorTheme(r)}}),this._updateIndoorEnabled(),this._changes.setDirty()}addLayer(r,a,n={}){let o;this._checkLoaded();let s=r.id;if(this._layers[s])return void this.fire(new i.v(Error(`Layer with i
109d "${s}" already exists on this map`)));if("custom"===r.type){if(np(this,i.fY(r)))return;o=i.c0(r,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=Object.assign(r=i.bL(r),{source:s})),this._validate(tl,`layers.${s}`,r,{arrayIndex:-1},n))return;o=i.c0(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}})}let l=i.ea(o.source,o.scope);0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(l),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(l);let h=this._order.length;if(a){let r=this._order.indexOf(a);if(-1===r)return void this.fire(new i.v(Error(`Layer with id "${a}" does not exist on this map.`)));o.slot&&o.slot!==this._layers[a].slot?i.f_(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):h=r}this._order.splice(h,0,s),this._handleLayerOrderChange(),this._layers[s]=o;let u=this.getOwnLayerSourceCache(o),c=!!this.directionalLight&&this.directionalLight.shadowsEnabled();u&&o.canCastShadows()&&c&&(u.castsShadows=!0);let d=this._changes.getRemovedLayer(o);if(d&&o.source&&u&&"custom"!==o.type){this._changes.discardLayerRemoval(o);let r=i.ea(o.source,o.scope);d.type!==o.type?this._changes.updateSourceCache(r,"clear"):(this._changes.updateSourceCache(r,"reload"),u.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();let n=this._checkLayer(r);if(!n||r===a)return;let o=this._order.indexOf(r);this._order.splice(o,1);let s=this._order.length;if(a){let r=this._order.indexOf(a);
109if(-1===r)return void this.fire(new i.v(Error(`Layer with id "${a}" does not exist on this map.`)));n.slot&&n.slot!==this._layers[a].slot?i.f_(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):s=r}this._order.splice(s,0,r),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(i){this._checkLoaded();let r=this._checkLayer(i);if(!r)return;r.setEventedParent(null);let a=this._order.indexOf(i);this._order.splice(a,1),delete this._layers[i],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(r.fqid),this._indoorDependentLayers.delete(r.fqid),this._changes.removeLayer(r);let n=this.getOwnLayerSourceCache(r);if(n&&n.castsShadows){let i=!1;for(let a in this._layers)if(this._layers[a].source===r.source&&this._layers[a].canCastShadows()){i=!0;break}n.castsShadows=i}r.onRemove&&r.onRemove(this.map),this.mergeLayers()}getOwnLayer(i){return this._layers[i]}hasLayer(i){return i in this._mergedLayers}hasLayerType(i){for(let r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(i,r,a){this._checkLoaded();let n=this._checkLayer(i);n&&(n.minzoom===r&&n.maxzoom===a||(null!=r&&(n.minzoom=r),null!=a&&(n.maxzoom=a),this._updateLayer(n)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(i,r){this._checkLoaded();let a=this._checkLayer(i);a&&a.slot!==r&&(a.slot=r,this._updateLayer(a))}setFilter(r,a,n={}){this._checkLoaded();let o=this._checkLayer(r);if(o&&!i.c2(o.filter,a))return null==a?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(th,`layers.${o.id}.filter`,a,{layerType:o.type},n)||(o.filter=i.bL(a),this._updateLayer(o)))}getFilter(r){let a=this._checkLayer(r);if(a)return i.bL(a.filter)}setLayoutProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(s&&!i.c2(s.getLayoutProperty(a),n)){if(null!=n&&(!o||!1!==o.validate)&&np(s,tc.call(te,{key:`layers.${r}.layout.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.fs,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(a,n),0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),this._updateLayer(s)}}getLayerProperty(i,r){let a=this._checkLayer(i);if(a){switch(r){case"minzoom":return a.minzoom;case"maxzoom":return a.maxzoom;case"filter":return this.getFilter(i);case"slot":return a.slot;case"appearances":return a.getAppearances().map(i=>i.serialize())}return a.isPaintProperty(r)?this.getPaintProperty(i,r):this.getLayoutProperty(i,r)}}setLayerProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o){switch(r){case"appearances":return o.setAppearances(a),void this._updateLayer(o);case"minzoom":return this.setLayerZoomRange(i,a);case"maxzoom":return this.setLayerZoomRange(i,null,a);case"filter":return this.setFilter(i,a,n);case"slot":return this.setSlot(i,a)}o.isPaintProperty(r)?this.setPaintProperty(i,r,a,n):this.setLayoutProperty(i,r,a,n)}}getLayoutProperty(i,r){let a=this._checkLayer(i);if(a)return a.getLayoutProperty(r)}setPaintProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(!s||i.c2(s.getPaintProperty(a),n)||null!=n&&(!o||!1!==o.validate)&&np(s,tu.call(te,{key:`layers.${r}.paint.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.fs})))return;let l=s.setPaintProperty(a,n);0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),l&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(i,r){let a=this._checkLayer(i);if(a)return a.getPaintProperty(r)}setFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.setFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.setFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=r.sourceLayer,s=this._checkSource(n);if(!s)return;let l=s.type;if("geojson"===l&&o)return void this.fire(new i.v(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.v(Error("The sourceLayer parameter must be provided for vector source types.")));for(let s of(void 0===r.id&&this.fire(new i.v(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)))s.setFeatureState(
109o,r.id,a)}removeFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.removeFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.removeFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=this._checkSource(n);if(!o)return;let s=o.type,l="vector"===s?r.sourceLayer:void 0;if("vector"===s&&!l)return void this.fire(new i.v(Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.v(Error("A feature id is required to remove its specific state property.")));for(let i of this.getOwnSourceCaches(n))i.removeFeatureState(l,r.id,a)}getFeatureState(r){if(this._checkLoaded(),"target"in r){let a;if("featuresetId"in r.target){let{featuresetId:n,importId:o}=r.target,s=this.getFragmentStyle(o);for(let{source:o,sourceLayer:l}of s.getFeaturesetLayers(n)){let n=s.getFeatureState({id:r.id,source:o,sourceLayer:l});if(n&&!a)a=n;else if(!i.c2(a,n))return void this.fire(new i.v(Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);a=this.getFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer})}return a}let a=r.source,n=r.sourceLayer,o=this._checkSource(a);if(o){if("vector"!==o.type||n)return void 0===r.id&&this.fire(new i.v(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(n,r.id);this.fire(new i.v(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}setWorldview(i){i!==this._worldview&&(this._worldview=i,this.dispatcher.broadcast("setWorldview",this._worldview),this.reloadSources())}serialize(){this._checkLoaded();let r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return i.cr({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateFilteredLayers(i){for(let r of Object.values(this._mergedLayers))i(r)&&this._updateLayer(r)}_updateLayer(r){this._changes.updateLayer(r);let a=this.getLayerSourceCache(r),n=i.ea(r.source,r.scope),o=this._changes.getUpdatedSourceCaches();r.source&&!o[n]&&a&&"raster"!==a.getSource().type&&(this._changes.updateSourceCache(n,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){let r=i=>this._mergedLayers[i].is3D(!!this.terrain),a=this.order,n={},o=[];for(let s=a.length-1;s>=0;s--){let l=a[s];if(r(l))for(let r of(n[l]=s,i)){let i=r[l];if(i)for(let r of i)o.push(r)}}o.sort((i,r)=>r.intersectionZ-i.intersectionZ);let s=[];for(let l=a.length-1;l>=0;l--){let h=a[l];if(r(h))for(let i=o.length-1;i>=0;i--){let r=o[i].feature;if(r.layer&&n[r.layer.id]<l)break;s.push(r),o.pop()}else for(let r of i){let i=r[h];if(i)for(let r of i)s.push(r.feature)}}return s}queryRasterValue(r,a,n){let o=this.getOwnSource(r);return o?"raster-array"!==o.type?(this.fire(new i.v(Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):o.queryRasterArrayValue(a,n):(this.fire(new i.v(Error(`Source with i
109d "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(th,"queryRenderedFeatures.filter",a.filter,null,a),o=i.bZ(a.filter));let s={},l=i=>{if(ny.has(i.type))return;let r=this.getOwnLayerSourceCache(i),a=s[r.id]=s[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};i.is3D(!!this.terrain)&&(a.has3DLayers=!0),a.layers[i.fqid]=a.layers[i.fqid]||{styleLayer:i,targets:[]},a.layers[i.fqid].targets.push({filter:o})};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new i.v(Error("parameters.layers must be an Array."))),[];for(let r of a.layers){let a=this._layers[r];if(!a)return this.fire(new i.v(Error(`The layer '${r}' does not exist in the map's style and cannot be queried for features.`))),[];l(a)}}else for(let i in this._layers)l(this._layers[i]);let h=this._queryRenderedFeatures(r,s,n),u=this._flattenAndSortRenderedFeatures(h),c=[];for(let r of u)i.cZ(r.layer.id)===this.scope&&c.push(r);return c}queryRenderedFeatureset(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(th,"queryRenderedFeatures.filter",a.filter,null,a),o=i.bZ(a.filter));let s="mock",l=[];if(a&&a.target)l.push(Object.assign({},a,{targetId:s,filter:o}));else{for(let i of this.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:i});for(let{style:i}of this.fragments)for(let r of i.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:r})}let h=this.queryRenderedTargets(r,l,n),u=[],c=new Set;for(let r of h)for(let a of r.variants[s])aL(a,r,c)||u.push(new i.aZ(r,a));return u}queryRenderedTargets(r,a,n){let o={},s=(i,r,a,n)=>{let s=o[r.id]=o[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};(s.layers[i.fqid]=s.layers[i.fqid]||{styleLayer:i,targets:[]},i.is3D(!!this.terrain)&&(s.has3DLayers=!0),n)?s.layers[i.fqid].targets.push(Object.assign({},a,{namespace:n.namespace,properties:n.properties,uniqueFeatureID:n.uniqueFeatureID})):(a.uniqueFeatureID=!1,s.layers[i.fqid].targets.push(a))};for(let r of a)if("featuresetId"in r.target){let{featuresetId:a,importId:n}=r.target,o=this.getFragmentStyle(n);if(!o||!o._featuresetSelectors)continue;let l=o._featuresetSelectors[a];if(!l){this.fire(new i.v(Error(`The featureset '${a}' does not exist in the map's style and cannot be queried for features.`)));continue}for(let i of l){let a=o.getOwnLayer(i.layerId);a&&!ny.has(a.type)&&s(a,o.getOwnLayerSourceCache(a),r,i)}}else if("layerId"in r.target){let{layerId:i}=r.target,a=this.getLayer(i);if(!a||ny.has(a.type))continue;s(a,this.getLayerSourceCache(a),r)}let l=this._queryRenderedFeatures(r,o,n);return this._flattenAndSortRenderedFeatures(l)}_queryRenderedFeatures(r,a,n){let o=[],s=!!this.map._showQueryGeometry,l=aI.createFromScreenPoints(r,n);for(let i in a){let r=function(i,r,a,n,o=!1,s){let l=r.sourceCache.transform,h=r.sourceCache.tilesIn(i,r.has3DLayers,o);h.sort(az);let u=[];for(let i of h){let h=i.tile.queryRenderedFeatures(r,i,a,n,l,o,s);Object.keys(h).length&&u.push({wrappedTileID:i.tile.tileID.wrapped().key,queryResults:h})}for(let a in r.layers){let o=r.layers[a];if(o.styleLayer){let a=o.styleLayer.queryRenderedFeatures(i,r.sourceCache,n);Object.keys(a).length&&u.push({wrappedTileID:0,queryResults:a})}}return 0===u.length?{}:function(i){let r={},a={};for(let n of i){let i=n.queryResults,o=n.wrappedTileID,s=a[o]=a[o]||{};for(let a in i){let n=i[a],o=s[a]=s[a]||{},l=r[a]=r[a]||[];for(let i of n)o[i.featureIndex]||(o[i.featureIndex]=!0,l.push(i))}}return r}(u)}(l,a[i],this._availableImages,n,s,this.getActualScope());Object.keys(r).length&&o.push(r)}if(this.placement)for(let r in a){if(a[r].sourceCache._renderSourceType!==i.aC.Symbol)continue;let n=function(i,r,a,n,o,s){let l={},h=n.queryRenderedSymbols(i),u=[];for(let i of Object.keys(h).map(Number))u.push(o[i]);for(let i of(u.sort(az),u)){let n=i.featureIndex.lookupSymbolFeatures(h[i.bucketInstanceId],i.bucketIndex,i.sourceLayerIndex,r,a,s);for(let r in n){let a=l[r]=l[r]||[],o=n[r];for(let r of(o.sort((r,a)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(r.featureIndex);return n.indexOf(a.featureIndex)-i}return a.featureIndex-r.featureIndex}),o))a.push(r)}}return l}(l.screenGeometry,a[r],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(n).length&&o.push(n)}return o}querySourceFeatures(i,r){let a=r&&r.filter;
109a&&this._validate(th,"querySourceFeatures.filter",a,null,r);let n=[];for(let a of this.getOwnSourceCaches(i))n=n.concat(function(i,r){let a=i.getRenderableIds().map(r=>i.getTileByID(r)),n=[],o={};for(let i=0;i<a.length;i++){let s=a[i],l=s.tileID.canonical.key;o[l]||(o[l]=!0,s.querySourceFeatures(n,r))}return n}(a,r));return n}addSourceType(i,r,a){return nb.getSourceType(i)?a(Error(`A source type called "${i}" already exists.`)):(nb.setSourceType(i,r),a(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,n={}){this._checkLoaded();let o=this.light.getLight(),s=!1;for(let a in r)if(!i.c2(r[a],o[a])){s=!0;break}if(!s)return;let l=this._getTransitionParameters();this.light.setLight(r,a,n),this.light.updateTransitions(l)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=i.co.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.f_("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===a&&delete this.terrain,null===r?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let n=r,o=!("source"in r)||null==r.source;if(1===a){if(this.disableElevatedTerrain)return;if("source"in n&&"object"==typeof n.source){let r="terrain-dem-src";this.addSource(r,n.source),n=Object.assign(n=i.bL(n),{source:r})}let r=Object.assign({},n),a={};if(this.terrain&&o){r.source=this.terrain.get().source;let i=this.terrain?this.getFragmentStyle(this.terrain.scope):null;i&&(a.style=i.serialize())}if(this._validate(ta,"terrain",r,a))return}if(this.terrain&&(this.terrain.scope===this.scope||o)&&(!this.terrain||a===this.terrain.drapeRenderMode)){let a=this.terrain,o=a.get();for(let r of Object.keys(i.fs.terrain))!Object.hasOwn(n,r)&&i.fs.terrain[r].default&&(n[r]=i.fs.terrain[r].default);for(let n in r)if(!i.c2(r[n],o[n])){a.set(r,this.options),this.stylesheet.terrain=r;let n=this._getTransitionParameters({duration:0});a.updateTransitions(n),this.fire(new i.x("data",{dataType:"style"}));break}}else{if(!n)return;this._createTerrain(n,a),this.fire(new i.x("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new tT(i,this.map.transform,this.scope,this.options);this.stylesheet.fog=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createSnow(i){let r=this.snow=new tI(i,this.map.transform,this.scope,this.options);this.stylesheet.snow=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createRain(i){let r=this.rain=new tA(i,this.map.transform,this.scope,this.options);this.stylesheet.rain=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),r)if(this.fog){let a=this.fog;if(!i.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createFog(r);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}getSnow(){return this.snow?this.snow.get():null}setSnow(r){if(this._checkLoaded(),!r)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){let a=this.snow;if(!i.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.snow=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createSnow(r);
109this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(r){if(this._checkLoaded(),!r)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){let a=this.rain;if(!i.c2(a.get(),r)){a.set(r,this.options),this.stylesheet.rain=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createRain(r);this._markersNeedUpdate=!0}_reloadColorTheme(){let r=()=>{for(let i in this._layers)this._layers[i].lut=this._styleColorTheme.lut;for(let i in this._sourceCaches)this._sourceCaches[i].clearTiles()},a=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!a)return this._styleColorTheme.lut=null,void r();let n=this._evaluateColorThemeData(a);this._loadColorTheme(n).then(()=>{this.fire(new i.x("colorthemeset")),r()}).catch(r=>{i.f_(`Couldn't set color theme: ${r}`)})}setColorTheme(r){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.f_("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=r,this._reloadColorTheme()}setImportColorTheme(i,r){let a=this.getFragmentStyle(i);a&&(a._styleColorTheme.colorThemeOverride=r,a._reloadColorTheme())}_getTransitionParameters(r){return{now:i.co.now(),transition:Object.assign(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;let i=[],r=[];for(let a of this._mergedOrder)this.isLayerDraped(this._mergedLayers[a])?i.push(a):r.push(a);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(i,r){let a=this.terrain=new ty(i,r,this.scope,this.options,this.map.getWorldview());1===r&&(this.stylesheet.terrain=i),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let n=this._getTransitionParameters({duration:0});a.updateTransitions(n)}_force3DLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,a,n,o,s={}){if(s&&!1===s.validate)return!1;let l=Object.assign({},this.serialize());return np(this,r.call(te,Object.assign({key:a,style:l,value:n,styleSpec:i.fs},o)))}_remove(){for(let r in this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.ck.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];r.clearTiles(),r.setEventedParent(null);let a=r.getSource();a&&a.onRemove&&a.onRemove(this.map)}this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager&&this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(i){for(let r of this.getSourceCaches(i))r.clearTiles()}clearSources(){for(let i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles()}clearLayers(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];r._clear&&r._clear()}}reloadSource(i){for(let r of this.getSourceCaches(i))r.resume(),r.reload()}
109reloadSources(){for(let i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(i){let r;this.directionalLight&&(r=iy(this.directionalLight));let a=new Set,n=new Set,o=new Set;for(let i in this._mergedLayers){let r=this._mergedLayers[i];"building"===r.type?a.add(r.source):"raster"===r.type&&r.paint&&"ground"===r.paint.get("raster-elevation-reference")&&o.add(r.source),r.hasElevation()&&!n.has(r.source)&&n.add(r.source)}for(let s in this.updateFrcCoverageFadeRange(),this._mergedSourceCaches){let l=this._mergedSourceCaches[s],h=n.has(l._source.id);l._isRasterElevatedOverTerrain=o.has(l._source.id),a.has(l._source.id)&&(l._source.reparseOverscaled=!1),l.update(i,void 0,void 0,r,h)}this.updateFrcCoverage()}_reloadSources(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&rQ&&rQ(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&rK&&rK(this,this._hdCoverage)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new i.x("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new ne),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,a,n,o,s,l){this.pauseablePlacement||(this.pauseablePlacement=new ne);let h=!1,u=!1,c={},d={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if("symbol"!==n.type)continue;let o=i.ea(n.source,n.scope),s=c[o];if(!s){let i=this.getLayerSourceCache(n);if(!i)continue;let r=i.getRenderableIds(!0).map(r=>i.getTileByID(r));d[o]=r.slice(),s=c[o]=r.sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let l=this.crossTileSymbolIndex.addLayer(n,s,r.center.lng,r.projection);h=h||l}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);let f=!!(this.placement&&!r.equals(this.placement.transform)),p=!!(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!s||this.placement.lastReplacementSourceUpdateTime!==s.updateTime)),m=f||p||h,_=(m||this.pauseablePlacement.isStale())&&0===n,g=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.co.now(),r.zoom)&&0!==n;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||_||g)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,this._mergedOrder,a,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex,l),this.map.painter)){let i=this.map.painter.maxFrontCutoffRawStart;if(i>0){let a=180*r.pitch/Math.PI;if(a>=15){let r=Math.min(1,Math.max(0,(a-15)/5)),n=r*r*(3-2*r);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-n)+i*n}}}if(this.pauseablePlacement.isDone()?m&&0!==n&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,c,d,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.co.now()),u=!0),h&&this.pauseablePlacement.setStale()),u||h){this._buildingIndex.onNewFrame(r.zoom);for(let r=0;r<this._mergedOrder.length;r++){let a=this._mergedLayers[this._mergedOrder[r]];if("symbol"!==a.type||"none"===a.visibility)continue;let n=this.isLayerClipped(a);this.placement.updateLayerOpacities(a,c[i.ea(a.source,a.scope)],r,n?s:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(i.co.now())}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(r,a){this._checkLoaded();let n=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==n.findIndex(({id:i})=>i===r.id))return void this.fire(new i.v(Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return n.push(r),this._loadImports([r],!0);let o=n.findIndex(({id:i})=>i===a);return-1===o&&this.fire(new i.v(Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=n.slice(0,o).c
109oncat(r).concat(n.slice(o)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();let n=this.stylesheet.imports||[],o=this.getImportIndex(r);return-1===o||("string"==typeof a?this.setImportUrl(r,a):(a.url&&a.url!==n[o].url&&this.setImportUrl(r,a.url),i.c2(a.config,n[o].config)||this.setImportConfig(r,a.config,a.data.schema),i.c2(a.data,n[o].data)||this.setImportData(r,a.data))),this}moveImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;let o=this.getImportIndex(r);if(-1===o)return this;let s=a[n],l=this.fragments[n];return a=a.filter(({id:r})=>r!==i),this.fragments=this.fragments.filter(({id:r})=>r!==i),this.stylesheet.imports=a.slice(0,o).concat(s).concat(a.slice(o)),this.fragments=this.fragments.slice(0,o).concat(l).concat(this.fragments.slice(o)),this.mergeLayers(),this}setImportUrl(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;a[n].url=r;let o=this.fragments[n];return o.style=this._createFragmentStyle(a[n]),o.style.on("style.import.load",()=>this.mergeAll()),o.style.loadURL(r),this}setImportData(i,r){this._checkLoaded();let a=this.getImportIndex(i),n=this.stylesheet.imports||[];return-1===a?this:r?(this.fragments[a].style.setState(r),this._reloadImports(),this):(delete n[a].data,this.setImportUrl(i,n[a].url))}setImportConfig(i,r,a){this._checkLoaded();let n=this.getImportIndex(i),o=this.stylesheet.imports||[];if(-1===n)return this;r?o[n].config=r:delete o[n].config;let s=this.fragments[n];a&&s.style.stylesheet&&(s.style.stylesheet.schema=a);let l=s.style.stylesheet&&s.style.stylesheet.schema;return s.config=r,s.style.updateConfig(r,l),this.updateConfigDependencies(),this}removeImport(i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(i);-1!==a&&(r.splice(a,1),this.fragments[a].style._remove(),this.fragments.splice(a,1),this._reloadImports())}getImportIndex(r){let a=(this.stylesheet.imports||[]).findIndex(i=>i.id===r);return-1===a&&this.fire(new i.v(Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(i){return this._mergedLayers[i]}getSources(){let i=[];for(let r in this._mergedOtherSourceCaches){let a=this._mergedOtherSourceCaches[r];a&&i.push(a.getSource())}return i}getSource(i,r){let a=this.getSourceCache(i,r);return a&&a.getSource()}getLayerSource(i){let r=this.getLayerSourceCache(i);return r&&r.getSource()}getSourceCache(r,a){let n=i.ea(r,a);return this._mergedOtherSourceCaches[n]}getLayerSourceCache(r){let a=i.ea(r.source,r.scope);return"symbol"===r.type?this._mergedSymbolSourceCaches[a]:"fill-extrusion"===r.type?this._mergedFillExtrusionSourceCaches[a]||this._mergedOtherSourceCaches[a]:"fill"===r.type&&r.sourceLayer===i.X&&this._mergedHdRoadCoverageSourceCaches[a]?this._mergedHdRoadCoverageSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(i){if(null==i)return Object.values(this._mergedSourceCaches);let r=[];return this._mergedOtherSourceCaches[i]&&r.push(this._mergedOtherSourceCaches[i]),this._mergedSymbolSourceCaches[i]&&r.push(this._mergedSymbolSourceCaches[i]),this._mergedFillExtrusionSourceCaches[i]&&r.push(this._mergedFillExtrusionSourceCaches[i]),this._mergedHdRoadCoverageSourceCaches[i]&&r.push(this._mergedHdRoadCoverageSourceCaches[i]),r}updateSourceCaches(){let i=this._changes.getUpdatedSourceCaches();for(let r in i){let a=i[r];"reload"===a?this.reloadSource(r):"clear"===a&&this.clearSource(r)}}updateLayers(i){for(let r of this._changes.getUpdatedPaintProperties()){let a=this.getLayer(r);a&&a.updateTransitions(i)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(i){this.stylesheet.glyphs=i,this.glyphManager.setURL(i)}getImages(r,a,n){this.imageManager.getImages(a.icons.concat(a.patterns),a.scope,n),this._updateTilesForChangedImages();let o=a.icons.map(r=>i.a1.toString(r)),s=a.patterns.map(r=>i.a1.toString(r)),l=i=>{i&&(i.setDependencies(a.tileID.key,"icons",o),i.setDependencies(a.tileID.key,"patterns",s))},h=i.ea(a.source,a.scope);l(this._mergedOtherSourceCaches[h]),l(this._mergedSymbolSourceCaches[h]),(a.icons.some(i=>i.iconsetId)||a.patterns.some(i=>i.iconsetId))&&this.fire(new i.x("data",{dataType:"style"}))}rasterizeImages(i,r,a){this.imageManager.rasterizeImages(r,a)}checkAtlasCache(i,r,a){let n=this.imageManager.imageAtlasCache.findCachedAtlas(r.descriptor);a(null,n&&n.contentDescriptor?{iconPositions:n.iconPositions,patternPositions:n.patternPositions,sourceHash:n.contentDescriptor.hash}:null)}getGlyphs(i,r,a){this.glyphManager.getGlyphs(r.stacks,a)}getOwnSourceCache(i){return this._otherSourceCaches[i]}getOwnLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:"fill-extrusion"===i.t
109ype&&this._fillExtrusionSourceCaches[i.source]||this._otherSourceCaches[i.source]}getOwnSourceCaches(i){let r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),this._fillExtrusionSourceCaches[i]&&r.push(this._fillExtrusionSourceCaches[i]),this._hdCoverage&&this._hdCoverage.coverageSourceCaches[i]&&r.push(this._hdCoverage.coverageSourceCaches[i]),r}_updateHdCoverageSourceCache(r){return rY&&rJ?(this._hdCoverage||(this._hdCoverage=new rY),rJ(this,this._hdCoverage,r),!1):"fill"===r.type&&r.sourceLayer===i.X}_isSourceCacheLoaded(r){let a=this.getOwnSourceCaches(r);return 0===a.length?(this.fire(new i.v(Error(`There is no source with ID '${r}'`))),!1):a.every(i=>i.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(i,r){if(!this._clipLayerPresent&&"fill-extrusion"!==i.type&&"building"!==i.type)return!1;let a="fill-extrusion"===i.type&&("building"===i.sourceLayer||"procedural_buildings"===i.sourceLayer),n="building"===i.type;if(i.is3D(!!this.terrain)){if(a||n||r&&"batched-model"===r.type||"model"===i.type)return!0}else if("symbol"===i.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(i=>{i.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}nb.getSourceType=function(i){return aD[i]},nb.setSourceType=function(i,r){aD[i]=r},nb.registerForPluginStateChange=i.e_;class nw{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,r,a,n,o,s,l,h){this.context=i;let u=this.boundPaintVertexBuffers.length!==n.length;for(let i=0;!u&&i<n.length;i++)this.boundPaintVertexBuffers[i]!==n[i]&&(u=!0);let c=this.boundDynamicVertexBuffers.length!==l.length;for(let i=0;!c&&i<l.length;i++)this.boundDynamicVertexBuffers[i]!==l[i]&&(c=!0);if(!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==a||u||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==s)this.freshBind(r,a,n,o,s,l,h);else{for(let a of(i.bindVertexArrayOES.set(this.vao),l))a&&(a.bind(),h&&a.instanceCount&&a.setVertexAttribDivisor(i.gl,r,h));o&&o.dynamicDraw&&o.bind()}}freshBind(i,r,a,n,o,s,l){let h=this.context,u=h.gl;for(let l of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffers=s,r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),a))l.enableAttributes(u,i),l.bind(),l.setVertexAttribPointers(u,i,o);for(let r of s)r&&(r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),l&&r.instanceCount&&r.setVertexAttribDivisor(u,i,l));n&&n.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function nT(r,a,n){if(!a.needsDEMTextureUpload)return;let o=r.context,s=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||r.getTileTexture(n.stride);let l=n.getPixels();a.demTexture?a.demTexture.update(l,{premultiply:!1}):a.demTexture=new i.a_(o,l,s.R32F,{premultiply:!1}),a.needsDEMTextureUpload=!1}class nS{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class nE extends nS{getDefault(){return i.i.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class nI extends nS{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class nA extends nS{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}
109class nM extends nS{getDefault(){return[!0,!0,!0,!0]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class nC extends nS{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class nD extends nS{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class nR extends nS{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let r=this.current;(i.func!==r.func||i.ref!==r.ref||i.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class nP extends nS{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class nL extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=i,this.dirty=!1}}class nz extends nS{getDefault(){return[0,1]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class nO extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=i,this.dirty=!1}}class nF extends nS{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class nB extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.BLEND):r.disable(r.BLEND),this.current=i,this.dirty=!1}}class nk extends nS{getDefault(){let i=this.gl;return[i.ONE,i.ZERO,i.ONE,i.ZERO]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.blendFuncSeparate(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class nN extends nS{getDefault(){return i.i.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class nU extends nS{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(i,i),this.current=i,this.dirty=!1)}}class nV extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=i,this.dirty=!1}}class nj extends nS{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class nG extends nS{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let nH=class extends nS{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}};class nq extends nS{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class n$ extends nS{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class nZ extends nS{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class nW extends nS{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class nX extends nS{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class nY extends nS{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class nK extends nS{getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class nJ extends nS{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class nQ extends nS{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class n0 extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class n1 extends nS{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class n2 extends nS{constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class n3 extends n2{constructor(i,r,a=0){super(i,r),this.attachmentPoint=i.gl.COLOR_ATTACHMENT0+a}setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachmentPoint,r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class n4 extends n2{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class n5 extends n2{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachment(),r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class n6 extends n4{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let n8=(i,r,a,n)=>({u_matrix:i,u_image0:0,u_image1:1,u_skirt_height:r,u_ground_shadow_factor:a,u_emissive_texture_available:n}),n9=(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:a,u_zoom_transition:o,u_merc_center:s,u_image0:0,u_image1:1,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:d,u_globe_radius:f,u_viewport:p,u_grid_matrix:y?Float32Array.from(y):new Float32Array(9),u_skirt_height:m,u_far_z_cutoff:_,u_emissive_texture_available:g});function n7(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let oe=new class{constructor(){this.operations={}}newMorphing(i,r,a,n,o){if(i in this.operations){let r=this.operations[i];r.to.tileID.key!==a.tileID.key&&(r.queued=a)}else this.operations[i]={startTime:n,phase:0,duration:o,from:r,to:a,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;let r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(let r in this.operations){let a=this.operations[r];for(a.phase=(i-a.startTime)/a.duration;a.phase>
109=1||!this._validOp(a);)if(!this._nextOp(a,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}};function ot(i,r,a){return 0===r?0:6*Math.pow(1.5,22-i)*Math.max(r,1)*(r<1&&514===a?.25/r:1)}function oi(i,r){if(!i.style||!i.style.enable3dLights())return;let a=i.context,n=a.gl;a.activeTexture.set(n.TEXTURE1),r?r.bind(n.LINEAR,n.CLAMP_TO_EDGE):i.emptyTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}class or extends rD{constructor(i){const r=aR("mock-dem",{type:"raster-dem",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("mock-dem",r,null),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class oa extends rD{constructor(i){const r=aR("proxy",{type:"geojson",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("proxy",r,null),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,n){if(r.freezeTileCoverage)return;this.transform=r;let o=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((a,n)=>{if(a[n.key]="",!this._tiles[n.key]){let a=new i.b0(n,this._source.tileSize*n.overscaleFactor(),r.tileZoom,void 0,void 0,this._source.worldview);a.state="loaded",this._tiles[n.key]=a}return a},{});for(let i in this._tiles)i in o||(this.freeFBO(i),this._tiles[i].unloadVectorData(),delete this._tiles[i])}freeFBO(i){let r=this.proxyCachedFBO[i];if(void 0!==r){let a=Object.values(r);this.renderCachePool.push(...a),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class on extends i.ap{constructor(i,r,a){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=a}}class oo extends i.s{constructor(r,a){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,o,s]=function(){let r=new i.aQ,a=new i.aT;r.reserve(17161),a.reserve(33800);let n=i.r/128,o=i.r+n/2,s=o+n;for(let a=-n;a<s;a+=n)for(let l=-n;l<s;l+=n){let n=24575*(l<0||l>o||a<0||a>o),s=i.bG(Math.round(l),0,i.r),h=i.bG(Math.round(a),0,i.r);r.emplaceBack(s+n,h)}let l=(i,r)=>{let n=131*r+i;a.emplaceBack(n+1,n,n+131),a.emplaceBack(n+131,n+131+1,n+1)};for(let i=1;i<129;i++)for(let r=1;r<129;r++)l(r,i);return[0,129].forEach(i=>{for(let r=0;r<130;r++)l(r,i),l(i,r)}),[r,a,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(n,i.eQ.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.aJ.simpleSegment(0,0,n.length,o.length),this.gridNoSkirtSegments=i.aJ.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new oa(a.map),this.orthoMatrix=i.bT(),i.eB(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),i.r,0,i.r,0,1);const h=l.gl;this._overlapStencilMode=new t7({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new or(a.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1,this._devtoolsFolder=null}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),this._style=i,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,n){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);let o=r.terrain.properties,s=0===r.terrain.drapeRenderMode,l=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.co.now();let h=r.terrain&&r.terrain.scope,u=o.get("source"),c=s?this._mockSourceCache:r.getSourceCache(u,h);if(!c)return void i.f_(`Couldn't find terrain source "${u}".`);if(this.sourceCache=c,this._attenuationRange=r.terrain.getAttenuationRange(),this._exaggeration=l?this.calculateExaggeration(a):o.get("exaggeration"),!a.projection.requiresDraping&&l&&0===this._exaggeration)return void this._disable();this.enabled=!0;let d=()=>{this.sourceCache.used&&i.f_(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 110This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let r=this.getScaledDemTileSize();this.sourceCache.update(a,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,d(),this._initializing=!0),d(),a.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);let a=this._previousCameraAltitude,n=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=n;let o=null!=a?n-a:Number.MAX_VALUE;if(2>Math.abs(o))return this._exaggeration;let s=r.zoom,l=this._style.terrain;if(!this._previousUpdateTimestamp)return l.getExaggeration(s);let h=s-this._previousZoom,u=this._previousUpdateTimestamp,c=s;null!=this._evaluationZoom&&(Math.abs(s-(c=this._evaluationZoom))>.5&&(h=.5*(s-c+h)),h*o<0&&(c+=h)),this._evaluationZoom=c;let d=l.getExaggeration(c),f=d===l.getExaggeration(Math.max(0,c-.1));if(f&&.01>Math.abs(d-this._exaggeration))return d;let p=Math.min(.1,.00375*(this._updateTimestamp-u));return(f||d<.1||1e-4>Math.abs(h))&&(p=Math.min(.2,4*p)),i.dY(this._exaggeration,d,p)}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(i){"source"===i.dataType&&i.coord?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let i in this._style._mergedSourceCaches)this._style._mergedSourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(i=>
110i.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){var a;let n,o;if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let s=this.proxySourceCache,l=this.painter.transform;this._initializing&&(this._initializing=0===l._centerAltitude&&-1===this.getAtPointOrZero(i.ag.fromLngLat(l.center),-1),this._emptyDEMTextureDirty=!this._initializing);let h=this.proxyCoords=s.getIds().map(i=>{let r=s.getTileByID(i).tileID;return r.projMatrix=l.calculateProjMatrix(r.toUnwrapped()),r});n=(a=this.painter).transform.pointCoordinate(a.transform.getCameraPoint()),o=new i.au(n.x,n.y),h.sort((r,a)=>{if(a.overscaledZ-r.overscaledZ)return a.overscaledZ-r.overscaledZ;let n=new i.au(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=new i.au(a.canonical.x+(1<<a.canonical.z)*a.wrap,a.canonical.y),l=o.mult(1<<r.canonical.z);return l.x-=.5,l.y-=.5,l.distSqr(n)-l.distSqr(s)});let u=this.proxyToSource||{};this.proxyToSource={},h.forEach(i=>{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};let c=this._style._mergedSourceCaches;for(let i in c){let a=c[i];if(!a.used||(a!==this.sourceCache&&this.resetTileLookupCache(a.id),this._setupProxiedCoordsForOrtho(a,r[i],u),a.usedForTerrain))continue;let n=r[i];(a.getSource().reparseOverscaled||a._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(n)}this.proxiedCoords[s.id]=h.map(i=>new on(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(h),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(u),this.renderingToTexture=!1;let d={};for(let i of(this._visibleDemTiles=[],this.proxyCoords)){let r=this.terrainTileForTile[i.key];if(!r)continue;let a=r.tileID.key;a in d||(this._visibleDemTiles.push(r),d[a]=a)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;let r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){let i=this.painter.context,r=i.gl;for(let a in this.terrainTileForTile){let n=this.terrainTileForTile[a],o=n.dem;o&&(!n.demTexture||n.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),nT(this.painter,n,o))}}_prepareDemTileUniforms(i,r,a,n){if(!r||null==r.demTexture)return!1;let o=i.tileID.canonical,s=Math.pow(2,r.tileID.canonical.z-o.z),l=n||"";return a[`u_dem_tl${l}`]=[o.x*s%1,o.y*s%1],a[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let i=0,r=this._visibleDemTiles.reduce((r,a)=>{if(!a.dem)return r;let n=a.dem.tree.minimums[0];return n>0&&i++,r+n},0);return i?r/i:0}_updateEmptyDEMTexture(){let r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);let n=this._getLoadedAreaMinimum(),o=new i.L({width:1,height:1},new Float32Array([n]));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new i.a_(r,o,a.R32F,{premultiply:!1}),s}setupElevationDraw(r,a,n){var o;let s=this.painter.context,l=s.gl,h={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};h.u_exaggeration=this.exaggeration();let u=null,c=null,d=1;if(n&&n.morphing&&this._useVertexMorphing){let i=n.morphing.srcDemTile,a=n.morphing.dstDemTile;
110d=n.morphing.phase,i&&a&&(this._prepareDemTileUniforms(r,i,h,"_prev")&&(c=i),this._prepareDemTileUniforms(r,a,h)&&(u=a))}let f=i=>i&&i.demTexture&&this.painter.linearFloatFilteringSupported()?l.LINEAR:l.NEAREST,p=null;if(this.enabled?c&&u?(p=u.demTexture,s.activeTexture.set(l.TEXTURE4),c.demTexture.bind(f(c),l.CLAMP_TO_EDGE),h.u_dem_lerp=d):(u=this.terrainTileForTile[r.tileID.key],p=this._prepareDemTileUniforms(r,u,h)?u.demTexture:this.emptyDEMTexture):p=this.emptyDEMTexture,s.activeTexture.set(l.TEXTURE2),p&&(h.u_dem_size=1===(o=p).size[0]?1:o.size[0]-2,p.bind(f(u),l.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(n&&n.useDepthForOcclusion,a,h),n&&n.useMeterToDem&&u&&(h.u_meter_to_dem=(1<<u.tileID.canonical.z)*i.em(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize),n&&n.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=n.labelPlaneMatrixInv),a.setTerrainUniformValues(s,h),"globe"===this.painter.transform.projection.name){let i=this.globeUniformValues(this.painter.transform,r.tileID.canonical,n&&n.useDenormalizedUpVectorScale);a.setGlobeUniformValues(s,i)}}globeUniformValues(r,a,n){let o=r.projection;return{u_tile_tl_up:o.upVector(a,0,0),u_tile_tr_up:o.upVector(a,i.r,0),u_tile_br_up:o.upVector(a,i.r,i.r),u_tile_bl_up:o.upVector(a,0,i.r),u_tile_up_scale:n?i.dg(1):o.upVectorScale(a,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){let a=this.painter,n=this.painter.context;0!==r.length&&(n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),a.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(r,a,n,o,s){if("globe"===r.transform.projection.name)!function(r,a,n,o,s){let l,h,u=r.context,c=u.gl,d=r.transform,f=i.dn(r,u,d),p=(i,a)=>{if(h===a)return;let n=[];1===a&&n.push("TERRAIN_VERTEX_MORPHING"),n.push("PROJECTION_GLOBE_VIEW"),f&&n.push("CUSTOM_ANTIALIASING");let o=r.isTileAffectedByFog(i);l=r.getOrCreateProgram("globeRaster",{defines:n,overrideFog:o}),h=a},m=r.colorModeForRenderPass(),_=new tN(c.LEQUAL,tN.ReadWrite,r.depthRangeFor3D);oe.update(s);let g=i.by(d),y=[i.ek(d.center.lng),i.el(d.center.lat)],x=r.globeSharedBuffers,v=[d.width*i.co.devicePixelRatio,d.height*i.co.devicePixelRatio],b=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};{let d=r.transform,f=ot(d.zoom,a.exaggeration(),a.sourceCache._source.tileSize);h=-1;let T=c.TRIANGLES;for(let h of o){let o=n.getTile(h),S=t7.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];n7(E,I)&&oe.newMorphing(h.key,E,I,s,250),oi(r,o.emissiveTexture),u.activeTexture.set(c.TEXTURE0),o.texture&&o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=oe.getMorphValuesForProxy(h.key),M=+!!A;A&&Object.assign(w,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.cb(A.phase)}});let C=i.fF(h.canonical),D=i.cU(C.getCenter().lat),R=i.cP(h.canonical,C,D,d.worldSize/d._pixelsPerMercatorPixel),P=i.dh(i.dk(h.canonical)),L=+("mrt-fallback"===r.emissiveMode),z=n9(d.expandedFarZProjMatrix,b,g,P,i.dm(d.zoom),y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,f,d._farZ,L,R);if(p(h,M),l&&(a.setupElevationDraw(o,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),x)){let[i,a,n]=x.getGridBuffers(D,0!==f);l.draw(r,T,_,S,m,tk.backCCW,z,"globe_raster",i,a,n)}}}if(x&&(r.renderDefaultNorthPole||r.renderDefaultSouthPole)){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(f&&s.push("CUSTOM_ANTIALIASING"),l=r.getOrCreateProgram("globeRaster",{defines:s}),o)){let{x:o,y:s,z:f}=h.canonical,p=0===s,g=s===(1<<f)-1,[b,T,S,E]=x.getPoleBuffers(f,!1);if(E&&(p||g)){let s=n.getTile(h);oi(r,s.emissiveTexture),u.activeTexture.set(c.TEXTURE0),s.texture&&s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let x=i.dj(f,o,d),I=i.dh(i.dk(h.canonical)),A=+("mrt-fallback"===r.emissiveMode),M=(i,a)=>i.draw(r,c.TRIANGLES,_,t7.disabled,m,tk.disabled,n9(d.expandedFarZProjMatrix,x,x,I,0,y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,0,d._farZ,A),"globe_pole_raster",a,S,E);a.setupElevationDraw(s,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),p&&r.renderDefaultNorthPole&&M(l,b),g&&r.renderDefaultSouthPole&&(x=i.fc(i.bT(),x,[1,-1,1]),M(l,T))}}}}(r,a,n,o,s);else{let l,h,u=r.context,c=u.gl,d=r.shadowRenderer,f=t9(r,r.longestCutoffRange),p=i=>{if(h===i)return;let a=[];1===i&&a.push("TERRAIN_VERTEX_MORPHING"),f.shouldRenderCutoff&&a.push("RENDER_CUTOFF"),d&&(a.push("RENDER_SHADOWS"),d.useNormalOffset&&a.push("NORMAL_OFFSET")),l=r.getOrCreateProgram("terrainRaster",{defines:a}),h=i},m=r.colorModeForRenderPass(),_=new tN(c.LEQUAL,tN.ReadWrite,r.depthRangeFor3D);oe.update(s);let g=r.transform,y=ot(g.zoom,a.exaggeration(),a.sourceCache._source.tileSize),x=[0,0,0];if(d){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(x=ix(r.style,i,a))}{h=-1;let v=c.TRIANGLES,[b,w]=[a.gridIndexBuffer,a.gridSegments];for(let h of o){let o,T=n.getTile(h),S=t7.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];n7(E,I)&&oe.newMorphing(h.key,E,I,s,250),oi(r,T.emissiveTexture),u.activeTexture.set(c.TEXTURE0),T.texture&&T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=oe.getMorphValuesForProxy(h.key),M=+!!A;A&&(o={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.cb(A.phase)}});let C=+("mrt-fallback"===r.emissiveMode),D=n8(h.projMatrix,!function(i,r){let a=1<<i.z;return!r&&(0===i.x||i.x===a-1)||0===i.y||i.y===a-1}(h.canonical,g.renderWorldCopies)?y:y/10,x,C);if(p(M),!l)continue;a.setupElevationDraw(T,l,o);let R=h.toUnwrapped();d&&d.setupShadows(R,l),r.uploadCommonUniforms(u,l,R,null,f),l.draw(r,v,_,S,m,tk.backCCW,D,"terrain_raster",a.gridBuffer,b,w)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;let a=this.painter,n=this.painter.context,o=this.proxySourceCache,s=this.proxiedCoords[o.id],l=this._drapedRenderBatches.shift(),h=a.style.order,u=[];this._updateFBOs("mrt-fallback"===a.emissiveMode);let c=0;for(let d of s){let s,f=o.getTileByID(d.proxyTileKey),p=o.proxyCachedFBO[d.key]?o.proxyCachedFBO[d.key][r]:void 0,m=void 0!==p?o.renderCache[p]:this.pool[c++],_=void 0!==p;if(f.texture=m.tex,f.emissiveTexture=m.emissiveTex,_&&!m.dirty){u.push(f.tileID);continue}n.bindFramebuffer.set(m.fb.framebuffer);let g=n.gl;g.drawBuffers("mrt-fallback"===a.emissiveMode?[g.COLOR_ATTACHMENT0,g.COLOR_ATTACHMENT1]:[g.COLOR_ATTACHMENT0]),this.renderedToTile=!1,m.dirty&&(n.clear({color:i.i.transparent,stencil:0}),m.dirty=!1);for(let i=l.start;i<=l.end;++i){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}if(g.drawBuffers([g.COLOR_ATTACHMENT0]),0===this._drapedRenderBatches.length)for(let i of this._pendingGroundEffectLayers){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}this.renderedToTile?(m.dirty=!0,u.push(f.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(u))}return this.renderToBackBuffer(u),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),l.end+1}postRender(){}isLayerOrderingCorrect(i){let r=i.order.length,a=-1,n=r;for(let o=0;o<r;++o)this._style.isLayerDraped(i._mergedLayers[i.order[o]])?a=Math.max(a,o):n=Math.min(n,o);return n>a}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(i=>i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,a){if(!this._visibleDemTiles)return null;let n=this._visibleDemTiles.filter(i=>i.dem).map(n=>{let o=n.tileID,s=1<<o.overscaledZ,{x:l,y:h}=o.canonical,u=l/s,c=(l+1)/s,d=h/s,f=(h+1)/s;return{minx:u,miny:d,maxx:c,maxy:f,t:n.dem.tree.raycastRoot(u,d,c,f,i,r,a),tile:n}});for(let o of(n.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),n)){if(null==o.t)break;let n=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,i,r,a);if(null!=n)return n}return null}_createFBO(){let r,a=this.painter.context,n=a.gl,o=this.drapeBufferSize;a.activeTexture.set(n.TEXTURE0);
110let s=new i.a_(a,{width:o[0],height:o[1],data:null},n.RGBA8);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);let l=a.createFramebuffer(o[0],o[1],1,null);return l.colorAttachment0.set(s.texture),this._emissiveTexture&&((r=new i.a_(a,{width:o[0],height:o[1],data:null},n.R8)).bind(n.LINEAR,n.CLAMP_TO_EDGE),l.createColorAttachment(a,1),l.colorAttachment1.set(r.texture)),l.depthAttachment=new n6(a,l.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,l.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):l.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:l,tex:s,emissiveTex:r,dirty:!1}}_updateFBOs(i){if(this._emissiveTexture!==i){for(let r of this.pool)this._updateFBO(r,i);for(let r of this.proxySourceCache.renderCache)this._updateFBO(r,i);this._emissiveTexture=i}}_updateFBO(r,a){let n=r.fb,o=this.painter.context,s=o.gl,l=this.drapeBufferSize;if(a){let a=new i.a_(o,{width:l[0],height:l[1],data:null},s.R8);a.bind(s.LINEAR,s.CLAMP_TO_EDGE),r.emissiveTex=a,n.createColorAttachment(o,1),n.colorAttachment1.set(a.texture)}else r.emissiveTex=void 0,n.removeColorAttachment(o,1);r.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{let r=this._style._mergedLayers[i],a=r.isHidden(this.painter.transform.zoom);return"hillshade"===r.type||"custom"===r.type?!a&&r.shouldRedrape():!a&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(let i of this._style.getSources())if(i instanceof aC){r=!0;break}if(!r)return;let a={};for(let r=0;r<this._style.order.length;++r){let n=this._style._mergedLayers[this._style.order[r]],o=this._style.getLayerSourceCache(n);if(!o||a[o.id]||n.isHidden(this.painter.transform.zoom)||"line"!==n.type)continue;let s=n.widthExpression(),l=n.emissiveStrengthExpression();if(s instanceof i.bh||l instanceof i.bh)for(let i of(a[o.id]=!0,this.proxyCoords)){let r=this.proxyToSource[i.key][o.id];if(r)for(let i of r)this._clearRenderCacheForTile(o.id,i)}}}_clearRasterLayersFromRenderCache(){let i=!1;for(let r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r]._source instanceof ij){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(!n||r[n.id]||a.isHidden(this.painter.transform.zoom)||"raster"!==a.type)continue;let o=a.paint.get("raster-fade-duration");for(let i of this.proxyCoords){let r=this.proxyToSource[i.key][n.id];if(r)for(let i of r){let r=i$(n.getTile(i),n.findLoadedParent(i,0),n,this.painter.transform,o);(1!==r.opacity||0!==r.mix)&&this._clearRenderCacheForTile(n.id,i)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();let r=this._style.order,a=r.length;if(0===a)return;let n=[];this._pendingGroundEffectLayers=[];let o,s=0,l=this._style._mergedLayers[r[s]];for(;!this._style.isLayerDraped(l)&&l.isHidden(this.painter.transform.zoom)&&++s<a;)l=this._style._mergedLayers[r[s]];for(;s<a;++s){let i=this._style._mergedLayers[r[s]];i.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(i)?void 0===o&&(o=s):("fill-extrusion"===i.type&&this._pendingGroundEffectLayers.push(s),void 0!==o&&(n.push({start:o,end:s-1}),o=void 0)))}if(void 0!==o&&n.push({start:o,end:s-1}),0!==n.length){let r=n.at(-1);this._pendingGroundEffectLayers.every(i=>i>r.end)||i.f_("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=n}_setupRenderCache(i){let r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){let i=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let a=0;a<i.length;++a){let n=Object.values(i[a]);r.renderCachePool.push(...n)}}return}this._clearRasterLayersFromRenderCache();let a=this.proxyCoords,n=this._tilesDirty;for(let o=a.length-1;o>=0;o--){let s=a[o];if(r.getTileByID(s.key),void 0!==r.proxyCachedFBO[s.key]){let a=i[s.key],o=this.proxyToSource[s.key],l=0;for(let i in o){let r=o[i],s=a[i];if(!s||s.length!==r.length||r.some((r,a)=>r!==s[a]||n[i]&&Object.hasOwn(n[i],r.key))){l=-1;break}++l}for(let i in r.proxyCachedFBO[s.key])r.renderCache[r.proxyCachedFBO[s.key][i]].dirty=l<0||l!==Object.values(a).length}}let o=[...this._drapedRenderBatches];for(let i of(o.sort((i,r)=>r.end-r.start-(i.end-i.start)),o))for(let n of a){if(r.proxyCachedFBO[n.key])continue;let a=r.renderCachePool.pop();void 0===a&&r.renderCache.length<50&&(a=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==a&&(r.proxyCachedFBO[n.key]={},r.proxyCachedFBO[n.key][i.start]=a,r.renderCache[a].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,a,n){let o;if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);
110if(a.isTileClipped())o=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r.at(-1).overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,a.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(i){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[i.key]),this._overlapStencilMode):t7.disabled}_renderTileClippingMasks(i,r){let a=this.painter,n=this.painter.context,o=n.gl;a._tileClippingMaskIDs={},n.setColorMode(ie.disabled),n.setDepthMode(tN.disabled);let s=a.getOrCreateProgram("clippingMask");for(let n of i){let i=a._tileClippingMaskIDs[n.key]=--r;s.draw(a,o.TRIANGLES,tN.disabled,new t7({func:o.ALWAYS,mask:0},i,255,o.KEEP,o.KEEP,o.REPLACE),ie.disabled,tk.disabled,rL(n.projMatrix),"$clipping",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}pointCoordinate(r){let a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;let n=[r.x,r.y,1,1];i.fM(n,n,a.pixelMatrixInverse),i.fb(n,n,1/n[3]),n[0]/=a.worldSize,n[1]/=a.worldSize;let o=a._camera.position,s=i.em(1,a.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.fz([],n.slice(0,3),l);i.ex(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.fe(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}_setupProxiedCoordsForOrtho(r,a,n){if(r.getSource()instanceof i.a3)return this._setupProxiedCoordsForImageSource(r,a,n);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords;for(let i=0;i<s.length;i++){let a=s[i],l=this._findTileCoveringTileID(a,r);if(l){let i=this._createProxiedId(a,l,n[a.key]&&n[a.key][r.id]);o.push(i),this.proxyToSource[a.key][r.id]=[i]}}let l=!1,h=new Set;for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData())continue;let u=this._findTileCoveringTileID(s.tileID,this.proxySourceCache);if(u&&u.tileID.canonical.z!==s.tileID.canonical.z){let i=this.proxyToSource[u.tileID.key][r.id],a=this._createProxiedId(u.tileID,s,n[u.tileID.key]&&n[u.tileID.key][r.id]);i?i.splice(i.length-1,0,a):this.proxyToSource[u.tileID.key][r.id]=[a];let c=this.proxyToSource[u.tileID.key][r.id];h.has(c)||h.add(c),o.push(a),l=!0}}if(this._sourceTilesOverlap[r.id]=l,l)for(let i of h)i.sort((i,r)=>r.overscaledZ-i.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,n){if(!r.getSource().loaded())return;let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords,l=r.getSource(),h=l.tileID;if(!h)return;let u=new i.au(h.x,h.y)._div(1<<h.z),c=l.coordinates.map(i.ag.fromLngLat).reduce((i,r)=>(i.min.x=Math.min(i.min.x,r.x-u.x),i.min.y=Math.min(i.min.y,r.y-u.y),i.max.x=Math.max(i.max.x,r.x-u.x),i.max.y=Math.max(i.max.y,r.y-u.y),i),{min:new i.au(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.au(-Number.MAX_VALUE,-Number.MAX_VALUE)}),d=(r,a)=>{let n=r.wrap+r.canonical.x/(1<<r.canonical.z),o=r.canonical.y/(1<<r.canonical.z),s=i.r/(1<<r.canonical.z),l=a.wrap+a.canonical.x/(1<<a.canonical.z),h=a.canonical.y/(1<<a.canonical.z);return n+s<l+c.min.x||n>l+c.max.x||o+s<h+c.min.y||o>h+c.max.y};for(let i=0;i<s.length;i++){let l=s[i];for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData()||d(l,s.tileID))continue;let h=this._createProxiedId(l,s,n[l.key]&&n[l.key][r.id]),u=this.proxyToSource[l.key][r.id];u?u.push(h):this.proxyToSource[l.key][r.id]=[h],o.push(h)}}}_createProxiedId(r,a,n){let o=this.orthoMatrix;if(n){let i=n.find(i=>i.key===a.tileID.key);if(i)return i}if(a.tileID.key!==r.key){let n,s,l,h=r.canonical.z-a.tileID.canonical.z;o=i.bT();let u=a.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(n=i.r>>h)*((a.tileID.canonical.x<<h)-r.canonical.x+u),l=n*((a.tileID.canonical.y<<h)-r.canonical.y)):(n=i.r<<-h,s=i.r*(a.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.r*(a.tileID.canonical.y-(r.canonical.y<<-h))),i.eB(o,0,n,0,n,0,1),i.fQ(o,o,[s,l,0])}return new on(a.tileID,r.key,o)}_findTileCoveringTileID(r,a){let n=a.getTile(r);if(n&&n.hasData())return n;let o=this._findCoveringTileCache[a.id],s=o[r.key];if((n=s?a.getTileByID(s):null)&&n.hasData()||null===s)return n;let l=n?n.tileID:r,h=l.overscaledZ,u=a.getSource().minzoom,c=[];if(!s){let o=a.getSource().maxzoom;if(r.canonical.z>=o){let n=r.canonical.z-o;a.getSource().reparseOverscaled?(h=Math.max(r.canonical.z+2,a.transform.tileZoom),l=new i.ap(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n)):0!==n&&(h=o,l=new i.ap(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n))}l.key!==r.key&&(c.push(l.key),n=a.getTile(l))}let d=i=>
110{c.forEach(r=>{o[r]=i}),c.length=0};for(h-=1;h>=u&&(!n||!n.hasData());h--){n&&d(n.tileID.key);let i=l.calculateScaledKey(h);if((n=a.getTileByID(i))&&n.hasData())break;let r=o[i];if(null===r)break;void 0===r?c.push(i):n=a.getTileByID(r)}return d(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let a=this._tilesDirty[i];a||(a=this._tilesDirty[i]={}),a[r.key]=!0}}let os=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ol=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class oh{static cacheKey(i,r,a,n){let o=[r];for(let r of(n&&o.push(n.cacheKey),a))("string"==typeof r&&r.includes(" ")||i.usedDefines.has(r))&&o.push(r);return o.join("/")}constructor(i,r,a,n,o,s,l=!1){const h=i.gl;this.program=h.createProgram(),this._context=i,this._fixedUniformsFn=o,this._pending=!0,this._precompiled=l,this.attributes={},this.configuration=n,this.name=r,this.fixedDefines=[...s],l?i._compileStats.precompiled++:i._compileStats.onDemand++;const u=`#version 300 es 111${(n?n.defines():[]).concat(s.map(i=>`#define ${i}`)).join("\n")}`,c=[u,ro];for(const i of a.fragmentIncludes)c.push(re[i]);c.push(a.fragmentSource);const d=c.join("\n"),f=[u,rs];for(const i of a.vertexIncludes)f.push(re[i]);this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&a.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&f.push("uniform int u_instanceID;"),f.push(a.vertexSource);let p=f.join("\n");this.forceManualRenderingForInstanceIDShaders&&(p=p.replaceAll("gl_InstanceID","u_instanceID"));const m=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);h.shaderSource(m,d),h.compileShader(m),h.attachShader(this.program,m);const _=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);h.shaderSource(_,p),h.compileShader(_),h.attachShader(this.program,_),h.linkProgram(this.program),this._fragmentShader=m,this._vertexShader=_,i.extParallelShaderCompile?i._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;let r=this._context,a=r.gl;r._pendingPrograms.delete(this);let n=i.co.now(),o=a.getProgramParameter(this.program,a.LINK_STATUS),s=i.co.now()-n,l=r._compileStats;if(l.totalStallMs+=s,s>l.maxStallMs&&(l.maxStallMs=s),s>1){l.framesMissed+=Math.floor(60*s/1e3);let i=this.fixedDefines.join(",");l.stalls.push({name:`${this.name}${i?"/":""}${i}`,ms:s,timestamp:n})}if(this._fragmentShader&&(o||i.f_(`Fragment shader '${this.name}': ${a.getShaderInfoLog(this._fragmentShader)}`),a.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(o||i.f_(`Vertex shader '${this.name}': ${a.getShaderInfoLog(this._vertexShader)}`),a.deleteShader(this._vertexShader),this._vertexShader=null),!o)return i.f_(`Failed to link program '${this.name}': ${a.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms={u_instanceID:new i.b5(r)});let h=this.fixedDefines,u=this.name;(h.includes("TERRAIN")||h.includes("ELEVATED")||u.includes("symbol")||u.includes("circle"))&&(this.terrainUniforms={u_dem:new i.b5(r),u_dem_prev:new i.b5(r),u_dem_tl:new i.b6(r),u_dem_scale:new i.b4(r),u_dem_tl_prev:new i.b6(r),u_dem_scale_prev:new i.b4(r),u_dem_size:new i.b4(r),u_dem_lerp:new i.b4(r),u_exaggeration:new i.b4(r),u_depth:new i.b5(r),u_depth_size_inv:new i.b6(r),u_depth_range_unpack:new i.b6(r),u_occluder_half_size:new i.b4(r),u_occlusion_depth_offset:new i.b4(r),u_meter_to_dem:new i.b4(r),u_label_plane_matrix_inv:new i.bb(r)}),h.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new i.b7(r),u_tile_tr_up:new i.b7(r),u_tile_br_up:new i.b7(r),u_tile_bl_up:new i.b7(r),u_tile_up_scale:new i.b4(r)}),h.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new i.bb(r),u_fog_range:new i.b6(r),u_fog_color:new i.b8(r),u_fog_horizon_blend:new i.b4(r),u_fog_vertical_limit:new i.b6(r),u_fog_temporal_offset:new i.b4(r),u_frustum_tl:new i.b7(r),u_frustum_tr:new i.b7(r),u_frustum_br:new i.b7(r),u_frustum_bl:new i.b7(r),u_globe_pos:new i.b7(r),u_globe_radius:new i.b4(r),u_globe_transition:new i.b4(r),u_is_globe:new i.b5(r),u_viewport:new i.b6(r)}),h.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new i.b8(r)}),h.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new i.b7(r),u_lighting_directional_dir:new i.b7(r),u_lighting_directional_color:new i.b7(r),u_ground_radiance:new i.b7(r)}),h.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new i.bb(r),u_light_matrix_1:new i.bb(r),u_fade_range:new i.b6(r),u_shadow_normal_offset:new i.b7(r),u_shadow_intensity:new i.b4(r),u_shadow_texel_size:new i.b4(r),u_shadow_map_resolution:new i.b4(r),u_shadow_direction:new i.b7(r),u_shadow_bias:new i.b7(r),u_shadowmap_0:new i.b5(r),u_shadowmap_1:new i.b5(r)})}
111maybeFinalize(){if(!this._pending)return;let i=this._context.extParallelShaderCompile;i&&!this._context.gl.getProgramParameter(this.program,i.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(i,r){this._ensureReady();let a=this.attributes[r];return void 0===a&&(a=this.attributes[r]=i.getAttribLocation(this.program,r)),a}setTerrainUniformValues(i,r){if(this._ensureReady(),!this.terrainUniforms)return;let a=this.terrainUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setGlobeUniformValues(i,r){if(this._ensureReady(),!this.globeUniforms)return;let a=this.globeUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setFogUniformValues(i,r){if(this._ensureReady(),!this.fogUniforms)return;let a=this.fogUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setCutoffUniformValues(i,r){if(this._ensureReady(),!this.cutoffUniforms)return;let a=this.cutoffUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setLightsUniformValues(i,r){if(this._ensureReady(),!this.lightsUniforms)return;let a=this.lightsUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setShadowUniformValues(i,r){if(this._ensureReady(),this.failedToCreate||!this.shadowUniforms)return;let a=this.shadowUniforms;for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}_drawDebugWireframe(r,a,n,o,s,l,h,u,c,d){let f=r.options.wireframe;if(!1===f.terrain&&!1===f.layers2D&&!1===f.layers3D)return;let p=r.context;if(!(!(!f.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!f.layers2D||r._terrain&&r._terrain.renderingToTexture||!os.includes(this.name))||!(!f.layers3D||!ol.includes(this.name))))return;let m=p.gl,_=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,s,p);if(!_)return;let g=[...this.fixedDefines,"DEBUG_WIREFRAME"],y=r.getOrCreateProgram(this.name,{config:this.configuration,defines:g});y._ensureReady(),p.program.set(y.program);let x=(i,r,a)=>{if(r[i]&&a[i])for(let n in r[i])a[i][n]&&a[i][n].set(a.program,n,r[i][n].current)};c&&c.setUniforms(y.program,p,y.binderUniforms,h,{zoom:u}),x("fixedUniforms",this,y),x("terrainUniforms",this,y),x("globeUniforms",this,y),x("fogUniforms",this,y),x("lightsUniforms",this,y),x("shadowUniforms",this,y),_.bind(),p.setColorMode(new ie([m.ONE,m.ONE_MINUS_SRC_ALPHA,m.ZERO,m.ONE],i.i.transparent,[!0,!0,!0,!1])),p.setDepthMode(new tN(a.func===m.LESS?m.LEQUAL:a.func,tN.ReadOnly,a.range)),p.setStencilMode(t7.disabled);let v=3*l.primitiveLength*2,b=3*l.primitiveOffset*4;if(this.forceManualRenderingForInstanceIDShaders){let i=d||1;for(let r=0;r<i;++r)y.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",r),m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b)}else d&&d>1?m.drawElementsInstanced(m.LINES,v,m.UNSIGNED_SHORT,b,d):m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b);s.bind(),p.program.set(this.program),p.setDepthMode(a),p.setStencilMode(n),p.setColorMode(o)}checkUniforms(i,r,a){if(this.fixedDefines.includes(r)){for(let n of Object.keys(a))if(!a[n].initialized)throw Error(`Program '${this.name}', from draw '${i}': uniform ${n} not set but required by ${r} being defined`)}}draw(i,r,a,n,o,s,l,h,u,c,d,f,p,m,_,g){let y=i.context,x=y.gl;if(this._ensureReady(),this.failedToCreate)return;for(let[i,r]of(y.program.set(this.program),y.setDepthMode(a),y.setStencilMode(n),y.setColorMode(o),y.setCullFace(s),this.fixedUniformsEntries))r.set(this.program,i,l[i]);m&&m.setUniforms(this.program,y,this.binderUniforms,f,{zoom:p});let v={[x.POINTS]:1,[x.LINES]:2,[x.TRIANGLES]:3,[x.LINE_STRIP]:1}[r];this.checkUniforms(h,"RENDER_SHADOWS",this.shadowUniforms);let b=_||[],w=m?m.getPaintVertexBuffers():[],T=r===x.TRIANGLES&&c,S=g&&g>0?1:void 0;for(let s of d.get()){let l=s.vaos||(s.vaos={});if((l[h]||(l[h]=new nw)).bind(y,this,u,w,c,s.vertexOffset,b,S),this.forceManualRenderingForInstanceIDShaders){let i=g||1;for(let a=0;a<i;++a)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",a),c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength)}else g&&g>1?x.drawElementsInstanced(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2,g):c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength);T&&this._drawDebugWireframe(i,a,n,o,c,s,f,p,m,g)}}}let ou=(i,r,a)=>({u_matrix:i,u_emissive_strength:r,u_ground_shadow_factor:a,u_opacity_multiplier:1}),oc=(i,r,a,n,o,s=0)=>Object.assign(ou(i,r,o),it(a,n,s)),od=(i,r,a,n)=>({u_matrix:i,u_world:a,u_emissive_strength:r,u_ground_shadow_factor:n,u_opacity_multiplier:1}),of=(i,r,a,n,o,s,l=0)=>Object.assign(oc(i,r,a,n,s,l),{u_world:o}),op=(i,r,a)=>({u_image:i,u_texel_size:r,u_first_pass:+!!a}),om=(r,a,n,o,s,l,h,u)=>{let c=i.r/l.tileSize;return{u_matrix:r,u_inv_rot_matrix:a,u_camera_to_center_distance:n.getCameraToCenterDistance(u),u_extrude_scale:[n.pixelsToGLUnits[0]/c,n.pixelsToGLUnits[1]/c],u_zoom_transition:o,u_tile_id:h,u_merc_center:s}},o_=(i,r,a,n)=>({u_matrix:i,u_inv_matrix:r,u_camera_to_center_distance:a.getCameraToCenterDistance(n),u_viewport_size:[a.width,a.height]}),og=i.bT(),oy=(r,a,n,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,d=c?i.di(u.zoom,a.canonical)*u._pixelsPerMercatorPixel:i.eG(n,1,l),f={u_matrix:a.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:og,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){f.u_inv_rot_matrix=o,f.u_merc_center=s,f.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],f.u_zoom_transition=i.dm(u.zoom);let r=s[0]*i.r,n=s[1]*i.r;f.u_up_dir=u.projection.upVector(new i.f(0,0,0),r,n)}return f},ox=(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S)=>{var E;let I,A,M;return{u_matrix:a,u_normalize_matrix:n,u_globe_matrix:o,u_merc_matrix:s,u_grid_matrix:l,u_tl_parent:h,u_scale_parent:f,u_fade_t:p.mix,u_opacity:p.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:i.f9(m.paint.get("raster-saturation")),u_contrast_factor:i.bP(m.paint.get("raster-contrast")),u_spin_weights:(A=Math.sin(E=m.paint.get("raster-hue-rotate")*(Math.PI/180)
111),[(2*(M=Math.cos(E))+1)/3,(-Math.sqrt(3)*A-M+1)/3,(Math.sqrt(3)*A-M+1)/3]),u_perspective_transform:_,u_raster_elevation:g,u_zoom_transition:u,u_merc_center:c,u_cutoff_params:d,u_colorization_mix:iB(i.e,x,b),u_colorization_offset:ik(i.e,v,b),u_color_ramp:y,u_texture_offset:[T/(w+2*T),w/(w+2*T)],u_texture_res:[w+2*T,w+2*T],u_emissive_strength:S,u_zbias_factor:(I=r.terrain?r.terrain.exaggeration():1,(r.transform.pitch<15?i.dY(.07,.7,i.bG((14-r.transform.zoom)/5,0,1)):.07)*I)}},ov=i.bT(),ob=(r,a,n,o,s,l,h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I)=>{let A=s.transform,M={u_is_size_zoom_constant:+("constant"===r||"source"===r),u_is_size_feature_constant:+("constant"===r||"camera"===r),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:A.getCameraToCenterDistance(b),u_rotate_symbol:+n,u_aspect_ratio:A.width/A.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+d,u_elevation_from_sea:+!!c,u_pitch_with_map:+o,u_texsize:f,u_texsize_icon:p,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ov,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:ov,u_up_vector:[0,-1,0],u_color_adj_mat:S,u_icon_transition:E||0,u_gamma_scale:o?s.transform.getCameraToCenterDistance(b)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:i.co.devicePixelRatio,u_is_halo:1,u_scale_factor:I||1,u_ground_shadow_factor:w,u_inv_matrix:i.dr(i.bT(),h),u_normal_scale:T,u_lutTexture:10,u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0],u_spp_fill_color_zoom_factor:0,u_spp_halo_color_zoom_factor:0,u_spp_opacity_zoom_factor:0,u_spp_halo_width_zoom_factor:0,u_spp_halo_blur_zoom_factor:0,u_spp_emissive_strength_zoom_factor:0,u_spp_occlusion_opacity_zoom_factor:0,u_spp_z_offset_zoom_factor:0,u_spp_translate_zoom_factor:0,u_opacity_multiplier:1};return"globe"===b.name&&(M.u_tile_id=[_.canonical.x,_.canonical.y,1<<_.canonical.z],M.u_zoom_transition=g,M.u_inv_rot_matrix=x,M.u_merc_center=y,M.u_camera_forward=A._camera.forward(),M.u_ecef_origin=i.df(A.globeMatrix,_.toUnwrapped()),M.u_tile_matrix=A.globeMatrix,M.u_up_vector=v),M},ow=(i,r,a,n)=>({u_matrix:i,u_emissive_strength:r,u_opacity:a,u_color:n}),oT=(r,a,n,o,s,l,h,u,c)=>Object.assign(function(r,a,n,o,s){let{width:l,height:h}=n.imageManager.getPixelSize(r),u=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,n.transform.tileZoom)/u,d=c*(s.tileID.canonical.x+s.tileID.wrap*u),f=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[l,h],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/i.eG(s,1,n.transform.tileZoom),1/i.eG(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[d>>16,f>>16],u_pixel_coord_lower:[65535&d,65535&f]}}(l,h,o,u,c),{u_matrix:r,u_emissive_strength:a,u_opacity:n}),oS={fillExtrusion:r=>({u_matrix:new i.bb(r),u_lightpos:new i.b7(r),u_lightintensity:new i.b4(r),u_lightcolor:new i.b7(r),u_vertical_gradient:new i.b4(r),u_opacity:new i.b4(r),u_edge_radius:new i.b4(r),u_width_scale:new i.b4(r),u_ao:new i.b6(r),u_height_type:new i.b5(r),u_base_type:new i.b5(r),u_tile_id:new i.b7(r),u_zoom_transition:new i.b4(r),u_inv_rot_matrix:new i.bb(r),u_merc_center:new i.b6(r),u_up_dir:new i.b7(r),u_height_lift:new i.b4(r),u_flood_light_color:new i.b7(r),u_vertical_scale:new i.b4(r),u_flood_light_intensity:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_front_cutoff_params:new i.b7(r)}),fillExtrusionDepth:r=>({u_matrix:new i.bb(r),u_edge_radius:new i.b4(r),u_width_scale:new i.b4(r),u_vertical_scale:new i.b4(r),u_height_type:new i.b5(r),u_base_type:new i.b5(r)}),fillExtrusionPattern:r=>({u_matrix:new i.bb(r),u_lightpos:new i.b7(r),u_lightintensity:new i.b4(r),u_lightcolor:new i.b7(r),u_vertical_gradient:new i.b4(r),u_height_factor:new i.b4(r),u_edge_radius:new i.b4(r),u_width_scale:new i.b4(r),u_ao:new i.b6(r),u_height_type:new i.b5(r),u_base_type:new i.b5(r),u_tile_id:new i.b7(r),u_zoom_transition:new i.b4(r),u_inv_rot_matrix:new i.bb(r),u_merc_center:new i.b6(r),u_up_dir:new i.b7(r),u_height_lift:new i.b4(r),u_image:new i.b5(r),u_texsize:new i.b6(r),u_pixel_coord_upper:new i.b6(r),u_pixel_coord_lower:new i.b6(r),u_tile_units_to_pixels:new i.b4(r),u_opacity:new i.b4(r),u_pattern_transition:new i.b4(r)}),fillExtrusionGroundEffect:r=>({u_matrix:new i.bb(r),u_opacity:new i.b4(r),u_ao_pass:new i.b4(r),u_meter_to_tile:new i.b4(r),u_ao:new i.b6(r),u_flood_light_intensity:new i.b4(r),u_flood_light_color:new i.b7(r),u_attenuation:new i.b4(r),u_edge_radius:new i.b4(r),u_fb:new i.b5(r),u_fb_size:new i.b4(r),u_dynamic_offset:new i.b4(r)}),fill:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_opacity_multiplier:new i.b4(r)}),fillPattern:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_image:new i.b5(r),u_texsize:new i.b6(r),u_pixel_coord_upper:new i.b6(r),u_pixel_coord_lower:new i.b6(r),u_tile_units_to_pixels:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_pattern_transition:new i.b4(r),u_opacity_multiplier:new i.b4(r)}),fillOutline:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_world:new i.b6(r),u_ground_shadow_factor:new i.b7(r),u_opacity_multiplier:new i.b4(r)}),fillOutlinePattern:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_world:new i.b6(r),u_image:new i.b5(r),u_texsize:new i.b6(r),u_pixel_coord_upper:new i.b6(r),u_pixel_coord_lower:new i.b6(r),u_tile_units_to_pixels:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_pattern_transition:new i.b4(r),u_opacity_multiplier:new i.b4(r)}),lineBlendComposite:r=>({u_image:new i.b5(r),u_opacity:new i.b4(r),u_blend_mode:new i.b5(r),u_max_density:new i.b4(r)}),lineBlendReduce:r=>({u_image:new i.b5(r),u_texel_size:new i.b6(r),u_first_pass:new i.b5(r)}),circle:i.bE,collisionBox:r=>({u_matrix:new i.bb(r),u_inv_rot_matrix:new i.bb(r),u_camera_to_center_distance:new i.b4(r),u_extrude_scale:new i.b6(r),u_zoom_transition:new i.b4(r),u_merc_center:new i.b6(r),u_tile_id:new i.b7(r)}),collisionCircle:r=>({u_matrix:new i.bb(r),u_inv_matrix:new i.bb(r),u_camera_to_center_distance:new i.b4(r),u_viewport_size:new i.b6(r)}),debug:r=>
vendor: 6,882 bytes, line 111
111({u_color:new i.b9(r),u_matrix:new i.bb(r),u_overlay:new i.b5(r),u_overlay_scale:new i.b4(r)}),clippingMask:r=>({u_matrix:new i.bb(r)}),heatmap:r=>({u_extrude_scale:new i.b4(r),u_intensity:new i.b4(r),u_matrix:new i.bb(r),u_inv_rot_matrix:new i.bb(r),u_merc_center:new i.b6(r),u_tile_id:new i.b7(r),u_zoom_transition:new i.b4(r),u_up_dir:new i.b7(r)}),heatmapTexture:r=>({u_image:new i.b5(r),u_color_ramp:new i.b5(r),u_opacity:new i.b4(r)}),hillshade:r=>({u_matrix:new i.bb(r),u_image:new i.b5(r),u_latrange:new i.b6(r),u_light:new i.b6(r),u_shadow:new i.b9(r),u_highlight:new i.b9(r),u_emissive_strength:new i.b4(r),u_accent:new i.b9(r)}),hillshadePrepare:r=>({u_matrix:new i.bb(r),u_image:new i.b5(r),u_dimension:new i.b6(r),u_zoom:new i.b4(r)}),line:i.e3,linePattern:i.e1,raster:r=>({u_matrix:new i.bb(r),u_normalize_matrix:new i.bb(r),u_globe_matrix:new i.bb(r),u_merc_matrix:new i.bb(r),u_grid_matrix:new i.ba(r),u_tl_parent:new i.b6(r),u_scale_parent:new i.b4(r),u_fade_t:new i.b4(r),u_opacity:new i.b4(r),u_image0:new i.b5(r),u_image1:new i.b5(r),u_brightness_low:new i.b4(r),u_brightness_high:new i.b4(r),u_saturation_factor:new i.b4(r),u_contrast_factor:new i.b4(r),u_spin_weights:new i.b7(r),u_perspective_transform:new i.b6(r),u_raster_elevation:new i.b4(r),u_zoom_transition:new i.b4(r),u_merc_center:new i.b6(r),u_cutoff_params:new i.b8(r),u_colorization_mix:new i.b8(r),u_colorization_offset:new i.b4(r),u_color_ramp:new i.b5(r),u_texture_offset:new i.b6(r),u_texture_res:new i.b6(r),u_emissive_strength:new i.b4(r),u_zbias_factor:new i.b4(r)}),symbol:r=>({u_is_size_zoom_constant:new i.b5(r),u_is_size_feature_constant:new i.b5(r),u_size_t:new i.b4(r),u_size:new i.b4(r),u_camera_to_center_distance:new i.b4(r),u_rotate_symbol:new i.b5(r),u_aspect_ratio:new i.b4(r),u_fade_change:new i.b4(r),u_matrix:new i.bb(r),u_label_plane_matrix:new i.bb(r),u_coord_matrix:new i.bb(r),u_is_text:new i.b5(r),u_elevation_from_sea:new i.b5(r),u_pitch_with_map:new i.b5(r),u_texsize:new i.b6(r),u_texsize_icon:new i.b6(r),u_texture:new i.b5(r),u_texture_icon:new i.b5(r),u_gamma_scale:new i.b4(r),u_device_pixel_ratio:new i.b4(r),u_tile_id:new i.b7(r),u_zoom_transition:new i.b4(r),u_inv_rot_matrix:new i.bb(r),u_merc_center:new i.b6(r),u_camera_forward:new i.b7(r),u_tile_matrix:new i.bb(r),u_up_vector:new i.b7(r),u_ecef_origin:new i.b7(r),u_is_halo:new i.b5(r),u_icon_transition:new i.b4(r),u_color_adj_mat:new i.bb(r),u_scale_factor:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_inv_matrix:new i.bb(r),u_normal_scale:new i.b4(r),u_lutTexture:new i.b5(r),u_spp_fill_np_color:new i.b8(r),u_spp_halo_np_color:new i.b8(r),u_spp_opacity:new i.b4(r),u_spp_halo_width:new i.b4(r),u_spp_halo_blur:new i.b4(r),u_spp_emissive_strength:new i.b4(r),u_spp_occlusion_opacity:new i.b4(r),u_spp_z_offset:new i.b4(r),u_spp_translate_rotation:new i.b6(r),u_spp_fill_color_zoom_factor:new i.b4(r),u_spp_halo_color_zoom_factor:new i.b4(r),u_spp_opacity_zoom_factor:new i.b4(r),u_spp_halo_width_zoom_factor:new i.b4(r),u_spp_halo_blur_zoom_factor:new i.b4(r),u_spp_emissive_strength_zoom_factor:new i.b4(r),u_spp_occlusion_opacity_zoom_factor:new i.b4(r),u_spp_z_offset_zoom_factor:new i.b4(r),u_spp_translate_zoom_factor:new i.b4(r),u_opacity_multiplier:new i.b4(r)}),background:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_opacity:new i.b4(r),u_color:new i.b9(r)}),backgroundPattern:r=>({u_matrix:new i.bb(r),u_emissive_strength:new i.b4(r),u_opacity:new i.b4(r),u_image:new i.b5(r),u_pattern_tl:new i.b6(r),u_pattern_br:new i.b6(r),u_texsize:new i.b6(r),u_pattern_size:new i.b6(r),u_pixel_coord_upper:new i.b6(r),u_pixel_coord_lower:new i.b6(r),u_pattern_units_to_pixels:new i.b6(r)}),terrainRaster:r=>({u_matrix:new i.bb(r),u_image0:new i.b5(r),u_image1:new i.b5(r),u_skirt_height:new i.b4(r),u_ground_shadow_factor:new i.b7(r),u_emissive_texture_available:new i.b4(r)}),skybox:r=>({u_matrix:new i.bb(r),u_sun_direction:new i.b7(r),u_cubemap:new i.b5(r),u_opacity:new i.b4(r),u_temporal_offset:new i.b4(r)}),skyboxGradient:r=>({u_matrix:new i.bb(r),u_color_ramp:new i.b5(r),u_center_direction:new i.b7(r),u_radius:new i.b4(r),u_opacity:new i.b4(r),u_temporal_offset:new i.b4(r)}),skyboxCapture:r=>({u_matrix_3f:new i.ba(r),u_sun_direction:new i.b7(r),u_sun_intensity:new i.b4(r),u_color_tint_r:new i.b8(r),u_color_tint_m:new i.b8(r),u_luminance:new i.b4(r)}),globeRaster:r=>({u_proj_matrix:new i.bb(r),u_globe_matrix:new i.bb(r),u_normalize_matrix:new i.bb(r),u_merc_matrix:new i.bb(r),u_zoom_transition:new i.b4(r),u_merc_center:new i.b6(r),u_image0:new i.b5(r),u_image1:new i.b5(r),u_grid_matrix:new i.ba(r),u_skirt_height:new i.b4(r),u_far_z_cutoff:new i.b4(r),u_frustum_tl:new i.b7(r),u_frustum_tr:new i.b7(r),u_frustum_br:new i.b7(r),u_frustum_bl:new i.b7(r),u_globe_pos:new i.b7(r),u_globe_radius:new i.b4(r),u_viewport:new i.b6(r),u_emissive_texture_available:new i.b4(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.b7(r),u_frustum_tr:new i.b7(r),u_frustum_br:new i.b7(r),u_frustum_bl:new i.b7(r),u_horizon:new i.b4(r),u_transition:new i.b4(r),u_fadeout_range:new i.b4(r),u_atmosphere_fog_color:new i.b8(r),u_high_color:new i.b8(r),u_space_color:new i.b8(r),u_temporal_offset:new i.b4(r),u_horizon_angle:new i.b4(r)}),groundShadow:r=>({u_matrix:new i.bb(r),u_ground_shadow_factor:new i.b7(r)}),stars:r=>({u_matrix:new i.bb(r),u_up:new i.b7(r),u_right:new i.b7(r),u_intensity_multiplier:new i.b4(r)}),occlusion:r=>({u_matrix:new i.bb(r),u_anchorPos:new i.b7(r),u_screenSizePx:new i.b6(r),u_occluderSizePx:new i.b6(r),u_color:new i.b8(r)})};class oE{constructor(i,r,a,n){this.id=oE.uniqueIdxCounter,oE.uniqueIdxCounter++,this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||n||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){this.id=oE.uniqueIdxCounter,oE.uniqueIdxCounter++;let r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}oE.uniqueIdxCounter=0;let oI={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class oA{constructor(i,r,a,n,o,s){this.length=r.length,this.attributes=a,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.instanceCount=s,this.context=i;const l=i.gl;this.buffer=l.createBuffer(),i.bindVertexBuffer.set(this.buffer),l.bufferData(l.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}
111enableAttributes(i,r){for(let a of this.attributes){let n=r.getAttributeLocation(i,a.name);-1!==n&&i.enableVertexAttribArray(n)}}setVertexAttribPointers(i,r,a){for(let n of this.attributes){let o=r.getAttributeLocation(i,n.name);if(-1!==o){let r=n.offset+this.itemSize*(a||0);"Float32"===n.type?i.vertexAttribPointer(o,n.components,i.FLOAT,!1,this.itemSize,r):i.vertexAttribIPointer(o,n.components,i[oI[n.type]],this.itemSize,r)}}}setVertexAttribDivisor(i,r,a){for(let n=0;n<this.attributes.length;n++){let o=r.getAttributeLocation(i,this.attributes[n].name);-1!==o&&this.instanceCount&&this.instanceCount>0&&i.vertexAttribDivisor(o,a)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class oM{constructor(i,r,a,n,o){this.context=i,this.width=r,this.height=a;const s=this.framebuffer=i.gl.createFramebuffer();n>0&&(this.colorAttachment0=new n3(i,s,0)),n>1&&(this.colorAttachment1=new n3(i,s,1)),o&&(this.depthAttachmentType=o,this.depthAttachment="renderbuffer"===o?new n4(i,s):new n5(i,s))}static createWithTexture(r,a,n,o,s){let l=r.gl;if(r.activeTexture.set(l.TEXTURE1),r.viewport.set([0,0,n,o]),a&&a.width===n&&a.height===o)return l.bindTexture(l.TEXTURE_2D,a.colorAttachment0.get()),r.bindFramebuffer.set(a.framebuffer),a;a&&a.destroy();let h=r.extRenderToTextureHalfFloat||r.extColorBufferFloat?r.gl.RGBA16F:r.gl.RGBA8,u=new i.a_(r,{width:n,height:o,data:null},h);u.bind(l.LINEAR,l.CLAMP_TO_EDGE);let c=r.createFramebuffer(n,o,1,null);if(c.format=h,c.colorAttachment0.set(u.texture),s){let i=r.createRenderbuffer(l.DEPTH24_STENCIL8,n,o);r.bindFramebuffer.set(c.framebuffer),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,i),c._stencilRbo=i}return c}createColorAttachment(i,r){0===r?this.colorAttachment0=new n3(i,this.framebuffer,0):1===r&&(this.colorAttachment1=new n3(i,this.framebuffer,1))}removeColorAttachment(i,r){let a,n=this.context.gl;0===r?(a=this.colorAttachment0.get(),this.colorAttachment0=void 0):1===r&&(a=this.colorAttachment1.get(),this.colorAttachment1=void 0),a&&n.deleteTexture(a)}destroy(){let i=this.context.gl;if(this.colorAttachment0){let r=this.colorAttachment0.get();r&&i.deleteTexture(r)}if(this.colorAttachment1){let r=this.colorAttachment1.get();r&&i.deleteTexture(r)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){let r=this.depthAttachment.get();r&&i.deleteRenderbuffer(r)}else{let r=this.depthAttachment.get();r&&i.deleteTexture(r)}this._stencilRbo&&(i.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),i.deleteFramebuffer(this.framebuffer)}}class oC{constructor(i,r){this.gl=i,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new nE(this),this.clearDepth=new nI(this),this.clearStencil=new nA(this),this.colorMask=new nM(this),this.depthMask=new nC(this),this.stencilMask=new nD(this),this.stencilFunc=new nR(this),this.stencilOp=new nP(this),this.stencilTest=new nL(this),this.depthRange=new nz(this),this.depthTest=new nO(this),this.depthFunc=new nF(this),this.blend=new nB(this),this.blendFunc=new nk(this),this.blendColor=new nN(this),this.blendEquation=new nU(this),this.cullFace=new nV(this),this.cullFaceSide=new nj(this),this.frontFace=new nG(this),this.program=new nH(this),this.activeTexture=new nq(this),this.viewport=new n$(this),this.bindFramebuffer=new nZ(this),this.bindRenderbuffer=new nW(this),this.bindTexture=new nX(this),this.bindVertexBuffer=new nY(this),this.bindElementBuffer=new nK(this),this.bindVertexArrayOES=new nJ(this),this.pixelStoreUnpack=new nQ(this),this.pixelStoreUnpackPremultiplyAlpha=new n0(this),this.pixelStoreUnpackFlipY=new n1(this),this.options=r?Object.assign({},r):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=i.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=i.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=i.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=r&&!!r.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.disableSymbolUBO=r&&!!r.forceDisableSymbolUBO,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=i.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=i.getExtension("EXT_color_buffer_float"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(i.getParameter(i.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=i.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=i.getExtension("KHR_parallel_shader_compile")}
111sweepPendingPrograms(){if(0!==this._pendingPrograms.size)for(let i of this._pendingPrograms)i.maybeFinalize()}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(i,r,a){return new oE(this,i,r,a)}createVertexBuffer(i,r,a,n,o){return new oA(this,i,r,a,n,o)}createRenderbuffer(i,r,a){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,i,r,a),this.bindRenderbuffer.set(null),o}createFramebuffer(i,r,a,n){return new oM(this,i,r,a,n)}clear({color:i,depth:r,stencil:a,colorMask:n}){let o=this.gl,s=0;i&&(s|=o.COLOR_BUFFER_BIT,this.clearColor.set(i.toNonPremultipliedRenderColor(null)),this.colorMask.set(n||[!0,!0,!0,!0])),void 0!==r&&(s|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==a&&(s|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(s)}setCullFace(i){!1===i.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(r){i.c2(r.blendFunction,ie.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function oD(r,a,n,o,s,l,h){let u=r.context,d=u.gl,f=r.transform,p=[i.ek(f.center.lng),i.el(f.center.lat)],m=n.layout.get("symbol-placement"),_=n.layout.get("text-variable-anchor"),g="map"===n.layout.get("icon-rotation-alignment"),y="map"===n.layout.get("text-rotation-alignment"),x="point"!==m,v=[],b=0,w=0;for(let u=0;u<o.length;u++){let c=o[u],m=a.getTile(c),T=m.getBucket(n);if(!T)continue;let S=T.getProjection().createInversionMatrix(f,c.canonical),E=[],I=function(i,r,a){if(r.projection.name===a.projection.name)return i.projMatrix;let n=a.clone();return n.setProjection(r.projection),aH(n,r.getProjection(),i)}(c,T,f),A=!h&&g&&x,M=h&&y&&x,C=_&&T.hasTextData(),D=T.hasIconTextFit()&&C&&T.hasIconData(),R=A||M||h&&C||D,P="globe"===T.projection.name,L=P?i.dm(f.zoom):0;P&&(E.push("PROJECTION_GLOBE_VIEW"),R&&E.push("PROJECTED_POS_ON_VIEWPORT"));let z=r.getOrCreateProgram("collisionBox",{defines:E}),O=I;0===s[0]&&0===s[1]||(O=r.translatePosMatrix(I,m,s,l));let F=h?T.textCollisionBox:T.iconCollisionBox,B=T.collisionCircleArray;
111if(B.length>0){let r=i.bT(),a=O;i.eo(r,T.placementInvProjMatrix,f.glCoordMatrix),i.eo(r,r,T.placementViewportMatrix),v.push({circleArray:B,circleOffset:w,transform:a,invTransform:r,projection:T.getProjection()}),b+=B.length/4,w=b}if(!F)continue;r.terrain&&r.terrain.setupElevationDraw(m,z);let k=P?[c.canonical.x,c.canonical.y,1<<c.canonical.z]:[0,0,0];z.draw(r,d.LINES,tN.disabled,t7.disabled,r.colorModeForRenderPass(),tk.disabled,om(O,S,f,L,p,m,k,T.getProjection()),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,null,f.zoom,null,[F.collisionVertexBuffer,F.collisionVertexBufferExt])}if(!h||!v.length)return;let T=r.getOrCreateProgram("collisionCircle"),S=new i.aN;S.resize(4*b),S._trim();let E=0;for(let i of v)for(let r=0;r<i.circleArray.length/4;r++){let a=4*r,n=i.circleArray[a+0],o=i.circleArray[a+1],s=i.circleArray[a+2],l=i.circleArray[a+3];S.emplace(E++,n,o,s,l,0),S.emplace(E++,n,o,s,l,1),S.emplace(E++,n,o,s,l,2),S.emplace(E++,n,o,s,l,3)}(!c||c.length<2*b)&&(c=function(r){let a=2*r,n=new i.aT;n.resize(a),n._trim();for(let i=0;i<a;i++){let r=6*i;n.uint16[r+0]=4*i+0,n.uint16[r+1]=4*i+1,n.uint16[r+2]=4*i+2,n.uint16[r+3]=4*i+2,n.uint16[r+4]=4*i+3,n.uint16[r+5]=4*i+0}return n}(b));let I=u.createIndexBuffer(c,!0),A=u.createVertexBuffer(S,i.bM.members,!0);for(let a of v){let o=o_(a.transform,a.invTransform,f,a.projection);T.draw(r,d.TRIANGLES,tN.disabled,t7.disabled,r.colorModeForRenderPass(),tk.disabled,o,n.id,A,I,i.aJ.simpleSegment(0,2*a.circleOffset,a.circleArray.length,a.circleArray.length/2),null,f.zoom)}A.destroy(),I.destroy()}let oR=i.bT();function oP(r){let a=r._camera.getWorldToCamera(r.worldSize,1),n=i.er([],a,r.globeMatrix);i.dr(n,n);let o=[0,0,0],s=[0,1,0,0];return i.fM(s,s,n),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.ex(o,o),o}function oL(r,a,n,o,s,l,h={}){let u=n.paint.get("icon-translate"),c=n.paint.get("text-translate"),d=n.paint.get("icon-translate-anchor"),f=n.paint.get("text-translate-anchor"),p=n.layout.get("icon-rotation-alignment"),m=n.layout.get("text-rotation-alignment"),_=n.layout.get("icon-pitch-alignment"),g=n.layout.get("text-pitch-alignment"),y=n.layout.get("icon-keep-upright"),x=n.layout.get("text-keep-upright"),v=n.paint.get("icon-color-saturation"),b=n.paint.get("icon-color-contrast"),w=n.paint.get("icon-color-brightness-min"),T=n.paint.get("icon-color-brightness-max"),S="sea"===n.layout.get("symbol-elevation-reference"),E="none"===n.layout.get("icon-image-use-theme"),I=r.context,A=I.gl,M=r.transform,C="map"===p,D="map"===m,R="map"===_,P="map"===g,L=void 0!==n.layout.get("symbol-sort-key").constantOr(1),z=!1,O=r.depthModeForSublayer(0,tN.ReadOnly),F=new tN(r.context.gl.LEQUAL,tN.ReadOnly,r.depthRangeFor3D),B=[i.ek(M.center.lng),i.el(M.center.lat)],k=n.layout.get("text-variable-anchor"),N="globe"===M.projection.name,U=[],V=[0,-1,0];for(let s of o){let o=a.getTile(s),l=o.getBucket(n);if(!l||"mercator"===l.projection.name&&N||l.fullyClipped)continue;let p="globe"===l.projection.name,m=p?i.dm(M.zoom):0,_=aq(s,l.getProjection(),M),g=M.calculatePixelsToTileUnitsMatrix(o),j=k&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData(),H=l.getProjection().createInversionMatrix(M,s.canonical),q=(1<<o.tileID.canonical.z)*i.r/r.transform.worldSize,$=i=>{let a=[0,0,0];if(i){let i=r.style.directionalLight,n=r.style.ambientLight;i&&n&&(a=ix(r.style,i,n))}return a},Z=i=>{if(r.context.disableSymbolUBO)return;i.push("USE_PAINT_PROPERTIES_UBO");let a=Math.floor(Math.floor(r.context.maxUniformBlockSize/4)/4);i.push(`MAX_UBO_SIZE_VEC4 ${a}u`)},W=i=>{M.depthOcclusionForSymbolsAndCircles&&(n.hasOcclusionOpacityProperties||r.terrain)&&(i.push("DEPTH_D24"),i.push("DEPTH_OCCLUSION"))},X=a=>{n.lut&&!E&&(n.lut.texture||(n.lut.texture=new i.a$(r.context,n.lut.image,[n.lut.image.height,n.lut.image.height,n.lut.image.height],I.gl.RGBA8)),I.activeTexture.set(I.gl.TEXTURE0+10),n.lut.texture&&n.lut.texture.bind(I.gl.LINEAR,I.gl.CLAMP_TO_EDGE),a.push("APPLY_LUT_ON_GPU"))},Y=()=>{let a=C&&"point"!==n.layout.get("symbol-placement"),h=[];W(h),X(h);let c=a||G,f="road"===l.elevationType,x=r.shadowRenderer,E=f&&R&&!!x&&x.enabled,D=$(E),P=f&&R&&!r.terrain?F:O,L=n.paint.get("icon-image-cross-fade");r.terrainRenderModeElevated()&&R&&h.push("PITCH_WITH_MAP_TERRAIN"),p&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),L>0&&l.hasAnySecondaryIcon&&h.push("ICON_TRANSITION"),!l.icon.zOffsetVertexBuffer||f&&r.terrain||h.push("Z_OFFSET"),0===v&&0===b&&0===w&&1===T||h.push("COLOR_ADJUSTMENT"),l.sdfIcons&&h.push("RENDER_SDF"),E&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),f&&R&&!r.terrain&&l.icon.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),Z(h);let z=I.disableSymbolUBO?l.icon.programConfigurations.get(n.id):null,k=r.getOrCreateProgram("symbol",{c
111onfig:z,defines:h}),U=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],j=l.iconSizeData,Y=i.ci(j,M.zoom),K=R||!M.isOrthographic,J=tZ(_,o.tileID.canonical,R,C,M,l.getProjection(),g),Q=tX(_,o.tileID.canonical,R,C,M,l.getProjection(),g),ee=l.icon.uboBinder&&l.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:u,et=r.translatePosMatrix(Q,o,ee,d,!0),ei=r.translatePosMatrix(_,o,ee,d),er=c?oR:J,ea=C&&!R&&!a,en=V;(N||M.mercatorFromTransition)&&!C&&(en=oP(M));let eo=p?en:V,es=n.getColorAdjustmentMatrix(v,b,w,T),el=ob(j.kind,Y,ea,R,r,ei,er,et,S,!1,U,[0,0],0,s,m,B,H,eo,l.getProjection(),D,q,es,L,null),eh=o.imageAtlasTexture?o.imageAtlasTexture:null,eu=1!==n.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear,ec=l.sdfIcons||r.options.rotating||r.options.zooming||eu||K?A.LINEAR:A.NEAREST,ed=l.sdfIcons&&0!==n.paint.get("icon-halo-width").constantOr(1),ef=r.terrain&&R&&a?i.dr(i.bT(),J):oR;if(a&&l.icon){let a=i.s.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),h=tW(_,o.tileID.canonical,R,C,M,l.getProjection(),g),u=n.layout.get("icon-size-scale-range"),c=i.bG(r.scaleFactor,u[0],u[1]);tJ(l,_,r,!1,h,Q,R,y,a,s,c)}return{program:k,buffers:l.icon,uniformValues:el,atlasTexture:eh,atlasTextureIcon:null,atlasInterpolation:ec,atlasInterpolationIcon:null,isSDF:l.sdfIcons,hasHalo:ed,depthMode:P,tile:o,renderWithShadows:E,labelPlaneMatrixInv:ef}},K=()=>{let a=D&&"point"!==n.layout.get("symbol-placement"),h=[],u=a||k||G,d="road"===l.elevationType,y=r.shadowRenderer,v=d&&P&&!!y&&y.enabled,b=$(v),w=d&&P&&!r.terrain?F:O;r.terrainRenderModeElevated()&&P&&h.push("PITCH_WITH_MAP_TERRAIN"),p&&(h.push("PROJECTION_GLOBE_VIEW"),u&&h.push("PROJECTED_POS_ON_VIEWPORT")),!l.text.zOffsetVertexBuffer||d&&r.terrain||h.push("Z_OFFSET"),l.iconsInText&&h.push("RENDER_TEXT_AND_SYMBOL"),h.push("RENDER_SDF"),v&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),d&&P&&!r.terrain&&l.text.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),W(h),Z(h);let T=I.disableSymbolUBO?l.text.programConfigurations.get(n.id):null,E=r.getOrCreateProgram("symbol",{config:T,defines:h}),C,R=[0,0],L=null,z=l.textSizeData;l.iconsInText&&(R=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],L=o.imageAtlasTexture?o.imageAtlasTexture:null,C=P||!M.isOrthographic||r.options.rotating||r.options.zooming||"composite"===z.kind||"camera"===z.kind?A.LINEAR:A.NEAREST);let U=o.glyphAtlasTexture?o.glyphAtlasTexture.size:[0,0],j=n.layout.get("text-size-scale-range"),X=i.bG(r.scaleFactor,j[0],j[1]),Y=i.ci(z,M.zoom,X),K=tZ(_,o.tileID.canonical,P,D,M,l.getProjection(),g),J=tX(_,o.tileID.canonical,P,D,M,l.getProjection(),g),Q=l.text.uboBinder&&l.text.uboBinder.hasPerFeatureTranslate()?[0,0]:c,ee=r.translatePosMatrix(J,o,Q,f,!0),et=r.translatePosMatrix(_,o,Q,f),ei=u?oR:K,er=D&&!P&&!a,ea=V;(N||M.mercatorFromTransition)&&!D&&(ea=oP(M));let en=ob(z.kind,Y,er,P,r,et,ei,ee,S,!0,U,R,0,s,m,B,H,p?ea:V,l.getProjection(),b,q,null,null,X),eo=o.glyphAtlasTexture?o.glyphAtlasTexture:null,es=A.LINEAR,el=0!==n.paint.get("text-halo-width").constantOr(1),eh=r.terrain&&P&&a?i.dr(i.bT(),K):oR;if(a&&l.text){let a=i.s.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),n=tW(_,o.tileID.canonical,P,D,M,l.getProjection(),g);tJ(l,_,r,!0,n,J,P,x,a,s,X)}return{program:E,buffers:l.text,uniformValues:en,atlasTexture:eo,atlasTextureIcon:L,atlasInterpolation:es,atlasInterpolationIcon:C,isSDF:!0,hasHalo:el,depthMode:w,tile:o,renderWithShadows:v,labelPlaneMatrixInv:eh}},J=l.icon.segments.get().length,Q=l.text.segments.get().length,ee=J&&!h.onlyText?Y():null,et=Q&&!h.onlyIcons?K():null,ei=n.paint.get("icon-opacity").constantOr(1),er=n.paint.get("text-opacity").constantOr(1);if(L&&l.canOverlap){z=!0;let r=ei&&!h.onlyText?l.icon.segments.get():[],a=er&&!h.onlyIcons?l.text.segments.get():[];for(let a of r)U.push({segments:new i.aJ([a]),sortKey:a.sortKey,state:ee});for(let r of a)U.push({segments:new i.aJ([r]),sortKey:r.sortKey,state:et})}else h.onlyText||U.push({segments:ei?l.icon.segments:new i.aJ([]),sortKey:0,state:ee}),h.onlyIcons||U.push({segments:er?l.text.segments:new i.aJ([]),sortKey:0,state:et})}for(let i of(z&&U.sort((i,r)=>i.sortKey-r.sortKey),U)){let a=i.state;if(a)if(r.terrain?r.terrain.setupElevationDraw(a.tile,a.program,{useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles,labelPlaneMatr
111ixInv:a.labelPlaneMatrixInv}):r.setupDepthForOcclusion(M.depthOcclusionForSymbolsAndCircles,a.program),I.activeTexture.set(A.TEXTURE0),a.atlasTexture&&a.atlasTexture.bind(a.atlasInterpolation,A.CLAMP_TO_EDGE,!0),a.atlasTextureIcon&&(I.activeTexture.set(A.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,A.CLAMP_TO_EDGE,!0)),a.renderWithShadows&&r.shadowRenderer.setupShadows(a.tile.tileID.toUnwrapped(),a.program,"vector-tile"),r.uploadCommonLightUniforms(r.context,a.program),a.hasHalo){let o=a.uniformValues;o.u_is_halo=1,oz(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,2),o.u_is_halo=0}else{if(a.isSDF){let o=a.uniformValues;a.hasHalo&&(o.u_is_halo=1,oz(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,1)),o.u_is_halo=0}oz(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,a.uniformValues,1)}}}function oz(i,r,a,n,o,s,l,h,u,c){let d=n.context,f=d.gl,p=[i.dynamicLayoutVertexBuffer,i.opacityVertexBuffer,i.iconTransitioningVertexBuffer,i.globeExtVertexBuffer,i.zOffsetVertexBuffer,i.orientationVertexBuffer];i.featureIdBuffer&&p.push(i.featureIdBuffer);let m=i.uboBinder?null:i.programConfigurations.get(a.id);if(i.uboBinder){i.uboBinder.layer=a;let r=n.transform.zoom,o=n.style.getBrightness?n.style.getBrightness():null,s=i.uboBinder.getConstantUniformValues(r,o);u.u_spp_fill_np_color=s.fill_np_color,u.u_spp_halo_np_color=s.halo_np_color,u.u_spp_opacity=s.opacity,u.u_spp_halo_width=s.halo_width,u.u_spp_halo_blur=s.halo_blur,u.u_spp_emissive_strength=s.emissive_strength,u.u_spp_occlusion_opacity=s.occlusion_opacity,u.u_spp_z_offset=s.z_offset;let l=s.zoomFactors;u.u_spp_fill_color_zoom_factor=l[0],u.u_spp_halo_color_zoom_factor=l[1],u.u_spp_opacity_zoom_factor=l[2],u.u_spp_halo_width_zoom_factor=l[3],u.u_spp_halo_blur_zoom_factor=l[4],u.u_spp_emissive_strength_zoom_factor=l[5],u.u_spp_occlusion_opacity_zoom_factor=l[6],u.u_spp_z_offset_zoom_factor=l[7],u.u_spp_translate_zoom_factor=l[8];let h=a.paint.get(i.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),c=i.uboBinder.hasPerFeatureTranslate()&&"map"===h?n.transform.angle:0;u.u_spp_translate_rotation=[Math.cos(c),Math.sin(c)]}let{batchIndices:_,batchSegments:g}=i.getBatchGrouping(r);for(let r of _){let _=g.get(r);i.uboBinder&&i.uboBinder.bind(d,o.program,r),o.draw(n,f.TRIANGLES,s,l,h,tk.disabled,u,a.id,i.layoutVertexBuffer,i.indexBuffer,_,a.paint,n.transform.zoom,m,p,c)}}function oO(r,a,n,o,s,l){let h,u=n.paint.get("line-width"),c=n.paint.get("line-emissive-strength").isConstant(),d=n.paint.get("line-emissive-strength").constantOr(0),f=n.paint.get("line-occlusion-opacity"),p=n.layout.get("line-elevation-reference"),m="meters"===n.layout.get("line-width-unit"),_=!(!r.terrain||!r.terrain.enabled),g=r.context,y=g.gl;if(n.hasElevatedBuckets&&"globe"===r.transform.projection.name)return;let x=n.layout.get("line-cross-slope"),v=s||r.colorModeForDrapableLayerRenderPass(c?d:null),b=r.terrain&&r.terrain.renderingToTexture||l,w=b?1:i.co.devicePixelRatio,T=n.paint.get("line-dasharray"),S=T.constantOr(1),E=n.layout.get("line-cap"),I=T.constantOr(null),A=E.constantOr(null),M=n.paint.get("line-pattern"),C=M.constantOr(1),D=n.paint.get("line-pattern-cross-fade"),R=M.constantOr(null),P=n.paint.get("line-opacity").constantOr(1),L=!C&&1!==P||r.depthOcclusion&&f>0&&f<1,z=n.paint.get("line-gradient"),O=C?"linePattern":"line",F=i.d$(n);if(b&&r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(L=!1),0!==f&&r.depthOcclusion){let r=n.paint._values["line-opacity"];r&&r.value&&"constant"===r.value.kind?h=r.value:i.f_(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==u.value.kind&&!1===u.value.isLineProgressConstant&&F.push("VARIABLE_LINE_WIDTH");let B=n.paint.get("line-emissive-strength");C||"constant"===B.value.kind||!1!==B.value.isLineProgressConstant||F.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),r._debugParams.showElevationIdDebug&&F.push("DEBUG_ELEVATION_ID"),b&&("dual-source-blending"!==r.emissiveMode||c?"mrt-fallback"===r.emissiveMode&&F.push("USE_MRT1"):F.push("DUAL_SOURCE_BLENDING"));let k={},N=[],U=(o,s,l,u,c,d)=>{for(let p of o){let o,_=a.getTile(p);if(C&&!_.patternsLoaded())continue;let x=_.getBucket(n);if(!x||"none"!==x.elevationType&&!c||"none"===x.elevationType&&c)continue;r.prepareDrawTile();let T=[...s],E=r.shadowRenderer,M="road"===x.elevationType&&!!E&&E.enabled,F=[0,0,0];if(M){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(F=ix(r.style,i,a)),T.push("RENDER_SHADOWS","NORMAL_OFFSET")}let B=x.programConfigurations.get(n.id),U=!1;if(R&&_.imageAtlas){let r=i.aG.from(R),a=r.getPrimary().scaleSelf(w).toString(),n=_.imageAtlas.patternPositions.get(a),o=r.getSecondary(),s=o?_.imageAtlas.patternPositions.get(o.scaleSelf(w).toString()):null;U=!!n&&!!s,n&&B.setConstantPatternPositions(n,s)}D>0&&(U||B.getPatternTransitionVertexBuffer("line-pattern"))&&T.push("LINE_PATTERN_TRANSITION"),x.elevationGroundScaleVertexBuffer&&T.push("ELEVATION_GROUND_SCALE");let V=r.isTileAffectedByFog(p),j=r.getOrCreateProgram(O,{config:B,defines:T,overrideFog:V});if(!C&&I&&A&&_.lineAtlas){let i=_.lineAtlas.getDash(I,A);i&&B.setConstantPatternPositions(i)}M&&E.setupShadows(_.tileID.toUnwrapped(),j,"vector-tile");let[G,H]=n.paint.get("line-trim-offset");("round"===A||"square"===A)&&G!==H&&(0===G&&(G-=1),1===H&&(H+=1));let q=b?p.projMatrix:null,$=m?1/x.tileToMeter/i.eG(_,1,r.transform.zoom):1,Z=m?1/x.tileToMeter/i.eG(_,1,Math.floor(r.transform.zoom)):1,W=S?n.paint._values["line-floorwidth"]:null;if(W&&"constant"===W.value.kind){let i=x.zoom;i in k||(k[i]=Math.max(.01,n.widthExpression().evaluate({zoom:i}))),o=W.value.value;let a=Math.floor(r.transform.zoom);
111W.value.value=k[i]*Math.pow(2,a-_.tileID.overscaledZ)}let X=C?i.e0(r,_,n,q,w,$,Z,[G,H],F,D):i.e2(r,_,n,q,x.lineClipsArray.length,w,$,Z,[G,H],F);if(z){let o=x.gradients[n.id],s=o.texture;if(n.gradientVersion!==o.version){let l=256;if(n.stepInterpolant){let n=a.getSource().maxzoom,o=p.canonical.z===n?Math.ceil(1<<r.transform.maxZoom-p.canonical.z):1;l=i.bG(i.ew(x.maxLineLength/i.r*1024*o),256,g.maxTextureSize)}let h="none"===n.paint.get("line-gradient-use-theme").constantOr("default");o.gradient=i.e$({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:x.lineClipsArray,lut:h?null:n.lut}),o.texture?o.texture.update(o.gradient):o.texture=new i.a_(g,o.gradient,y.RGBA8),o.version=n.gradientVersion,s=o.texture}g.activeTexture.set(y.TEXTURE1),s.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}S&&(g.activeTexture.set(y.TEXTURE0),_.lineAtlasTexture&&_.lineAtlasTexture.bind(y.LINEAR,y.REPEAT),B.updatePaintBuffers()),C&&(g.activeTexture.set(y.TEXTURE0),_.imageAtlasTexture&&_.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),B.updatePaintBuffers()),c&&r.terrain.setupElevationDraw(_,j),r.uploadCommonUniforms(g,j,p.toUnwrapped());let Y=r3?r3(r,x,p,c,X,B,j,l,v,N):null,K=(i,a,o)=>{a&&0!==a.get().length&&(null!=h&&(h.value=P*f),void 0!==o&&(X.u_opacity_multiplier=o),j.draw(r,y.TRIANGLES,l,i,v,tk.disabled,X,n.id,x.layoutVertexBuffer,x.indexBuffer,a,n.paint,r.transform.zoom,B,[x.layoutVertexBuffer2,x.patternVertexBuffer,x.zOffsetVertexBuffer,x.elevationIdColVertexBuffer,x.elevationGroundScaleVertexBuffer]),void 0!==o&&(X.u_opacity_multiplier=1),null!=h&&(h.value=P))},J=i=>{Y&&Y.active&&r4?r4(x,Y,i,K):K(i,x.segments)};if(L&&!c){let i=r.stencilModeForClipping(p).ref;0===i&&b&&g.clear({stencil:0});let a={func:y.EQUAL,mask:255};X.u_alpha_discard_threshold=.8,J(new t7(a,i,255,y.KEEP,y.KEEP,y.INVERT)),X.u_alpha_discard_threshold=0,J(new t7(a,i,255,y.KEEP,y.KEEP,y.KEEP))}
111else X.u_alpha_discard_threshold=L&&c&&d?.8:0,J(c?u:r.stencilModeForClipping(p));Y&&r5&&r5(r,x,p,Y,c,u,K),void 0!==o&&(W.value.value=o)}},V=r.depthModeForSublayer(0,tN.ReadOnly),j=new tN(r.depthOcclusion?y.GREATER:y.LEQUAL,tN.ReadOnly,r.depthRangeFor3D);if(n.hasNonElevatedBuckets){let a=!b&&r.terrain;0!==f&&a?i.f_(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):a?i.f_(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):U(o,F,V,t7.disabled,!1,!0)}if(n.hasElevatedBuckets){"hd-road-markup"===p?_||(V=j,F.push("ELEVATED_ROADS")):(F.push("ELEVATED"),V=j,void 0!==x&&F.push(x<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),"sea"===p&&F.push("ELEVATION_REFERENCE_SEA"));let i=L?r.stencilModeFor3D():t7.disabled;r.forceTerrainMode=!0,U(o,F,V,i,!0,!0),L&&U(o,F,V,i,!0,!1),r.forceTerrainMode=!1}r6&&r6(r,n,N),L&&(r.resetStencilClippingMasks(),b&&g.clear({stencil:0})),0===f||r.depthOcclusion||b||r.layersWithOcclusionOpacity.push(r.currentLayer)}class oF{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class oB{constructor(i){this.pbo=i.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(i){this.sync&&(i.deleteSync(this.sync),this.sync=null),i.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}let ok={additive:{clearColor:new i.i(0,0,0,0),colorMode:ie.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new i.i(1,1,1,1),colorMode:ie.multiply,compositeUniformValue:0}};function oN(i){return!(!i.extRenderToTextureHalfFloat&&!i.extColorBufferFloat)}function oU(i,r){return"additive"===i&&oN(r)?ie.additiveAlphaWeightedUnboundedAlpha:ok[i].colorMode}function oV(i,r,a){let n=i.context,o=n.gl,s=a.width,l=a.height,h=a.colorAttachment0.get();r.lineBlendDensityReadback||(r.lineBlendDensityReadback=new oB(o));let u=r.lineBlendDensityReadback,c=0,d=!0;for(;s>1||l>1;){let a=Math.max(1,Math.floor(s/2)),f=Math.max(1,Math.floor(l/2)),p=0===c?"fboA":"fboB";u[p]=oM.createWithTexture(n,u[p],a,f,!1);let m=u[p];n.bindFramebuffer.set(m.framebuffer),n.viewport.set([0,0,a,f]),n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h),i.getOrCreateProgram("lineBlendReduce").draw(i,o.TRIANGLES,tN.disabled,t7.disabled,ie.unblended,tk.disabled,op(0,[1/s,1/l],d),r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom),s=a,l=f,h=m.colorAttachment0.get(),c=1-c,d=!1}let f=oN(n);u.sync&&(o.deleteSync(u.sync),u.sync=null),o.bindBuffer(o.PIXEL_PACK_BUFFER,u.pbo),o.bufferData(o.PIXEL_PACK_BUFFER,f?16:4,o.STREAM_READ),o.readPixels(0,0,1,1,o.RGBA,f?o.FLOAT:o.UNSIGNED_BYTE,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),u.sync=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0),n.viewport.set([0,0,i.width,i.height])}function oj(i,r,a){if(!oN(i.context))return;let n=r.lineBlendDensityReadback;n&&n.sync?(function(i,r,a){if(i.sync&&r.getSyncParameter(i.sync,r.SYNC_STATUS)===r.SIGNALED){if(r.deleteSync(i.sync),i.sync=null,r.bindBuffer(r.PIXEL_PACK_BUFFER,i.pbo),oN(a)){let a=new Float32Array(4);r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a);let n=a[1];i.maxDensity=Math.max(2*(n>0?a[0]/n:0),1)}else i.maxDensity=1;r.bindBuffer(r.PIXEL_PACK_BUFFER,null)}}(n,i.context.gl,i.context),n.sync||(oV(i,r,a),i.style.map.triggerRepaint())):(oV(i,r,a),i.style.map.triggerRepaint())}function oG(i,r,a,n,o,s){let l=i.context,h=l.gl,u="additive"===a?1:r.paint.get("line-opacity").constantOr(1),c="additive"===a?function(i){let r=i.paint.get("line-blend-additive-clamp");if(r>0)return r;let a=i.lineBlendDensityReadback;return a&&0!==a.maxDensity?a.maxDensity:null}(r):1;if(null===c)return;l.bindFramebuffer.set(o),s&&l.viewport.set([0,0,s[0],s[1]]),l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,n.colorAttachment0.get());let d=oU(a,i.context);i.getOrCreateProgram("lineBlendComposite").draw(i,h.TRIANGLES,tN.disabled,t7.disabled,d,tk.disabled,{u_image:0,u_opacity:u,u_blend_mode:ok[a].compositeUniformValue,u_max_density:c},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}function oH(r,a,n,o){let{painter:s,sourceCache:l,layer:h,coords:u,colorMode:c,elevationType:d,terrainEnabled:f,pass:p}=r,m=s.context.gl,_=h.paint.get("fill-pattern"),g=h.paint.get("fill-pattern-cross-fade"),y=_.constantOr(null),x=d;"road"!==d||a&&!f||(x="none");let v="road"===x,b=r.painter.shadowRenderer,w=v&&!!b&&b.enabled,T=new tN(s.context.gl.LEQUAL,tN.ReadOnly,s.depthRangeFor3D),S=[0,0,0];if(w){let i=s.style.directionalLight,r=s.style.ambientLight;i&&r&&(S=ix(s.style,i,r))}let E=_&&_.constantOr(1),I=s.terrain&&s.terrain.renderingToTexture,A=(r,p)=>{let _,x,A,M,C;p?(_=E&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=m.LINES):(_=E?"fillPattern":"fill",A=m.TRIANGLES);let D=[];for(let R of u){let u=l.getTile(R);if(E&&!u.patternsLoaded())continue;let P=u.getBucket(h);if(!P)continue;let L=a?P.hdExt&&P.hdExt.elevationBufferData:P.bufferData;if(!L||L.isEmpty())continue;s.prepareDrawTile();let z=L.programConfigurations.get(h.id),O=s.isTileAffectedByFog(R),F=[],B=[];v&&(F.push("ELEVATED_ROADS"),B.push(L.elevatedLayoutVertexBuffer)),w&&F.push("RENDER_SHADOWS","NORMAL_OFFSET"),I&&n&&F.push("USE_MRT1"),E&&(s.context.activeTexture.set(m.TEXTURE0),u.imageAtlasTexture&&u.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),z.updatePaintBuffers());let k=!1;if(y&&u.imageAtlas){let r=u.imageAtlas,a=i.aG.from(y),n=a.getPrimary().scaleSelf(i.co.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.co.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&z.setConstantPatternPositions(s,l)}g>0&&(k||z.getPatternTransitionVertexBuffer("fill-pattern"))&&F.push("FILL_PATTERN_TRANSITION");let N=s.getOrCreateProgram(_,{config:z,overrideFog:O,defines:F}),U=s.translatePosMatrix(R.projMatrix,u,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));w&&b.setupShadows(u.tileID.toUnwrapped(),N,"vector-tile");let V=h.paint.get("fill-emissive-strength");if(p){M=L.lineIndexBuffer,C=L.lineSegments;let i=s.terrain&&s.terrain.renderingToTexture?s.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];x="fillOutlinePattern"===_&&E?of(U,V,s,u,i,S,g):od(U,V,i,S)}else M=L.indexBuffer,C=L.triangleSegments,x=E?oc(U,V,s,u,S,g):ou(U,V,S);s.uploadCommonUniforms(s.context,N,R.toUnwrapped());let j=r;if(("road"!==d||f)&&"offset"!==d||(j=T),!C||C.get&&0===C.get().length)continue;let G=o||s.stencilModeForClipping(R),H="fallthrough";!p&&r1&&(H=r1({painter:s,layer:h,bucket:P,coord:R,elevatedGeometry:a,program:N,programConfiguration:z,uniformValues:x,drawMode:A,depthMode:j,stencilMode:G,colorMode:c,bufferData:L,indexBuffer:M,segments:C,dynamicBuffers:B,polygonCoverageTiles:D})),"fallthrough"===H&&N.draw(s,A,j,G,c,tk.disabled,x,h.id,L.layoutVertexBuffer,M,C,h.paint,s.transform.zoom,z,B)}!p&&r2&&r2(s,h,D,A,c)};s.renderPass===p&&A(s.depthModeForSublayer(1,"opaque"===s.renderPass?tN.ReadWrite:tN.ReadOnly),!1),"none"===x&&"translucent"===s.renderPass&&h.paint.get("fill-antialias")&&A(s.depthModeForSublayer(2*!!h.getPaintProperty("fill-outline-color"),tN.ReadOnly),!0)}function oq(r){return[r[0]*i.C,r[1]*i.C,r[2]*i.C,0]}function o$(r,a,n,o,s,l,h,u,c){let d,f,p,m,_,g,y,x,v=o.getSource(),b=n.globeSharedBuffers;
111if(!b||(a&&(d=o.getTile(a)),v instanceof i.a3?(f=v.texture,p=i.dj(0,0,n.transform)):d&&a&&(f=d.texture,p=i.dj(a.canonical.z,a.canonical.x,n.transform)),!f||!p))return;r||(p=i.fc(i.bT(),p,[1,-1,1]));let w=n.context,T=w.gl,S="nearest"===s.paint.get("raster-resampling")?T.NEAREST:T.LINEAR,E=n.colorModeForDrapableLayerRenderPass(l),I=h.defines;I.push("GLOBE_POLES");let A=new tN(T.LEQUAL,tN.ReadWrite,n.depthRangeFor3D),M=n.transform.expandedFarZProjMatrix,C=Float32Array.from(i.dh(i.dk(new i.f(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),w.activeTexture.set(T.TEXTURE0),f.bind(S,T.CLAMP_TO_EDGE),w.activeTexture.set(T.TEXTURE1),f.bind(S,T.CLAMP_TO_EDGE),"useMipmap"in f&&w.extTextureFilterAnisotropic&&n.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);let[D,R,P,L]=a?b.getPoleBuffers(a.canonical.z,!1):b.getPoleBuffers(0,!0),z=s.paint.get("raster-elevation");r?(m=D,n.renderDefaultNorthPole=0!==z):(m=R,n.renderDefaultSouthPole=0!==z);let O=oq(h.mix),F=(_=p,g=i.dm(n.transform.zoom),y=h.offset,x=h.range,ox(n,M,C,_,new Float32Array(16),new Float32Array(9),[0,0],g,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0],z,2,O,y,x,1,0,l)),B=n.getOrCreateProgram("raster",{defines:I});n.uploadCommonUniforms(w,B,null),B.draw(n,T.TRIANGLES,A,c,E,u,F,s.id,m,P,L)}let oZ=i.dq(new Float32Array(16)),oW=new i.i(1,0,0,1),oX=new i.i(0,1,0,1),oY=new i.i(0,0,1,1),oK=new i.i(1,0,1,1),oJ=new i.i(0,1,1,1);function oQ(i,r,a,n){o1(i,0,r+a/2,i.transform.width,a,n)}function o0(i,r,a,n){o1(i,r-a/2,0,a,i.transform.height,n)}function o1(r,a,n,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(a*i.co.devicePixelRatio,n*i.co.devicePixelRatio,o*i.co.devicePixelRatio,s*i.co.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let{members:o2}=i.b_([{name:"a_pos_3f",components:3,type:"Float32"}]);function o3(i,r,a,n){i.emplaceBack(r,a,n)}class o4{constructor(r){this.vertexArray=new i.aS,this.indices=new i.aT,o3(this.vertexArray,-1,-1,1),o3(this.vertexArray,1,-1,1),o3(this.vertexArray,-1,1,1),o3(this.vertexArray,1,1,1),o3(this.vertexArray,-1,-1,-1),o3(this.vertexArray,1,-1,-1),o3(this.vertexArray,-1,1,-1),o3(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,o2),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.aJ.simpleSegment(0,0,36,12)}}function o5(r,a,n,o,s,l){let h,u,c,d=r.context.gl,f=a.paint.get("sky-atmosphere-color"),p=a.paint.get("sky-atmosphere-halo-color"),m=a.paint.get("sky-atmosphere-sun-intensity"),_=(h=i.cs(i.bV(),o),u=f.toPremultipliedRenderColor(null),c=p.toPremultipliedRenderColor(null),{u_matrix_3f:h,u_sun_direction:s,u_sun_intensity:m,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5});d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+l,a.skyboxTexture,0),n.draw(r,d.TRIANGLES,tN.disabled,t7.disabled,ie.unblended,tk.frontCW,_,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}let o6=i.b_([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class o8{constructor(r){const a=new i.aU;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const n=new i.aT;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,o6.members),this.indexBuffer=r.createIndexBuffer(n),this.segments=i.aJ.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let o9=i.b_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_opacity",components:1}]);class o7{constructor(){this.colorModeAlphaBlendedWriteRGB=new ie([1,771,1,771],i.i.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ie([1,0,1,0],i.i.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(r){this._painter=r;let a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new o8(a);let r=this.params,n=r.sizeRange,o=r.intensityRange,s=function(r){let a=i.eq(30),n=[];for(let o=0;o<r;++o){let r=2*Math.PI*a(),o=Math.acos(1-2*a())-.5*Math.PI;n.push(i.cx(Math.cos(o)*Math.cos(r),Math.cos(o)*Math.sin(r),Math.sin(o)))}return n}(r.starsCount),l=i.eq(300),h=new i.aV,u=new i.aT,c=0;for(let r=0;r<s.length;++r){let a=i.fa([],s[r],200),d=Math.max(0,1+.01*n*(l()-.5)),f=Math.max(0,1+.01*o*(l()-.5));h.emplaceBack(a[0],a[1],a[2],-1,-1,d,f),h.emplaceBack(a[0],a[1],a[2],1,-1,d,f),h.emplaceBack(a[0],a[1],a[2],1,1,d,f),h.emplaceBack(a[0],a[1],a[2],-1,1,d,f),u.emplaceBack(c+0,c+1,c+2),u.emplaceBack(c+0,c+2,c+3),c+=4}this.starsVx=a.createVertexBuffer(h,o9.members),this.starsIdx=a.createIndexBuffer(u),this.starsSegments=i.aJ.simpleSegment(0,0,h.length,u.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(r,a){let n=r.context,o=n.gl,s=r.transform,l=new tN(o.LEQUAL,tN.ReadOnly,[0,1]),h=i.dm(s.zoom),u=r.style.getLut(a.scope),c="none"===a.properties.get("color-use-theme"),d=a.properties.get("color").toNonPremultipliedRenderColor(c?null:u),f="none"===a.properties.get("high-color-use-theme"),p=a.properties.get("high-color").toNonPremultipliedRenderColor(f?null:u),m="none"===a.properties.get("space-color-use-theme"),_=a.properties.get("space-color").toNonPremultipliedRenderColor(m?null:u),g=i.ec(a.properties.get("horizon-blend"),0,1,5e-4,.25),y=i.dn(r,n,s)&&5e-4===g?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,x=r.frameCounter/1e3%1,v=i.dW(s.globeCenterInViewSpace),b=Math.acos(Math.sqrt(Math.pow(v,2)-Math.pow(y,2))/v),w=i=>{let a,u,c,f,m,y="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];i&&y.push("ALPHA_PASS");let v=r.getOrCreateProgram("globeAtmosphere",{defines:y}),w=(a=s.frustumCorners.TL,u=s.frustumCorners.TR,c=s.frustumCorners.BR,f=s.frustumCorners.BL,m=s.frustumCorners.horizon,{u_frustum_tl:a,u_frustum_tr:u,u_frustum_br:c,u_frustum_bl:f,u_horizon:m,u_transition:h,u_fadeout_range:g,u_atmosphere_fog_color:d.toArray01(),u_high_color:p.toArray01(),u_space_color:_.toArray01(),u_temporal_offset:x,u_horizon_angle:b});r.uploadCommonUniforms(n,v);let T=this.atmosphereBuffer;T&&v.draw(r,o.TRIANGLES,l,t7.disabled,i?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,tk.backCW,w,i?"atmosphere_glow_alpha":"atmosphere_glow",T.vertexBuffer,T.indexBuffer,T.segments)};w(!1),w(!0)}drawStars(r,a){let n=i.bG(a.properties.get("star-intensity"),0,1);if(0===n)return;let o=r.context,s=o.gl,l=r.transform,h=r.getOrCreateProgram("stars"),u=i.dp([]);i.f2(u,u,-l._pitch),i.f5(u,u,-l.angle),i.f2(u,u,i.c4(l._center.lat)),i.f4(u,u,-i.c4(l._center.lng));let c=i.ct(new Float32Array(16),u),d=i.er([],l.starsProjMatrix,c),f=i.cs([],c),p=i.dt([],f),m=this.params.sizeMultiplier,_=[0,1,0];i.fK(_,_,p),i.fa(_,_,m);let g=[1,0,0];i.fK(g,g,p),i.fa(g,g,m);let y={u_matrix:Float32Array.from(d),u_up:_,u_right:g,u_intensity_multiplier:n};r.uploadCommonUniforms(o,h),this.starsVx&&this.starsIdx&&h.draw(r,s.TRIANGLES,tN.disabled,t7.disabled,this.colorModeAlphaBlendedWriteRGB,tk.disabled,y,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class se{constructor(){this.visibleTiles=[]}updateBorders(r,a){let n=[],o=[];for(let i of r._getRenderableCoordinates(!1,!0)){let s=r.getTile(i);if(!s.hasData())continue;let l=s.getBucket(a);l&&(l.isEmpty()||(n.push(i.key),o.push({bucket:l,tileID:i.canonical})))}let s=n.length!==this.visibleTiles.length;if(!s){n.sort();for(let i=0;i<n.length;i++)if(n[i]!==this.visibleTiles[i]){s=!0;break}}if(!s)return;let l=new Set;for(let r of(this.visibleTiles=n,o.sort((i,r)=>i.tileID.z-r.tileID.z||i.tileID.x-r.tileID.x||i.tileID.y-r.tileID.y),o)){let a=[],n=[],o=r.bucket;for(let i of o.featuresOnBorder)l.has(i.featureId)?n.push(i.footprintIndex):(l.add(i.featureId),a.push(i.footprintIndex));o.updateFootprintHiddenFlags(a,i.B,!1),o.updateFootprintHiddenFlags(n,i.B,!0)}}}class st{}class si{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,n){{let i=this._storage.get(a.id);if(i)return i.lastUsedFrameIdx=r,i.buf}let o=n.gl,s=o.getBufferParameter(o.ELEMENT_ARRAY_BUFFER,o.BUFFER_SIZE),l=new ArrayBuffer(s),h=new Int16Array(l);o.getBufferSubData(o.ELEMENT_ARRAY_BUFFER,0,new Int16Array(l));let u=new i.aR;for(let i=0;i<s/2;i+=3){let r=h[i],a=h[i+1],n=h[i+2];u.emplaceBack(r,a),u.emplaceBack(a,n),u.emplaceBack(n,r)}let c=n.bindVertexArrayOES.current,d=new st;return d.buf=new oE(n,u),d.lastUsedFrameIdx=r,this._storage.set(a.id,d),n.bindVertexArrayOES.set(c),d.buf}update(i){for(let[r,a]of this._storage)i-a.lastUsedFrameIdx>30&&(a.buf.destroy(),this._storage.delete(r))}destroy(){for(let[i,r]of this._storage)r.buf.destroy(),this._storage.delete(i)}}class sr{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}
111let sa={symbol:function(r,a,n,o,s){if("translucent"!==r.renderPass)return;let l=t7.disabled,h=r.colorModeForRenderPass(),u=n.layout.get("text-variable-anchor"),c=n.layout.get("text-size-scale-range"),d=i.bG(r.scaleFactor,c[0],c[1]);u&&function(r,a,n,o,s,l,h,u){let c=a.transform,d="map"===s,f="map"===l;for(let a of r){let r=o.getTile(a),s=r.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;let l=i.ci(s.textSizeData,c.zoom,u),p=aq(a,s.getProjection(),c),m=c.calculatePixelsToTileUnitsMatrix(r),_=tZ(p,r.tileID.canonical,f,d,c,s.getProjection(),m),g=s.hasIconTextFit()&&s.hasIconData();l&&function(r,a,n,o,s,l,h,u,c,d){let f=r.text.placedSymbolArray,p=r.text.dynamicLayoutVertexArray,m=r.icon.dynamicLayoutVertexArray,_={},g=r.getProjection(),y=aq(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;p.clear();for(let m=0;m<f.length;m++){let b=f.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:S}=b,E=b.hidden||!b.crossTileID||r.allowVerticalPlacement&&!b.placedOrientation?null:o[b.crossTileID];if(E){let o=0,f=0,I=0,A="road"===r.elevationType;if(x||A){let a=A&&r.hdExt?r.hdExt.getElevationFeatureForPlacedSymbol(r,r.text,m):null,n=i.s.getAtTileOffset(h,new i.au(w,T),x,a),[s,l,u]=g.upVector(h.canonical,w,T);o=n*s*v,f=n*l*v,I=n*u*v}let[M,C,D,R]=tY(b.projectedAnchorX+o,b.projectedAnchorY+f,b.projectedAnchorZ+I,n?y:l),P=tK(s.getCameraToCenterDistance(g),R),L=i.ch(r.textSizeData,c,b)*P/i.ao;n&&(L*=r.tilePixelRatio/u);let z=function({width:r,height:a,anchor:n,textOffset:o,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=i.cE(n),c=i.cj(n,o);return new i.au((-(h-.5)*r/s+c[0])*l,(-(u-.5)*a/s+c[1])*l)}(E,L);n?({x:M,y:C,z:D}=g.projectTilePoint(w+z.x,T+z.y,h.canonical),[M,C,D]=tY(M+o,C+f,D+I,l)):(a&&z._rotate(-s.angle),M+=z.x,C+=z.y,D=0);let O=r.allowVerticalPlacement&&b.placedOrientation===i.bg.vertical?Math.PI/2:0;for(let r=0;r<S;r++)i.bl(p,M,C,D,O);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:M,y:C,z:D,angle:O})}else t5(S,p)}if(d){m.clear();let a=r.icon.placedSymbolArray;for(let r=0;r<a.length;r++){let n=a.get(r),{numGlyphs:o}=n,s=_[r];if(n.hidden||!s)t5(o,m);else{let{x:r,y:a,z:n,angle:l}=s;for(let s=0;s<o;s++)i.bl(m,r,a,n,l)}}r.icon.dynamicLayoutVertexBuffer.updateData(m)}r.text.dynamicLayoutVertexBuffer.updateData(p)}(s,d,f,h,c,_,a,Math.pow(2,c.zoom-r.tileID.overscaledZ),l,g)}}(o,r,n,a,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),s,d);let f=0!==n.paint.get("icon-opacity").constantOr(1),p=0!==n.paint.get("text-opacity").constantOr(1);void 0!==n.layout.get("symbol-sort-key").constantOr(1)&&(f||p)?oL(r,a,n,o,l,h):(f&&oL(r,a,n,o,l,h,{onlyIcons:!0}),p&&oL(r,a,n,o,l,h,{onlyText:!0})),a.map.showCollisionBoxes&&(oD(r,a,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),oD(r,a,n,o,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(r,a,n,o){if("translucent"!==r.renderPass)return;let s=n.paint.get("circle-opacity"),l=n.paint.get("circle-stroke-width"),h=n.paint.get("circle-stroke-opacity"),u=void 0!==n.layout.get("circle-sort-key").constantOr(1),c=n.paint.get("circle-emissive-strength");if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let d=r.context,f=d.gl,p=r.transform,m=!(!r.terrain||!r.terrain.enabled),_=n.layout.get("circle-elevation-reference"),g=r.depthModeForSublayer(0,tN.ReadOnly),y=new tN(r.context.gl.LEQUAL,tN.ReadOnly,r.depthRangeFor3D),x="none"===_||m?g:y,v=t7.disabled,b=r.colorModeForDrapableLayerRenderPass(c),w="globe"===p.projection.name,T=[i.ek(p.center.lng),i.el(p.center.lat)],S=[];for(let s=0;s<o.length;s++){let l=o[s],h=a.getTile(l),c=h.getBucket(n);if(!c||c.projection.name!==p.projection.name)continue;let d=c.programConfigurations.get(n.id),f=c.layoutVertexBuffer,m=c.globeExtVertexBuffer,_=c.indexBuffer,g=i.bC(n),y=[m],x=r.isTileAffectedByFog(l);w&&g.push("PROJECTION_GLOBE_VIEW"),g.push("DEPTH_D24"),r.terrain&&p.depthOcclusionForSymbolsAndCircles&&g.push("DEPTH_OCCLUSION"),c.hdExt&&c.hdExt.hasElevation&&!r.terrain&&(g.push("ELEVATED_ROADS"),y.push(c.hdExt.elevatedLayoutVertexBuffer));let v=r.getOrCreateProgram("circle",{config:d,defines:g,overrideFog:x}),b=p.projection.createInversionMatrix(p,l.canonical),E={programConfiguration:d,program:v,layoutVertexBuffer:f,dynamicBuffers:y,indexBuffer:_,uniformValues:i.bD(r,l,h,b,T,n),tile:h};if(u)for(let r of c.segments.get())S.push({segments:new i.aJ([r]),sortKey:r.sortKey,state:E});else S.push({segments:c.segments,sortKey:0,state:E})}u&&S.sort((i,r)=>i.sortKey-r.sortKey);let E={useDepthForOcclusion:p.depthOcclusionForSymbolsAndCircles};for(let i of S){let{programConfiguration:a,program:o,layoutVertexBuffer:s,dynamicBuffers:l,indexBuffer:h,uniformValues:u,tile:c}=i.state,m=i.segments;r.terrain&&r.terrain.setupElevationDraw(c,o,E),r.uploadCommonUniforms(d,o,c.tileID.toUnwrapped()),o.draw(r,f.TRIANGLES,x,v,b,tk.disabled,u,n.id,s,h,m,n.paint,p.zoom,a,l)}},heatmap:function(r,a,n,o){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===r.renderPass){let s=r.context,l=s.gl,h=t7.disabled,u=new ie([l.ONE,l.ONE,l.ONE,l.ONE],i.i.transparent,[!0,!0,!0,!0]),c="globe"===r.transform.projection.name?.5:.25;n.heatmapFbo=oM.createWithTexture(s,n.heatmapFbo,r.width*c,r.height*c),s.clear({color:i.i.transparent});let d=r.transform,f="globe"===d.projection.name,p=f?["PROJECTION_GLOBE_VIEW"]:[],m=f?tk.frontCCW:tk.disabled,_=[i.ek(d.center.lng),i.el(d.center.lat)];for(let i=0;i<o.length;i++){let c=o[i];if(a.hasRenderableParent(c))continue;
111let g=a.getTile(c),y=g.getBucket(n);if(!y||y.projection.name!==d.projection.name)continue;let x=r.isTileAffectedByFog(c),v=y.programConfigurations.get(n.id),b=r.getOrCreateProgram("heatmap",{config:v,defines:p,overrideFog:x}),{zoom:w}=r.transform;r.terrain&&r.terrain.setupElevationDraw(g,b),r.uploadCommonUniforms(s,b,c.toUnwrapped());let T=d.projection.createInversionMatrix(d,c.canonical);b.draw(r,l.TRIANGLES,tN.disabled,h,u,m,oy(r,c,g,T,_,w,n.paint.get("heatmap-intensity")),n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,r.transform.zoom,v,f?[y.globeExtVertexBuffer]:null)}s.viewport.set([0,0,r.width,r.height])}else"translucent"===r.renderPass&&(r.context.setColorMode(r.colorModeForRenderPass()),function(r,a){let n=r.context,o=n.gl,s=a.heatmapFbo;if(!s)return;n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment0.get()),n.activeTexture.set(o.TEXTURE1);let l=a.colorRampTexture;l||(l=a.colorRampTexture=new i.a_(n,a.colorRamp,o.RGBA8)),l.bind(o.LINEAR,o.CLAMP_TO_EDGE),r.getOrCreateProgram("heatmapTexture").draw(r,o.TRIANGLES,tN.disabled,t7.disabled,r.colorModeForRenderPass(),tk.disabled,{u_image:0,u_color_ramp:1,u_opacity:a.paint.get("heatmap-opacity")},a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,a.paint,r.transform.zoom)}(r,n))},line:function(i,r,a,n){let o=a.paint.get("line-opacity"),s=a.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;let l=a.paint.get("line-blend-mode"),h=i.terrain&&i.terrain.renderingToTexture;if("default"===l||"globe"===i.transform.projection.name)"translucent"===i.renderPass&&oO(i,r,a,n);else{if(h)return void function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=i.context,l=s.gl,h=i.terrain;if(!h)return;let u=s.bindFramebuffer.current,c="mrt-fallback"===i.emissiveMode,d=h.drapeBufferSize[0],f=h.drapeBufferSize[1];a.lineBlendFbos||(a.lineBlendFbos=new oF),a.lineBlendFbos.drapeFbo=oM.createWithTexture(s,a.lineBlendFbos.drapeFbo,d,f,!0),c&&l.drawBuffers([l.COLOR_ATTACHMENT0]),s.clear({color:ok[o].clearColor,depth:1,stencil:0});let p=i.currentStencilSource,m=i._tileClippingMaskIDs,_=i.nextStencilID;i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1;let g=i._terrain;i._terrain=null,i._renderTileClippingMasks(a,r,n),oO(i,r,a,n,oU(o,i.context),!0),i._terrain=g,i.currentStencilSource=p,i._tileClippingMaskIDs=m,i.nextStencilID=_,c&&l.drawBuffers([l.COLOR_ATTACHMENT0,l.COLOR_ATTACHMENT1]);let y=h.drapeBufferSize,x=a.lineBlendFbos&&a.lineBlendFbos.drapeFbo;x&&("additive"===o&&oj(i,a,x),oG(i,a,o,x,u,y))}(i,r,a,n,l);if("offscreen"===i.renderPass){let o,s,h,u,c,d,f;return void(o=i.context,s=Math.ceil(i.width),h=Math.ceil(i.height),a.lineBlendFbos||(a.lineBlendFbos=new oF),a.lineBlendFbos.fbo=oM.createWithTexture(o,a.lineBlendFbos.fbo,s,h,!0),o.clear({color:ok[l].clearColor,depth:1,stencil:0}),u=i.currentStencilSource,c=i._tileClippingMaskIDs,d=i.nextStencilID,i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1,i._renderTileClippingMasks(a,r,n),f=i.renderPass,i.renderPass="translucent",oO(i,r,a,n,oU(l,i.context)),i.renderPass=f,i.currentStencilSource=u,i._tileClippingMaskIDs=c,i.nextStencilID=d,o.viewport.set([0,0,i.width,i.height]),"additive"===l&&oj(i,a,a.lineBlendFbos.fbo))}if("translucent"===i.renderPass){let r=a.lineBlendFbos&&a.lineBlendFbos.fbo;return void(r&&oG(i,a,l,r,null))}}},fill:function(r,a,n,o){let s=n.paint.get("fill-color"),l=n.paint.get("fill-opacity");if(0===l.constantOr(1))return;let h=n.paint.get("fill-emissive-strength"),u=r.colorModeForDrapableLayerRenderPass(h),c=n.paint.get("fill-pattern"),d=r.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===s.constantOr(i.i.transparent).a&&1===l.constantOr(0)?"opaque":"translucent",f="none";"none"!==n.layout.get("fill-elevation-reference")?f="road":0!==n.paint.get("fill-z-offset").constantOr(1)&&(f="offset");let p=!(!r.terrain||!r.terrain.enabled),m={painter:r,sourceCache:a,layer:n,coords:o,colorMode:u,elevationType:f,terrainEnabled:p,pass:d};if("shadow"===r.renderPass)return void(r.shadowRenderer&&"road"===f&&!p&&r$&&r$(m));let _="mrt-fallback"===r.emissiveMode;if("offset"!==f){if(oH(m,!1,_),"road"===f){let i=!p&&"translucent"===r.renderPass;i&&rZ&&rZ(r,a,n,o,"geometry"),oH(m,!0,_,t7.disabled),i&&rq&&rq(m)}}else oH(m,!1,_,r.stencilModeFor3D())},"fill-extrusion":function(r,a,n,o){let s=n.paint.get("fill-extrusion-opacity"),l=r.context,h=l.gl,u=r.terrain,c=u&&u.renderingToTexture;if(0===s)return;let d="mrt-fallback"===r.emissiveMode,f=r.conflationActive&&r.style.isLayerClipped(n,a.getSource()),p=r.style.order.indexOf(n.fqid);if(f&&function(i,r,a,n,o){for(let s of n){let n=r.getTile(s).getBucket(a);n&&(n.updateReplacement(s,i.replacementSource,o),n.uploadCentroid(i.context))}}(r,a,n,o,p),u||f)for(let s of o){let o=a.getTile(s).getBucket(n);o&&function(r,a,n,o,s,l,h){0===o.centroidVertexArray.length&&o.createCentroidsBuffer();let u=l?l.findDEMTileFor(n):null;if(!(u&&u.dem||h))return;l&&u&&u.dem&&o.selfDEMTileTimestamp!==u.dem._timestamp&&(o.borderDoneWithNeighborZ=[-1,-1,-1,-1],o.selfDEMTileTimestamp=u.dem._timestamp);let c=(r,a)=>{(r.flags|a.flags)&i.Y?(r.flags|=i.Y,a.flags|=i.Y):(r.flags&=~i.Y,a.flags&=~i.Y)},d=r=>
111new i.au(Math.ceil((r+i.E)*i.q),0),f=(r,a,n)=>{let o=Math.ceil((r+i.E)*i.q),s=Math.floor(Math.max(0,Math.min(i.r-1,n))/4);return new i.au(o,s<<5|(3&a)<<3|7)},p=i=>{let r=a.getSource().minzoom,n=i=>{let r=a.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};for(let a of[0,-1,1]){if(i.overscaledZ+a<r)continue;let o=n(i.calculateScaledKey(i.overscaledZ+a));if(o)return o}},m=[0,0,0],_=(r,a)=>(m[0]=Math.min(r.min.y,a.min.y),m[1]=Math.max(r.max.y,a.max.y),m[2]=i.r-a.min.x>r.max.x?a.min.x-i.r:r.max.x,m),g=(r,a)=>(m[0]=Math.min(r.min.x,a.min.x),m[1]=Math.max(r.max.x,a.max.x),m[2]=i.r-a.min.y>r.max.y?a.min.y-i.r:r.max.y,m),y=[(i,r)=>_(i,r),(i,r)=>_(r,i),(i,r)=>g(i,r),(i,r)=>g(r,i)],x=(r,a,o,s,h,c,d)=>{if(!l)return 0;let f=[[c?o:r,c?r:o,0],[c?o:a,c?a:o,0]],p=d<0?i.r+d:d,m=[c?p:(r+a)/2,c?(r+a)/2:p,0];return 0===o&&d<0||0!==o&&d>0?l.getForTilePoints(h,[m],!0,s):f.push(m),l.getForTilePoints(n,f,!0,u),Math.max(f[0][2],f[1][2],m[2])/l.exaggeration()};for(let r=0;r<4;r++){let a=o.borderFeatureIndices[r];if(0===a.length)continue;let s=i.ev[r](n),u=p(s);if(!(u&&u instanceof i.K))continue;let m=l?l.findDEMTileFor(s):null;if(!(m&&m.dem||h)||(l&&m&&m.dem&&o.borderDEMTileTimestamp[r]!==m.dem._timestamp&&(o.borderDoneWithNeighborZ[r]=-1,o.borderDEMTileTimestamp[r]=m.dem._timestamp),o.borderDoneWithNeighborZ[r]===u.canonical.z))continue;0===u.centroidVertexArray.length&&u.createCentroidsBuffer();let _=(r<2?1:5)-r,g=u.borderDoneWithNeighborZ[_]!==o.canonical.z,v=u.borderFeatureIndices[_],b=0;if(o.canonical.z!==u.canonical.z){for(let i of a)o.showCentroid(o.featuresOnBorder[i]);if(g)for(let i of v)u.showCentroid(u.featuresOnBorder[i]);o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z;continue}let w=new Map,T=new Set,S=new Set;for(let i=0;i<v.length;i++){let r=u.featuresOnBorder[v[i]];void 0!==r.buildingId&&w.set(r.buildingId,i)}for(let n of a){let a=o.featuresOnBorder[n],l=o.centroidData.get(a.centroidDataIndex);if(void 0===a.buildingId)continue;let d=w.get(a.buildingId);if(void 0===d)continue;let p=u.featuresOnBorder[v[d]],g=u.centroidData.get(p.centroidDataIndex);T.add(n),S.add(d),h&&c(l,g);let b=0!==l.groupCentroidPos.x||0!==l.groupCentroidPos.y?l.groupCentroidPos:a.centroid(),E=0!==g.groupCentroidPos.x||0!==g.groupCentroidPos.y?g.groupCentroidPos:p.centroid(),I=r<2?Math.round((b.y+E.y)/2):Math.round((b.x+E.x)/2),A=a.intersectsCount()>1||p.intersectsCount()>1;{let a=0;if(m&&m.dem&&!A){let n=y[r](l,g),o=r%2?i.r-1:0;a=x(n[0],Math.min(i.r-1,n[1]),o,m,s,r<2,n[2])}l.centroidXY=f(a,r,I),g.centroidXY=f(a,_,I)}if(o.writeCentroidToBuffer(l),u.writeCentroidToBuffer(g),void 0!==a.buildingId){for(let i of o.centroidData)i.buildingId===a.buildingId&&i!==l&&(i.centroidXY=l.centroidXY,o.writeCentroidToBuffer(i));for(let i of u.centroidData)i.buildingId===a.buildingId&&i!==g&&(i.centroidXY=g.centroidXY,u.writeCentroidToBuffer(i))}}for(let n of a){let a;if(T.has(n))continue;let l=o.featuresOnBorder[n],f=o.centroidData.get(l.centroidDataIndex),p=l.borders[r];for(;b<v.length;){if(S.has(b)){b++;continue}let i=(a=u.featuresOnBorder[v[b]]).borders[_];if(i[1]>p[0]+3||i[0]>p[0]-3)break;u.showCentroid(a),b++}if(a&&b<v.length){let n=b,g=0;for(;;)if(S.has(b)){if(++b===v.length)break;a=u.featuresOnBorder[v[b]]}else{if(a.borders[_][0]>p[1]-3||(g++,++b===v.length))break;a=u.featuresOnBorder[v[b]]}for(;n<v.length&&S.has(n);)n++;if(n>=v.length){o.showCentroid(l);continue}a=u.featuresOnBorder[v[n]];let w=!1;if(g>=1){let i=a.borders[_];3>Math.abs(p[0]-i[0])&&3>Math.abs(p[1]-i[1])&&(g=1,w=!0,b=n+1)}else if(0===g){o.showCentroid(l);continue}let T=u.centroidData.get(a.centroidDataIndex);h&&w&&c(f,T);let E=l.intersectsCount()>1||a.intersectsCount()>1;if(g>1)b=n,f.centroidXY=T.centroidXY=new i.au(0,0);else if(m&&m.dem&&!E){let a=y[r](f,T),n=r%2?i.r-1:0;f.centroidXY=T.centroidXY=d(x(a[0],Math.min(i.r-1,a[1]),n,m,s,r<2,a[2]))}else E?f.centroidXY=T.centroidXY=new i.au(0,0):(f.centroidXY=o.encodeBorderCentroid(l),T.centroidXY=u.encodeBorderCentroid(a));o.writeCentroidToBuffer(f),u.writeCentroidToBuffer(T)}else o.showCentroid(l)}o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(r)}(r.context,a,s,o,n,u,f)}if("shadow"===r.renderPass&&r.shadowRenderer){if(u&&s<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.bh)return;let l=r.shadowRenderer.getShadowPassDepthMode();ib(r,a,n,o,l,t7.disabled,ie.disabled,f)}else if("translucent"===r.renderPass){let p=!n.paint.get("fill-extrusion-pattern").constantOr(1),m=n.paint.get("fill-extrusion-color").constantOr(i.i.white);if(!c&&0!==m.a){let i=new tN(r.context.gl.LEQUAL,tN.ReadWrite,r.depthRangeFor3D);1===s&&p?ib(r,a,n,o,i,t7.disabled,ie.unblended,f):(ib(r,a,n,o,i,t7.disabled,ie.disabled,f),ib(r,a,n,o,i,r.stencilModeFor3D(),r.colorModeForRenderPass(),f),r.resetStencilClippingMasks())}if(r.style.enable3dLights()&&p&&(!u&&"globe"!==r.transform.projection.name||c)){let s=n.paint.get("fill-extrusion-opacity"),p=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),m=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),_=n.paint.get("fill-extrusion-flood-light-intensity"),g="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
111constantOr("default"),y=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(g?null:n.lut).toArray01().slice(0,3),x=p>0&&m>0,v=_>0,b=new iw;b.translate=n.paint.get("fill-extrusion-translate"),b.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),b.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),b.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");let w=l=>{let u=r.depthModeForSublayer(1,tN.ReadOnly,h.LEQUAL,!0),c=n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),d=i.dY(.1,3,c),g=r._showOverdrawInspector;g||iS(b,r,a,n,o,u,new t7({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new ie([h.ONE,h.ONE,h.ONE,h.ONE],i.i.transparent,[!1,!1,!1,!0],h.MIN),tk.disabled,l,"sdf",s,p,m,_,y,d,f,!1);{let c=g?t7.disabled:new t7({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),x=g?r.colorModeForRenderPass():new ie([h.ONE_MINUS_DST_ALPHA,h.DST_ALPHA,h.ONE,h.ONE],i.i.transparent,[!0,!0,!0,!0]);iS(b,r,a,n,o,u,c,x,tk.disabled,l,"color",s,p,m,_,y,d,f,!1)}};if(c){let c=()=>{let r=u.drapeBufferSize[0],a=u.drapeBufferSize[1],n=u.framebufferCopyTexture;return n&&(!n||n.size[0]===r&&n.size[1]===a)||(n&&n.destroy(),n=u.framebufferCopyTexture=new i.a_(l,new i.ay({width:r,height:a}),h.RGBA8)),n.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,r,a),n},g=(l,u,g)=>{let x=r.depthModeForSublayer(1,tN.ReadOnly,h.LEQUAL,!1),v=n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),w=i.dY(.1,3,v);{let c=new ie([h.ONE,h.ONE,h.ONE,h.ONE],i.i.transparent,[!1,!1,!1,!0]);iS(b,r,a,n,o,x,t7.disabled,c,tk.disabled,l,"clear",s,p,m,_,y,w,f,u)}iS(b,r,a,n,o,x,new t7({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new ie([h.ONE,h.ONE,h.ONE,h.ONE],i.i.transparent,[!1,!1,!1,!0],h.MIN),tk.disabled,l,"sdf",s,p,m,_,y,w,f,u),d&&!l&&(g=c());{let c=l?h.ZERO:h.ONE_MINUS_DST_ALPHA;iS(b,r,a,n,o,x,new t7({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),new ie([c,h.DST_ALPHA,h.ONE_MINUS_DST_ALPHA,h.ZERO],i.i.transparent,[!0,!0,!0,!0]),tk.disabled,l,"color",s,p,m,_,y,w,f,u)}if(!d||l){let c=new ie([h.ONE,h.ONE,h.ONE,l?h.ZERO:h.ONE],i.i.transparent,[!1,!1,!1,!0],l?h.FUNC_ADD:h.MAX);iS(b,r,a,n,o,x,t7.disabled,c,tk.disabled,l,"clear",s,p,m,_,y,w,f,u,g)}else h.drawBuffers([h.NONE,h.COLOR_ATTACHMENT1]),iS(b,r,a,n,o,x,new t7({func:h.EQUAL,mask:255},254,255,h.KEEP,h.DECR,h.DECR),new ie([h.ONE,h.ONE,h.ONE,h.ONE],i.i.transparent,[!0,!1,!1,!1],h.MAX),tk.disabled,l,"emissive",s,p,m,_,y,w,f,u,g),h.drawBuffers([h.COLOR_ATTACHMENT0])};if(x||v){let i;r.prepareDrawTile(),d&&!x||(i=c()),x&&g(!0,!1,i),v&&g(!1,!0,i)}}else x&&w(!0),v&&w(!1),(x||v)&&r.resetStencilClippingMasks()}}},hillshade:function(r,a,n,o){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass||r.style.disableElevatedTerrain)return;let s=r.context,l=r.terrain&&r.terrain.renderingToTexture,[h,u]="translucent"!==r.renderPass||l?[{},o]:r.stencilConfigForOverlap(o);for(let o of u){let s=a.getTile(o);if(s.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,a,n){var o;let s,l,h=r.context,u=h.gl;if(!a.dem)return;let c=a.dem;if(h.activeTexture.set(u.TEXTURE1),nT(r,a,c),!a.demTexture)return;a.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);let d=c.dim;h.activeTexture.set(u.TEXTURE0);let f=a.hillshadeFBO;if(!f){let r=new i.a_(h,{width:d,height:d,data:null},u.RGBA8);r.bind(u.LINEAR,u.CLAMP_TO_EDGE),(f=a.hillshadeFBO=h.createFramebuffer(d,d,1,"renderbuffer")).colorAttachment0.set(r.texture)}h.bindFramebuffer.set(f.framebuffer),h.viewport.set([0,0,d,d]);let{tileBoundsBuffer:p,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=r.getMercatorTileBoundsBuffers(),g=[];r.linearFloatFilteringSupported()&&g.push("TERRAIN_DEM_FLOAT_FORMAT"),r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&g.push("USE_MRT1"),r.getOrCreateProgram("hillshadePrepare",{defines:g}).draw(r,u.TRIANGLES,tN.disabled,t7.disabled,ie.unblended,tk.disabled,(o=a.tileID,s=c.stride,l=i.bT(),i.eB(l,0,i.r,-i.r,0,0,1),i.fQ(l,l,[0,-i.r,0]),{u_matrix:l,u_image:1,u_dimension:[s,s],u_zoom:o.overscaledZ}),n.id,p,m,_),a.needsHillshadePrepare=!1}(r,s,n);else if("translucent"===r.renderPass){let a=r.depthModeForSublayer(0,tN.ReadOnly),u=n.paint.get("hillshade-emissive-strength"),c=r.colorModeForDrapableLayerRenderPass(u),d=l&&r.terrain?r.terrain.stencilModeForRTTOverlap(o):h[o.overscaledZ];!function(r,a,n,o,s,l,h){let u=r.context,c=u.gl,d=n.hillshadeFBO;if(!d)return;r.prepareDrawTile();let f=r.isTileAffectedByFog(a),p=[];r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&p.push("USE_MRT1");let m=r.getOrCreateProgram("hillshade",{overrideFog:f,defines:p});u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,d.colorAttachment0.get());let _=((r,a,n,o)=>{var s;let l,h,u=n.paint.get("hillshade-shadow-color"),c="none"===n.paint.get("hillshade-shadow-color-use-theme").
111constantOr("default"),d=n.paint.get("hillshade-highlight-color"),f="none"===n.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),p=n.paint.get("hillshade-accent-color"),m="none"===n.paint.get("hillshade-accent-color-use-theme").constantOr("default"),_=n.paint.get("hillshade-emissive-strength"),g=i.c4(n.paint.get("hillshade-illumination-direction"));if("viewport"===n.paint.get("hillshade-illumination-anchor"))g-=r.transform.angle;else if(r.style&&r.style.enable3dLights()&&r.style.directionalLight){let a=r.style.directionalLight.properties.get("direction"),n=i.bB(a.x,a.y,a.z);g=i.c4(n[1])}let y=!r.options.moving;return{u_matrix:o||r.transform.calculateProjMatrix(a.tileID.toUnwrapped(),y),u_image:0,u_latrange:(l=Math.pow(2,(s=a.tileID).canonical.z),h=s.canonical.y,[new i.ag(0,h/l).toLngLat().lat,new i.ag(0,(h+1)/l).toLngLat().lat]),u_light:[n.paint.get("hillshade-exaggeration"),g],u_shadow:u.toPremultipliedRenderColor(c?null:n.lut),u_highlight:d.toPremultipliedRenderColor(f?null:n.lut),u_emissive_strength:_,u_accent:p.toPremultipliedRenderColor(m?null:n.lut)}})(r,n,o,r.terrain?a.projMatrix:null);r.uploadCommonUniforms(u,m,a.toUnwrapped());let{tileBoundsBuffer:g,tileBoundsIndexBuffer:y,tileBoundsSegments:x}=r.getTileBoundsBuffers(n);m.draw(r,c.TRIANGLES,s,l,h,tk.disabled,_,o.id,g,y,x)}(r,o,s,n,a,d,c)}}s.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,a,n,o,s,l){if("translucent"!==r.renderPass)return;let h=n.paint.get("raster-opacity");if(0===h)return;let u="globe"===r.transform.projection.name,c=0!==n.paint.get("raster-elevation"),d=c&&u,f=r.terrain&&r.terrain.exaggeration()>0&&c&&"ground"===n.paint.get("raster-elevation-reference"),p=!u&&f;if(r.renderElevatedRasterBackface&&!d)return;let m=r.context,_=m.gl,g=a.getSource(),y=function(r,a,n,o,s){let l=a.paint.get("raster-color"),h="raster-array"===r.type,u=[],c=a.paint.get("raster-resampling"),d=a.paint.get("raster-color-mix"),f=a.paint.get("raster-color-range"),p=[d[0],d[1],d[2],0],m=d[3],_="nearest"===c?o.NEAREST:o.LINEAR;if(h&&(u.push("RASTER_ARRAY"),l||u.push("RASTER_COLOR"),"linear"===c&&u.push("RASTER_ARRAY_LINEAR"),_=o.NEAREST,!f&&r.rasterLayers)){let i=r.rasterLayers.find(({id:i})=>i===a.sourceLayer);i&&i.fields&&i.fields.range&&(f=i.fields.range)}if(f=f||[0,1],l){u.push("RASTER_COLOR"),n.activeTexture.set(o.TEXTURE2),a.updateColorRamp(f);let r=a.colorRampTexture;r||(r=a.colorRampTexture=new i.a_(n,a.colorRamp,o.RGBA8)),r.bind(_,o.CLAMP_TO_EDGE)}return s&&u.push("USE_MRT1"),{mix:p,range:f,offset:m,defines:u,resampling:_}}(g,n,m,_,r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode);if(g instanceof i.a3&&!o.length&&!u)return;let x=n.paint.get("raster-emissive-strength"),v=r.colorModeForDrapableLayerRenderPass(x),b=r.terrain&&r.terrain.renderingToTexture,w=!r.options.moving,T="nearest"===n.paint.get("raster-resampling")?_.NEAREST:_.LINEAR;if(g instanceof i.a3&&!o.length&&(g.onNorthPole||g.onSouthPole)){let i=c?r.stencilModeFor3D():t7.disabled;return void o$(!!g.onNorthPole,null,r,a,n,x,y,tk.disabled,i)}if(!o.length)return;let[S,E]=g instanceof i.a3||b?[{},o]:r.stencilConfigForOverlap(o),I=E.at(-1).overscaledZ;d&&y.defines.push("PROJECTION_GLOBE_VIEW"),c&&y.defines.push("RENDER_CUTOFF","ELEVATED"),f&&y.defines.push("ELEVATION_REFERENCE_GROUND");let A=(o,s,E)=>{for(let A of o){let o,M,C,D,R,P=A.toUnwrapped(),L=a.getTile(A);if(b&&(!L||!L.hasData()))continue;m.activeTexture.set(_.TEXTURE0);let z=function(i,r,a,n){if(i)return r instanceof iG&&i instanceof iN?r.getTextureDescriptor(i,a,!0):{texture:i.texture,mix:oq(n.mix),offset:n.offset,buffer:0,tileSize:1}}(L,g,n,y);if(!z||!z.texture)continue;let{texture:O,mix:F,offset:B,tileSize:k,buffer:N}=z;b?(o=tN.disabled,M=A.projMatrix):c?(o=new tN(_.LEQUAL,tN.ReadWrite,r.depthRangeFor3D),M=u?r.transform.expandedFarZProjMatrix:r.transform.calculateProjMatrix(P,w)):(o=r.depthModeForSublayer(A.overscaledZ-I,1===h?tN.ReadWrite:tN.ReadOnly,_.LESS),M=r.transform.calculateProjMatrix(P,w));let U=r.terrain&&b?r.terrain.stencilModeForRTTOverlap(A):S[A.overscaledZ],V=l?0:n.paint.get("raster-fade-duration");L.registerFadeDuration(V);let j=a.findLoadedParent(A,0),G=i$(L,j,a,r.transform,V);!G.isFading&&L.refreshedUponExpiration&&(L.refreshedUponExpiration=!1),r.terrain&&r.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),O.bind(T,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),j?(j.texture&&j.texture.bind(T,_.CLAMP_TO_EDGE),C=Math.pow(2,j.tileID.overscaledZ-L.tileID.overscaledZ
111),D=[L.tileID.canonical.x*C%1,L.tileID.canonical.y*C%1]):O.bind(T,_.CLAMP_TO_EDGE),"useMipmap"in O&&m.extTextureFilterAnisotropic&&r.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);let H=r.transform,q=c?function(i){if(i.isOrthographic)return[0,0,0,0];let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(H):[0,0,0,0],$,Z,W,X,Y,K=0;if(d&&g instanceof i.a3&&g.coordinates.length>3)$=Float32Array.from(i.dh(i.dk(new i.f(0,0,0)))),Z=Float32Array.from(H.globeMatrix),W=Float32Array.from(i.by(H)),X=[i.ek(H.center.lng),i.el(H.center.lat)],R=g.elevatedGlobePerspectiveTransform,Y=g.elevatedGlobeGridMatrix||new Float32Array(9);else if(d){let r=i.fF(A.canonical);K=i.cU(r.getCenter().lat),$=Float32Array.from(i.dh(i.dk(A.canonical))),Z=Float32Array.from(H.globeMatrix),W=Float32Array.from(i.by(H)),X=[i.ek(H.center.lng),i.el(H.center.lat)],R=[0,0],Y=Float32Array.from(i.cP(A.canonical,r,K,H.worldSize/H._pixelsPerMercatorPixel))}else R=g instanceof i.a3?g.perspectiveTransform:[0,0],$=new Float32Array(16),Z=new Float32Array(9),W=new Float32Array(16),X=[0,0],Y=new Float32Array(9);let J=ox(r,M,$,Z,W,Y,D||[0,0],i.dm(r.transform.zoom),X,q,C||1,G,n,R,c?n.paint.get("raster-elevation"):0,2,F,B,y.range,k,N,x),Q=r.isTileAffectedByFog(A),ee=r.getOrCreateProgram("raster",{defines:y.defines,overrideFog:Q});if(r.uploadCommonUniforms(m,ee,P),g instanceof i.a3){let a=g.elevatedGlobeVertexBuffer,l=g.elevatedGlobeIndexBuffer;if(b||!u)g.boundsBuffer&&g.boundsSegments&&ee.draw(r,_.TRIANGLES,o,t7.disabled,v,tk.disabled,J,n.id,g.boundsBuffer,r.quadTriangleIndexBuffer,g.boundsSegments);else if(a&&l){let h=H.zoom<=i.S?g.elevatedGlobeSegments:g.getSegmentsForLongitude(H.center.lng);h&&ee.draw(r,_.TRIANGLES,o,t7.disabled,v,s,J,n.id,a,l,h)}}else if(d){o=new tN(_.LEQUAL,tN.ReadOnly,r.depthRangeFor3D);let i=r.globeSharedBuffers;if(i){f&&(r.terrain.setupElevationDraw(L,ee),r.uploadCommonUniforms(m,ee,L.tileID.toUnwrapped()));let[a,l,h]=i.getGridBuffers(K,!1),u=ee.getAttributeLocation(_,"a_texture_pos");-1!==u&&_.vertexAttribI4ui(u,0,0,0,0),ee.draw(r,_.TRIANGLES,o,E||U,r.colorModeForRenderPass(),s,J,n.id,a,l,h)}}else if(p)o=new tN(_.LEQUAL,tN.ReadWrite,r.depthRangeFor3D),r.terrain.setupElevationDraw(L,ee),r.uploadCommonUniforms(m,ee,L.tileID.toUnwrapped()),H.pitch>20&&ee.draw(r,_.TRIANGLES,o,t7.disabled,ie.disabled,tk.frontCCW,J,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments),ee.draw(r,_.TRIANGLES,o,U,v,tk.backCCW,J,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments);else{let{tileBoundsBuffer:i,tileBoundsIndexBuffer:a,tileBoundsSegments:s}=r.getTileBoundsBuffers(L);ee.draw(r,_.TRIANGLES,o,U,v,tk.disabled,J,n.id,i,a,s)}}if(!(g instanceof i.a3)&&d)for(let i of o){let o=i.canonical.y===(1<<i.canonical.z)-1;0===i.canonical.y&&o$(!0,i,r,a,n,x,y,s,E||t7.disabled),o&&o$(!1,i,r,a,n,x,y,s===tk.frontCW?tk.backCW:tk.frontCW,E||t7.disabled)}};d?A(E,r.renderElevatedRasterBackface?tk.backCW:tk.frontCW,r.stencilModeFor3D()):A(E,tk.disabled,void 0),r.resetStencilClippingMasks()},background:function(r,a,n,o){let s,l=n.paint.get("background-color"),h="none"===n.paint.get("background-color-use-theme").constantOr("default"),u=n.paint.get("background-opacity"),c=n.paint.get("background-emissive-strength"),d="viewport"===n.paint.get("background-pitch-alignment");if(0===u)return;let f=r.context,p=f.gl,m=r.transform,_=m.tileSize,g=n.paint.get("background-pattern");if(void 0!==g&&(null===g||!(s=r.imageManager.getPattern(i.a1.from(g.toString()),n.scope,r.style.getLut(n.scope)))))return;let y=!g&&1===l.a&&1===u&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==y)return;let x=t7.disabled,v=r.depthModeForSublayer(0,"opaque"===y?tN.ReadWrite:tN.ReadOnly),b=r.colorModeForDrapableLayerRenderPass(c),w=g?"backgroundPattern":"background",T,S=o;S||(S=Object.values(T=r.getBackgroundTiles()).map(i=>i.tileID)),g&&(f.activeTexture.set(p.TEXTURE0),r.imageManager.bind(r.context,n.scope));let E=[];if(r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&E.push("USE_MRT1"),d){let a=r.getOrCreateProgram(w,{overrideFog:!1,overrideRtt:!0,defines:E}),o=new i.ap(0,0,0,0,0),f=g?oT(oZ,c,u,r,0,n.scope,s,d,{tileID:o,tileSize:_}):ow(oZ,c,u,l.toPremultipliedRenderColor(h?null:n.lut));return void a.draw(r,p.TRIANGLES,v,x,b,tk.disabled,f,n.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}for(let y of S){let S=r.isTileAffectedByFog(y),I=r.getOrCreateProgram(w,{overrideFog:S,defines:E}),A=y.toUnwrapped(),M=o?y.projMatrix:r.transform.calculateProjMatrix(A);r.prepareDrawTile();let C=a?a.getTile(y):T?T[y.key]:new i.b0(y,_,m.zoom,r),D=g?oT(M,c,u,r,0,n.scope,s,d,{tileID:y,tileSize:_}):ow(M,c,u,l.toPremultipliedRenderColor(h?null:n.lut));r.uploadCommonUniforms(f,I,A);let{tileBoundsBuffer:R,tileBoundsIndexBuffer:P,tileBoundsSegments:L}=r.getTileBoundsBuffers(C);I.draw(r,p.TRIANGLES,v,x,b,tk.disabled,D,n.id,R,P,L)}},sky:function(r,a,n){let o,s,l,h,u,c,d,f,p,m,_,g,y,x,v=r._atmosphere?i.dm(r.transform.zoom):1,b=n.paint.get("sky-opacity")*v;if(0===b)return;let w=r.context,T=n.paint.get("sky-type"),S=new tN(w.gl.LEQUAL,tN.ReadOnly,[0,1]),E=r.frameCounter/1e3%1;"atmosphere"===T?"offscreen"===r.renderPass?n.needsSkyboxCapture(r)&&(function(r,a){let n=r.context,o=n.gl,s=a.skyboxFbo;if(!s){s=a.skyboxFbo=n.createFramebuffer(32,32,1,null),a.skyboxGeometry=new o4(n),a.skyboxTexture=n.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,a.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(let i=0;i<6;++i)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,32,32]);let l=a.getCenter(r,!0),h=r.getOrCreateProgram("skyboxCapture"),u=new Float64Array(16);i.cB(u,-(.5*Math.PI)),o5(r,a,h,u,l,0),i.cB(u,.5*Math.PI),o5(r,a,h,u,l,1),i.cA(u,-(.5*Math.PI)),o5(r,a,h,u,l,2),i.cA(u,.5*Math.PI),o5(r,a,h,u,l,3),i.dq(u),o5(r,a,h,u,l,4),i.cB(u,Math.PI),o5(r,a,h,u,l,5),n.viewport.set([0,0,r.width,r.height])}(r,n),n.markSkyboxValid(r)):"sky"===r.renderPass&&(s=(o=r.context).gl,l=r.transform,h=r.getOrCreateProgram("skybox"),o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,n.skyboxTexture),u={u_matrix:l.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:b,u_temporal_offset:E},r.uploadCommonUniforms(o,h),h.draw(r,s.TRIANGLES,S,t7.disabled,r.colorModeForRenderPass(),tk.backCW,u,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)):"gradient"===T&&"sky"===r.renderPass&&(d=(c=r.context).gl,f=r.transform,p=r.getOrCreateProgram("skyboxGradient"),n.skyboxGeometry||(n.skyboxGeometry=new o4(c)),c.activeTexture.set(d.TEXTURE0),(m=n.colorRampTexture)||(m=n.colorRampTexture=new i.a_(c,n.colorRamp,d.RGBA8)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE),_=f.skyboxMatrix,g=n.getCenter(r,!1),y=n.paint.get("sky-gradient-radius"),x={u_matrix:_,u_color_ramp:0,u_center_direction:g,u_radius:i.c4(y),u_opacity:b,u_temporal_offset:E},r.uploadCommonUniforms(c,p),p.draw(r,d.TRIANGLES,S,t7.disabled,r.colorModeForRenderPass(),tk.backCW,x,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment))},custom:function(r,a,n,o){let s=r.context,l=n.implementation;if(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes("custom")||r.terrain&&(r.terrain.renderingToTexture||"offscreen"===r.renderPass)&&n.isDraped(a)){if("offscreen"===r.renderPass){let a=l.prerender;if(a){if(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),"globe"===r.transform.projection.name){let n=r.transform.pointMerc;a.call(l,s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.dm(r.transform.zoom),[n.x,n.y],r.transform.pixelsPerMeterRatio)}else a.call(l,s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState()}}else if("translucent"===r.renderPass){if(r.terrain&&r.terrain.renderingToTexture){let i=l.renderToTile;if(i){let a=o[0].canonical,n={x:a.x+o[0].wrap*(l.wrapTileId?0:1<<a.z),y:a.y,z:a.z};s.setDepthMode(tN.disabled),s.setStencilMode(t7.disabled),s.setColorMode(r.colorModeForRenderPass()),r.setCustomLayerDefaults();let h=s.gl;"mrt-fallback"===r.emissiveMode&&h.drawBuffers([h.COLOR_ATTACHMENT0]),i.call(l,s.gl,n),"mrt-fallback"===r.emissiveMode&&h.drawBuffers([h.COLOR_ATTACHMENT0,h.COLOR_ATTACHMENT1]),s.setDirty(),r.setBaseState()}return}r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(t7.disabled);let a="3d"===l.renderingMode?new tN(r.context.gl.LEQUAL,tN.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,tN.ReadOnly);if(s.setDepthMode(a),"globe"===r.transform.projection.name){let a=r.transform.pointMerc;l.render(s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.dm(r.transform.zoom),[a.x,a.y],r.transform.pixelsPerMeterRatio)}else l.render(s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}else i.f_("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},sn={line:function(i,r,a){if(i.hasElevatedBuckets=!1,i.hasNonElevatedBuckets=!1,void 0!==i._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==i._unevaluatedLayout.getValue("line-z-offset")){if(r)for(let a of r.getVisibleCoordinates()){let n=r.getTile(a).getBucket(i);if(n&&("none"!==n.elevationType?i.hasElevatedBuckets=!0:i.hasNonElevatedBuckets=!0,i.hasElevatedBuckets&&i.hasNonElevatedBuckets))break}}else i.hasNonElevatedBuckets=!0},raster:function(i,r,a){let n=r.getSource();if(!(n instanceof iG&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)}};class so{constructor(r,a,n,o,s){this.context=new oC(r,a),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=r0?new r0:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,dt:0,timeStamp:i.co.now(),continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParam
111sOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:5e3,lodSwitchFadeDuration:.5},this.occlusionParams=new sr,this.setup(),this.numSublayers=rD.maxUnderzooming+rD.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new i.aF,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new i_(this),this._wireframeDebugCache=new si,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const l=new i.ay({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.a_(this.context,l,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=o,this.maxFrontCutoffRawStart=0,this.worldview=s,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(i,r){let a=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(a||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new oo(this,i));let n=this._terrain;this.transform.elevation=a?n:null,n.update(i,this.transform,r),this.transform.elevation&&!n.enabled&&(this.transform.elevation=null)}_updateFog(i){let r=i.fog;if(!r||"globe"===this.transform.projection.name||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[a,n]=r.getRangeForProjection();if(a>n)return void(this.transform.fogCullDistSq=null);let o=a+.78*(n-a);this.transform.fogCullDistSq=o*o}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(i){i&&!this._terrain&&(this._terrain=new oo(this,this.style)),this._forceTerrainMode=i}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*i.co.devicePixelRatio,this.height=a*i.co.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style.order)this.style._mergedLayers[i].resize()}setup(){let r=this.context,a=new i.aQ;a.emplaceBack(0,0),a.emplaceBack(i.r,0),a.emplaceBack(0,i.r),a.emplaceBack(i.r,i.r),this.tileExtentBuffer=r.createVertexBuffer(a,i.eQ.members),this.tileExtentSegments=i.aJ.simpleSegment(0,0,4,2);let n=new i.aQ;n.emplaceBack(0,0),n.emplaceBack(i.r,0),n.emplaceBack(0,i.r),n.emplaceBack(i.r,i.r),this.debugBuffer=r.createVertexBuffer(n,i.eQ.members),this.debugSegments=i.aJ.simpleSegment(0,0,4,5);let o=new i.aQ;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.eQ.members),this.viewportSegments=i.aJ.simpleSegment(0,0,4,2);let s=new i.aP;s.emplaceBack(0,0,0,0),s.emplaceBack(i.r,0,i.r,0),s.emplaceBack(0,i.r,0,i.r),s.emplaceBack(i.r,i.r,i.r,i.r),this.mercatorBoundsBuffer=r.createVertexBuffer(s,i.bt.members),this.mercatorBoundsSegments=i.aJ.simpleSegment(0,0,4,2);let l=new i.aT;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.aM;for(let i of[0,1,3,2,0])h.emplaceBack(i);this.debugIndexBuffer=r.createIndexBuffer(h),this.emptyTexture=new i.a_(r,new i.ay({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=i.bT();let u=this.context.gl;this.stencilClearMode=new t7({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let i=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,i.TRIANGLES,tN.disabled,this.stencilClearMode,ie.disabled,tk.disabled,rL(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(i,r,a){if(!r||this.currentStencilSource===r.id||!i.isTileClipped()||!a||0===a.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of a)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=r.id;let n=this.context,o=n.gl;this.nextStencilID+a.length>256&&this.clearStencil(),n.setColorMode(ie.disabled),n.setDepthMode(tN.disabled);let s=this.getOrCreateProgram("clippingMask");for(let i of(this._tileClippingMaskIDs={},a)){let a=r.getTile(i),n=this._tileClippingMaskIDs[i.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=this.getTileBoundsBuffers(a);s.draw(this,o.TRIANGLES,tN.disabled,new t7({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),ie.disabled,tk.disabled,rL(i.projMatrix),"$clipping",l,h,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,r=this.context.gl;return new t7({func:r.NOTEQUAL,mask:255},i,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(i){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(i);let r=this.context.gl;return new t7({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,r.KEEP,r.KEEP,r.REPLACE)}stencilConfigForOverlap(i){let r=this.context.gl,a=i.sort((i,r)=>
111r.overscaledZ-i.overscaledZ),n=a.at(-1).overscaledZ,o=a[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let i={};for(let a=0;a<o;a++)i[a+n]=new t7({func:r.GEQUAL,mask:255},a+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[i,a]}return[{[n]:t7.disabled},a]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let a=1/8;return new ie([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new i.i(a,a,a,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?ie.unblended:ie.alphaBlended}colorModeForDrapableLayerRenderPass(r){let a=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?null!=r&&"mrt-fallback"!==this.emissiveMode||"constant"===this.emissiveMode?new ie([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new i.i(0,0,0,null!=r?r:0),[!0,!0,!0,!0]):"dual-source-blending"===this.emissiveMode?new ie([a.ONE,a.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,a.ONE_MINUS_SRC_ALPHA],i.i.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(i,r,a,n=!1){if(this.depthOcclusion)return new tN(this.context.gl.GREATER,tN.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!n)return tN.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new tN(a||this.context.gl.LEQUAL,r,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let r=this.context.gl,a=Math.ceil(this.width),n=Math.ceil(this.height),o=this.context.bindFramebuffer.get(),s=r.getParameter(r.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===a&&this.depthFBO.height===n||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==a&&0!==n&&(this.depthFBO=new oM(this.context,a,n,0,"texture"),this.depthTexture=new i.a_(this.context,{width:a,height:n,data:null},r.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(o),r.bindTexture(r.TEXTURE_2D,s),this.depthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),r.blitFramebuffer(0,0,a,n,0,0,a,n,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(r,a){var n,o;let s,l;this.context.sweepPendingPrograms(),this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=a,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&r0&&(this.frcCoverageRenderer=new r0),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));let h=this.style._mergedLayers,u=!(!this.terrain||!this.terrain.enabled),c=()=>this.style._getOrder(u),d=c(),f=!1,p=!1,m=null,_=0,g=!1;for(let i of d){let r=h[i];"none"!==r.visibility&&("circle"===r.type?f=!0:"building"===r.type?(m=r,++_):"symbol"===r.type&&(r.hasOcclusionOpacityProperties?p=!0:f=!0))}this.updateEmissiveMode();let y=d.map(i=>h[i]),x=this.style._mergedSourceCaches;for(let a in this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(i.co.now()),this.imageManager.beginFrame(),x){let i=x[a];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++_)}let v=!1;for(let i of y)i.isHidden(this.transform.zoom)||("clip"===i.type&&(v=!0),this.prepareLayer(i));let b={},w={},T={},S={},E={};for(let i in x){let r=x[i];b[i]=r.getVisibleCoordinates(),w[i]=b[i].slice().reverse(),T[i]=r.getVisibleCoordinates(!0).reverse(),S[i]=r.getShadowCasterCoordinates(),E[i]=r.sortCoordinatesByDistance(b[i])}let I=i=>{let r=this.style.getLayerSourceCache(i);return r&&r.used?r.getSource():null};if(_||v||this._clippingActiveLastFrame){let r=[],a=[],n=0;for(let i of y)this.isSourceForClippingOrConflation(i,I(i))&&(r.push(i),a.push(n)),n++;if(r&&(v||r.length>1)||this._clippingActiveLastFrame){v=!1;let n=[];for(let o=0;o<r.length;o++){let s=r[o],l=a[o],h=this.style.getLayerSourceCache(s);if(!h||!h.used||!h.getSource().usedInConflation&&"clip"!==s.type&&"building"!==s.type)continue;let u=i.aE,c=i.a8.None,d=[],f=!0;if("building"===s.type)u=i.aD;else if("clip"===s.type)if(u=l,s.isHidden(this.transform.zoom))f=!1;else{if(!s.layout){f=!1;continue}
111for(let r of s.layout.get("clip-layer-types"))c|="model"===r?i.a8.Model:"symbol"===r?i.a8.Symbol:i.a8.FillExtrusion;for(let r of s.layout.get("clip-layer-scope"))d.push(i.ea(r,s.scope));v=!0}f&&n.push({layer:s.fqid,cache:h,order:u,clipMask:c,clipScope:d})}this.replacementSource.setSources(n),g=!0}}this._clippingActiveLastFrame=v,g||this.replacementSource.clear(),this.conflationActive=g,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let i=0;i<y.length;i++){let r=y[i];if("none"===r.visibility)continue;let a=r.cutoffRange();if(this.longestCutoffRange=Math.max(a,this.longestCutoffRange),a>0){let i=I(r);i&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom)),r.minzoom&&(this.minCutoffZoom=Math.max(r.minzoom,this.minCutoffZoom))}r.is3D(u)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=i),this._lastOcclusionLayer=i)}let A=this.style&&this.style.fog;A?(this._fogVisible=0!==A.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=A.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(T),this.opaquePassCutoff=0,y=(d=c()).map(i=>h[i]));let M=this._shadowRenderer;if(M)for(let i in M.updateShadowParameters(this.transform,this.style.directionalLight),x)for(let r of b[i]){let i={min:0,max:0};this.terrain&&(i=this.terrain.getMinMaxForTile(r)||i),M.addShadowReceiver(r.toUnwrapped(),i.min,i.max)}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.T(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new o7),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let C=!(!this.style||!this.style.snow),D=!(!this.style||!this.style.rain);if(C&&!this._snow&&rj&&(this._snow=new rj),!C&&this._snow&&(this._snow.destroy(),delete this._snow),D&&!this._rain&&rV&&(this._rain=new rV),!D&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),m){this.buildingTileBorderManager||(this.buildingTileBorderManager=new se);let i=this.style.getLayerSourceCache(m);this.buildingTileBorderManager.updateBorders(i,m)}if(!eh.has(this.context.gl))return;for(let i of(this.renderPass="offscreen",y)){let a=r.getLayerSourceCache(i);if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let n=a?w[a.id]:void 0;("custom"===i.type||"raster"===i.type||"raster-particle"===i.type||i.isSky()||n&&n.length)&&this.renderLayer(this,a,i,n)}this.depthRangeFor3D=[0,1-(y.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,S)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let R="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),P=(()=>{if(a.showOverdrawInspector)return i.i.black;let r=this.style.fog;if(r&&this.transform.projection.supportsFog){let a=this.style.getLut(r.scope);if(!R){let n="none"===r.properties.get("color-use-theme"),o=r.properties.get("color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.i(...o)}if(R){let n="none"===r.properties.get("space-color-use-theme"),o=r.properties.get("space-color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.i(...o)}}return i.i.transparent})();if(this.context.clear({color:P,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&R&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=d.length-1;this.currentLayer>=0;this.currentLayer--){let i=y[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())continue;let n=a?(i.is3D(u)?E:w)[a.id]:void 0;this._renderTileClippingMasks(i,a,n),this.renderLayer(this,a,i,n)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&R&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||i.dm(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isH
111orizonVisible()))for(this.currentLayer=0;this.currentLayer<d.length;this.currentLayer++){let i=y[this.currentLayer],a=r.getLayerSourceCache(i);i.isSky()&&this.renderLayer(this,a,i,a?w[a.id]:void 0)}function L(i,r){let a;return r&&(a=("symbol"===i.type?T:i.is3D(u)?E:w)[r.id]),a}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<d.length;){let i=y[this.currentLayer];if("raster"===i.type||"raster-particle"===i.type){let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,L(i,a))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let z=M?M.getGroundShadowLayerIndex():-1,O=!1,F=-1;for(let i=0;i<d.length;++i){let r=y[i];r.isHidden(this.transform.zoom)||r.is3D(u)&&(F=i)}p&&-1===F&&(f=!0);let B=!1;for(;this.currentLayer<d.length;){let i=y[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(i)){if(i.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!B&&i.is3D(u)&&!u){let i=this.currentLayer,r=i=>{for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){let r=y[this.currentLayer];if("fill"===r.type&&rZ){let a=this.style.getLayerSourceCache(r);rZ(this,a,r,L(r,a),i)}}};r("initialize"),r("reset"),this.currentLayer=i,B=!0}if(f&&!O&&this.terrain&&!this.transform.isOrthographic&&(O=!0,this.blitDepth()),p&&-1!==F&&this.currentLayer===F+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(i,a,a?b[a.id]:void 0),this.renderLayer(this,a,i,L(i,a)),!this.terrain&&M&&this.currentLayer===z){{this.clearStencil(),this.resetStencilClippingMasks();let i=this.currentLayer;for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){let i=y[this.currentLayer];if("fill"===i.type&&rW){let r=this.style.getLayerSourceCache(i);rW(this,r,i,L(i,r))}}this.currentLayer=i}if(M.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){let i=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=i;this.currentLayer++){let i=y[this.currentLayer];if(!i.hasLightBeamPass())continue;let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,a?w[a.id]:void 0)}this.currentLayer=i,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let i=this.currentLayer;for(let i of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=i;let a=y[this.currentLayer],n=r.getLayerSourceCache(a),o=n?w[n.id]:void 0;this.terrain||this._renderTileClippingMasks(a,n,n?b[n.id]:void 0),this.renderLayer(this,n,a,o)}this.depthOcclusion=!1,this.currentLayer=i,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let a=null;y.forEach(i=>{let n=r.getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&n.getVisibleCoordinates().length&&(!a||a.getSource().maxzoom<n.getSource().maxzoom)&&(a=n)}),a&&this.options.showTileBoundaries&&function(r,a,n,o,s){for(let l=0;l<n.length;l++)!function(r,a,n,o,s){let l=r.context,h=r.transform,u=l.gl,c="globe"===h.projection.name,d=i.bJ(n.projMatrix);if(c&&i.dm(h.zoom)>0){let r=i.fP(n.canonical,h),a=i.de(r);d=i.er(new Float32Array(16),h.globeMatrix,a),i.er(d,h.projMatrix,d)}let f=i.bT();f[12]+=0/(i.co.devicePixelRatio*h.width),f[13]+=0/(i.co.devicePixelRatio*h.height),i.er(d,f,d);let p=r.getOrCreateProgram("debug",{defines:c?["PROJECTION_GLOBE_VIEW"]:[]}),m=a.getTileByID(n.key);r.terrain&&r.terrain.setupElevationDraw(m,p);let _=tN.disabled,g=t7.disabled,y=r.colorModeForRenderPass(),x="$debug";l.activeTexture.set(u.TEXTURE0),r.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),c?m._makeGlobeTileDebugBuffers(r.context,h):m._makeDebugTileBoundsBuffers(r.context,h.projection);let v=m._tileDebugBuffer||r.debugBuffer,b=m._tileDebugIndexBuffer||r.debugIndexBuffer,w=m._tileDebugSegments||r.debugSegments;if(p.draw(r,u.LINE_STRIP,_,g,y,tk.disabled,at(d,o.toPremultipliedRenderColor(null)),x,v,b,w,null,null,null,[m._globeTileDebugBorderBuffer]),s){var T;let i,a,o,s=m.latestRawTileData,l=Math.floor((s&&s.byteLength||0)/1024),h=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(h+=` => ${n.overscaledZ}`),h+=` ${m.state}`,h+=` ${l}kb`,T=h,r.initDebugOverlayCanvas(),i=r.debugOverlayCanvas,a=r.context.gl,(o=r.debugOverlayCanvas.getContext("2d")).clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(T,5,5),o.strokeText(T,5,5),r.debugOverlayTexture.update(i),r.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}let S=512/Math.min(a.getTile(n).tileSize,512)*(n.overscaledZ/h.zoom)*.5,E=m._tileDebugTextBuffer||r.debugBuffer,I=m._tileDebugTextIndexBuffer||r.quadTriangleIndexBuffer,A=m._tileDebugTextSegments||r.debugSegments;p.draw(r,u.TRIANGLES,_,g,ie.alphaBlended,tk.disabled,at(d,i.i.transparent.toPremultipliedRenderColor(null),S),x,E,I,A,null,null,null,[m._globeTileDebugTextBuffer])}(r,a,n[l],o,s)}(this,a,a.getVisibleCoordinates(),i.i.red,this.options.showParseStatus)}this.options.showPadding&&(s=this.transform.padding,oQ(this,this.transform.height-(s.top||0),3,oW),oQ(this,s.bottom||0,3,oX),o0(this,s.left||0,3,oY),o0(this,this.transform.width-(s.right||0),3,oK),l=this.transform.centerPoint,n=l.x,o1(this,n-1,(o=this.transform.height-l.y)-10,2,20,oJ),o1(this,n-10,o-1,20,2,oJ)),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
111anvasCopy()),g||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);let{unsupportedLayers:r}=this.transform.projection,a=!r||!r.includes(i.type);if(sn[i.type]&&(a||this.terrain&&"custom"===i.type)){let r=this.style.getLayerSourceCache(i);sn[i.type](i,r,this)}this.gpuTimingEnd()}renderLayer(i,r,a,n){a.isHidden(this.transform.zoom)||("background"===a.type||"sky"===a.type||"custom"===a.type||"model"===a.type||"raster"===a.type||"raster-particle"===a.type||n&&n.length)&&(this.id=a.id,this.gpuTimingStart(a),(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes(a.type)||i.terrain&&"custom"===a.type)&&"clip"!==a.type&&"slot"!==a.type&&sa[a.type]&&sa[a.type](i,r,a,n,this.style.placement.variableOffsets,this.options.isInitialLoad),sa[a.type]||(a.mayUse("HD")&&async function(){await r8(),Object.assign(sa,{building:rk,"raster-particle":rN}),Object.assign(sn,{"raster-particle":rU})}(),a.mayUse("Standard")&&async function(){await aE(),Object.assign(sa,{model:aS.drawModels}),Object.assign(sn,{model:aS.prepare})}()),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery,a=this.context.gl,n=this.gpuTimers[i.id];n||(n=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:a.createQuery()}),n.calls++,a.beginQuery(r.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let i=this.context.extTimerQuery,r=this.context.gl,a=r.createQuery();this.deferredRenderGpuTimeQueries.push(a),r.beginQuery(i.TIME_ELAPSED_EXT,a)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){let i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){let r={};for(let a in i){let n=i[a],o=this.context.extTimerQuery,s=o.getQueryParameter(n.query,this.context.gl.QUERY_RESULT)/1e6;o.deleteQueryEXT(n.query),r[a]=s}return r}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;let r=this.context.gl,a=0;for(let n of i)a+=r.getQueryParameter(n,r.QUERY_RESULT)/1e6,r.deleteQuery(n);return a}translatePosMatrix(r,a,n,o,s){if(!n[0]&&!n[1])return r;let l=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(l){let i=Math.sin(l),r=Math.cos(l);n=[n[0]*r-n[1]*i,n[0]*i+n[1]*r]}let h=[s?n[0]:i.eG(a,n[0],this.transform.zoom),s?n[1]:i.eG(a,n[1],this.transform.zoom),0],u=new Float32Array(16);return i.fQ(u,r,h),u}saveTileTexture(i){if(i.context!==this.context)return;let r=i.size[0],a=this._tileTextures[r];a?a.push(i):this._tileTextures[r]=[i]}getTileTexture(i){let r=this._tileTextures[i];return r&&r.length>0?r.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(i,r,a,n,o){let s=void 0===a?this.terrain&&this.terrain.renderingToTexture:a,l=void 0===n?this.terrainRenderModeElevated():n,h=void 0===o?"globe"===this.transform.projection.name:o,u=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===i||"terrainRaster"===i?(u.push("LIGHTING_3D_MODE"),u.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):s||u.push("LIGHTING_3D_MODE")),l&&(u.push("TERRAIN"),this.linearFloatFilteringSupported()&&u.push("TERRAIN_DEM_FLOAT_FORMAT")),h&&u.push("GLOBE"),this._fogVisible&&!s&&(void 0===r||r)&&u.push("FOG"),s&&u.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&u.push("OVERDRAW_INSPECTOR"),u}getOrCreateProgram(i,r){this.cache=this.cache||{};let{defines:a,config:n,overrideFog:o,overrideRtt:s,overrideTerrain:l,overrideGlobe:h,precompiled:u}=r||{},c=this.currentGlobalDefines(i,o,s,l,h).concat(a||[]),d=this.getShaderSource(i),f=rH,p=aS.programUniforms,m=oS[i]||f&&f[i]||p&&p[i],_=oh.cacheKey(d,i,c,n);return this.cache[_]||(this.cache[_]=new oh(this.context,i,d,n,m,c,u)),this.cache[_]}getShaderSource(i){let r=rG,a=aS.shaders;return rl[i]||r&&r[i]||a&&a[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.a_(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
111stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a){if(this.style.enable3dLights()){let s=this.style.directionalLight,l=this.style.ambientLight;if(s&&l){var n,o;let h,u,c,d,f,p,m,_,g,y,x,v,b,w,T,S,E,I=(n=this.style,h=s.properties.get("direction"),u="none"===s.properties.get("color-use-theme"),c=s.properties.get("color").toNonPremultipliedRenderColor(u?null:n.getLut(s.scope)).toArray01(),d=s.properties.get("intensity"),f="none"===l.properties.get("color-use-theme"),p=l.properties.get("color").toNonPremultipliedRenderColor(f?null:n.getLut(l.scope)).toArray01(),m=l.properties.get("intensity"),_=[h.x,h.y,h.z],g=i.f8(p,m),{u_lighting_ambient_color:g,u_lighting_directional_dir:_,u_lighting_directional_color:y=i.f8(c,d),u_ground_radiance:(o=[0,0,1],x=i.c7(o,_),v=1-.3*Math.min(i.c7(y,[.2126,.7152,.0722]),1),b=i.dY(v,1,Math.min(x+1,1)),w=i.dY(.92,1,Math.asin(i.bG(o[2],-1,1))/Math.PI+.5)*b,T=[0,0,0],i.fa(T,g.slice(0,3),w),S=[0,0,0],i.fa(S,y.slice(0,3),_[2]),E=[0,0,0],i.bj(E,T,S),i.e4(E))});a.setLightsUniformValues(r,I)}}}uploadCommonUniforms(r,a,n,o,s){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;let l=this.style.fog;if(l){let s=l.getOpacity(this.transform.pitch),h=((r,a,n,o,s,l,h,u,c,d,f,p)=>{let m=r.transform,_="none"===a.properties.get("color-use-theme"),g=a.properties.get("color").toNonPremultipliedRenderColor(_?null:r.style.getLut(a.scope)).toArray01();g[3]=o;let y=r.frameCounter/1e3%1,[x,v]=a.properties.get("vertical-range");return{u_fog_matrix:n?m.calculateFogTileMatrix(n):p||r.identityMat,u_fog_range:a.getRangeForProjection(),u_fog_color:g,u_fog_horizon_blend:a.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(x,v),v],u_fog_temporal_offset:y,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:f,u_globe_transition:i.dm(m.zoom),u_is_globe:+("globe"===m.projection.name)}})(this,l,n,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.co.devicePixelRatio,this.transform.height*i.co.devicePixelRatio],o);a.setFogUniformValues(r,h)}s&&a.setCutoffUniformValues(r,s.uniformValues)}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){let i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){let i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){let r=this._backgroundTiles,a=this._backgroundTiles={};for(let n of this.transform.coveringTiles({tileSize:512}))a[n.key]=r[n.key]||new i.b0(n,512,this.transform.tileZoom,this,void 0,this.worldview);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(i,r){return!(!i.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==i.type&&"building"!==i.type&&(i.minzoom&&i.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==i.sourceLayer&&"procedural_buildings"!==i.sourceLayer)&&(!r||"batched-model"!==r.type)))}isTileAffectedByFog(i){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let r=this._cachedTileFogOpacities[i.key];return r||(this._cachedTileFogOpacities[i.key]=r=this.style.fog.getOpacityForTile(i)),r[0]>=.05||r[1]>=.05}setupDepthForOcclusion(i,r,a){var n;let o=this.context,s=o.gl,l=!!a;a||(a={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),o.activeTexture.set(s.TEXTURE3),i&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),a.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],a.u_depth_range_unpack=[2/((n=this.depthRangeFor3D)[1]-n[0]),-1-2*n[0]/(n[1]-n[0])],a.u_occluder_half_size=.5*this.occlusionParams.occluderSize,a.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
111DepthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0),l||r.setTerrainUniformValues(o,a)}updateEmissiveMode(){if(this._forceEmissiveMode)return;let i=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=i?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function ss(i,r){let a=!1,n=null,o=()=>{n=null,a&&(i(),n=setTimeout(o,r),a=!1)};return()=>(a=!0,n||o(),n)}let sl=/(#.+)?$/;class sh{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bs(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ss(this._updateHashUnthrottled.bind(this),300)}addTo(i){return this._map=i,window.addEventListener("hashchange",this._onHashChange,!1),i.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let i=this._map;if(!i)return"";let r=su(i);if(this._hashName){let i=this._hashName,a=!1,n=location.hash.slice(1).split("&").map(n=>{let o=n.split("=")[0];return o===i?(a=!0,`${o}=${r}`):n}).filter(i=>i);return a||n.push(`${i}=${r}`),`#${n.join("&")}`}return`#${r}`}_getCurrentHash(){let i=location.hash.replace("#","");if(this._hashName){let r;return i.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(r=i)}),(r&&r[1]||"").split("/")}return i.split("/")}_onHashChange(){let i=this._map;if(!i)return!1;let r=this._getCurrentHash();if(r.length>=3&&!r.some(i=>isNaN(Number(i)))){let a=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(r[3]||0):i.getBearing();return i.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:a,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(sl,this.getHashString()))}}function su(i,r){let a=i.getCenter(),n=Math.round(100*i.getZoom())/100,o=Math.pow(10,Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10)),s=Math.round(a.lng*o)/o,l=Math.round(a.lat*o)/o,h=i.getBearing(),u=i.getPitch(),c=r?`/${s}/${l}/${n}`:`${n}/${l}/${s}`;return(h||u)&&(c+="/"+Math.round(10*h)/10),u&&(c+=`/${Math.round(u)}`),c}let sc={linearity:.3,easing:i.fV(0,0,.3,1)},sd=Object.assign({deceleration:2500,maxSpeed:1400},sc),sf=Object.assign({deceleration:20,maxSpeed:1400},sc),sp=Object.assign({deceleration:1e3,maxSpeed:360},sc),sm=Object.assign({deceleration:1e3,maxSpeed:90},sc);class s_{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.co.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,a=i.co.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let a={zoom:0,bearing:0,pitch:0,pan:new i.au(0,0),pinchAround:void 0,around:void 0};for(let{settings:i}of this._inertiaBuffer)a.zoom+=i.zoomDelta||0,a.bearing+=i.bearingDelta||0,a.pitch+=i.pitchDelta||0,i.panDelta&&a.pan._add(i.panDelta),i.around&&(a.around=i.around),i.pinchAround&&(a.pinchAround=i.pinchAround);let n=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,o={};if(a.pan.mag()){let i=sy(a.pan.mag(),n,Object.assign({},sd,r||{}));o.offset=a.pan.mult(i.amount/a.pan.mag()),o.center=this._map.transform.center,sg(o,i)}if(a.zoom){let i=sy(a.zoom,n,sf);o.zoom=this._map.transform.zoom+i.amount,sg(o,i)}if(a.bearing){let r=sy(a.bearing,n,sp);o.bearing=this._map.transform.bearing+i.bG(r.amount,-179,179),sg(o,r)}if(a.pitch){let i=sy(a.pitch,n,sm);o.pitch=this._map.transform.pitch+i.amount,sg(o,i)}if(o.zoom||o.bearing){let i=void 0===a.pinchAround?a.around:a.pinchAround;o.around=i?this._map.unproject(i):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function sg(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function sy(r,a,n){let{maxSpeed:o,linearity:s,deceleration:l}=n,h=i.bG(r*s/(a/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:n.easing,duration:1e3*u,amount:u/2*h}}class sx extends i.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){const o=M(r.getCanvasContainer(),a),s=r.unproject(o);super(i,Object.assign({point:o,lngLat:s,originalEvent:a}
111,n)),this._defaultPrevented=!1,this.target=r}}class sv extends i.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,n){const o="touchend"===r?n.changedTouches:n.touches,s=C(a.getCanvasContainer(),o),l=s.map(i=>a.unproject(i)),h=s.reduce((i,r,a,n)=>i.add(r.div(n.length)),new i.au(0,0));super(r,{points:s,point:h,lngLats:l,lngLat:a.unproject(h),originalEvent:n}),this._defaultPrevented=!1}}class sb extends i.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class sw{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new sb(this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new sx(i.type,this._map,i))}mouseup(i){this._map.fire(new sx(i.type,this._map,i))}preclick(i){let r=new MouseEvent("preclick",i);this._map.fire(new sx(r.type,this._map,r))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new sx(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new sx(i.type,this._map,i))}mouseover(i){this._map.fire(new sx(i.type,this._map,i))}mouseout(i){this._map.fire(new sx(i.type,this._map,i))}touchstart(i){return this._firePreventable(new sv(i.type,this._map,i))}touchmove(i){this._map.fire(new sv(i.type,this._map,i))}touchend(i){this._map.fire(new sv(i.type,this._map,i))}touchcancel(i){this._map.fire(new sv(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sT{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new sx(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new sx("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new sx(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class sS{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(S(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;let a=this._startPos,n=this._lastPos;if(!a||!n||n.equals(r)||!this._box&&r.dist(a)<this._clickTolerance)return;this._lastPos=r,this._box||(this._box=v("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let o=Math.min(a.x,r.x),s=Math.max(a.x,r.x),l=Math.min(a.y,r.y),h=Math.max(a.y,r.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${l}px)`,this._box.style.width=s-o+"px",this._box.style.height=h-l+"px")})}mouseupWindow(r,a){if(!this._active)return;let n=this._startPos;if(n&&0===r.button){if(this.reset(),A(),n.x!==a.x||n.y!==a.y)return this._map.fire(new i.x("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(n,a,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),E(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new i.x(r,{originalEvent:a}))}}function sE(i,r){let a={};for(let n=0;n<i.length;n++)a[i[n].identifier]=r[n];return a}class sI{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,a,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=r.timeStamp),n.length===this.numTouches&&(this.centroid=function(r){let a=new i.au(0,0);for(let i of r)a._add(i);return a.div(r.length)}(a),this.touches=sE(n,a)))}touchmove(i,r,a){if(this.aborted||!this.centroid)return;let n=sE(a,r);for(let i in this.touches){let r=n[i];(!r||r.dist(this.touches[i])>30)&&(this.aborted=!0)}}touchend(i,r,a){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===a.length){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}}class sA{constructor(i){this.singleTap=new sI(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,r,a){this.singleTap.touchstart(i,r,a)}touchmove(i,r,a){this.singleTap.touchmove(i,r,a)}touchend(i,r,a){let n=this.singleTap.touchend(i,r,a);if(n){let r=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(n);if(r&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class sM{constructor(){this._zoomIn=new sA({numTouches:1,numTaps:2}),this._zoomOut=new sA({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,a){this._zoomIn.touchstart(i,r,a),this._zoomOut.touchstart(i,r,a)}touchmove(i,r,a){this._zoomIn.touchmove(i,r,a),this._zoomOut.touchmove(i,r,a)}touchend(i,r,a){let n=this._zoomIn.touchend(i,r,a),o=this._zoomOut.touchend(i,r,a);return n?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(n)},{originalEvent:i})}):o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(o)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let sC={0:1,2:2},sD={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class sR{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;let a=D(i);this._correctButton(i,a)&&(this._lastPoint=r,this._eventButton=a)}mousemoveWindow(i,r){let a=this._lastPoint;if(a){let n;if(i.preventDefault(),null!=this._eventButton&&(n=sC[this._eventButton],void 0===i.buttons||(i.buttons&n)!==n))this.reset();else if(this._moved||!(r.dist(a)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(a,r)}}mouseupWindow(i){this._lastPoint&&D(i)===this._eventButton&&(this._moved&&A(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sP extends sR{mousedown(i,r){super.mousedown(i,r),this._lastPoint&&(this._active=!0)}_correctButton(i,r){return 0===r&&!i.ctrlKey}_move(i,r){return{around:r,panDelta:r.sub(i)}}}class sL extends sR{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?sD[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=.8*(r.x-i.x);if(a)return this._active=!0,{bearingDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class sz extends sR{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?sD[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=-.5*(r.y-i.y);if(a)return this._active=!0,{pitchDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class sO{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),i.bs(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.au(0,0)}touchstart(i,r,a){return this._calculateTransform(i,r,a)}touchmove(r,a,n){if(this._active&&!(n.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===n.length&&!i.dA())return void this._showTouchPanBlockerAlert();
111"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,a,n)}}touchend(i,r,a){this._calculateTransform(i,r,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,n){n.length>0&&(this._active=!0);let o=sE(n,a),s=new i.au(0,0),l=new i.au(0,0),h=0;for(let i in o){let r=o[i],a=this._touches[i];a&&(s._add(r),l._add(r.sub(a)),h++,o[i]=r)}if(this._touches=o,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=v("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class sF{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,r,a){return{}}touchstart(i,r,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,a){let n=this._firstTwoTouches;if(!n)return;i.preventDefault();let[o,s]=n,l=sB(a,r,o),h=sB(a,r,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,i)}touchend(i,r,a){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,s=sB(a,r,n),l=sB(a,r,o);s&&l||(this._active&&A(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function sB(i,r,a){for(let n=0;n<i.length;n++)if(i[n].identifier===a)return r[n]}function sk(i,r){return Math.log2(i/r)}class sN extends sF{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,r){let a=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(.1>Math.abs(sk(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:sk(this._distance,a),pinchAround:r}}}function sU(i,r){return 180*i.angleWith(r)/Math.PI}class sV extends sF{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){let a=this._vector;if(this._vector=i[0].sub(i[1]),a&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:sU(this._vector,a),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let r=25/(Math.PI*this._minDiameter)*360,a=this._startVector;return!!a&&Math.abs(sU(i,a))<r}}function sj(i){return Math.abs(i.y)>Math.abs(i.x)}class sG extends sF{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,sj(i[0].sub(i[1]))&&(this._valid=!1)}_move(r,a,n){let o=this._lastPoints;if(!o)return;let s=r[0].sub(o[0]),l=r[1].sub(o[1]);return this._map._cooperativeGestures&&!i.dA()&&n.touches.length<3||(this._val
111id=this.gestureBeginsVertically(s,l,n.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:-((s.y+l.y)/2*.5)})}gestureBeginsVertically(i,r,a){if(void 0!==this._valid)return this._valid;let n=i.mag()>=2,o=r.mag()>=2;if(!n&&!o)return;if(!n||!o)return null==this._firstMove&&(this._firstMove=a),a-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return sj(i)&&sj(r)&&s}}let sH=100,sq=15,s$=10;class sZ{constructor(){this._panStep=sH,this._bearingStep=sq,this._pitchStep=s$,this._rotationDisabled=!1,this._panDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,a=0,n=0,o=0,s=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?a=-1:(i.preventDefault(),o=-1);break;case 39:i.shiftKey?a=1:(i.preventDefault(),o=1);break;case 38:i.shiftKey?n=1:(i.preventDefault(),s=-1);break;case 40:i.shiftKey?n=-1:(i.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(a=0,n=0),this._panDisabled&&(o=0,s=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:sW,zoom:r?Math.round(h)+r*(i.shiftKey?2:1):h,bearing:l.getBearing()+a*this._bearingStep,pitch:l.getPitch()+n*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.getCenter()},{originalEvent:i})}}}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}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}}function sW(i){return i*(2-i)}let sX=1/450,sY=/(Mac|iPad)/i;class sK{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=sX,i.bs(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||i.dA()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,n=i.co.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==a&&a%4.000244140625==0?this._type="wheel":0!==a&&4>Math.abs(a)?this._type="trackpad":o>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(o*a)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){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 r=M(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let r=this._map.transform;"wheel"===this._type&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);let o=a(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(l*n))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let n="number"==typeof this._targetZoom?this._targetZoom:a(),o=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&o&&s){let r=Math.min((i.co.now()-this._lastWheelEventTime)/200,1),a=s(r);l=i.dY(o,n,a),r<1?this._frameId||(this._frameId=!0):h=!0}else l=n,h=!0;this._active=!0,h&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
111{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let u=l-a();return u*this._lastDelta<0&&(u=0),{noInertia:!0,needsRenderFrame:!h,zoomDelta:u,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=i.ca;if(this._prevEase){let r=this._prevEase,n=(i.co.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);a=i.fV(s,l,.25,1)}return this._prevEase={start:i.co.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=v("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=sY.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class sJ{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 sQ{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(i.shiftKey?-1:1),around:a.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class s0{constructor(){this._tap=new sA({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,r,a){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=r[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(i,r,a))}touchmove(i,r,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;let n=r[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,i.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(i,r,a)}touchend(i,r,a){this._tapTime?this._swipePoint&&0===a.length&&this.reset():this._tap.touchend(i,r,a)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class s1{constructor(i,r,a){this._el=i,this._mousePan=r,this._touchPan=a}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class s2{constructor(i,r,a){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=a,this._pitchDisabled=!1}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._pitchDisabled||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mouseRotate.isEnabled()&&this._mousePitch.enable()}}class s3{constructor(i,r,a,n){this._el=i,this._touchZoom=r,this._touchRotate=a,this._tapDragZoom=n,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoomDisabled||this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&(this._tapDragZoomDisabled||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()}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}}let s4=i=>i.zoom||i.drag||i.pitch||i.rotate;class s5 extends i.x{}class s6{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){let n=i.fx([],a,r);this.radius=i.dW(n[2]<0?i.c6([],n,this.constants):[n[0],n[1],0])}projectRay(r){i.c6(r,r,this.constants),i.ex(r,r),i.ep(r,r,this.constants);let a=i.fa([],r,this.radius);if(a[2]>0){let r=i.fa([],[0,0,1],i.c7(a,[0,0,1])),n=i.fa([],i.ex([],[a[0],a[1],0]),this.radius),o=i.bj([],a,i.fa([],i.fx([],i.bj([],n,r),a),2));a[0]=o[0],a[1]=o[1]}return a}}function s8(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class s9{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new s_(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new s6,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),i.bs(["handleEvent","handleWindowEvent"],this);const n=this._el;for(const[i,r,a]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){const n=i===document?this.handleWindowEvent:this.handleEvent;i.addEventListener(r,n,a)}}destroy(){for(let[i,r,a]of this._listeners){let n=i===document?this.handleWindowEvent:this.handleEvent;i.removeEventListener(r,n,a)}}_addDefaultHandlers(i){let r=this._map,a=r.getCanvasContainer();this._add("mapEvent",new sw(r,i));let n=r.boxZoom=new sS(r,i);this._add("boxZoom",n);let o=new sM,s=new sQ;r.doubleClickZoom=new sJ(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new s0;this._add("tapDragZoom",l);let h=r.touchPitch=new sG(r);this._add("touchPitch",h);let u=new sL(i),c=new sz(i);r.dragRotate=new s2(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new sP(i),f=new sO(r,i);r.dragPan=new s1(a,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]);let p=new sV,m=new sN;r.touchZoomRotate=new s3(a,m,p,l),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new sT(r));let _=r.scrollZoom=new sK(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new sZ;for(let a of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[a]&&r[a].enable(i[a])}_add(i,r,a){this._handlers.push({handlerName:i,handler:r,allowed:a}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!s4(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,r,a){for(let n in i)if(!(n===a||r&&r.includes(n)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let r=[];for(let a of i)this._el.contains(a.target)&&r.push(a);return r}handleEvent(i,r){this._updatingCamera=!0;let a="renderFrame"===i.type,n=a?void 0:i,o={needsRenderFrame:!1},s={},l={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?C(this._el,h):a?void 0:M(this._el,i);for(let{handlerName:a,handler:c,allowed:d}of this._handlers){let f;c.isEnabled()&&(this._blockedByActive(l,d,a)?c.reset():c[r||i.type]&&(f=c[r||i.type](i,u,h),this.mergeHandlerResult(o,s,f,a,n),f&&f.needsRenderFrame&&this._triggerRe
111nderFrame()),(f||c.isActive())&&(l[a]=c))}let c={};for(let i in this._previousActiveHandlers)l[i]||(c[i]=n);this._previousActiveHandlers=l,(Object.keys(c).length||s8(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||s8(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=o;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;Object.assign(i,a);let s={handlerName:n,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(r.zoom=s),void 0!==a.panDelta&&(r.drag=s),void 0!==a.pitchDelta&&(r.pitch=s),void 0!==a.bearingDelta&&(r.rotate=s)}_applyChanges(){let r={},a={},n={};for(let[o,s,l]of this._changes)o.panDelta&&(r.panDelta=(r.panDelta||new i.au(0,0))._add(o.panDelta)),o.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(r.around=o.around),void 0!==o.aroundCoord&&(r.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(r.pinchAround=o.pinchAround),o.noInertia&&(r.noInertia=o.noInertia),Object.assign(a,s),Object.assign(n,l);this._updateMapTransform(r,a,n),this._changes=[]}_updateMapTransform(r,a,n){let o,s=this._map,l=s.transform,h=i=>[i.x,i.y,i.z];if((o=this._eventsInProgress.drag)&&!this._handlersById[o.handlerName].isActive()&&!s8(r)){let i=l.zoom;l.cameraElevationReference="sea",null!=this._originalZoom&&l._orthographicProjectionAtLowPitch&&"globe"!==l.projection.name&&0===l.pitch?(l.cameraElevationReference="ground",l.zoom=this._originalZoom):(l.recenterOnTerrain(),l.cameraElevationReference="ground"),i!==l.zoom&&this._map._update(!0)}if(l._isCameraConstrained&&s._stop(!0),!s8(r))return void this._fireEvents(a,n,!0);let{panDelta:u,zoomDelta:c,bearingDelta:d,pitchDelta:f,around:p,aroundCoord:m,pinchAround:_}=r;l._isCameraConstrained&&(c>0&&(c=0),l._isCameraConstrained=!1),void 0!==_&&(p=_),(c||a.drag&&!this._eventsInProgress.drag)&&p&&(this._dragOrigin=h(l.pointCoordinate3D(p)),this._originalZoom=l.zoom,this._trackingEllipsoid.setup(l._camera.position,this._dragOrigin)),l.cameraElevationReference="sea",s._stop(!0),p=p||s.transform.centerPoint,d&&(l.bearing+=d),f&&(l.pitch+=f),l._updateCameraState();let g=[0,0,0];if(u)if("mercator"===l.projection.name){let i=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(p).dir),r=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(p.sub(u)).dir);g[0]=r[0]-i[0],g[1]=r[1]-i[1]}else{let r=l.pointCoordinate(p);if("globe"===l.projection.name){u=u.rotate(-l.angle);let a=l._pixelsPerMercatorPixel/l.worldSize;g[0]=-u.x*i.ej(i.dT(r.y))*a,g[1]=-u.y*i.ej(l.center.lat)*a}else{let i=l.pointCoordinate(p.sub(u));r&&i&&(g[0]=i.x-r.x,g[1]=i.y-r.y)}}let y=l.zoom,x=[0,0,0];if(c){let r=h(m||l.pointCoordinate3D(p)),a={dir:i.ex([],i.fx([],r,l._camera.position))};if(a.dir[2]<0){let n=l.zoomDeltaToMovement(r,c);i.fa(x,a.dir,n)}}let v=i.bj(g,g,x);l._translateCameraConstrained(v),c&&Math.abs(l.zoom-y)>1e-4&&l.recenterOnTerrain(),l.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,n,!0)}_fireEvents(r,a,n){let o,s=s4(this._eventsInProgress),l=s4(r),h={};for(let i in r){let{originalEvent:a}=r[i];this._eventsInProgress[i]||(h[`${i}start`]=a),this._eventsInProgress[i]=r[i]}for(let i in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(i,h[i]);for(let i in l&&this._fireEvent("move",l.originalEvent),r){let{originalEvent:a}=r[i];this._fireEvent(i,a)}let u={};for(let i in this._eventsInProgress){let{handlerName:r,originalEvent:n}=this._eventsInProgress[i];this._handlersById[r].isActive()||(delete this._eventsInProgress[i],o=a[r]||n,u[`${i}end`]=o)}for(let i in u)this._fireEvent(i,u[i]);let c=s4(this._eventsInProgress);if(n&&(s||l)&&!c){this._updatingCamera=!0;let r=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),a=i=>0!==i&&-this._bearingSnap<i&&i<this._bearingSnap;r?(a(r.bearing||this._map.getBearing())&&(r.bearing=0),this._map.easeTo(r,{originalEvent:o})):(this._map.fire(new i.x("moveend",{originalEvent:o})),a(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new i.x(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new s5("renderFrame",{timeStamp:i})),this._applyChanges()})}
111_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let s7="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class le extends i.y{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=!1!==a.respectPrefersReducedMotion,i.bs(["_renderFrameCallback"],this)}getCenter(){return new i.ab(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,a,n){return r=i.au.convert(r).mult(-1),this.panTo(this.transform.center,Object.assign({offset:r},a),n)}panTo(i,r,a){return this.easeTo(Object.assign({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(i,r,a){return this.easeTo(Object.assign({zoom:i},r),a)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(i,r,a){return this.easeTo(Object.assign({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,Object.assign({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(i,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,r):this}getPitch(){return this.transform.pitch}setPitch(i,r){return this.jumpTo({pitch:i},r),this}cameraForBounds(r,a){r=i.ac.convert(r);let n=a&&a.bearing||0,o=a&&a.pitch||0,s=r.getNorthWest(),l=r.getSouthEast();return this._cameraForBounds(this.transform,s,l,n,o,a)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?Object.assign({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:Object.assign({},r,i)}_extendCameraOptions(i){return(i=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(i,r){let a=r.max[0]-r.min[0],n=r.max[1]-r.min[1];return a/n>i.aspect?a/(2*Math.tan(.5*i.fovX)*i.aspect):n/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(r,a,n,o,s,l){let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.ab.convert(a),d=i.ab.convert(n),f=.5*(c.lat+d.lat),p=.5*(c.lng+d.lng),m=i.dU(f,p),_=i.ex([],m),g=i.ex([],i.c1([],_,[0,1,0])),y=i.c1([],g,_),x=[g[0],g[1],g[2],0,y[0],y[1],y[2],0,_[0],_[1],_[2],0,0,0,0,1],v=[m,i.dU(c.lat,c.lng),i.dU(d.lat,c.lng),i.dU(d.lat,d.lng),i.dU(c.lat,d.lng),i.dU(f,c.lng),i.dU(f,d.lng),i.dU(c.lat,p),i.dU(d.lat,p)],b=i.A.fromPoints(v.map(r=>[i.c7(g,r),i.c7(y,r),i.c7(_,r)])),w=i.fL([],b.center,x);0===i.fu(w)&&i.ff(w,0,0,1),i.ex(w,w),i.fa(w,w,i.P),h.center=i.cd(w);let T=h.getWorldToCameraMatrix(),S=i.dr(new Float64Array(16),T);b=i.A.applyTransform(b,i.er([],T,x));let E=this._extendAABB(b,h,u,o);if(!E)return void i.f_("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=E,i.fL(w,w,T);let I=.5*(b.max[2]-b.min[2]),A=this._minimumAABBFrustumDistance(h,b),M=i.fa([],[0,0,1],I),C=i.bj(M,w,M),D=A+(0===h.pitch?0:i.c5(w,C)),R=h.globeCenterInViewSpace,P=i.fx([],w,[R[0],R[1],R[2]]);i.ex(P,P),i.fa(P,P,D);let L=i.bj([],w,P);i.fL(L,L,S);let z=i.c9/i.P,O=i.dW(L),F=i.em(Math.max(O*z-i.c9,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(F),u.maxZoom);return B>.5*(i.S+i.R)?(h.setProjection({name:"mercator"}),h.zoom=B,this._cameraForBounds(h,a,n,o,s,l)):{center:h.center,zoom:B,bearing:o,pitch:s}}_extendAABB(r,a,n,o){let s=.5*((n.padding.left||0)+(n.padding.right||0)),l=.5*((n.padding.top||0)+(n.padding.bottom||0)),h=a.width-(s+s),u=a.height-(l+l),c=i.fx([],r.max,r.min),d=Math.min(h/c[0],u/c[1]),f=Math.min(a.scaleZoom(a.scale*d),n.maxZoom);if(isNaN(f))return null;let p=a.scale/a.zoomScale(f),m=new i.A([r.min[0]-s*p,r.min[1]-l*p,r.min[2]],[r.max[0]+s*p,r.max[1]+l*p,r.max[2]]),_=("number"==typeof n.offset.x&&"number"==typeof n.offset.y?new i.au(n.offset.x,n.offset.y):i.au.convert(n.offset)).rotate(-i.c4(o));return m.center[0]-=_.x*p,m.center[1]+=_.y*p,m}queryTerrainElevation(r,a){let n=this.transform.elevation;return n?(a=Object.assign({},{exaggerated:!0},a),n.getAtPoint(i.ag.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,n,o,s,l){if("globe"===r.projection.name)return this._cameraForBoundsOnGlobe(r,a,n,o,s,l);let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.ab.convert(a),d=i.ab.convert(n),f=new i.ab(c.lng,d.lat),p=new i.ab(d.lng,c.lat),m=h.project(c),_=h.project(d),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(f),v=this.queryTerrainElevation(p),b=[[m.x,m.y,Math.min(g||0,y||0,x||0,v||0)],[_.x,_.y,Math.max(g||0,y||0,x||0,v||0)]],w=i.A.fromPoints(b),T=h.getWorldToCameraMatrix(),S=i.dr(new Float64Array(16),T);
111w=i.A.applyTransform(w,T);let E=this._extendAABB(w,h,u,o);if(!E)return void i.f_("Map cannot fit within canvas with the given bounds, padding, and/or offset.");w=E;let I=.5*i.fx([],w.max,w.min)[2],A=this._minimumAABBFrustumDistance(h,w),M=[0,0,1,0];i.fM(M,M,T),i.ez(M,M);let C=i.fa([],M,A+I),D=i.bj([],w.center,C);i.fL(w.center,w.center,S),i.fL(D,D,S);let R=h.unproject(new i.au(w.center[0],w.center[1])),P=Math.pow(2,i.dc(h.projection,R)),L=Math.min(h._zoomFromMercatorZ(D[2]*h.pixelsPerMeter*P/h.worldSize),u.maxZoom);return h.mercatorFromTransition&&L<.5*(i.S+i.R)?(h.setProjection({name:"globe"}),h.zoom=L,this._cameraForBounds(h,a,n,o,s,l)):{center:R,zoom:L,bearing:o,pitch:s}}fitBounds(i,r,a){let n=this.cameraForBounds(i,r);return this._fitInternal(n,r,a)}fitScreenCoordinates(r,a,n,o,s){let l=i.au.convert(r),h=i.au.convert(a),u=new i.au(Math.min(l.x,h.x),Math.min(l.y,h.y)),c=new i.au(Math.max(l.x,h.x),Math.max(l.y,h.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(l,h))return this;let d=this.transform.pointLocation3D(u),f=this.transform.pointLocation3D(c),p=this.transform.pointLocation3D(new i.au(u.x,c.y)),m=this.transform.pointLocation3D(new i.au(c.x,u.y)),_=[Math.min(d.lng,f.lng,p.lng,m.lng),Math.min(d.lat,f.lat,p.lat,m.lat)],g=[Math.max(d.lng,f.lng,p.lng,m.lng),Math.max(d.lat,f.lat,p.lat,m.lat)],y=o&&o.pitch?o.pitch:this.getPitch(),x=this._cameraForBounds(this.transform,_,g,n,y,o);return this._fitInternal(x,o,s)}_fitInternal(i,r,a){return i?(r=Object.assign(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(r,a){this.stop();let n=r.preloadOnly?this.transform.clone():this.transform,o=!1,s=!1,l=!1;"zoom"in r&&n.zoom!==+r.zoom&&(o=!0,n.zoom=+r.zoom),void 0!==r.center&&(n.center=i.ab.convert(r.center)),"bearing"in r&&n.bearing!==+r.bearing&&(s=!0,n.bearing=+r.bearing),"pitch"in r&&n.pitch!==+r.pitch&&(l=!0,n.pitch=+r.pitch);let h="number"==typeof r.padding?this._extendPadding(r.padding):r.padding;
111if(null!=r.padding&&!n.isPaddingEqual(h))if(!1===r.retainPadding){let i=n.clone();i.padding=h,n.setLocationAtPoint(n.center,i.centerPoint)}else n.padding=h;return r.preloadOnly?(this._preloadTiles(n),this):(this.fire(new i.x("movestart",a)).fire(new i.x("move",a)),o&&this.fire(new i.x("zoomstart",a)).fire(new i.x("zoom",a)).fire(new i.x("zoomend",a)),s&&this.fire(new i.x("rotatestart",a)).fire(new i.x("rotate",a)).fire(new i.x("rotateend",a)),l&&this.fire(new i.x("pitchstart",a)).fire(new i.x("pitch",a)).fire(new i.x("pitchend",a)),this.fire(new i.x("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.f_(s7),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){let n=this.transform;if(!n.projection.supportsFreeCamera)return i.f_(s7),this;this.stop();let o=n.zoom,s=n.pitch,l=n.bearing;n.setFreeCameraOptions(r);let h=o!==n.zoom,u=s!==n.pitch,c=l!==n.bearing;return this.fire(new i.x("movestart",a)).fire(new i.x("move",a)),h&&this.fire(new i.x("zoomstart",a)).fire(new i.x("zoom",a)).fire(new i.x("zoomend",a)),c&&this.fire(new i.x("rotatestart",a)).fire(new i.x("rotate",a)).fire(new i.x("rotateend",a)),u&&this.fire(new i.x("pitchstart",a)).fire(new i.x("pitch",a)).fire(new i.x("pitchend",a)),this.fire(new i.x("moveend",a)),this}easeTo(r,a){let n,o,s,l,h;this._stop(!1,r.easeId),(!1===(r=Object.assign({offset:[0,0],duration:500,easing:i.ca},r)).animate||this._prefersReducedMotion(r))&&(r.duration=0);let u=this.transform,c=this.getZoom(),d=this.getBearing(),f=this.getPitch(),p=this.getPadding(),m="zoom"in r?+r.zoom:c,_="bearing"in r?this._normalizeBearing(r.bearing,d):d,g="pitch"in r?+r.pitch:f,y=this._extendPadding(r.padding),x=i.au.convert(r.offset);if("globe"===u.projection.name){let a=i.ag.fromLngLat(u.center),l=x.rotate(-u.angle);a.x+=l.x/u.worldSize,a.y+=l.y/u.worldSize;let h=a.toLngLat(),c=i.ab.convert(r.center||h);this._normalizeCenter(c),n=u.centerPoint.add(l),o=new i.au(a.x,a.y).mult(u.worldSize),s=new i.au(i.ek(c.lng),i.el(c.lat)).mult(u.worldSize).sub(o)}else{n=u.centerPoint.add(x);let a=u.pointLocation(n),l=i.ab.convert(r.center||a);this._normalizeCenter(l),o=u.project(a),s=u.project(l).sub(o)}let v=u.zoomScale(m-c);r.around&&(l=i.ab.convert(r.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||d!==_,T=this._pitching||g!==f,S=!u.isPaddingEqual(y),E=!1===r.retainPadding?u.clone():u,I=u=>I=>{if(b&&(u.zoom=i.dY(c,m,I)),w&&(u.bearing=i.dY(d,_,I)),T&&(u.pitch=i.dY(f,g,I)),S&&(E.interpolatePadding(p,y,I),n=E.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=Math.pow(m>c?Math.min(2,v):Math.max(.5,v),1-I),a=u.unproject(o.add(s.mult(I*r)).mult(i));u.setLocationAtPoint(u.renderWorldCopies?a.wrap():a,n)}return r.preloadOnly||this._fireMoveEvents(a),u};if(r.preloadOnly){let i=this._emulate(I,r.duration,u);return this._preloadTiles(i),this}let A={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=S,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,A),this._ease(I(u),i=>{"sea"===u.cameraElevationReference&&u.recenterOnTerrain(),this._afterEase(a,i)},r),this}_prepareEase(r,a,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),a||n.moving||this.fire(new i.x("movestart",r)),this._zooming&&!n.zooming&&this.fire(new i.x("zoomstart",r)),this._rotating&&!n.rotating&&this.fire(new i.x("rotatestart",r)),this._pitching&&!n.pitching&&this.fire(new i.x("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.x("move",r)),this._zooming&&this.fire(new i.x("zoom",r)),this._rotating&&this.fire(new i.x("rotate",r)),this._pitching&&this.fire(new i.x("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let n=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new i.x("zoomend",r)),o&&this.fire(new i.x("rotateend",r)),s&&this.fire(new i.x("pitchend",r)),this.fire(new i.x("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){let n=i.eF(r,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(n,a)}this.stop(),r=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.ca},r);let n=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.bG(+r.zoom,n.minZoom,n.maxZoom):o,c="bearing"in r?this._normalizeBearing(r.bearing,s):s,d="pitch"in r?+r.pitch:l,f=this._extendPadding(r.padding),p=n.zoomScale(u-o),m=i.au.convert(r.offset),_=n.centerPoint.add(m),g=n.pointLocation(_),y=i.ab.convert(r.center||g);this._normalizeCenter(y);let x=n.project(g),v=n.project(y).sub(x),b=r.curve,w=Math.max(n.width,n.height),T=w/p,S=v.mag();
111if("minZoom"in r){let a=i.bG(Math.min(r.minZoom,o,u),n.minZoom,n.maxZoom);b=Math.sqrt(w/n.zoomScale(a-o)/S*2)}let E=b*b;function I(i){let r=(T*T-w*w+(i?-1:1)*E*E*S*S)/(2*(i?T:w)*E*S);return Math.log(Math.sqrt(r*r+1)-r)}function A(i){return(Math.exp(i)-Math.exp(-i))/2}function M(i){return(Math.exp(i)+Math.exp(-i))/2}let C=I(0),D=function(i){return M(C)/M(C+b*i)},R=function(i){var r;return w*((M(C)*(A(r=C+b*i)/M(r))-A(C))/E)/S},P=(I(1)-C)/b;if(1e-6>Math.abs(S)||!isFinite(P)){if(1e-6>Math.abs(w-T))return this.easeTo(r,a);let i=T<w?-1:1;P=Math.abs(Math.log(T/w))/b,R=function(){return 0},D=function(r){return Math.exp(i*b*r)}}r.duration="duration"in r?+r.duration:1e3*P/("screenSpeed"in r?r.screenSpeed/b:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let L=s!==c,z=d!==l,O=!n.isPaddingEqual(f),F=!1===r.retainPadding?n.clone():n,B=n=>p=>{let g=p*P,b=1/D(g);n.zoom=1===p?u:o+n.scaleZoom(b),L&&(n.bearing=i.dY(s,c,p)),z&&(n.pitch=i.dY(l,d,p)),O&&(F.interpolatePadding(h,f,p),_=F.centerPoint.add(m));let w=1===p?y:n.unproject(x.add(v.mult(R(g))).mult(b));return n.setLocationAtPoint(n.renderWorldCopies?w.wrap():w,_),n._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),n};if(r.preloadOnly){let i=this._emulate(B,r.duration,n);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=L,this._pitching=z,this._padding=O,this._prepareEase(a,!1),this._ease(B(n),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,r)}if(!i){let i=this.handlers;i&&i.stop(!1)}return this}_ease(r,a,n){!1===n.animate||0===n.duration?(r(1),a()):(this._easeStart=i.co.now(),this._easeOptions=n,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.co.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){let n=Math.abs((r=i.f$(r,-180,180))-a);return Math.abs(r-360-a)<n&&(r-=360),Math.abs(r+360-a)<n&&(r+=360),r}_normalizeCenter(i){let r=this.transform;if(r.maxBounds||"globe"!==r.projection.name&&!r.renderWorldCopies)return;let a=i.lng-r.center.lng;i.lng+=a>180?-360:360*(a<-180)}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&i.co.prefersReducedMotion&&!(r&&r.essential)}_emulate(i,r,a){let n=Math.ceil(15*r/1e3),o=[],s=i(a.clone());for(let i=0;i<=n;i++){let r=s(i/n);o.push(r.clone())}return o}_preloadTiles(i,r){}}let lt=/^(https?:|mailto:)/i;class li{constructor(r={}){this.options=r,i.bs(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){let r=this.options&&this.options.compact,a=i._getUIString("AttributionControl.ToggleAttribution");this._map=i,this._container=v("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=v("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",a);let n=v("span","mapboxgl-ctrl-icon",this._compactButton);return n.setAttribute("aria-hidden","true"),n.setAttribute("title",a),this._innerContainer=v("div","mapboxgl-ctrl-attrib-inner",this._container),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===r&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
111se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));let a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.bN.ACCESS_TOKEN}];if(r){let n=a.reduce((i,r,n)=>(r.value&&(i+=`${r.key}=${r.value}${n<a.length-1?"&":""}`),i),"?");r.href=`${i.bN.FEEDBACK_URL}/${n}#${su(this._map,!0)}`,r.rel="noopener nofollow"}}_updateData(i){i&&("source"===i.dataType&&("metadata"===i.sourceDataType||"visibility"===i.sourceDataType)||"style"===i.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style._mergedSourceCaches;for(let a in r){let n=r[a];if(n.used){let r=n.getSource();r.attribution&&!i.includes(r.attribution)&&i.push(r.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,a)=>{for(let n=a+1;n<i.length;n++)if(i[n].includes(r))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));let a=i.map(i=>{let r;return Array.from((r=(new DOMParser).parseFromString(i,"text/html")).body.querySelectorAll("*")).reverse().forEach(i=>{let a=i.textContent||"";if("A"!==i.tagName)return void i.replaceWith(...i.childNodes);let n=i.getAttribute("href");if(!n||!lt.test(n))return void i.replaceWith(r.createTextNode(a));let o=r.createElement("a");o.href=n,o.textContent=a,o.rel="noopener nofollow";let s=i.getAttribute("class");s&&(o.className=s),i.replaceWith(o)}),r.body.innerHTML}).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,i.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class lr{constructor(){i.bs(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=v("div","mapboxgl-ctrl");let r=v("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(let r in i){let a=i[r].getSource();if(Object.hasOwn(a,"mapbox_logo")&&!a.mapbox_logo)return!1}return!0}_updateCompact(){let i=this._container.children;if(i.length){let r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class la{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){let r=this._currentlyRunning;for(let a of r?this._queue.concat(r):this._queue)if(a.id===i)return void(a.cancelled=!0)}run(i=0){let r=this._currentlyRunning=this._queue;for(let a of(this._queue=[],r))if(!a.cancelled&&(a.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class ln{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let a=i.cb((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,a){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+a}}let lo={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class ls extends i.x{constructor(i,r,a,n){const{point:o,lngLat:s,originalEvent:l,target:h}=i;super(i.type,{point:o,lngLat:s,originalEvent:l,target:h}),this.preventDefault=()=>{i.preventDefault()},this.id=r,this.interaction=a,this.feature=n}}class ll{constructor(i){this.map=i,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
111add(r,a){if(this.typeById.has(r))throw Error(`Interaction id "${r}" already exists.`);let n=a.filter,o=a.type;n&&this.filters.set(r,i.bZ(n)),"mouseover"===o&&(o="mouseenter"),"mouseout"===o&&(o="mouseleave");let s=this.interactionsByType.get(o)||new Map;"mouseenter"===o||"mouseleave"===o?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(r,a)):0===s.size&&this.map.on(o,this.handleType),0===s.size&&this.interactionsByType.set(o,s),s.set(r,a),this.typeById.set(r,o)}get(i){let r=this.typeById.get(i);if(!r)return;let a=this.interactionsByType.get(r);return a?a.get(i):void 0}remove(i){let r=this.typeById.get(i);if(!r)return;this.typeById.delete(i),this.filters.delete(i);let a=this.interactionsByType.get(r);a&&(a.delete(i),"mouseenter"===r||"mouseleave"===r?(this.delegatedInteractions.delete(i),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===a.size&&this.map.off(r,this.handleType))}queryTargets(i,r){let a=[];for(let[i,n]of r)n.target&&a.push({targetId:i,target:n.target,filter:this.filters.get(i)});return this.map.style.queryRenderedTargets(i,a,this.map.transform)}handleMove(i){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;let r=this.queryTargets(i.point,Array.from(this.delegatedInteractions).reverse());r.length&&(i.type="mouseenter",this.handleType(i,r));let a=new Map;for(let[i,{feature:r}]of this.prevHoveredFeatures)this.hoveredFeatures.has(i)||a.set(r.id,r);a.size&&(i.type="mouseleave",this.handleType(i,Array.from(a.values())))}handleOut(i){let r=Array.from(this.hoveredFeatures.values()).map(({feature:i})=>i);r.length&&(i.type="mouseleave",this.handleType(i,r)),this.hoveredFeatures.clear()}handleType(r,a){let n="mouseenter"===r.type;if(n&&!this.interactionsByType.has(r.type))return void i.f_("mouseenter interaction required for mouseleave to work.");let o=Array.from(this.interactionsByType.get(r.type)).reverse(),s=!!a;a=a||this.queryTargets(r.point,o);let l=!1,h=new Set;for(let u of a){for(let[a,c]of o){if(!c.target)continue;let o=u.variants?u.variants[a]:null;if(o){for(let d of o){if(aL(d,u,h,a))continue;let o=new i.aZ(u,d),f=aP(d,u,a);s&&void 0!==o.id&&(o.state=this.map.getFeatureState(o));let p=n?this.prevHoveredFeatures.get(f):null,m=new ls(r,a,c,o),_=p?p.stop:c.handler(m);if(n&&this.hoveredFeatures.set(f,{feature:u,stop:_}),!1!==_){l=!0;break}}if(l)break}}if(l)break}if(!l)for(let[i,a]of o){let{handler:n,target:o}=a;if(!o&&!1!==n(new ls(r,i,a,null)))break}}}let lh=/matrix.*\((.+)\)/,lu={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},lc={showCompass:!0,showZoom:!0,visualizePitch:!1};class ld{constructor(r,a,n=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new sL({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,n&&(this.mousePitch=new sz({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bs(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),S()}move(i,r){let a=this.map,n=this.mouseRotate.mousemoveWindow(i,r),o=n&&n.bearingDelta;if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){let n=this.mousePitch.mousemoveWindow(i,r),o=n&&n.pitchDelta;o&&a.setPitch(a.getPitch()+o)}}off(){let i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){E(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(Object.assign({},i,{button:i.button,type:i.type,ctrlKey:!0,preventDefault:()=>i.preventDefault()}),M(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,M(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=C(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=C(this.element,i.targetTouches)[0],this.move({buttons:1,preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&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 lf(r,a,n){if(r=new i.ab(r.lng,r.lat),a){let o=new i.ab(r.lng-360,r.lat),s=new i.ab(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-n.center.lng)/360),h=n.locationPoint3D(r).distSqr(a),u=a.x<0||a.y<0||a.x>n.width||a.y>n.height;n.locationPoint3D(o).distSqr(a)<h&&(u||Math.abs(o.lng-n.center.lng)<l)?r=o:n.locationPoint3D(s).distSqr(a)<h&&(u||Math.abs(s.lng-n.center.lng)<l)&&(r=s)}for(;Math.abs(r.lng-n.center.lng)>180;){let i=n.locationPoint3D(r);if(i.x>=0&&i.y>=0&&i.x<=n.width&&i.y<=n.height)break;r.lng>n.center.lng?r.lng-=360:r.lng+=360}return r}
111let lp={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%)"},lm=/\s+/,l_="auto",lg="auto";class ly extends i.y{constructor(r,a){super(),(r instanceof HTMLElement||a)&&(r=Object.assign({element:r},a)),i.bs(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:n="center",color:o="#3FB1CE",scale:s=1,draggable:l=!1,clickTolerance:h=0,rotation:u=0,rotationAlignment:c=l_,pitchAlignment:d=lg,occludedOpacity:f=.2,altitude:p=0}=r||{};this._anchor=n,this._color=o,this._scale=s,this._draggable=l,this._clickTolerance=h,this._rotation=u,this._rotationAlignment=c,this._pitchAlignment=d,this._occludedOpacity=f,this._altitude=p,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),r&&r.element?(this._element=r.element,this._offset=i.au.convert(r&&r.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.au.convert(r&&r.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const m=this._element.classList;for(const i in lp)m.remove(`mapboxgl-marker-anchor-${i}`);m.add(`mapboxgl-marker-anchor-${this._anchor}`),r&&r.className&&m.add(...r.className.trim().split(lm)),this._popup=null}_createDefaultMarker(){let i=v("div"),r=b("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);this._svgElement=r;let a=b("radialGradient",{id:"shadowGradient"},b("defs",{},r));b("stop",{offset:"10%","stop-opacity":.4},a),b("stop",{offset:"100%","stop-opacity":.05},a);let n=b("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=n,0===this._altitude&&r.insertBefore(n,r.firstChild),b("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),b("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),b("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),i}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){let i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.ab.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){if(i===this._altitude)return this;let r=this._altitude;return this._altitude=i||0,this._defaultMarker&&0===r!=(0===this._altitude)&&(0===this._altitude?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),this._update(),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
1110,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,i._marker=this,i._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(i){let r=i.code,a=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==a&&13!==a||this.togglePopup()}_onMapClick(i){let r=i.originalEvent.target,a=this._element;this._popup&&(r===a||a.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let i=this._map,r=this._pos;if(!i||!r)return!1;let a=i.unproject(r,this._altitude),n=i.getFreeCameraOptions();if(!n.position)return!1;let o=n.position.toLngLat();return o.distanceTo(a)<.9*o.distanceTo(this._lngLat)}_evaluateOpacity(){let r,a=this._map;if(!a)return;let n=this._pos;if(!n||n.x<0||n.x>a.transform.width||n.y<0||n.y>a.transform.height)return void this._clearFadeTimer();let o=a.unproject(n,this._altitude);a._showingGlobe()&&i.dE(a.transform,this._lngLat)?r=0:(r=1-a._queryFogOpacity(o),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let i=this._pos;if(!i||!this._map)return;let r=this._offset.mult(this._scale);this._element.style.transform=` 112 translate(${i.x}px,${i.y}px) 113 ${lp[this._anchor]} 114 ${this._calculateXYTransform()} ${this._calculateZTransform()} 115 translate(${r.x}px,${r.y}px) 116 `}_calculateXYTransform(){let r=this._pos,a=this._map,n=this.getPitchAlignment();if(!a||!r||"map"!==n)return"";if(!a._showingGlobe()){let i=a.getPitch();return i?`rotateX(${i}deg)`:""}let o=i.eX(i.dl(a.transform,this._lngLat)),s=r.sub(i.dd(a.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=o/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let r=this._pos,a=this._map;if(!a||!r)return"";let n=0,o=this.getRotationAlignment();if("map"===o)if(a._showingGlobe()){let r=a.project(new i.ab(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),o=a.project(new i.ab(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(r);n=i.eX(Math.atan2(o.y,o.x))-90}else n=-a.getBearing();else if("horizon"===o){let o=i.fq(4,6,a.getZoom()),s=i.dd(a.transform);s.y+=o*a.transform.height;let l=r.sub(s),h=i.eX(Math.atan2(l.y,l.x));n=(h>90?h-270:h+90)*(1-o)}return(n+=this._rotation)?`rotateZ(${n}deg)`:""}_update(i){cancelAnimationFrame(this._updateFrameId);let r=this._map;
116r&&(r.transform.renderWorldCopies&&(this._lngLat=lf(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat,this._altitude),!0===i?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),r._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=i.au.convert(r),this._update(),this}addClassName(i){return this._element.classList.add(i),this}removeClassName(i){return this._element.classList.remove(i),this}toggleClassName(i){return this._element.classList.toggle(i)}_onMove(r){let a=this._map;if(!a)return;let n=this._pointerdownPos,o=this._positionDelta;if(n&&o){if(!this._isDragging){let i=this._clickTolerance||a._clickTolerance;if(r.point.dist(n)<i)return;this._isDragging=!0}this._pos=r.point.sub(o),this._lngLat=a.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.x("dragstart"))),this.fire(new i.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.x("dragend")),this._state="inactive"}_addDragHandler(i){let r=this._map,a=this._pos;r&&a&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(a),this._pointerdownPos=i.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;let r=this._map;return r&&(i?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||l_,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||lg,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let lx={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},lv={maxWidth:100,unit:"metric"},lb={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},lw=/\s+/,lT={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0};function lS(r=new i.au(0,0),a="bottom"){if("number"==typeof r){let n=Math.round(Math.sqrt(.5*Math.pow(r,2)));switch(a){case"top":return new i.au(0,r);case"top-left":return new i.au(n,n);case"top-right":return new i.au(-n,n);case"bottom":return new i.au(0,-r);case"bottom-left":return new i.au(n,-n);case"bottom-right":return new i.au(-n,-n);case"left":return new i.au(r,0);case"right":return new i.au(-r,0)}return new i.au(0,0)}return r instanceof i.au||Array.isArray(r)?i.au.convert(r):i.au.convert(r[a]||[0,0])}let lE="u">typeof document?document.currentScript:null;return $=lE&&lE.src&&i.dF(lE.src)?"cdn":"other",{version:d,supported:function(i){let n,o;return!!("u">typeof window)&&!!("u">typeof document)&&!!Object.hasOwn&&((n=document.createElement("canvas")).width=n.height=1,!!(o=n.getContext("2d"))&&o.getImageData(0,0,1,1).width===n.width&&((i?(void 0===a&&(a=g(!0)),!!a):(void 0===r&&(r=g(!1)),!!r))||!1))},setRTLTextPlugin:i.fo,getRTLTextPluginStatus:i.d3,setSdkInfo:function(r){"string"!=typeof r||r.length>64||!q.test(r)?i.f_(`Invalid SDK info "${r}"; expected a "Name/version" string. Ignoring.`):o=r},addTileProvider:i.bm,Map:class extends le{constructor(r){p.mark(f.create);const a=r;if(null!=(r=Object.assign({},lu,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");r.antialias&&i.dO(window)&&(r.antialias=!1,i.f_("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new t8(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies,null,null),r),this._repaint=!!r.repaint,this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileC
116acheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._placementAlgorithm=r.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._collectResourceTiming=r.collectResourceTiming,this._language=this._parseLanguage(r.language),this._worldview=r.worldview,this._renderTaskQueue=new la,this._domRenderTaskQueue=new la,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.fU(),this._locale=Object.assign({},lo,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._performanceMetricsCollection=r.performanceMetricsCollection,this._tessellationStep=r.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=r.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ln(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=r.scaleFactor,this._requestManager=new k(r.transformRequest,r.accessToken,r.testMode);const n=G(r.accessToken||i.bN.ACCESS_TOKEN);if(n&&"atlas"in n&&"number"==typeof n.atlas&&(this._tokenExpiration=n.atlas),this._silenceAuthErrors=!!r.testMode,this._contextCreateOptions=r.contextCreateOptions?Object.assign({},r.contextCreateOptions):{},"string"==typeof r.container){const i=document.getElementById(r.container);if(!i)throw Error(`Container '${r.container.toString()}' not found.`);this._container=i}else{if(!(r.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.f_("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),r.maxBounds&&this.setMaxBounds(r.maxBounds),this._spriteFormat="auto",i.bs(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new s9(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,this._fontstackCompositing=r.fontstackCompositing,(r.style||!r.testMode)&&this.setStyle(r.style||i.bN.DEFAULT_STYLE,{config:r.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),r.projection&&this.setProjection(r.projection),r.hash&&(this._hash=new sh("string"==typeof r.hash&&r.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==a.center&&null==a.zoom||(this.transform._unmodified=!1),this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch});const i=r.bounds;i&&(this.resize(),this.fitBounds(i,Object.assign({},r.fitBoundsOptions,{duration:0})))}this.resize(),r.attributionControl&&this.addControl(new li({customAttribution:r.customAttribution})),this._logoControl=new lr,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.x(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.x(`${r.dataType}dataloading`,r))}),this._interactions=new ll(this)}_getMapId(){return this._mapId}addControl(r,a){if(void 0===a&&(a=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.v(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[a];return a.includes("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}
116removeControl(r){if(!r||!r.onRemove)return this.fire(new i.v(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let a=this._controls.indexOf(r);return a>-1&&this._controls.splice(a,1),r.onRemove(this),this}hasControl(i){return this._controls.includes(i)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));let a=!this._moving;return a&&this.fire(new i.x("movestart",r)).fire(new i.x("move",r)),this.fire(new i.x("resize",r)),a&&this.fire(new i.x("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.ac.convert(r)),this._update()}setMinZoom(r){if((r=r??-2)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()<r?this.setZoom(r):this.fire(new i.x("zoomstart")).fire(new i.x("zoom")).fire(new i.x("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if((r=r??22)>=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.x("zoomstart")).fire(new i.x("zoom")).fire(new i.x("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=r??0)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()<r?this.setPitch(r):this.fire(new i.x("pitchstart")).fire(new i.x("pitch")).fire(new i.x("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if((r=r??85)>85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.x("pitchstart")).fire(new i.x("pitch")).fire(new i.x("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(i){return this._scaleFactor=i,this.painter.scaleFactor=i,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(i=>"symbol"===i.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(i){return"auto"===i?navigator.language:Array.isArray(i)?0===i.length?void 0:i.map(i=>"auto"===i?navigator.language:i):i}setLanguage(i){let r=this._parseLanguage(i);if(!this.style||r===this._language)return this;for(let i of(this._language=r,this.style.reloadSources(),this._controls))i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(i){return this.style&&i!==this._worldview&&(this._worldview=i,this._styleDirty=!0,this.style.setWorldview(i)),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(i){return this._lazyInitEmptyStyle(),i?"string"==typeof i&&(i={name:i}):i=null,this._useExplicitProjection=!!i,this._prioritizeAndUpdateProjection(i,this.style.projection)}_updateProjectionTransition(){let r;if("globe"!==this.getProjection().name)return;let a=this.transform,n=a.projection.name;"globe"===n&&a.zoom>=i.R?(a.setMercatorFromTransition(),r=!0):"mercator"===n&&a.zoom<i.R&&(a.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
116Update(),this._update(!0))}_prioritizeAndUpdateProjection(i,r){return this._updateProjection(i||r||{name:"mercator"})}_updateProjection(r){let a,n=this.transform.mercatorFromTransition;a="globe"===r.name&&this.transform.zoom>=i.R?this.transform.setMercatorFromTransition():this.transform.setProjection(r),this.style.applyProjectionUpdate();let o="mercator"===this.transform.getProjection().name&&n!==this.transform.mercatorFromTransition;return(a||o)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(r,a){return this.transform.locationPoint3D(i.ab.convert(r),a)}unproject(r,a){return this.transform.pointLocation3D(i.au.convert(r),a)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(i,r,a){let n=i=>{let a=[];if(Array.isArray(r)){let n=r.filter(i=>this.getLayer(i));a=n.length?this.queryRenderedFeatures(i,{layers:n}):[]}else a=this.queryRenderedFeatures(i,{target:r});return a};if("mouseenter"===i||"mouseover"===i){let o=!1,s=r=>{let s=n(r.point);s.length?o||(o=!0,a.call(this,new sx(i,this,r.originalEvent,{features:s}))):o=!1};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:()=>{o=!1}}}}if("mouseleave"===i||"mouseout"===i){let o=!1,s=r=>{n(r.point).length?o=!0:o&&(o=!1,a.call(this,new sx(i,this,r.originalEvent)))},l=r=>{o&&(o=!1,a.call(this,new sx(i,this,r.originalEvent)))};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:l}}}{let o=i=>{let r=n(i.point);r.length&&(i.features=r,a.call(this,i),delete i.features)};return{listener:a,targets:r,delegates:{[i]:o}}}}on(i,r,a){if("function"==typeof r||void 0===a)return super.on(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let r in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(n),n.delegates)this.on(r,n.delegates[r]);return this}once(i,r,a){if("function"==typeof r||void 0===a)return super.once(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let i in n.delegates)this.once(i,n.delegates[i]);return this}off(r,a,n){if("function"==typeof a||void 0===n)return super.off(r,a);if("string"==typeof a&&(a=[a]),!this._areTargetsValid(a))return this;let o=this._delegatedListeners?this._delegatedListeners[r]:void 0;return o&&(r=>{for(let o=0;o<r.length;o++){let s=r[o];if(s.listener===n&&function(r,a){if(Array.isArray(r)&&Array.isArray(a)){let i=new Set(r),n=new Set(a);return i.size===n.size&&r.every(i=>n.has(i))}return i.c2(r,a)}(s.targets,a)){for(let i in s.delegates)this.off(i,s.delegates[i]);return r.splice(o,1),this}}})(o),this}queryRenderedFeatures(r,a){if(!this.style)return[];if(void 0===r||r instanceof i.au||Array.isArray(r)||void 0!==a||(a=r,r=void 0),r=r||[[0,0],[this.transform.width,this.transform.height]],!a){let i=this.style.queryRenderedFeatures(r,void 0,this.transform),a=this.style.queryRenderedFeatureset(r,void 0,this.transform);return i.concat(a)}let n=!0;if(a.target&&(n=this._isTargetValid(a.target))&&!a.layers)return this.style.queryRenderedFeatureset(r,a,this.transform);let o=!0;if(a.layers&&Array.isArray(a.layers)){for(let i of a.layers)if(!this._isValidId(i)){o=!1;break}if(o&&!a.target)return this.style.queryRenderedFeatures(r,a,this.transform)}let s=[];return o&&(s=s.concat(this.style.queryRenderedFeatures(r,a,this.transform))),n&&(s=s.concat(this.style.queryRenderedFeatureset(r,a,this.transform))),s}querySourceFeatures(i,r){return i&&("string"!=typeof i||this._isValidId(i))?this.style.querySourceFeatures(i,r):[]}queryRasterValue(i,r,a){return this._isValidId(i)?this.style.queryRasterValue(i,r,a):Promise.resolve(null)}isPointOnSurface(r){let{name:a}=this.transform.projection;return"globe"!==a&&"mercator"!==a&&i.f_(`${a} projection does not support isPointOnSurface, this API may behave unex
116pectedly.`),this.transform.isPointOnSurface(i.au.convert(r))}addInteraction(i,r){return this._interactions.add(i,r),this}removeInteraction(i){return this._interactions.remove(i),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(i){return this._cooperativeGestures=i,this}setStyle(r,a){return a=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing},a),this.style&&r&&!1!==a.diff&&a.localFontFamily===this._localFontFamily&&a.localIdeographFontFamily===this._localIdeographFontFamily&&a.fontstackCompositing===this._fontstackCompositing&&!a.config?(this.style._diffStyle(r,(n,o)=>{if(n){let o="string"==typeof n?n:n instanceof Error?n.message:n.error;i.f_(`Unable to perform style diff: ${o}. Rebuilding the style from scratch.`),this._updateStyle(r,a)}else o&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._fontstackCompositing=a.fontstackCompositing,this._updateStyle(r,a))}_getUIString(i){let r=this._locale[i];if(null==r)throw Error(`Missing UI string '${i}'`);return r}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=Object.assign({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new nb(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new nb(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.f_("There is no style added to the map."),!1)}_isValidId(r){return null==r?(this.fire(new i.v(Error("IDs can't be empty."))),!1):!i.dx(r)||(this.fire(new i.v(Error(`IDs can't contain special symbols: "${r}".`))),!1)}_isTargetValid(i){return"featuresetId"in i?this._isValidId("importId"in i?i.importId:i.featuresetId):"layerId"in i&&this._isValidId(i.layerId)}_areTargetsValid(i){if(Array.isArray(i)){for(let r of i)if(!this._isValidId(r))return!1;return!0}return this._isTargetValid(i)}addSource(i,r){return this._isValidId(i)?(this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)):this}isSourceLoaded(i){return!!this._isValidId(i)&&!!this.style&&this.style._isSourceCacheLoaded(i)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(i,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,a)}removeSource(i){return this._isValidId(i)?(this.style.removeSource(i),this._updateTerrain(),this._update(!0)):this}getSource(i){return this._isValidId(i)?this.style.getOwnSource(i):null}addImage(r,a,{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:h}={}){this._lazyInitEmptyStyle();let u=i.a1.from(r);if(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap){let{width:r,height:c,data:d}=i.co.getImageData(a);this.style.addImage(u,{data:new i.ay({width:r,height:c},d),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,version:0,usvg:!1})}else if(void 0===a.width||void 0===a.height)this.fire(new i.v(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{let{width:c,height:d}=a;this.style.addImage(u,{data:new i.ay({width:c,height:d},new Uint8Array(a.data)),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,usvg:!1,version:0,userImage:a}),a.onAdd&&a.onAdd(this,r)}}updateImage(r,a){this._lazyInitEmptyStyle();let n=i.a1.from(r),o=this.style.getImage(n);if(!o)return void this.fire(new i.v(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:s,height:l,data:h}=a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap?i.co.getImageData(a):a;if(void 0===s||void 0===l)return void this.fire(new i.v(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(s!==(o.usvg?o.icon.usvg_tree.width:o.data.width)||l!==(o.usvg?o.icon.usvg_tree.height:o.data.height))return void this.fire(new i.v(Error(`The width and height of the updated image (${s}, ${l}) 117 must be that same as the previous version of the image 118 (${o.data.width}, ${o.data.height})`)));let u=!(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap),c=!1;o.usvg?(o.data=new i.ay({width:s,height:l},new Uint8Array(h)),o.usvg=!1,o.icon=void 0,c=!0):o.data.replace(h,u),this.style.updateImage(n,o,c)}hasImage(r){return r?!!this.style&&!!this.style.getImage(i.a1.from(r)):(this.fire(new i.v(Error("Missing required image id"))),!1)}removeImage(r){this.style.removeImage(i.a1.from(r))}loadImage(r,a){i.cQ(this._requestManager.transformRequest(r,i.aH.Image),(i,r)=>{a(i,r)})}listImages(){return this.style.listImages().map(i=>i.name)}addModel(i,r){this._lazyInitEmptyStyle(),this.style.addModel(i,r)}hasModel(r){return r?this.style.hasModel(r):(this.fire(new i.v(Error("Missing required model id"))),!1)}removeModel(i){this.style.removeModel(i)}listModels(){return this.style.listModels()}addLayer(i,r){return this._isValidId(i.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)):this}getSlot(i){let r=this.getLayer(i);return r&&r.slot||null}setSlot(i,r){return this.style.setSlot(i,r),this.style.mergeLayers(),this._update(!0)}
118addImport(r,a){return this.style.addImport(r,a).catch(r=>this.fire(new i.v(Error("Failed to add import",r)))),this}updateImport(i,r){return"string"!=typeof r&&r.id!==i?(this.removeImport(i),this.addImport(r)):(this.style.updateImport(i,r),this._update(!0))}removeImport(i){return this.style.removeImport(i),this}moveImport(i,r){return this.style.moveImport(i,r),this._update(!0)}moveLayer(i,r){return this._isValidId(i)?(this.style.moveLayer(i,r),this._update(!0)):this}removeLayer(i){return this._isValidId(i)?(this.style.removeLayer(i),this._update(!0)):this}getLayer(i){if(!this._isValidId(i))return null;let r=this.style.getOwnLayer(i);return r?"custom"===r.type?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(i,r,a){return this._isValidId(i)?(this.style.setLayerZoomRange(i,r,a),this._update(!0)):this}setFilter(i,r,a={}){return this._isValidId(i)?(this.style.setFilter(i,r,a),this._update(!0)):this}getFilter(i){return this._isValidId(i)?this.style.getFilter(i):null}setPaintProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setPaintProperty(i,r,a,n),this._update(!0)):this}getPaintProperty(i,r){return this._isValidId(i)?this.style.getPaintProperty(i,r):null}setLayoutProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setLayoutProperty(i,r,a,n),this._update(!0)):this}getLayoutProperty(i,r){return this._isValidId(i)?this.style.getLayoutProperty(i,r):null}getLayerProperty(i,r){return this._isValidId(i)?this.style.getLayerProperty(i,r):null}setLayerProperty(i,r,a,n={}){return this._isValidId(i)?("appearances"===r&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(i,r,a,n),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(i){return this.style.setGlyphsUrl(i),this._update(!0)}getSchema(i){return this.style.getSchema(i)}setSchema(i,r){return this.style.setSchema(i,r),this._update(!0)}getConfig(i){return this.style.getConfig(i)}setConfig(i,r){return this.style.setConfig(i,r),this._update(!0)}getConfigProperty(i,r){return this.style.getConfigProperty(i,r)}setConfigProperty(i,r,a){return this.style.setConfigProperty(i,r,a),this._update(!0)}getFeaturesetDescriptors(i){return this.style.getFeaturesetDescriptors(i)}setLights(i){if(this._lazyInitEmptyStyle(),i&&1===i.length&&"flat"===i[0].type){let r=i[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(i),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let i=this.style.getLights()||[];return 0===i.length&&i.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),i}setLight(i,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:i}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(i){return this._lazyInitEmptyStyle(),this.style.setSnow(i),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(i){return this._lazyInitEmptyStyle(),this.style.setRain(i),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(i){return this._lazyInitEmptyStyle(),this.style.setColorTheme(i),this._update(!0)}setImportColorTheme(i,r){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(i,r),this._update(!0)}setCamera(i){return this.style.setCamera(i),this._triggerCameraUpdate(i)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(i){let r=this.transform.nearClipOffset!==i;return this.transform.nearClipOffset=i,this._update(r)}_triggerCameraUpdate(i){return this._update(this.transform.setOrthogra
118phicProjectionAtLowPitch("orthographic"===i["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.ab.convert(r),this.transform):0}setFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.setFeatureState(i,r),this._update())}removeFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.removeFeatureState(i,r),this._update())}getFeatureState(i){return i.source&&!this._isValidId(i.source)?null:this.style.getFeatureState(i)}_selectIndoorFloor(i){this.style.indoorManager&&this.style.indoorManager.selectFloor(i)}_setIndoorActiveFloorsVisibility(i){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(i)}getIndoorTileOptions(i,r){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?this.style.indoorManager.getIndoorTileOptions(i,r):null}_updateContainerDimensions(){if(!this._container)return;let i=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300,a,n,o,s=this._container;for(;s&&(!n||!o);){let i=window.getComputedStyle(s).transform;i&&"none"!==i&&((a=i.match(lh)[1].split(", "))[0]&&"0"!==a[0]&&"1"!==a[0]&&(n=a[0]),a[3]&&"0"!==a[3]&&"1"!==a[3]&&(o=a[3])),s=s.parentElement}this._containerWidth=n?Math.abs(i/n):i,this._containerHeight=o?Math.abs(r/o):r}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.f_("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){let i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=v("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=v("div","mapboxgl-canvas-container",i);this._canvas=v("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let a=this._controlContainer=v("div","mapboxgl-control-container",i),n=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(i=>{n[i]=v("div",`mapboxgl-ctrl-${i}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,a){let n=i.co.devicePixelRatio||1;this._canvas.width=n*Math.ceil(r),this._canvas.height=n*Math.ceil(a),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${a}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){let r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_addPopup(i){this._popups.push(i)}_removePopup(i){let r=this._popups.indexOf(i);-1!==r&&this._popups.splice(r,1)}_setupPainter(){let r=Object.assign({},_,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl2",r);a?(eu(a,!0),this.painter=new so(a,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",i=>{if("source"===i.dataType){let r=this.transform.elevation?this.transform.elevation._source():null;r&&i.sourceCacheId===r.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),i.cn.testSupport(a)):this.fire(new i.v(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new i.x("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.imageManager.imageAtlasCache.destroyTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new i.x("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let a;this.fire(new i.x("renderstart")),++this._frameId;let n=this.painter.context.extTimerQuery,o=i.co.now(),s=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(a=s.createQuery(),s.beginQuery(n.TIME_ELAPSED_EXT,a)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
118(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjectionTransition();let l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let r=this.transform.zoom,a=this.transform.pitch,n=i.co.now(),o=new i.w(r,{now:n,fadeDuration:l,pitch:a,transition:this.style.transition,worldview:this._worldview});this.style.update(o)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(o),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):h=this._updateAverageElevation(o),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._placementAlgorithm)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.mark(f.load),this.fire(new i.x("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),a){let r=i.co.now()-o;s.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{let n=s.getQueryParameter(a,s.QUERY_RESULT)/1e6;s.deleteQuery(a),this.fire(new i.x("gpu-timing-frame",{cpuTime:r,gpuTime:n}))},50)}if(this.listens("gpu-timing-layer")){let r=this.painter.collectGpuTimers();setTimeout(()=>{let a=this.painter.queryGpuTimers(r);this.fire(new i.x("gpu-timing-layer",{layerTimes:a}))},50)}if(this.listens("gpu-timing-deferred-render")){let r=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let a=this.painter.queryGpuTimeDeferredRender(r);this.fire(new i.x("gpu-timing-deferred-render",{gpuTime:a}))},50)}let u=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(u||this._repaint)this.triggerRepaint();else{let r=this.idle();if(r&&(h=this._updateAverageElevation(o,!0)),h)this.triggerRepaint();else{if(this._triggerFrame(!1),r&&(this.fire(new i.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.x("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}r&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,p.mark(f.fullLoad),this._performanceMetricsCollection&&eo(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(i){for(let r of this._markers)i&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(let r of this._popups)!i||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(i,r=!1){let a=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&a(0);let n=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(n||(r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){let r=this.transform.averageElevation,o=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(o)?o=0:this._averageElevationLastSampledAt=i;let s=Math.abs(r-o);if(s>
1181){if(this._isInitialLoad||n)return this._averageElevation.jumpTo(o),a(o);this._averageElevation.easeTo(o,i,300)}else if(s>1e-4)return this._averageElevation.jumpTo(o),a(o)}return!!this._averageElevation.isEasing(i)&&a(this._averageElevation.getValue(i))}_isTokenExpired(){return null!=this._tokenExpiration&&Date.now()>this._tokenExpiration}_revokeAuth(){let r=this.painter.context.gl;eu(r,!1),this._logoControl instanceof lr&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.v(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}_authenticate(){el(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{i&&(i.message!==B&&401!==i.status||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),J(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&ee(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&ei(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){ea(this._requestManager._customAccessToken)}_updateTerrain(){let i=this._isDragging();this.painter.updateTerrain(this.style,i)}_calculateSpeedIndex(){let i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());let a=this.painter.context.gl,n=a.createFramebuffer();function o(i){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i,0);let r=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,r),r}return a.bindFramebuffer(a.FRAMEBUFFER,n),this._canvasPixelComparison(o(i),r.canvasCopies.map(o),r.timeStamps)}_canvasPixelComparison(i,r,a){let n=a[1]-a[0],o=i.length/4;for(let s=0;s<r.length;s++){let l=r[s],h=0;for(let r=0;r<l.length;r+=4)l[r]===i[r]&&l[r+1]===i[r+1]&&l[r+2]===i[r+2]&&l[r+3]===i[r+3]&&(h+=1);n+=(a[s+2]-a[s+1])*(1-h/o)}return n}remove(){if(this._removed)return;for(let i of(this._hash&&this._hash.remove(),this._controls))i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),eh.delete(this.painter.context.gl),es.remove(),K.remove(),this._removed=!0,this.fire(new i.x("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){this._renderNextFrame=this._renderNextFrame||r,this.style&&!this._frame&&(this._frame=i.co.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){let a=this.style?this.style.getSourceCaches():[];return i.bp(a,(i,a)=>i._preloadTiles(r,a),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(i){this._showParseStatus!==i&&(this._showParseStatus=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(i){this._showLayers2DWireframe!==i&&(this._showLayers2DWireframe=i,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(i){this._showLayers3DWireframe!==i&&(this._showLayers3DWireframe=i,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(i){this.painter&&this.painter._debugParams.showElevationIdDebug!==i&&(this.painter._debugParams.showElevationIdDebug=i,this.style&&i?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,this.style&&i?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(i){this._showTileAABBs!==i&&(this._showTileAABBs=i,i&&this._update())}_setCacheLimits(r,a){i.fj(r,a)}get version(){return d}},NavigationControl:class{constructor(r={}){this.options=Object.assign({},lc,r),this._container=v("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bs(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),v("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),v("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bs(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{let r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:i}):r.resetNorth({},{originalEvent:i}))}),this._compassIcon=v("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let i=this._map;if(!i)return;let r=i.getZoom(),a=r===i.getMaxZoom(),n=r===i.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){let i=this._map;if(!i)return;let r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(i.transform.pitch*(Math.PI/180)
118),.5)}) rotateX(${i.transform.pitch}deg) rotateZ(${i.transform.angle*(180/Math.PI)}deg)`:`rotate(${i.transform.angle*(180/Math.PI)}deg)`;i._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),i.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&i.on("pitch",this._rotateCompassArrow),i.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ld(i,this._compass,this.options.visualizePitch)),this._container}onRemove(){let i=this._map;i&&(this._container.remove(),this.options.showZoom&&i.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&i.off("pitch",this._rotateCompassArrow),i.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(i,r){let a=v("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){if(!this._map)return;let a=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",a),i.firstElementChild&&i.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends i.y{constructor(r={}){super();const a=navigator.geolocation;this.options=Object.assign({geolocation:a},lx,r),i.bs(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ss(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=v("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(i){let r=(r=!!this.options.geolocation)=>{this._supportsGeolocation=r,i(r)};void 0!==this._supportsGeolocation?i(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(i=>r("denied"!==i.state)).catch(()=>r()):r()}_isOutOfMapMaxBounds(i){let r=this._map.getMaxBounds(),a=i.coords;return!!r&&(a.longitude<r.getWest()||a.longitude>r.getEast()||a.latitude<r.getSouth()||a.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(r){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.x("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=r,this.options.trackUserLocation)switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.followUserLocation&&(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(r),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.x("geolocate",Object.assign({coords:r.coords,timestamp:r.timestamp},r.toJSON?{toJSON:r.toJSON.bind(r)}:{}))),this._finish()}}
118_updateCamera(r){let a=new i.ab(r.coords.longitude,r.coords.latitude),n=r.coords.accuracy,o=Object.assign({bearing:this._map.getBearing()},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(n),o,{geolocateSource:!0})}_updateMarker(r){if(r){let a=new i.ab(r.coords.longitude,r.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(a).addTo(this._map):this._accuracyCircleMarker.remove(),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let r=this._map.transform,a=i.em(1,r._center.lat)*r.worldSize,n=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(r){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(1===r.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.x("error",{code:r.code,message:r.message,PERMISSION_DENIED:r.PERMISSION_DENIED,POSITION_UNAVAILABLE:r.POSITION_UNAVAILABLE,TIMEOUT:r.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();let i=this.options.positionOptions.timeout;i&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},i))}_clearRequestTimeout(){void 0!==this._requestTimeoutId&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(r){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=v("button","mapboxgl-ctrl-geolocate",this._container),v("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===r){i.f_("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),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.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.x("trackuserlocationend")))}),this.fire(new i.x("ready"))}}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.f_("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 i.x("trackuserlocationstart"));break;
118case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.x("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.x("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(i={maximumAge:6e5,timeout:0},this._noTimeout=!0):(i=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,i),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(r){return this.options.followUserLocation=null!=r?r:lx.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.x("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_ERROR"!==this._watchState||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new i.x("trackuserlocationend")))),this}setShowAccuracyCircle(r){if(this.options.showAccuracyCircle=null!=r?r:lx.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){let{longitude:r,latitude:a,accuracy:n}=this._lastKnownPosition.coords;this._accuracy=n,this._accuracyCircleMarker.setLngLat(new i.ab(r,a)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(i){return this.options.showUserHeading=null!=i?i:lx.showUserHeading,this._setup&&(this.options.showUserHeading?void 0!==this._geolocationWatchID&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation())),this}setFitBoundsOptions(i){return this.options.fitBoundsOptions=null!=i?i:lx.fitBoundsOptions,this}setShowUserLocation(i){return this.options.showUserLocation=null!=i?i:lx.showUserLocation,this._setup&&(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),this._lastKnownPosition&&(void 0===this._watchState||"OFF"!==this._watchState)&&this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove())),this}_addDeviceOrientationListener(){let i=()=>{let i="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(i,this._onDeviceOrientation)};"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(r=>{"granted"===r&&i()}).catch(console.error):i()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=v("div","mapboxgl-user-location"),this._dotElement.appendChild(v("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(v("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ly({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=v("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ly({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
118se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:li,ScaleControl:class{constructor(r={}){this.options=Object.assign({},lv,r),i.bs(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let i=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,n=r._containerWidth/2-i/2,o=r.unproject([n,a]),s=r.unproject([n+i,a]),l=o.distanceTo(s);if("imperial"===this.options.unit){let r=3.2808*l;r>5280?this._setScale(i,r/5280,"mile"):this._setScale(i,r,"foot")}else"nautical"===this.options.unit?this._setScale(i,l/1852,"nautical-mile"):l>=1e3?this._setScale(i,l/1e3,"kilometer"):this._setScale(i,l,"meter")}_setScale(i,r,a){this._map._requestDomTask(()=>{var n;let o,s,l,h=(o=Math.pow(10,`${Math.floor(r)}`.length-1),s=r/o,o*(s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:s>=1?1:(l=Math.pow(10,Math.ceil(-Math.log(n=s)/Math.LN10)),Math.round(n*l)/l))),u=h/r;this._container.innerHTML="nautical-mile"!==a?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(h):`${h} ${lb[a]}`,this._container.style.width=i*u+"px"})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=v("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(i){this._language=i,this._update()}setUnit(i){this.options.unit=i,this._update()}},FullscreenControl:class{constructor(r={}){this._fullscreen=!1,r&&r.container&&(r.container instanceof HTMLElement?this._container=r.container:i.f_("Full screen control 'container' must be a DOM element.")),i.bs(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=v("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.f_("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){let i=this._fullscreenButton=v("button","mapboxgl-ctrl-fullscreen",this._controlContainer);v("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),i.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:class{constructor(){i.bs(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(i){return this._map=i,this._container=v("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){let i=this._map.style.indoorManager;i.off("selector-update",this._onIndoorUpdate),i.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(i.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(i,r){let a=v("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){i.setAttribute("aria-label",r),i.textContent=r}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(i){if(!i||!i.floors||0===i.floors.length)return this._model=i,void(this._container.style.display="none");let r=this._model;this._model=i,this._container.style.display="inline-block";let a=!r||r.floors.length!==i.floors.length||r.floors.some((r,a)=>r.id!==i.floors[a].id);if(a&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),i.selectedFloorId){if(i.selectedFloorId!==this._lastSelectedFloorId||a){let r=i.floors.findIndex(r=>
118r.id===i.selectedFloorId);if(-1!==r){let a,n,o=i.floors.length;o<=5?(a=0,n=o-1):0===this._visibleFloorStart?(a=0,n=3):this._visibleFloorStart>=o-3?(a=o-3-1,n=o-1):(a=this._visibleFloorStart,n=this._visibleFloorStart+3-1),r<a?this._visibleFloorStart=r:r>n&&(this._visibleFloorStart=r-2)}}this._lastSelectedFloorId=i.selectedFloorId}this._render()}_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";let i=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);v("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||i.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(i);let r=this._model.floors,a=r.length;if(a<=5)return void r.forEach(i=>this._createFloorButton(i));let n=0===this._visibleFloorStart,o=this._visibleFloorStart>=a-3;if(n)this._createFloorButton(r[0]);else{let i=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);v("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}if((n?r.slice(1,4):o?r.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):r.slice(this._visibleFloorStart,this._visibleFloorStart+3)).forEach(i=>this._createFloorButton(i)),o)this._createFloorButton(r[a-1]);else{let i=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);v("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}}_createFloorButton(i){let r=this._createButton("mapboxgl-ctrl-level-button",()=>{let r=i.id;this._model&&this._model.selectedFloorId===r&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(r))}),a=(i.name||"").trim(),n=i.zIndex.toString(),o=a?Array.from(a).slice(0,3).join(""):n;this._setButtonTitle(r,o),this._model&&this._model.activeFloorsVisible&&i.id===this._model.selectedFloorId&&r.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(r)}_toggleIndoor(){this._map&&this._map.style&&this._map.style.indoorManager&&this._model&&this._model.activeFloorsVisible&&this._map.style.indoorManager.setActiveFloorsVisibility(!1)}_scrollUp(){if(this._visibleFloorStart>0){this._visibleFloorStart--,1===this._visibleFloorStart&&(this._visibleFloorStart=0);let i=this._model&&this._model.floors||[];if(i.length>3){let r=i.length-3;this._visibleFloorStart===r-1&&(this._visibleFloorStart=r-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){let i=this._model.floors.length-3;this._visibleFloorStart<i&&(this._visibleFloorStart++,1===this._visibleFloorStart&&(this._visibleFloorStart=2),this._visibleFloorStart===i-1&&(this._visibleFloorStart=i),this._visibleFloorStart>i&&(this._visibleFloorStart=i),this._render())}}},Popup:class extends i.y{constructor(r){super(),this.options=Object.assign(Object.create(lT),r),this._altitude=this.options.altitude,i.bs(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(lw):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&r.on("preclick",this._onClose),this.options.closeOnMove&&r.on("move",this._onClose),r.on("remove",this.remove),this._update(),r._addPopup(this),this._focusFirstElement(),this._trackPointer?(r.on("mousemove",this._onMouseEvent),r.on("mouseup",this._onMouseEvent),r._canvasContainer.classList.add("mapboxgl-track-pointer")):r.on("move",this._update),this.fire(new i.x("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let r=this._map;return r&&(r.off("move",this._update),r.off("move",this._onClose),r.off("preclick",this._onClose),r.off("click",this._onClose),r.off("remove",this.remove),r.off("mousemove",this._onMouseEvent),r.off("mouseup",this._onMouseEvent),r.off("drag",this._onMouseEvent),r._canvasContainer&&r._canvasContainer.classList.remove("mapboxgl-track-pointer"),r._removePopup(this),this._map=void 0),this.fire(new i.x("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.ab.convert(r),this._pos=null,this._trackPointer=!1,this._update();let a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(i){return this._altitude=i,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let i=this._map;return i&&(i.off("move",this._update),i.on("mousemove",this._onMouseEvent),i.on("drag",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(i){return this.setDOMContent(document.createTextNode(i))}setHTML(i){let r,a=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=i;r=n.firstChild;)a.appendChild(r);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=v("div","mapboxgl-popup-content",this._container||void 0);
118if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=v("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.innerHTML='<span aria-hidden="true">×</span>',i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._updateClassList(),r}_onMouseEvent(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;let r=this._map,a=this._container,n=this._pos;if(!r||!a||!n)return"bottom";let o=a.offsetWidth,s=a.offsetHeight,l=n.x<o/2,h=n.x>r.transform.width-o/2;if(n.y+i<s)return l?"top-left":h?"top-right":"top";if(n.y>r.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let i=this._container;if(!i)return;let r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),i.className=r.join(" ")}_update(r){let a=this._map,n=this._content;if(!a||!this._lngLat&&!this._trackPointer||!n)return;let o=this._container;if(o||(o=this._container=v("div","mapboxgl-popup",a.getContainer()),this._tip=v("div","mapboxgl-popup-tip",o),o.appendChild(n)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=lf(this._lngLat,this._pos,a.transform)),!this._trackPointer||r){let n=this._pos=this._trackPointer&&r instanceof i.au?r:a.project(this._lngLat,this._altitude),o=lS(this.options.offset),s=this._anchor=this._getAnchor(o.y),l=lS(this.options.offset,s),h=n.add(l).round();a._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${lp[s]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&&a._showingGlobe()){let r=+!i.dE(a.transform,this._lngLat);this._setOpacity(r)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._container&&(this._container.style.opacity=`${i}`),this._content&&(this._content.style.pointerEvents=i?"auto":"none")}},Marker:ly,Style:nb,LngLat:i.ab,LngLatBounds:i.ac,Point:i.au,MercatorCoordinate:i.ag,FreeCameraOptions:tH,Evented:i.y,config:i.bN,prewarm:function(){aF().acquire(tC)},clearPrewarmedResources:function(){let i=u;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(tC),u=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 accessToken(){return i.bN.ACCESS_TOKEN},set accessToken(t){i.fg(t)},get baseApiUrl(){return i.bN.API_URL},set baseApiUrl(t){i.fh(t)},get workerCount(){return tD.workerCount},set workerCount(e){tD.workerCount=e},get maxParallelImageRequests(){return i.bN.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.fm(t)},clearStorage(r){i.bH(r)},get workerUrl(){return tM.workerUrl},set workerUrl(e){tM.workerUrl=e},get workerClass(){return tM.workerClass},set workerClass(e){tM.workerClass=e},get dracoUrl(){return i.cN()},set dracoUrl(t){i.fl(t)},get meshoptUrl(){return i.cW()},set meshoptUrl(t){i.fn(t)},get buildingGenUrl(){return i.cK()},set buildingGenUrl(t){i.fi(t)},setNow:i.co.setNow,restoreNow:i.co.restoreNow}}),a}()});var h,u,c,d,f,p,m,_=(s("bvJM2"),s("bvJM2")),g={},y=180/Math.PI,x=Math.PI/180,v=Math.atan2,b=/([A-Z])/g,w=/(left|right|width|margin|padding|x)/i,T=/[\s,\(]\S/,S={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},E=function(i,r){return r.set(r.t,r.p,Math.round((r.s+r.c*i)*1e4)/1e4+r.u,r)},I=function(i,r){return r.set(r.t,r.p,1===i?r.e:Math.round((r.s+r.c*i)*1e4)/1e4+r.u,r)},A=function(i,r){return r.set(r.t,r.p,i?Math.round((r.s+r.c*i)*1e4)/1e4+r.u:r.b,r)},M=function(i,r){return r.set(r.t,r.p,1===i?r.e:i?Math.round((r.s+r.c*i)*1e4)/1e4+r.u:r.b,r)},C=function(i,r){var a=r.s+r.c*i;r.set(r.t,r.p,~~(a+(a<0?-.5:.5))+r.u,r)},D=function(i,r){return r.set(r.t,r.p,i?r.e:r.b,r)},R=function(i,r){return r.set(r.t,r.p,1!==i?r.b:r.e,r)},P=function(i,r,a){return i.style[r]=a},L=function(i,r,a){return i.style.setProperty(r,a)},z=function(i,r,a){return i._gsap[r]=a},O=function(i,r,a){return i._gsap.scaleX=i._gsap.scaleY=a},F=function(i,r,a,n,o){var s=i._gsap;s.scaleX=s.scaleY=a,s.renderTransform(o,s)},B=function(i,r,a,n,o){var s=i._gsap;s[r]=a,s.renderTransform(o,s)},k="transform",N=k+"Origin",U=function i(r,a){var n=this,o=this.target,s=o.style,l=o._gsap;if(r in g&&s){if(this.tfm=this.tfm||{},"transform"===r)return S.transform.split(",").forEach(function(r){return i.call(n,r,a)});if(~(r=S[r]||r).indexOf(",")?r.split(",").forEach(function(i){return n.tfm[i]=ea(o,i)}):this.tfm[r]=l.x?l[r]:ea(o,r),r===N&&(this.tfm.zOrigin=l.zOrigin),this.props.indexOf(k)>=0)return;l.svg&&(this.svgo=o.getAttribute("data-svg-origin"),this.props.push(N,a,"")),r=k}(s||a)&&this.props.push(r,a,s[r])},V=function(i){i.translate&&(i.removeProperty("translate"),i.removeProperty("scale"),i.removeProperty("rotate"))},j=function(){var i,r,a=this.props,n=this.target,o=n.style,s=n._gsap;for(i=0;i<a.length;i+=3)a[i+1]?2===a[i+1]?n[a[i]](a[i+2]):n[a[i]]=a[i+2]:a[i+2]?o[a[i]]=a[i+2]:o.removeProperty("--"===a[i].substr(0,2)?a[i]:a[i].replace(b,"-$1").toLowerCase());if(this.tfm){for(r in this.tfm)s[r]=this.tfm[r];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),(i=p())&&i.isStart||o[k]||(V(o),s.zOrigin&&o[N]&&(o[N]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},G=function(i,r){var a={target:i,props:[],revert:j,save:U};return i._gsap||_.gsap.core.getCache(i),r&&i.style&&i.nodeType&&r.split(",").forEach(function(i){return a.save(i)}),a},H=function(i,r){var a=h.createElementNS?h.createElementNS((r||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),i):h.createElement(i);return a&&a.style?a:h.createElement(i)},q=function i(r,a,n){var o=getComputedStyle(r);return o[a]||o.getPropertyValue(a.replace(b,"-$1").toLowerCase())||o.getPropertyValue(a)||!n&&i(r,Z(a)||a,1)||""},$="O,Moz,ms,Ms,Webkit".split(","),Z=function(i,r,a){var n=(r||d).style,o=5;if(i in n&&!a)return i;for(i=i.charAt(0).toUpperCase()+i.substr(1);o--&&!($[o]+i in n););return o<0?null:(3===o?"ms":o>=0?$[o]:"")+i},W=function(){"u">typeof window&&window.document&&(u=(h=window.document).documentElement,d=H("div")||{style:{}},H("div"),N=(k=Z(k))+"Origin",d.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",m=!!Z("perspective"),p=_.gsap.core.reverting,c=1)},X=function(i){var r,a=i.ownerSVGElement,n=H("svg",a&&a.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),o=i.cloneNode(!0);
118o.style.display="block",n.appendChild(o),u.appendChild(n);try{r=o.getBBox()}catch(i){}return n.removeChild(o),u.removeChild(n),r},Y=function(i,r){for(var a=r.length;a--;)if(i.hasAttribute(r[a]))return i.getAttribute(r[a])},K=function(i){var r,a;try{r=i.getBBox()}catch(n){r=X(i),a=1}return r&&(r.width||r.height)||a||(r=X(i)),!r||r.width||r.x||r.y?r:{x:+Y(i,["x","cx","x1"])||0,y:+Y(i,["y","cy","y1"])||0,width:0,height:0}},J=function(i){return!!(i.getCTM&&(!i.parentNode||i.ownerSVGElement)&&K(i))},Q=function(i,r){if(r){var a,n=i.style;r in g&&r!==N&&(r=k),n.removeProperty?(("ms"===(a=r.substr(0,2))||"webkit"===r.substr(0,6))&&(r="-"+r),n.removeProperty("--"===a?r:r.replace(b,"-$1").toLowerCase())):n.removeAttribute(r)}},ee=function(i,r,a,n,o,s){var l=new(0,_.PropTween)(i._pt,r,a,0,1,s?R:D);return i._pt=l,l.b=n,l.e=o,i._props.push(a),l},et={deg:1,rad:1,turn:1},ei={grid:1,flex:1},er=function i(r,a,n,o){var s,l,u,c,f=parseFloat(n)||0,p=(n+"").trim().substr((f+"").length)||"px",m=d.style,y=w.test(a),x="svg"===r.tagName.toLowerCase(),v=(x?"client":"offset")+(y?"Width":"Height"),b="px"===o,T="%"===o;if(o===p||!f||et[o]||et[p])return f;if("px"===p||b||(f=i(r,a,n,"px")),c=r.getCTM&&J(r),(T||"%"===p)&&(g[a]||~a.indexOf("adius")))return s=c?r.getBBox()[y?"width":"height"]:r[v],(0,_._round)(T?f/s*100:f/100*s);if(m[y?"width":"height"]=100+(b?p:o),l="rem"!==o&&~a.indexOf("adius")||"em"===o&&r.appendChild&&!x?r:r.parentNode,c&&(l=(r.ownerSVGElement||{}).parentNode),l&&l!==h&&l.appendChild||(l=h.body),(u=l._gsap)&&T&&u.width&&y&&u.time===_._ticker.time&&!u.uncache)return(0,_._round)(f/u.width*100);if(T&&("height"===a||"width"===a)){var S=r.style[a];r.style[a]=100+o,s=r[v],S?r.style[a]=S:Q(r,a)}else(T||"%"===p)&&!ei[q(l,"display")]&&(m.position=q(r,"position")),l===r&&(m.position="static"),l.appendChild(d),s=d[v],l.removeChild(d),m.position="absolute";return y&&T&&((u=(0,_._getCache)(l)).time=_._ticker.time,u.width=l[v]),(0,_._round)(b?s*f/100:s&&f?100/s*f:0)},ea=function(i,r,a,n){var o;return c||W(),r in S&&"transform"!==r&&~(r=S[r]).indexOf(",")&&(r=r.split(",")[0]),g[r]&&"transform"!==r?(o=e_(i,n),o="transformOrigin"!==r?o[r]:o.svg?o.origin:eg(q(i,N))+" "+o.zOrigin+"px"):(!(o=i.style[r])||"auto"===o||n||~(o+"").indexOf("calc("))&&(o=eh[r]&&eh[r](i,r,a)||q(i,r)||(0,_._getProperty)(i,r)||+("opacity"===r)),a&&!~(o+"").trim().indexOf(" ")?er(i,r,o,a)+a:o},en=function(i,r,a,n){if(!a||"none"===a){var o=Z(r,i,1),s=o&&q(i,o,1);s&&s!==a?(r=o,a=s):"borderColor"===r&&(a=q(i,"borderTopColor"))}var l,h,u,c,d,f,p,m,g,y,x,v=new(0,_.PropTween)(this._pt,i.style,r,0,1,_._renderComplexString),b=0,w=0;if(v.b=a,v.e=n,a+="","var(--"===(n+="").substring(0,6)&&(n=q(i,n.substring(4,n.indexOf(")")))),"auto"===n&&(f=i.style[r],i.style[r]=n,n=q(i,r)||n,f?i.style[r]=f:Q(i,r)),l=[a,n],(0,_._colorStringFilter)(l),a=l[0],n=l[1],u=a.match(_._numWithUnitExp)||[],(n.match(_._numWithUnitExp)||[]).length){for(;h=_._numWithUnitExp.exec(n);)p=h[0],g=n.substring(b,h.index),d?d=(d+1)%5:("rgba("===g.substr(-5)||"hsla("===g.substr(-5))&&(d=1),p!==(f=u[w++]||"")&&(c=parseFloat(f)||0,x=f.substr((c+"").length),"="===p.charAt(1)&&(p=(0,_._parseRelative)(c,p)+x),m=parseFloat(p),y=p.substr((m+"").length),b=_._numWithUnitExp.lastIndex-y.length,y||(y=y||_._config.units[r]||x,b===n.length&&(n+=y,v.e+=y)),x!==y&&(c=er(i,r,f,y)||0),v._pt={_next:v._pt,p:g||1===w?g:",",s:c,c:m-c,m:d&&d<4||"zIndex"===r?Math.round:0});v.c=b<n.length?n.substring(b,n.length):""}else v.r="display"===r&&"none"===n?R:D;return _._relExp.test(n)&&(v.e=0),this._pt=v,v},eo={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},es=function(i){var r=i.split(" "),a=r[0],n=r[1]||"50%";return("top"===a||"bottom"===a||"left"===n||"right"===n)&&(i=a,a=n,n=i),r[0]=eo[a]||a,r[1]=eo[n]||n,r.join(" ")},el=function(i,r){if(r.tween&&r.tween._time===r.tween._dur){var a,n,o,s=r.t,l=s.style,h=r.u,u=s._gsap;if("all"===h||!0===h)l.cssText="",n=1;else for(o=(h=h.split(",")).length;--o>-1;)g[a=h[o]]&&(n=1,a="transformOrigin"===a?N:k),Q(s,a);n&&(Q(s,k),u&&(u.svg&&s.removeAttribute("transform"),l.scale=l.rotate=l.translate="none",e_(s,1),u.uncache=1,V(l)))}},eh={clearProps:function(i,r,a,n,o){if("isFromStart"!==o.data){var s=i._pt=new(0,_.PropTween)(i._pt,r,a,0,0,el);return s.u=n,s.pr=-10,s.tween=o,i._props.push(a),1}}},eu=[1,0,0,1,0,0],ec={},ed=function(i){return"matrix(1, 0, 0, 1, 0, 0)"===i||"none"===i||!i},ef=function(i){var r=q(i,k);return ed(r)?eu:r.substr(7).match(_._numExp).map(_._round)},ep=function(i,r){var a,n,o,s,l=i._gsap||(0,_._getCache)(i),h=i.style,c=ef(i);return l.svg&&i.getAttribute("transform")?"1,0,0,1,0,0"===(c=[(o=i.transform.baseVal.consolidate().matrix).a,o.b,o.
118c,o.d,o.e,o.f]).join(",")?eu:c:(c!==eu||i.offsetParent||i===u||l.svg||(o=h.display,h.display="block",(a=i.parentNode)&&(i.offsetParent||i.getBoundingClientRect().width)||(s=1,n=i.nextElementSibling,u.appendChild(i)),c=ef(i),o?h.display=o:Q(i,"display"),s&&(n?a.insertBefore(i,n):a?a.appendChild(i):u.removeChild(i))),r&&c.length>6?[c[0],c[1],c[4],c[5],c[12],c[13]]:c)},em=function(i,r,a,n,o,s){var l,h,u,c,d=i._gsap,f=o||ep(i,!0),p=d.xOrigin||0,m=d.yOrigin||0,_=d.xOffset||0,g=d.yOffset||0,y=f[0],x=f[1],v=f[2],b=f[3],w=f[4],T=f[5],S=r.split(" "),E=parseFloat(S[0])||0,I=parseFloat(S[1])||0;a?f!==eu&&(h=y*b-x*v)&&(u=b/h*E+-v/h*I+(v*T-b*w)/h,c=-x/h*E+y/h*I-(y*T-x*w)/h,E=u,I=c):(E=(l=K(i)).x+(~S[0].indexOf("%")?E/100*l.width:E),I=l.y+(~(S[1]||S[0]).indexOf("%")?I/100*l.height:I)),n||!1!==n&&d.smooth?(d.xOffset=_+((w=E-p)*y+(T=I-m)*v)-w,d.yOffset=g+(w*x+T*b)-T):d.xOffset=d.yOffset=0,d.xOrigin=E,d.yOrigin=I,d.smooth=!!n,d.origin=r,d.originIsAbsolute=!!a,i.style[N]="0px 0px",s&&(ee(s,d,"xOrigin",p,E),ee(s,d,"yOrigin",m,I),ee(s,d,"xOffset",_,d.xOffset),ee(s,d,"yOffset",g,d.yOffset)),i.setAttribute("data-svg-origin",E+" "+I)},e_=function(i,r){var a=i._gsap||new(0,_.GSCache)(i);if("x"in a&&!r&&!a.uncache)return a;var n,o,s,l,h,u,c,d,f,p,g,b,w,T,S,E,I,A,M,C,D,R,P,L,z,O,F,B,U,V,j,G,H=i.style,$=a.scaleX<0,Z=getComputedStyle(i),W=q(i,N)||"0";return n=o=s=u=c=d=f=p=g=0,l=h=1,a.svg=!!(i.getCTM&&J(i)),Z.translate&&(("none"!==Z.translate||"none"!==Z.scale||"none"!==Z.rotate)&&(H[k]=("none"!==Z.translate?"translate3d("+(Z.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==Z.rotate?"rotate("+Z.rotate+") ":"")+("none"!==Z.scale?"scale("+Z.scale.split(" ").join(",")+") ":"")+("none"!==Z[k]?Z[k]:"")),H.scale=H.rotate=H.translate="none"),T=ep(i,a.svg),a.svg&&(a.uncache?(z=i.getBBox(),W=a.xOrigin-z.x+"px "+(a.yOrigin-z.y)+"px",L=""):L=!r&&i.getAttribute("data-svg-origin"),em(i,L||W,!!L||a.originIsAbsolute,!1!==a.smooth,T)),b=a.xOrigin||0,w=a.yOrigin||0,T!==eu&&(A=T[0],M=T[1],C=T[2],D=T[3],n=R=T[4],o=P=T[5],6===T.length?(l=Math.sqrt(A*A+M*M),h=Math.sqrt(D*D+C*C),u=A||M?v(M,A)*y:0,(f=C||D?v(C,D)*y+u:0)&&(h*=Math.abs(Math.cos(f*x))),a.svg&&(n-=b-(b*A+w*C),o-=w-(b*M+w*D))):(G=T[6],V=T[7],F=T[8],B=T[9],U=T[10],j=T[11],n=T[12],o=T[13],s=T[14],c=(S=v(G,U))*y,S&&(L=R*(E=Math.cos(-S))+F*(I=Math.sin(-S)),z=P*E+B*I,O=G*E+U*I,F=-(R*I)+F*E,B=-(P*I)+B*E,U=-(G*I)+U*E,j=-(V*I)+j*E,R=L,P=z,G=O),d=(S=v(-C,U))*y,S&&(L=A*(E=Math.cos(-S))-F*(I=Math.sin(-S)),z=M*E-B*I,O=C*E-U*I,j=D*I+j*E,A=L,M=z,C=O),u=(S=v(M,A))*y,S&&(L=A*(E=Math.cos(S))+M*(I=Math.sin(S)),z=R*E+P*I,M=M*E-A*I,P=P*E-R*I,A=L,R=z),c&&Math.abs(c)+Math.abs(u)>359.9&&(c=u=0,d=180-d),l=(0,_._round)(Math.sqrt(A*A+M*M+C*C)),h=(0,_._round)(Math.sqrt(P*P+G*G)),f=Math.abs(S=v(R,P))>2e-4?S*y:0,g=j?1/(j<0?-j:j):0),a.svg&&(L=i.getAttribute("transform"),a.forceCSS=i.setAttribute("transform","")||!ed(q(i,k)),L&&i.setAttribute("transform",L))),Math.abs(f)>90&&270>Math.abs(f)&&($?(l*=-1,f+=u<=0?180:-180,u+=u<=0?180:-180):(h*=-1,f+=f<=0?180:-180)),r=r||a.uncache,a.x=n-((a.xPercent=n&&(!r&&a.xPercent||(Math.round(i.offsetWidth/2)===Math.round(-n)?-50:0)))?i.offsetWidth*a.xPercent/100:0)+"px",a.y=o-((a.yPercent=o&&(!r&&a.yPercent||(Math.round(i.offsetHeight/2)===Math.round(-o)?-50:0)))?i.offsetHeight*a.yPercent/100:0)+"px",a.z=s+"px",a.scaleX=(0,_._round)(l),a.scaleY=(0,_._round)(h),a.rotation=(0,_._round)(u)+"deg",a.rotationX=(0,_._round)(c)+"deg",a.rotationY=(0,_._round)(d)+"deg",a.skewX=f+"deg",a.skewY=p+"deg",a.transformPerspective=g+"px",(a.zOrigin=parseFloat(W.split(" ")[2])||!r&&a.zOrigin||0)&&(H[N]=eg(W)),a.xOffset=a.yOffset=0,a.force3D=_._config.force3D,a.renderTransform=a.svg?ew:m?eb:ex,a.uncache=0,a},eg=function(i){return(i=i.split(" "))[0]+" "+i[1]},ey=function(i,r,a){var n=(0,_.getUnit)(r);return(0,_._round)(parseFloat(r)+parseFloat(er(i,"x",a+"px",n)))+n},ex=function(i,r){r.z="0px",r.rotationY=r.rotationX="0deg",r.force3D=0,eb(i,r)},ev="0deg",eb=function(i,r){var a=r||this,n=a.xPercent,o=a.yPercent,s=a.x,l=a.y,h=a.z,u=a.rotation,c=a.rotationY,d=a.rotationX,f=a.skewX,p=a.skewY,m=a.scaleX,_=a.scaleY,g=a.transformPerspective,y=a.force3D,v=a.target,b=a.zOrigin,w="",T="auto"===y&&i&&1!==i||!0===y;if(b&&(d!==ev||c!==ev)){var S,E=parseFloat(c)*x,I=Math.sin(E),A=Math.cos(E);s=ey(v,s,-(I*(S=Math.cos(E=parseFloat(d)*x))*b)),l=ey(v,l,-(-Math.sin(E)*b)),h=ey(v,h,-(A*S*b)+b)}"0px"!==g&&(w+="perspective("+g+") "),(n||o)&&(w+="translate("+n+"%, "+o+"%) "),(T||"0px"!==s||"0px"!==l||"0px"!==h)&&(w+="0px"!==h||T?"translate3d("+s+", "+l+", "+h+") ":"translate("+s+", "+l+") "),u!==ev&&(w+="rotate("+u+") "),c!==ev&&(w+="rotateY("+c+") "),d!==ev&&(w+="rotateX("+d+") "),(f!==ev||p!==ev)&&(w+="skew("+f+", "+p+") "),(1!==m||1!==_)&&(w+="scale("+m+", "+_+") "),v.style[k]=w||"translate(0, 0)"},ew=function(i,r){var a,n,o,s,l,h=r||this,u=h.xPercent,c=h.yPercent,d=h.x,f=h.y,p=h.rotation,m=h.skewX,g=h.skewY,y=h.scaleX,v=h.scaleY,b=h.target,w=h.xOrigin,T=h.yOrigin,S=h.xOffset,E=h.yOffset,I=h.forceCSS,A=parseFloat(d),M=parseFloat(f);p=parseFloat(p),m=parseFloat(m),(g=parseFloat(g))&&(m+=g=parseFloat(g),p+=g),p||m?(p*=x,m*=x,a=Math.cos(p)*y,n=Math.sin(p)*y,o=-(Math.sin(p-m)*v),s=Math.cos(p-m)*v,m&&(g*=x,o*=l=Math.sqrt(1+(l=Math.tan(m-g))*l),s*=l,g&&(a*=l=Math.sqrt(1+(l=Math.tan(g))*l),n*=l)),a=(0,_._round)(a),n=(0,_._round)(n),o=(0,_._round)(o),s=(0,_._round)(s)):(a=y,s=v,n=o=0),(A&&!~(d+"").indexOf("px")||M&&!~(f+"").indexOf("px"))&&(A=er(b,"x",d,"px"),M=er(b,"y",f,"px")),(w||T||S||E)&&(A=(0,_._round)(A+w-(w*a+T*o)+S),M=(0,_._round)(M+T-(w*n+T*s)+E)),(u||c)&&(l=b.getBBox(),A=(0,_._round)(A+u/100*l.width),M=(0,_._round)(M+c/100*l.height)),l="matrix("+a+","+n+","+o+","+s+","+A+","+M+")",b.setAttribute("transform",l),I&&(b.style[k]=l)},eT=function(i,r,a,n,o){var s,l,h=(0,_._isString)(o),u=parseFloat(o)*(h&&~o.indexOf("rad")?y:1)-n,c=n+u+"deg";return h&&("short"===(s=o.split("_")[1])&&(u%=360)!=u%180&&(u+=u<0?360:-360),"cw"===s&&u<0?u=(u+36e9)%360-360*~~(u/360):"ccw"===s&&u>0&&(u=(u-36e9)%360-360*~~(u/360))),i._pt=l=new(0,_.PropTween)(i._pt,r,a,n,u,I),l.e=c,l.u="deg",i._props.push(a),l},eS=function(i,r){for(var a in r)i[a]=r[a];return i},eE=function(i,r,a){var n,o,s,l,h,u,c,d=eS({},a._gsap),f=a.style;for(o in d.svg?(s=a.getAttribute("transform"),a.setAttribute("transform",""),f[k]=r,n=e_(a,1),Q(a,k),a.setAttribute("transform",s)):(s=getComputedStyle(a)[k],f[k]=r,n=e_(a,1),f[k]=s),g)(s=d[o])!==(l=n[o])&&0>"perspective,force3D,transformOrigin,svgOrigin".indexOf(o)&&(h=(0,_.getUnit)(s)!==(c=(0,_.getUnit)(l))?er(a,o,s,c):parseFloat(s),u=parseFloat(l),i._pt=new(0,_.PropTween)(i._pt,n,o,h,u-h,E),i._pt.u=c||0,i._props.push(o));eS(n,d)};(0,_._forEachName)("padding,margin,Width,Radius",function(i,r){var a="Right",n="Bottom",o="Left",s=(r<3?["Top",a,n,o]:["Top"+o,"Top"+a,n+a,n+o]).map(function(a){return r<2?i+a:"border"+a+i});eh[r>1?"border"+i:i]=function(i,r,a,n,o){var l,h;if(arguments.length<4)return 5===(h=(l=s.map(function(r){return ea(i,r,a)})).join(" ")).split(l[0]).length?l[0]:h;l=(n+"").split(" "),h={}
118,s.forEach(function(i,r){return h[i]=l[r]=l[r]||l[(r-1)/2|0]}),i.init(r,h,o)}});var eI={name:"css",register:W,targetTest:function(i){return i.style&&i.nodeType},init:function(i,r,a,n,o){var s,l,h,u,d,f,p,m,y,x,v,b,w,I,D,R,P,L=this._props,z=i.style,O=a.vars.startAt;for(p in c||W(),this.styles=this.styles||G(i),R=this.styles.props,this.tween=a,r)if("autoRound"!==p&&(l=r[p],!(_._plugins[p]&&(0,_._checkPlugin)(p,r,a,n,i,o)))){if(d=typeof l,f=eh[p],"function"===d&&(d=typeof(l=l.call(a,n,i,o))),"string"===d&&~l.indexOf("random(")&&(l=(0,_._replaceRandom)(l)),f)f(this,i,p,l,a)&&(D=1);else if("--"===p.substr(0,2))s=(getComputedStyle(i).getPropertyValue(p)+"").trim(),l+="",_._colorExp.lastIndex=0,!_._colorExp.test(s)&&(m=(0,_.getUnit)(s),(y=(0,_.getUnit)(l))?m!==y&&(s=er(i,p,s,y)+y):m&&(l+=m)),this.add(z,"setProperty",s,l,n,o,0,0,p),L.push(p),R.push(p,0,z[p]);else if("undefined"!==d){if(O&&p in O?(s="function"==typeof O[p]?O[p].call(a,n,i,o):O[p],(0,_._isString)(s)&&~s.indexOf("random(")&&(s=(0,_._replaceRandom)(s)),(0,_.getUnit)(s+"")||"auto"===s||(s+=_._config.units[p]||(0,_.getUnit)(ea(i,p))||""),"="===(s+"").charAt(1)&&(s=ea(i,p))):s=ea(i,p),u=parseFloat(s),(x="string"===d&&"="===l.charAt(1)&&l.substr(0,2))&&(l=l.substr(2)),h=parseFloat(l),p in S&&("autoAlpha"===p&&(1===u&&"hidden"===ea(i,"visibility")&&h&&(u=0),R.push("visibility",0,z.visibility),ee(this,z,"visibility",u?"inherit":"hidden",h?"inherit":"hidden",!h)),"scale"!==p&&"transform"!==p&&~(p=S[p]).indexOf(",")&&(p=p.split(",")[0])),v=p in g){if(this.styles.save(p),P=l,"string"===d&&"var(--"===l.substring(0,6)){if("calc("===(l=q(i,l.substring(4,l.indexOf(")")))).substring(0,5)){var F=i.style.perspective;i.style.perspective=l,l=q(i,"perspective"),F?i.style.perspective=F:Q(i,"perspective")}h=parseFloat(l)}if(b||((w=i._gsap).renderTransform&&!r.parseTransform||e_(i,r.parseTransform),I=!1!==r.smoothOrigin&&w.smooth,(b=this._pt=new(0,_.PropTween)(this._pt,z,k,0,1,w.renderTransform,w,0,-1)).dep=1),"scale"===p)this._pt=new(0,_.PropTween)(this._pt,w,"scaleY",w.scaleY,(x?(0,_._parseRelative)(w.scaleY,x+h):h)-w.scaleY||0,E),this._pt.u=0,L.push("scaleY",p),p+="X";else if("transformOrigin"===p){R.push(N,0,z[N]),l=es(l),w.svg?em(i,l,0,I,0,this):((y=parseFloat(l.split(" ")[2])||0)!==w.zOrigin&&ee(this,w,"zOrigin",w.zOrigin,y),ee(this,z,p,eg(s),eg(l)));continue}else if("svgOrigin"===p){em(i,l,1,I,0,this);continue}else if(p in ec){eT(this,w,p,u,x?(0,_._parseRelative)(u,x+l):l);continue}else if("smoothOrigin"===p){ee(this,w,"smooth",w.smooth,l);continue}else if("force3D"===p){w[p]=l;continue}else if("transform"===p){eE(this,l,i);continue}}else p in z||(p=Z(p)||p);if(v||(h||0===h)&&(u||0===u)&&!T.test(l)&&p in z)m=(s+"").substr((u+"").length),h||(h=0),y=(0,_.getUnit)(l)||(p in _._config.units?_._config.units[p]:m),m!==y&&(u=er(i,p,s,y)),this._pt=new(0,_.PropTween)(this._pt,v?w:z,p,u,(x?(0,_._parseRelative)(u,x+h):h)-u,!v&&("px"===y||"zIndex"===p)&&!1!==r.autoRound?C:E),this._pt.u=y||0,v&&P!==l?(this._pt.b=s,this._pt.e=P,this._pt.r=M):m!==y&&"%"!==y&&(this._pt.b=s,this._pt.r=A);else if(p in z)en.call(this,i,p,s,x?x+l:l);else if(p in i)this.add(i,p,s||i[p],x?x+l:l,n,o);else if("parseTransform"!==p){(0,_._missingPlugin)(p,l);continue}v||(p in z?R.push(p,0,z[p]):"function"==typeof i[p]?R.push(p,2,i[p]()):R.push(p,1,s||i[p])),L.push(p)}}D&&(0,_._sortPropTweensByPriority)(this)},render:function(i,r){if(r.tween._time||!p())for(var a=r._pt;a;)a.r(i,a.d),a=a._next;else r.styles.revert()},get:ea,aliases:S,getSetter:function(i,r,a){var n=S[r];return n&&0>n.indexOf(",")&&(r=n),r in g&&r!==N&&(i._gsap.x||ea(i,"x"))?a&&f===a?"scale"===r?O:z:(f=a||{},"scale"===r?F:B):i.style&&!(0,_._isUndefined)(i.style[r])?P:~r.indexOf("-")?L:(0,_._getSetter)(i,r)},core:{_removeProperty:Q,_getMatrix:ep}};_.gsap.utils.checkPrefix=Z,_.gsap.core.getStyleSaver=G,eM="rotation,rotationX,rotationY,skewX,skewY",eC=(0,_._forEachName)("x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+eM+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(i){g[i]=1}),(0,_._forEachName)(eM,function(i){_._config.units[i]="deg",ec[i]=1}),S[eC[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+eM,(0,_._forEachName)("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(i){var r=i.split(":");S[r[1]]=eC[r[0]]}),(0,_._forEachName)("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){_._config.units[i]="px"}),_.gsap.registerPlugin(eI);var eA=_.gsap.registerPlugin(eI)||_.gsap;eA.core.Tween;var eM,eC,eD,eR,eP,eL,ez,eO,eF,eB,ek=function(){return"u">typeof window},eN=function(){return eD||ek()&&(eD=window.gsap)&&eD.registerPlugin&&eD},eU=function(i){return"string"==typeof i},eV=function(i){return"function"==typeof i},ej=function(i,r){var a="x"===r?"Width":"Height",n="scroll"+a,o="client"+a;return i===eP||i===eL||i===ez?Math.max(eL[n],ez[n])-(eP["inner"+a]||eL[o]||ez[o]):i[n]-i["offset"+a]},eG=function(i,r){var a="scroll"+("x"===r?"Left":"Top");return i===eP&&(null!=i.pageXOffset?a="page"+r.toUpperCase()+"Offset":i=null!=eL[a]?eL:ez),function(){return i[a]}},eH=function(i,r,a,n){if(eV(i)&&(i=i(r,a,n)),"object"!=typeof i)return eU(i)&&"max"!==i&&"="!==i.charAt(1)?{x:i,y:i}:{y:i};if(i.nodeType)return{y:i,x:i};var o,s={};for(o in i)s[o]="onAutoKill"!==o&&eV(i[o])?i[o](r,a,n):i[o];return s},eq=function(i,r){if(!(i=eO(i)[0])||!i.getBoundingClientRect)return console.warn("scrollTo target doesn't exist. Using 0")||{x:0,y:0};var a=i.getBoundingClientRect(),n=!r||r===eP||r===ez,o=n?{top:eL.clientTop-(eP.pageYOffset||eL.scrollTop||ez.scrollTop||0),left
118:eL.clientLeft-(eP.pageXOffset||eL.scrollLeft||ez.scrollLeft||0)}:r.getBoundingClientRect(),s={x:a.left-o.left,y:a.top-o.top};return!n&&r&&(s.x+=eG(r,"x")(),s.y+=eG(r,"y")()),s},e$=function(i,r,a,n,o){return isNaN(i)||"object"==typeof i?eU(i)&&"="===i.charAt(1)?parseFloat(i.substr(2))*("-"===i.charAt(0)?-1:1)+n-o:"max"===i?ej(r,a)-o:Math.min(ej(r,a),eq(i,r)[a]-o):parseFloat(i)-o},eZ=function(){eD=eN(),ek()&&eD&&"u">typeof document&&document.body&&(eP=window,ez=document.body,eL=document.documentElement,eO=eD.utils.toArray,eD.config({autoKillThreshold:7}),eF=eD.config(),eR=1)},eW={version:"3.15.0",name:"scrollTo",rawVars:1,register:function(i){eD=i,eZ()},init:function(i,r,a,n,o){eR||eZ();var s=eD.getProperty(i,"scrollSnapType");this.isWin=i===eP,this.target=i,this.tween=a,r=eH(r,n,i,o),this.vars=r,this.autoKill=!!("autoKill"in r?r:eF).autoKill,this.getX=eG(i,"x"),this.getY=eG(i,"y"),this.x=this.xPrev=this.getX(),this.y=this.yPrev=this.getY(),eB||(eB=eD.core.globals().ScrollTrigger),"smooth"===eD.getProperty(i,"scrollBehavior")&&eD.set(i,{scrollBehavior:"auto"}),s&&"none"!==s&&(this.snap=1,this.snapInline=i.style.scrollSnapType,i.style.scrollSnapType="none"),null!=r.x?(this.add(this,"x",this.x,e$(r.x,i,"x",this.x,r.offsetX||0),n,o),this._props.push("scrollTo_x")):this.skipX=1,null!=r.y?(this.add(this,"y",this.y,e$(r.y,i,"y",this.y,r.offsetY||0),n,o),this._props.push("scrollTo_y")):this.skipY=1},render:function(i,r){for(var a,n,o,s,l,h=r._pt,u=r.target,c=r.tween,d=r.autoKill,f=r.xPrev,p=r.yPrev,m=r.isWin,_=r.snap,g=r.snapInline;h;)h.r(i,h.d),h=h._next;a=m||!r.skipX?r.getX():f,o=(n=m||!r.skipY?r.getY():p)-p,s=a-f,l=eF.autoKillThreshold,r.x<0&&(r.x=0),r.y<0&&(r.y=0),d&&(!r.skipX&&(s>l||s<-l)&&a<ej(u,"x")&&(r.skipX=1),!r.skipY&&(o>l||o<-l)&&n<ej(u,"y")&&(r.skipY=1),r.skipX&&r.skipY&&(c.kill(),r.vars.onAutoKill&&r.vars.onAutoKill.apply(c,r.vars.onAutoKillParams||[]))),m?eP.scrollTo(r.skipX?a:r.x,r.skipY?n:r.y):(r.skipY||(u.scrollTop=r.y),r.skipX||(u.scrollLeft=r.x)),_&&(1===i||0===i)&&(n=u.scrollTop,a=u.scrollLeft,g?u.style.scrollSnapType=g:u.style.removeProperty("scroll-snap-type"),u.scrollTop=n+1,u.scrollLeft=a+1,u.scrollTop=n,u.scrollLeft=a),r.xPrev=r.x,r.yPrev=r.y,eB&&eB.update()},kill:function(i){var r="scrollTo"===i,a=this._props.indexOf(i);return(r||"scrollTo_x"===i)&&(this.skipX=1),(r||"scrollTo_y"===i)&&(this.skipY=1),a>-1&&this._props.splice(a,1),!this._props.length}};eW.max=ej,eW.getOffset=eq,eW.buildGetter=eG,eW.config=function(i){for(var r in eF||eZ()||(eF=eD.config()),i)eF[r]=i[r]},eN()&&eD.registerPlugin(eW);var eX=s("f5sus"),eY=s("gKp6f"),eK=s("kMGLj");eA.registerPlugin(eW);let eJ=document.querySelector(".map").classList.contains("is-block"),eQ=document.querySelector(".map-canvas"),e0=document.querySelector(".map-loader"),e1=document.querySelector(".map-locations"),e2=document.querySelector(".map-filter"),e3=e2?.querySelector(".map-filter-box"),e4=document.querySelector(".map-filter-toggle"),e5=e4?.querySelector(".map-filter-toggle-label"),e6=e5?.dataset.labelWhenOpen,e8=e5?.textContent,e9=e2?.querySelectorAll(".map-filter-group")??[],e7=[],te=null,tt=null,ti=null,tr=!1,ta=!1,tn=[],to=(0,eY.createMap)({container:eQ,center:[4.5424,52.3787],zoom:14});function ts(i=!1){return window.matchMedia("(max-width: 767px)").matches?{padding:{top:100,right:30,bottom:i?300:120,left:30}}:{padding:{top:100,right:100,bottom:100,left:424}}}function tl(i){let a=e1.querySelectorAll(".map-location");a.length&&(ti=new(r(eK)).LngLatBounds,a.forEach(a=>{let n=parseFloat(a.dataset.lng),o=parseFloat(a.dataset.lat),s=document.createElement("div");s.className="map-marker",s.dataset.id=a.dataset.id,s.addEventListener("click",tc),i?s.dataset.categoryIds=a.dataset.categoryIds:s.classList.add("highlight"),e7.push(new(r(eK)).Marker(s).setLngLat([n,o]).addTo(to)),ti.extend([n,o])}),a.length>1?to.fitBounds(ti,ts()):to.flyTo({center:ti.getCenter(),zoom:14}))}function th(i){let r=e7.find(r=>r.getElement().dataset.id==i),a=e1.querySelector('.map-location[data-id="'+i+'"]');if(!r||!a)return;te?.getElement().classList.remove("active"),tt?.classList.remove("active"),r.getElement().classList.add("active"),a.classList.add("active"),te=r,tt=a,to.fitBounds(ti,ts(!0));let n=e1.getBoundingClientRect().height,o=a.getBoundingClientRect().height,s=e1.scrollHeight-n,l=a.offsetTop-n/2+o/2;l<0?l=0:l>s&&(l=s),eA.to(e1,{duration:.8,scrollTo:l,ease:"power3.inOut"}),td()}function tu(){te?.getElement().classList.remove("active"),tt?.classList.remove("active"),te=tt=null,e7.length>1&&to.fitBounds(ti,ts())}function tc(i){let r=i.target;te?.getElement()===r?tu():th(r.dataset.id)}function td(){tr&&(e5.textContent=e8,eA.timeline().to(e3,{duration:.5,height:0,y:-8,opacity:0,ease:"power3.inOut"}).set(e3,{display:"none"}),(0,eX.reverseAriaExpanded)(e4)),tr=!1}eJ&&(to.scrollZoom.disable(),to.addControl(new(r(eK)).NavigationControl)),tl(!1),to.on("load",()=>e0.classList.add("hidden")),e1.addEventListener("click",function(i){let r=i.target.classList.contains(".card-close")||i.target.closest(".card-close"),a=i.target.classList.contains(".card-show-on-map")||i.target.closest(".card-show-on-map"),n=i.target.closest(".map-location");(r||a)&&(i.stopPropagation(),i.preventDefault(),a&&n!==tt?th(n.dataset.id):(r||a&&n===tt)&&tu())}),e2?.addEventListener("change",function(i){let r=i.target,a=r.closest(".map-filter-group"),n=a.querySelector(".map-filter-group-input"),o=a.querySelectorAll(".map-filter-item-input"),s=r===n,l=Array.from(o).every(i=>i.checked),h=Array.from(o).some(i=>i.checked);s?o.forEach(i=>
118{i.checked=r.checked}):l?(n.indeterminate=!1,n.checked=!0):(h?n.indeterminate=!0:n.indeterminate=!1,n.checked=!1),tn=[],e2.querySelectorAll(".map-filter-item-input:checked").forEach(i=>{tn.push(i.value)}),ta=!0}),e4?.addEventListener("click",function(){tr?(ta&&fetch(urls.ajax,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"action=filter_locations&categories="+tn.join("|")}).then(i=>i.text()).then(i=>{e1.innerHTML=i,e7.forEach(i=>i.remove()),e7=[],tl(!!tn.length),ta=!1}),td()):(tr||(e5.textContent=e6,eA.timeline().set(e3,{display:"block",y:-8,opacity:0}).to(e3,{duration:.5,height:"auto",y:0,opacity:1,ease:"power3.inOut"}),(0,eX.reverseAriaExpanded)(e4)),tr=!0)}),e9.forEach(i=>{let r=i.querySelector(".map-filter-group-toggle"),a=i.querySelector(".map-filter-items"),n=eA.timeline({paused:!0}).to(a,{duration:.5,height:"auto",ease:"power3.inOut"});r.addEventListener("click",()=>{let r=i.classList.contains("open");i.classList.toggle("open"),r?n.reverse():n.play()})})})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.