PageSourceSearch

https://urbanize.city/modules/custom/urbanize_project_map/js/dist/project-map.js?tluovr

js urbanize.city collected 2026-09-24 17:57:23 UTC 1,888,225 bytes, 3,039 lines download raw bytes

vendor: 14,778 bytes, lines 1-33
1(function(){"use strict";var mC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $w(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var Hw={exports:{}},v_={},qw={exports:{}},Pn={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Rp=Symbol.for("react.element"),_C=Symbol.for("react.portal"),gC=Symbol.for("react.fragment"),yC=Symbol.for("react.strict_mode"),vC=Symbol.for("react.profiler"),xC=Symbol.for("react.provider"),wC=Symbol.for("react.context"),bC=Symbol.for("react.forward_ref"),TC=Symbol.for("react.suspense"),SC=Symbol.for("react.memo"),EC=Symbol.for("react.lazy"),Zw=Symbol.iterator;function IC(h){return h===null||typeof h!="object"?null:(h=Zw&&h[Zw]||h["@@iterator"],typeof h=="function"?h:null)}var Ww={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Xw=Object.assign,Yw={};function gh(h,f,w){this.props=h,this.context=f,this.refs=Yw,this.updater=w||Ww}gh.prototype.isReactComponent={},gh.prototype.setState=function(h,f){if(typeof h!="object"&&typeof h!="function"&&h!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,h,f,"setState")},gh.prototype.forceUpdate=function(h){this.updater.enqueueForceUpdate(this,h,"forceUpdate")};function Kw(){}Kw.prototype=gh.prototype;function L0(h,f,w){this.props=h,this.context=f,this.refs=Yw,this.updater=w||Ww}var z0=L0.prototype=new Kw;z0.constructor=L0,Xw(z0,gh.prototype),z0.isPureReactComponent=!0;var Jw=Array.isArray,Qw=Object.prototype.hasOwnProperty,D0={current:null},eb={key:!0,ref:!0,__self:!0,__source:!0};function tb(h,f,w){var A,L={},F=null,X=null;if(f!=null)for(A in f.ref!==void 0&&(X=f.ref),f.key!==void 0&&(F=""+f.key),f)Qw.call(f,A)&&!eb.hasOwnProperty(A)&&(L[A]=f[A]);var s=arguments.length-2;if(s===1)L.children=w;else if(1<s){for(var de=Array(s),Ee=0;Ee<s;Ee++)de[Ee]=arguments[Ee+2];L.children=de}if(h&&h.defaultProps)for(A in s=h.defaultProps,s)L[A]===void 0&&(L[A]=s[A]);return{$$typeof:Rp,type:h,key:F,ref:X,props:L,_owner:D0.current}}function AC(h,f){return{$$typeof:Rp,type:h.type,key:f,ref:h.ref,props:h.props,_owner:h._owner}}function k0(h){return typeof h=="object"&&h!==null&&h.$$typeof===Rp}function CC(h){var f={"=":"=0",":":"=2"};return"$"+h.replace(/[=:]/g,function(w){return f[w]})}var ib=/\/+/g;function O0(h,f){return typeof h=="object"&&h!==null&&h.key!=null?CC(""+h.key):f.toString(36)}function x_(h,f,w,A,L){var F=typeof h;(F==="undefined"||F==="boolean")&&(h=null);var X=!1;if(h===null)X=!0;else switch(F){case"string":case"number":X=!0;break;case"object":switch(h.$$typeof){case Rp:case _C:X=!0}}if(X)return X=h,L=L(X),h=A===""?"."+O0(X,0):A,Jw(L)?(w="",h!=null&&(w=h.replace(ib,"$&/")+"/"),x_(L,f,w,"",function(Ee){return Ee})):L!=null&&(k0(L)&&(L=AC(L,w+(!L.key||X&&X.key===L.key?"":(""+L.key).replace(ib,"$&/")+"/")+h)),f.push(L)),1;if(X=0,A=A===""?".":A+":",Jw(h))for(var s=0;s<h.length;s++){F=h[s];var de=A+O0(F,s);X+=x_(F,f,w,de,L)}else if(de=IC(h),typeof de=="function")for(h=de.call(h),s=0;!(F=h.next()).done;)F=F.value,de=A+O0(F,s++),X+=x_(F,f,w,de,L);else if(F==="object")throw f=String(h),Error("Objects are not valid as a React child (found: "+(f==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":f)+"). If you meant to render a collection of children, use an array instead.");return X}function w_(h,f,w){if(h==null)return h;var A=[],L=0;return x_(h,A,"","",function(F){return f.call(w,F,L++)}),A}function MC(h){if(h._status===-1){var f=h._result;f=f(),f.then(function(w){(h._status===0||h._status===-1)&&(h._status=1,h._result=w)},function(w){(h._status===0||h._status===-1)&&(h._status=2,h._result=w)}),h._status===-1&&(h._status=0,h._result=f)}if(h._status===1)return h._result.default;throw h._result}var No={current:null},b_={transition:null},PC={ReactCurrentDispatcher:No,ReactCurrentBatchConfig:b_,ReactCurrentOwner:D0};function nb(){throw Error("act(...) is not supported in production builds of React.")}Pn.Children={map:w_,forEach:function(h,f,w){w_(h,function(){f.apply(this,arguments)},w)},count:function(h){var f=0;return w_(h,function(){f++}),f},toArray:function(h){return w_(h,function(f){return f})||[]},only:function(h){if(!k0(h))throw Error("React.Children.only expected to receive a single React element child.");return h}},Pn.Component=gh,Pn.Fragment=gC,Pn.Profiler=vC,Pn.PureComponent=L0,Pn.StrictMode=yC,Pn.Suspense=TC,Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=PC,Pn.act=nb,Pn.cloneElement=function(h,f,w){if(h==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+h+".");var A=Xw({},h.props),L=h.key,F=h.ref,X=h._owner;if(f!=null){if(f.ref!==void 0&&(F=f.ref,X=D0.current),f.key!==void 0&&(L=""+f.key),h.type&&h.type.defaultProps)var s=h.type.defaultProps;for(de in f)Qw.call(f,de)&&!eb.hasOwnProperty(de)&&(A[de]=f[de]===void 0&&s!==void 0?s[de]:f[de])}var de=arguments.length-2;if(de===1)A.children=w;else if(1<de){s=Array(de);for(var Ee=0;Ee<de;Ee++)s[Ee]=arguments[Ee+2];A.children=s}return{$$typeof:Rp,type:h.type,key:L,ref:F,props:A,_owner:X}},Pn.createContext=function(h){return h={$$typeof:wC,_currentValue:h,_currentValue2:h,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},h.Provider={$$typeof:xC,_context:h},h.Consumer=h},Pn.createElement=tb,Pn.createFactory=function(h){var f=tb.bind(null,h);return f.type=h,f},Pn.createRef=function(){return{current:null}},Pn.forwardRef=function(h){return{$$typeof:bC,render:h}},Pn.isValidElement=k0,Pn.lazy=function(h){return{$$typeof:EC,_payload:{_status:-1,_result:h},_init:MC}},Pn.memo=function(h,f){return{$$typeof:SC,type:h,compare:f===void 0?null:f}},Pn.startTransition=function(h){var f=b_.transition;b_.transition={};try{h()}finally{b_.transition=f}},Pn.unstable_act=nb,Pn.useCallback=function(h,f){return No.current.useCallback(h,f)},Pn.useContext=function(h){return No.current.useContext(h)},Pn.useDebugValue=function(){},Pn.useDeferredValue=function(h){return No.current.useDeferredValue(h)},Pn.useEffect=function(h,f){return No.current.useEffect(h,f)},Pn.useId=function(){return No.current.useId()},Pn.useImperativeHandle=function(h,f,w){return No.current.useImperativeHandle(h,f,w)},Pn.useInsertionEffect=function(h,f){return No.current.useInsertionEffect(h,f)},Pn.useLayoutEffect=function(h,f){return No.current.useLayoutEffect(h,f)},Pn.useMemo=function(h,f){return No.current.useMemo(h,f)},Pn.useReducer=function(h,f,w){return No.current.useReducer(h,f,w)},Pn.useRef=function(h){return No.current.useRef(h)},Pn.useState=function(h){return No.current.useState(h)},Pn.useSyncExternalStore=function(h,f,w){return No.current.useSyncExternalStore(h,f,w)},Pn.useTransition=function(){return No.current.useTransition()},Pn.version="18.3.1",qw.exports=Pn;var st=qw.exports;const RC=$w(st);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var LC=st,zC=Symbol.for("react.element"),DC=Symbol.for("react.fragment"),kC=Object.prototype.hasOwnProperty,OC=LC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,FC={key:!0,ref:!0,__self:!0,__source:!0};function rb(h,f,w){var A,L={},F=null,X=null;w!==void 0&&(F=""+w),f.key!==void 0&&(F=""+f.key),f.ref!==void 0&&(X=f.ref);for(A in f)kC.call(f,A)&&!FC.hasOwnProperty(A)&&(L[A]=f[A]);if(h&&h.defaultProps)for(A in f=h.defaultProps,f)L[A]===void 0&&(L[A]=f[A]);return{$$typeof:zC,type:h,key:F,ref:X,props:L,_owner:OC.current}}v_.Fragment=DC,v_.jsx=rb,v_.jsxs=rb,Hw.exports=v_;var _e=Hw.exports,ob={exports:{}},ys={},sb={exports:{}},ab={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(h){function f(Gt,Ti){var Ct=Gt.length;Gt.push(Ti);e:for(;0<Ct;){var qe=Ct-1>>>1,ti=Gt[qe];if(0<L(ti,Ti))Gt[qe]=Ti,Gt[Ct]=ti,Ct=qe;else break e}}function w(Gt){return Gt.length===0?null:Gt[0]}function A(Gt){if(Gt.length===0)return null;var Ti=Gt[0],Ct=Gt.pop();if(Ct!==Ti){Gt[0]=Ct;e:for(var qe=0,ti=Gt.length,ai=ti>>>1;qe<ai;){var Si=2*(qe+1)-1,Sn=Gt[Si],Kn=Si+1,br=Gt[Kn];if(0>L(Sn,Ct))Kn<ti&&0>L(br,Sn)?(Gt[qe]=br,Gt[Kn]=Ct,qe=Kn):(Gt[qe]=Sn,Gt[Si]=Ct,qe=Si);else if(Kn<ti&&0>L(br,Ct))Gt[qe]=br,Gt[Kn]=Ct,qe=Kn;else break e}}return Ti}function L(Gt,Ti){var Ct=Gt.sortIndex-Ti.sortIndex;return Ct!==0?Ct:Gt.id-Ti.id}if(typeof performance=="object"&&typeof performance.now=="function"){var F=performance;h.unstable_now=function(){return F.now()}}else{var X=Date,s=X.now();h.unstable_now=function(){return X.now()-s}}var de=[],Ee=[],tt=1,Ie=null,He=3,vt=!1,mt=!1,at=!1,Ft=typeof setTimeout=="function"?setTimeout:null,Ve=typeof clearTimeout=="function"?clearTimeout:null,Se=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Ce(Gt){for(var Ti=w(Ee);Ti!==null;){if(Ti.callback===null)A(Ee);else if(Ti.startTime<=Gt)A(Ee),Ti.sortIndex=Ti.expirationTime,f(de,Ti);else break;Ti=w(Ee)}}function dt(Gt){if(at=!1,Ce(Gt),!mt)if(w(de)!==null)mt=!0,ri(Vt);else{var Ti=w(Ee);Ti!==null&&Ei(dt,Ti.startTime-Gt)}}function Vt(Gt,Ti){mt=!1,at&&(at=!1,Ve(si),si=-1),vt=!0;var Ct=He;try{for(Ce(Ti),Ie=w(de);Ie!==null&&(!(Ie.expirationTime>Ti)||Gt&&!ar());){var qe=Ie.callback;if(typeof qe=="function"){Ie.callback=null,He=Ie.priorityLevel;var ti=qe(Ie.expirationTime<=Ti);Ti=h.unstable_now(),typeof ti=="function"?Ie.callback=ti:Ie===w(de)&&A(de),Ce(Ti)}else A(de);Ie=w(de)}if(Ie!==null)var ai=!0;else{var Si=w(Ee);Si!==null&&Ei(dt,Si.startTime-Ti),ai=!1}return ai}finally{Ie=null,He=Ct,vt=!1}}var jt=!1,qt=null,si=-1,ji=5,Ui=-1;function ar(){return!(h.unstable_now()-Ui<ji)}function fr(){if(qt!==null){var Gt=h.unstable_now();Ui=Gt;var Ti=!0;try{Ti=qt(!0,Gt)}finally{Ti?Ii():(jt=!1,qt=null)}}else jt=!1}var Ii;if(typeof Se=="function")Ii=function(){Se(fr)};else if(typeof MessageChannel<"u"){var Cr=new MessageChannel,Hn=Cr.port2;Cr.port1.onmessage=fr,Ii=function(){Hn.postMessage(null)}}else Ii=function(){Ft(fr,0)};function ri(Gt){qt=Gt,jt||(jt=!0,Ii())}function Ei(Gt,Ti){si=Ft(function(){Gt(h.unstable_now())},Ti)}h.unstable_IdlePriority=5,h.unstable_ImmediatePriority=1,h.unstable_LowPriority=4,h.unstable_NormalPriority=3,h.unstable_Profiling=null,h.unstable_UserBlockingPriority=2,h.unstable_cancelCallback=function(Gt){Gt.callback=null},h.unstable_continueExecution=function(){mt||vt||(mt=!0,ri(Vt))},h.unstable_forceFrameRate=function(Gt){0>Gt||125<Gt?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ji=0<Gt?Math.floor(1e3/Gt):5},h.unstable_getCurrentPriorityLevel=function(){return He},h.unstable_getFirstCallbackNode=function(){return w(de)},h.unstable_next=function(Gt){switch(He){case 1:case 2:case 3:var Ti=3;break;default:Ti=He}var Ct=He;He=Ti;try{return Gt()}finally{He=Ct}},h.unstable_pauseExecution=function(){},h.unstable_requestPaint=function(){},h.unstable_runWithPriority=function(Gt,Ti){switch(Gt){case 1:case 2:case 3:case 4:case 5:break;default:Gt=3}var Ct=He;He=Gt;try{return Ti()}finally{He=Ct}},h.unstable_scheduleCallback=function(Gt,Ti,Ct){var qe=h.unstable_now();switch(typeof Ct=="object"&&Ct!==null?(Ct=Ct.delay,Ct=typeof Ct=="number"&&0<Ct?qe+Ct:qe):Ct=qe,Gt){case 1:var ti=-1;break;case 2:ti=250;break;case 5:ti=1073741823;break;case 4:ti=1e4;break;default:ti=5e3}return ti=Ct+ti,Gt={id:tt++,callback:Ti,priorityLevel:Gt,startTime:Ct,expirationTime:ti,sortIndex:-1},Ct>qe?(Gt.sortIndex=Ct,f(Ee,Gt),w(de)===null&&Gt===w(Ee)&&(at?(Ve(si),si=-1):at=!0,Ei(dt,Ct-qe))):(Gt.sortIndex=ti,f(de,Gt),mt||vt||(mt=!0,ri(Vt))),Gt},h.unstable_shouldYield=ar,h.unstable_wrapCallback=function(Gt){var Ti=He;return function(){var Ct=He;He=Ti;try{return Gt.apply(this,arguments)}finally{He=Ct}}}})(ab),sb.exports=ab;var BC=sb.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var NC=st,vs=BC;function Zt(h){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+h,w=1;w<arguments.length;w++)f+="&args[]="+encodeURIComponent(arguments[w]);return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var lb=new Set,Lp={};function au(h,f){yh(h,f),yh(h+"Capture",f)}function yh(h,f){for(Lp[h]=f,h=0;h<f.length;h++)lb.add(f[h])}var bl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),F0=Object.prototype.hasOwnProperty,VC=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cb={},ub={};function jC(h){return F0.call(ub,h)?!0:F0.call(cb,h)?!1:VC.test(h)?ub[h]=!0:(cb[h]=!0,!1)}function UC(h,f,w,A){if(w!==null&&w.type===0)return!1;switch(typeof f){case"function":case"symbol":return!0;case"boolean":return A?!1:w!==null?!w.acceptsBooleans:(h=h.toLowerCase().slice(0,5),h!=="data-"&&h!=="aria-");default:return!1}}function GC(h,f,w,A){if(f===null||typeof f>"u"||UC(h,f,w,A))return!0;if(A)return!1;if(w!==null)switch(w.type){case 3:return!f;case 4:return f===!1;case 5:return isNaN(f);case 6:return isNaN(f)||1>f}return!1}function Vo(h,f,w,A,L,F,X){this.acceptsBooleans=f===2||f===3||f===4,this.attributeName=A,this.attributeNamespace=L,this.mustUseProperty=w,this.propertyName=h,this.type=f,this.sanitizeURL=F,this.removeEmptyString=X}var xo={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(h){xo[h]=new Vo(h,0,!1,h,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEac
vendor: 4,532 bytes, lines 33-34
33h(function(h){var f=h[0];xo[f]=new Vo(f,1,!1,h[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(h){xo[h]=new Vo(h,2,!1,h.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(h){xo[h]=new Vo(h,2,!1,h,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(h){xo[h]=new Vo(h,3,!1,h.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(h){xo[h]=new Vo(h,3,!0,h,null,!1,!1)}),["capture","download"].forEach(function(h){xo[h]=new Vo(h,4,!1,h,null,!1,!1)}),["cols","rows","size","span"].forEach(function(h){xo[h]=new Vo(h,6,!1,h,null,!1,!1)}),["rowSpan","start"].forEach(function(h){xo[h]=new Vo(h,5,!1,h.toLowerCase(),null,!1,!1)});var B0=/[\-:]([a-z])/g;function N0(h){return h[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(h){var f=h.replace(B0,N0);xo[f]=new Vo(f,1,!1,h,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(h){var f=h.replace(B0,N0);xo[f]=new Vo(f,1,!1,h,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(h){var f=h.replace(B0,N0);xo[f]=new Vo(f,1,!1,h,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(h){xo[h]=new Vo(h,1,!1,h.toLowerCase(),null,!1,!1)}),xo.xlinkHref=new Vo("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(h){xo[h]=new Vo(h,1,!1,h.toLowerCase(),null,!0,!0)});function V0(h,f,w,A){var L=xo.hasOwnProperty(f)?xo[f]:null;(L!==null?L.type!==0:A||!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(GC(f,w,L,A)&&(w=null),A||L===null?jC(f)&&(w===null?h.removeAttribute(f):h.setAttribute(f,""+w)):L.mustUseProperty?h[L.propertyName]=w===null?L.type===3?!1:"":w:(f=L.attributeName,A=L.attributeNamespace,w===null?h.removeAttribute(f):(L=L.type,w=L===3||L===4&&w===!0?"":""+w,A?h.setAttributeNS(A,f,w):h.setAttribute(f,w))))}var Tl=NC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T_=Symbol.for("react.element"),vh=Symbol.for("react.portal"),xh=Symbol.for("react.fragment"),j0=Symbol.for("react.strict_mode"),U0=Symbol.for("react.profiler"),hb=Symbol.for("react.provider"),db=Symbol.for("react.context"),G0=Symbol.for("react.forward_ref"),$0=Symbol.for("react.suspense"),H0=Symbol.for("react.suspense_list"),q0=Symbol.for("react.memo"),sc=Symbol.for("react.lazy"),pb=Symbol.for("react.offscreen"),fb=Symbol.iterator;function zp(h){return h===null||typeof h!="object"?null:(h=fb&&h[fb]||h["@@iterator"],typeof h=="function"?h:null)}var zr=Object.assign,Z0;function Dp(h){if(Z0===void 0)try{throw Error()}catch(w){var f=w.stack.trim().match(/\n( *(at )?)/);Z0=f&&f[1]||""}return`
34`+Z0+h}var W0=!1;function X0(h,f){if(!h||W0)return"";W0=!0;var w=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(f)if(f=function(){throw Error()},Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(Ee){var A=Ee}Reflect.construct(h,[],f)}else{try{f.call()}catch(Ee){A=Ee}h.call(f.prototype)}else{try{throw Error()}catch(Ee){A=Ee}h()}}
vendor: 6,657 bytes, lines 34-37
34catch(Ee){if(Ee&&A&&typeof Ee.stack=="string"){for(var L=Ee.stack.split(`
35`),F=A.stack.split(`
36`),X=L.length-1,s=F.length-1;1<=X&&0<=s&&L[X]!==F[s];)s--;for(;1<=X&&0<=s;X--,s--)if(L[X]!==F[s]){if(X!==1||s!==1)do if(X--,s--,0>s||L[X]!==F[s]){var de=`
37`+L[X].replace(" at new "," at ");return h.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",h.displayName)),de}while(1<=X&&0<=s);break}}}finally{W0=!1,Error.prepareStackTrace=w}return(h=h?h.displayName||h.name:"")?Dp(h):""}function $C(h){switch(h.tag){case 5:return Dp(h.type);case 16:return Dp("Lazy");case 13:return Dp("Suspense");case 19:return Dp("SuspenseList");case 0:case 2:case 15:return h=X0(h.type,!1),h;case 11:return h=X0(h.type.render,!1),h;case 1:return h=X0(h.type,!0),h;default:return""}}function Y0(h){if(h==null)return null;if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case xh:return"Fragment";case vh:return"Portal";case U0:return"Profiler";case j0:return"StrictMode";case $0:return"Suspense";case H0:return"SuspenseList"}if(typeof h=="object")switch(h.$$typeof){case db:return(h.displayName||"Context")+".Consumer";case hb:return(h._context.displayName||"Context")+".Provider";case G0:var f=h.render;return h=h.displayName,h||(h=f.displayName||f.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case q0:return f=h.displayName||null,f!==null?f:Y0(h.type)||"Memo";case sc:f=h._payload,h=h._init;try{return Y0(h(f))}catch{}}return null}function HC(h){var f=h.type;switch(h.tag){case 24:return"Cache";case 9:return(f.displayName||"Context")+".Consumer";case 10:return(f._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return h=f.render,h=h.displayName||h.name||"",f.displayName||(h!==""?"ForwardRef("+h+")":"ForwardRef");case 7:return"Fragment";case 5:return f;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y0(f);case 8:return f===j0?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f}return null}function ac(h){switch(typeof h){case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function mb(h){var f=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function qC(h){var f=mb(h)?"checked":"value",w=Object.getOwnPropertyDescriptor(h.constructor.prototype,f),A=""+h[f];if(!h.hasOwnProperty(f)&&typeof w<"u"&&typeof w.get=="function"&&typeof w.set=="function"){var L=w.get,F=w.set;return Object.defineProperty(h,f,{configurable:!0,get:function(){return L.call(this)},set:function(X){A=""+X,F.call(this,X)}}),Object.defineProperty(h,f,{enumerable:w.enumerable}),{getValue:function(){return A},setValue:function(X){A=""+X},stopTracking:function(){h._valueTracker=null,delete h[f]}}}}function S_(h){h._valueTracker||(h._valueTracker=qC(h))}function _b(h){if(!h)return!1;var f=h._valueTracker;if(!f)return!0;var w=f.getValue(),A="";return h&&(A=mb(h)?h.checked?"true":"false":h.value),h=A,h!==w?(f.setValue(h),!0):!1}function E_(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}function K0(h,f){var w=f.checked;return zr({},f,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:w??h._wrapperState.initialChecked})}function gb(h,f){var w=f.defaultValue==null?"":f.defaultValue,A=f.checked!=null?f.checked:f.defaultChecked;w=ac(f.value!=null?f.value:w),h._wrapperState={initialChecked:A,initialValue:w,controlled:f.type==="checkbox"||f.type==="radio"?f.checked!=null:f.value!=null}}function yb(h,f){f=f.checked,f!=null&&V0(h,"checked",f,!1)}function J0(h,f){yb(h,f);var w=ac(f.value),A=f.type;if(w!=null)A==="number"?(w===0&&h.value===""||h.value!=w)&&(h.value=""+w):h.value!==""+w&&(h.value=""+w);else if(A==="submit"||A==="reset"){h.removeAttribute("value");return}f.hasOwnProperty("value")?Q0(h,f.type,w):f.hasOwnProperty("defaultValue")&&Q0(h,f.type,ac(f.defaultValue)),f.checked==null&&f.defaultChecked!=null&&(h.defaultChecked=!!f.defaultChecked)}function vb(h,f,w){if(f.hasOwnProperty("value")||f.hasOwnProperty("defaultValue")){var A=f.type;if(!(A!=="submit"&&A!=="reset"||f.value!==void 0&&f.value!==null))return;f=""+h._wrapperState.initialValue,w||f===h.value||(h.value=f),h.defaultValue=f}w=h.name,w!==""&&(h.name=""),h.defaultChecked=!!h._wrapperState.initialChecked,w!==""&&(h.name=w)}function Q0(h,f,w){(f!=="number"||E_(h.ownerDocument)!==h)&&(w==null?h.defaultValue=""+h._wrapperState.initialValue:h.defaultValue!==""+w&&(h.defaultValue=""+w))}var kp=Array.isArray;function wh(h,f,w,A){if(h=h.options,f){f={};for(var L=0;L<w.length;L++)f["$"+w[L]]=!0;for(w=0;w<h.length;w++)L=f.hasOwnProperty("$"+h[w].value),h[w].selected!==L&&(h[w].selected=L),L&&A&&(h[w].defaultSelected=!0)}else{for(w=""+ac(w),f=null,L=0;L<h.length;L++){if(h[L].value===w){h[L].selected=!0,A&&(h[L].defaultSelected=!0);return}f!==null||h[L].disabled||(f=h[L])}f!==null&&(f.selected=!0)}}function ev(h,f){if(f.dangerouslySetInnerHTML!=null)throw Error(Zt(91));return zr({},f,{value:void 0,defaultValue:void 0,children:""+h._wrapperState.initialValue})}function xb(h,f){var w=f.value;if(w==null){if(w=f.children,f=f.defaultValue,w!=null){if(f!=null)throw Error(Zt(92));if(kp(w)){if(1<w.length)throw Error(Zt(93));w=w[0]}f=w}f==null&&(f=""),w=f}h._wrapperState={initialValue:ac(w)}}function wb(h,f){var w=ac(f.value),A=ac(f.defaultValue);w!=null&&(w=""+w,w!==h.value&&(h.value=w),f.defaultValue==null&&h.defaultValue!==w&&(h.defaultValue=w)),A!=null&&(h.defaultValue=""+A)}function bb(h){var f=h.textContent;f===h._wrapperState.initialValue&&f!==""&&f!==null&&(h.value=f)}function Tb(h){switch(h){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function tv(h,f){return h==null||h==="http://www.w3.org/1999/xhtml"?Tb(f):h==="http://www.w3.org/2000/svg"&&f==="foreignObject"?"http://www.w3.org/1999/xhtml":h}var I_,Sb=function(h){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(f,w,A,L){MSApp.execUnsafeLocalFunction(function(){return h(f,w,A,L)})}:h}(function(h,f){if(h.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in h)h.innerHTML=f;else{for(I_=I_||document.createElement("div"),I_.innerHTML="<svg>"+f.valueOf().toString()+"</svg>",f=I_.firstChild;h.firstChild;)h.removeChild(h.firstChild);for(;
vendor: 2,539 bytes, line 37
37f.firstChild;)h.appendChild(f.firstChild)}});function Op(h,f){if(f){var w=h.firstChild;if(w&&w===h.lastChild&&w.nodeType===3){w.nodeValue=f;return}}h.textContent=f}var Fp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ZC=["Webkit","ms","Moz","O"];Object.keys(Fp).forEach(function(h){ZC.forEach(function(f){f=f+h.charAt(0).toUpperCase()+h.substring(1),Fp[f]=Fp[h]})});function Eb(h,f,w){return f==null||typeof f=="boolean"||f===""?"":w||typeof f!="number"||f===0||Fp.hasOwnProperty(h)&&Fp[h]?(""+f).trim():f+"px"}function Ib(h,f){h=h.style;for(var w in f)if(f.hasOwnProperty(w)){var A=w.indexOf("--")===0,L=Eb(w,f[w],A);w==="float"&&(w="cssFloat"),A?h.setProperty(w,L):h[w]=L}}var WC=zr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function iv(h,f){if(f){if(WC[h]&&(f.children!=null||f.dangerouslySetInnerHTML!=null))throw Error(Zt(137,h));if(f.dangerouslySetInnerHTML!=null){if(f.children!=null)throw Error(Zt(60));if(typeof f.dangerouslySetInnerHTML!="object"||!("__html"in f.dangerouslySetInnerHTML))throw Error(Zt(61))}if(f.style!=null&&typeof f.style!="object")throw Error(Zt(62))}}function nv(h,f){if(h.indexOf("-")===-1)return typeof f.is=="string";switch(h){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rv=null;function ov(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var sv=null,bh=null,Th=null;function Ab(h){if(h=sf(h)){if(typeof sv!="function")throw Error(Zt(280));var f=h.stateNode;f&&(f=X_(f),sv(h.stateNode,h.type,f))}}function Cb(h){bh?Th?Th.push(h):Th=[h]:bh=h}function Mb(){if(bh){var h=bh,f=Th;if(Th=bh=null,Ab(h),f)for(h=0;h<f.length;h++)Ab(f[h])}}function Pb(h,f){return h(f)}function Rb(){}var av=!1;
vendor: 8,716 bytes, line 37
37function Lb(h,f,w){if(av)return h(f,w);av=!0;try{return Pb(h,f,w)}finally{av=!1,(bh!==null||Th!==null)&&(Rb(),Mb())}}function Bp(h,f){var w=h.stateNode;if(w===null)return null;var A=X_(w);if(A===null)return null;w=A[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(A=!A.disabled)||(h=h.type,A=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!A;break e;default:h=!1}if(h)return null;if(w&&typeof w!="function")throw Error(Zt(231,f,typeof w));return w}var lv=!1;if(bl)try{var Np={};Object.defineProperty(Np,"passive",{get:function(){lv=!0}}),window.addEventListener("test",Np,Np),window.removeEventListener("test",Np,Np)}catch{lv=!1}function XC(h,f,w,A,L,F,X,s,de){var Ee=Array.prototype.slice.call(arguments,3);try{f.apply(w,Ee)}catch(tt){this.onError(tt)}}var Vp=!1,A_=null,C_=!1,cv=null,YC={onError:function(h){Vp=!0,A_=h}};function KC(h,f,w,A,L,F,X,s,de){Vp=!1,A_=null,XC.apply(YC,arguments)}function JC(h,f,w,A,L,F,X,s,de){if(KC.apply(this,arguments),Vp){if(Vp){var Ee=A_;Vp=!1,A_=null}else throw Error(Zt(198));C_||(C_=!0,cv=Ee)}}function lu(h){var f=h,w=h;if(h.alternate)for(;f.return;)f=f.return;else{h=f;do f=h,f.flags&4098&&(w=f.return),h=f.return;while(h)}return f.tag===3?w:null}function zb(h){if(h.tag===13){var f=h.memoizedState;if(f===null&&(h=h.alternate,h!==null&&(f=h.memoizedState)),f!==null)return f.dehydrated}return null}function Db(h){if(lu(h)!==h)throw Error(Zt(188))}function QC(h){var f=h.alternate;if(!f){if(f=lu(h),f===null)throw Error(Zt(188));return f!==h?null:h}for(var w=h,A=f;;){var L=w.return;if(L===null)break;var F=L.alternate;if(F===null){if(A=L.return,A!==null){w=A;continue}break}if(L.child===F.child){for(F=L.child;F;){if(F===w)return Db(L),h;if(F===A)return Db(L),f;F=F.sibling}throw Error(Zt(188))}if(w.return!==A.return)w=L,A=F;else{for(var X=!1,s=L.child;s;){if(s===w){X=!0,w=L,A=F;break}if(s===A){X=!0,A=L,w=F;break}s=s.sibling}if(!X){for(s=F.child;s;){if(s===w){X=!0,w=F,A=L;break}if(s===A){X=!0,A=F,w=L;break}s=s.sibling}if(!X)throw Error(Zt(189))}}if(w.alternate!==A)throw Error(Zt(190))}if(w.tag!==3)throw Error(Zt(188));return w.stateNode.current===w?h:f}function kb(h){return h=QC(h),h!==null?Ob(h):null}function Ob(h){if(h.tag===5||h.tag===6)return h;for(h=h.child;h!==null;){var f=Ob(h);if(f!==null)return f;h=h.sibling}return null}var Fb=vs.unstable_scheduleCallback,Bb=vs.unstable_cancelCallback,eM=vs.unstable_shouldYield,tM=vs.unstable_requestPaint,Hr=vs.unstable_now,iM=vs.unstable_getCurrentPriorityLevel,uv=vs.unstable_ImmediatePriority,Nb=vs.unstable_UserBlockingPriority,M_=vs.unstable_NormalPriority,nM=vs.unstable_LowPriority,Vb=vs.unstable_IdlePriority,P_=null,Wa=null;function rM(h){if(Wa&&typeof Wa.onCommitFiberRoot=="function")try{Wa.onCommitFiberRoot(P_,h,void 0,(h.current.flags&128)===128)}catch{}}var da=Math.clz32?Math.clz32:aM,oM=Math.log,sM=Math.LN2;function aM(h){return h>>>=0,h===0?32:31-(oM(h)/sM|0)|0}var R_=64,L_=4194304;function jp(h){switch(h&-h){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return h&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return h&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return h}}function z_(h,f){var w=h.pendingLanes;if(w===0)return 0;var A=0,L=h.suspendedLanes,F=h.pingedLanes,X=w&268435455;if(X!==0){var s=X&~L;s!==0?A=jp(s):(F&=X,F!==0&&(A=jp(F)))}else X=w&~L,X!==0?A=jp(X):F!==0&&(A=jp(F));if(A===0)return 0;if(f!==0&&f!==A&&!(f&L)&&(L=A&-A,F=f&-f,L>=F||L===16&&(F&4194240)!==0))return f;if(A&4&&(A|=w&16),f=h.entangledLanes,f!==0)for(h=h.entanglements,f&=A;0<f;)w=31-da(f),L=1<<w,A|=h[w],f&=~L;return A}function lM(h,f){switch(h){case 1:case 2:case 4:return f+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cM(h,f){for(var w=h.suspendedLanes,A=h.pingedLanes,L=h.expirationTimes,F=h.pendingLanes;0<F;){var X=31-da(F),s=1<<X,de=L[X];de===-1?(!(s&w)||s&A)&&(L[X]=lM(s,f)):de<=f&&(h.expiredLanes|=s),F&=~s}}function hv(h){return h=h.pendingLanes&-1073741825,h!==0?h:h&1073741824?1073741824:0}function jb(){var h=R_;return R_<<=1,!(R_&4194240)&&(R_=64),h}function dv(h){for(var f=[],w=0;31>w;w++)f.push(h);return f}function Up(h,f,w){h.pendingLanes|=f,f!==536870912&&(h.suspendedLanes=0,h.pingedLanes=0),h=h.eventTimes,f=31-da(f),h[f]=w}function uM(h,f){var w=h.pendingLanes&~f;h.pendingLanes=f,h.suspendedLanes=0,h.pingedLanes=0,h.expiredLanes&=f,h.mutableReadLanes&=f,h.entangledLanes&=f,f=h.entanglements;var A=h.eventTimes;for(h=h.expirationTimes;0<w;){var L=31-da(w),F=1<<L;f[L]=0,A[L]=-1,h[L]=-1,w&=~F}}function pv(h,f){var w=h.entangledLanes|=f;for(h=h.entanglements;w;){var A=31-da(w),L=1<<A;L&f|h[A]&f&&(h[A]|=f),w&=~L}}var or=0;function Ub(h){return h&=-h,1<h?4<h?h&268435455?16:536870912:4:1}var Gb,fv,$b,Hb,qb,mv=!1,D_=[],lc=null,cc=null,uc=null,Gp=new Map,$p=new Map,hc=[],hM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Zb(h,f){switch(h){case"focusin":case"focusout":lc=null;break;case"dragenter":case"dragleave":cc=null;break;case"mouseover":case"mouseout":uc=null;break;case"pointerover":case"pointerout":Gp.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":$p.delete(f.pointerId)}}function Hp(h,f,w,A,L,F){return h===null||h.nativeEvent!==F?(h={blockedOn:f,domEventName:w,eventSystemFlags:A,nativeEvent:F,targetContainers:[L]},f!==null&&(f=sf(f),f!==null&&fv(f)),h):(h.eventSystemFlags|=A,f=h.targetContainers,L!==null&&f.indexOf(L)===-1&&f.push(L),h)}function dM(h,f,w,A,L){switch(f){case"focusin":return lc=Hp(lc,h,f,w,A,L),!0;case"dragenter":return cc=Hp(cc,h,f,w,A,L),!0;case"mouseover":return uc=Hp(uc,h,f,w,A,L),!0;case"pointerover":var F=L.pointerId;return Gp.set(F,Hp(Gp.get(F)||null,h,f,w,A,L)),!0;case"gotpointercapture":return F=L.pointerId,$p.set(F,Hp($p.get(F)||null,h,f,w,A,L)),!0}return!1}function Wb(h){var f=cu(h.target);if(f!==null){var w=lu(f);if(w!==null){if(f=w.tag,f===13){if(f=zb(w),f!==null){h.blockedOn=f,qb(h.priority,function(){$b(w)});return}}else if(f===3&&w.stateNode.current.memoizedState.isDehydrated){h.blockedOn=w.tag===3?w.stateNode.containerInfo:null;return}}}h.blockedOn=null}function k_(h){if(h.blockedOn!==null)return!1;for(var f=h.targetContainers;0<f.length;){var w=gv(h.domEventName,h.eventSystemFlags,f[0],h.nativeEvent);if(w===null){w=h.nativeEvent;var A=new w.constructor(w.type,w);rv=A,w.target.dispatchEvent(A),rv=null}else return f=sf(w),f!==null&&fv(f),h.blockedOn=w,!1;f.shift()}return!0}function Xb(h,f,w){k_(h)&&w.delete(f)}function pM(){mv=!1,lc!==null&&k_(lc)&&(lc=null),cc!==null&&k_(cc)&&(cc=null),uc!==null&&k_(uc)&&(uc=null),Gp.forEach(Xb),$p.forEach(Xb)}function qp(h,f){h.blockedOn===f&&(h.blockedOn=null,mv||(mv=!0,vs.unstable_scheduleCallback(vs.unstable_NormalPriority,pM)))}function Zp(h){function f(L){return qp(L,h)}if(0<D_.length){qp(D_[0],h);for(var w=1;w<D_.length;w++){var A=D_[w];A.blockedOn===h&&(A.blockedOn=null)}}for(lc!==null&&qp(lc,h),cc!==null&&qp(cc,h),uc!==null&&qp(uc,h),Gp.forEach(f),$p.forEach(f),w=0;w<hc.length;w++)A=hc[w],A.blockedOn===h&&(A.blockedOn=null);for(;0<hc.length&&(w=hc[0],w.blockedOn===null);)Wb(w),w.blockedOn===null&&hc.shift()}var Sh=Tl.ReactCurrentBatchConfig,O_=!0;function fM(h,f,w,A){var L=or,F=Sh.transition;Sh.transition=null;try{or=1,_v(h,f,w,A)}finally{or=L,Sh.transition=F}}function mM(h,f,w,A){var L=or,F=Sh.transition;Sh.transition=null;try{or=4,_v(h,f,w,A)}finally{or=L,Sh.transition=F}}function _v(h,f,w,A){if(O_){var L=gv(h,f,w,A);if(L===null)Dv(h,f,A,F_,w),Zb(h,A);else if(dM(L,h,f,w,A))A.stopPropagation();else if(Zb(h,A),f&4&&-1<hM.indexOf(h)){for(;L!==null;){var F=sf(L);if(F!==null&&Gb(F),F=gv(h,f,w,A),F===null&&Dv(h,f,A,F_,w),F===L)break;L=F}L!==null&&A.stopPropagation()}else Dv(h,f,A,null,w)}}var F_=null;
vendor: 4,448 bytes, line 37
37function gv(h,f,w,A){if(F_=null,h=ov(A),h=cu(h),h!==null)if(f=lu(h),f===null)h=null;else if(w=f.tag,w===13){if(h=zb(f),h!==null)return h;h=null}else if(w===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;h=null}else f!==h&&(h=null);return F_=h,null}function Yb(h){switch(h){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(iM()){case uv:return 1;case Nb:return 4;case M_:case nM:return 16;case Vb:return 536870912;default:return 16}default:return 16}}var dc=null,yv=null,B_=null;function Kb(){if(B_)return B_;var h,f=yv,w=f.length,A,L="value"in dc?dc.value:dc.textContent,F=L.length;for(h=0;h<w&&f[h]===L[h];h++);var X=w-h;for(A=1;A<=X&&f[w-A]===L[F-A];A++);return B_=L.slice(h,1<A?1-A:void 0)}function N_(h){var f=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&f===13&&(h=13)):h=f,h===10&&(h=13),32<=h||h===13?h:0}function V_(){return!0}function Jb(){return!1}function xs(h){function f(w,A,L,F,X){this._reactName=w,this._targetInst=L,this.type=A,this.nativeEvent=F,this.target=X,this.currentTarget=null;for(var s in h)h.hasOwnProperty(s)&&(w=h[s],this[s]=w?w(F):F[s]);return this.isDefaultPrevented=(F.defaultPrevented!=null?F.defaultPrevented:F.returnValue===!1)?V_:Jb,this.isPropagationStopped=Jb,this}return zr(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var w=this.nativeEvent;w&&(w.preventDefault?w.preventDefault():typeof w.returnValue!="unknown"&&(w.returnValue=!1),this.isDefaultPrevented=V_)},stopPropagation:function(){var w=this.nativeEvent;w&&(w.stopPropagation?w.stopPropagation():typeof w.cancelBubble!="unknown"&&(w.cancelBubble=!0),this.isPropagationStopped=V_)},persist:function(){},isPersistent:V_}),f}var Eh={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vv=xs(Eh),Wp=zr({},Eh,{view:0,detail:0}),_M=xs(Wp),xv,wv,Xp,j_=zr({},Wp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tv,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==Xp&&(Xp&&h.type==="mousemove"?(xv=h.screenX-Xp.screenX,wv=h.screenY-Xp.screenY):wv=xv=0,Xp=h),xv)},movementY:function(h){return"movementY"in h?h.movementY:wv}}),Qb=xs(j_),gM=zr({},j_,{dataTransfer:0}),yM=xs(gM),vM=zr({},Wp,{relatedTarget:0}),bv=xs(vM),xM=zr({},Eh,{animationName:0,elapsedTime:0,pseudoElement:0}),wM=xs(xM),bM=zr({},Eh,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),TM=xs(bM),SM=zr({},Eh,{data:0}),eT=xs(SM),EM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},AM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};
vendor: 5,001 bytes, line 37
37function CM(h){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(h):(h=AM[h])?!!f[h]:!1}function Tv(){return CM}var MM=zr({},Wp,{key:function(h){if(h.key){var f=EM[h.key]||h.key;if(f!=="Unidentified")return f}return h.type==="keypress"?(h=N_(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?IM[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tv,charCode:function(h){return h.type==="keypress"?N_(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?N_(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),PM=xs(MM),RM=zr({},j_,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tT=xs(RM),LM=zr({},Wp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tv}),zM=xs(LM),DM=zr({},Eh,{propertyName:0,elapsedTime:0,pseudoElement:0}),kM=xs(DM),OM=zr({},j_,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),FM=xs(OM),BM=[9,13,27,32],Sv=bl&&"CompositionEvent"in window,Yp=null;bl&&"documentMode"in document&&(Yp=document.documentMode);var NM=bl&&"TextEvent"in window&&!Yp,iT=bl&&(!Sv||Yp&&8<Yp&&11>=Yp),nT=String.fromCharCode(32),rT=!1;function oT(h,f){switch(h){case"keyup":return BM.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sT(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var Ih=!1;function VM(h,f){switch(h){case"compositionend":return sT(f);case"keypress":return f.which!==32?null:(rT=!0,nT);case"textInput":return h=f.data,h===nT&&rT?null:h;default:return null}}function jM(h,f){if(Ih)return h==="compositionend"||!Sv&&oT(h,f)?(h=Kb(),B_=yv=dc=null,Ih=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return iT&&f.locale!=="ko"?null:f.data;default:return null}}var UM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function aT(h){var f=h&&h.nodeName&&h.nodeName.toLowerCase();return f==="input"?!!UM[h.type]:f==="textarea"}function lT(h,f,w,A){Cb(A),f=q_(f,"onChange"),0<f.length&&(w=new vv("onChange","change",null,w,A),h.push({event:w,listeners:f}))}var Kp=null,Jp=null;function GM(h){IT(h,0)}function U_(h){var f=Rh(h);if(_b(f))return h}function $M(h,f){if(h==="change")return f}var cT=!1;if(bl){var Ev;if(bl){var Iv="oninput"in document;if(!Iv){var uT=document.createElement("div");uT.setAttribute("oninput","return;"),Iv=typeof uT.oninput=="function"}Ev=Iv}else Ev=!1;cT=Ev&&(!document.documentMode||9<document.documentMode)}function hT(){Kp&&(Kp.detachEvent("onpropertychange",dT),Jp=Kp=null)}function dT(h){if(h.propertyName==="value"&&U_(Jp)){var f=[];lT(f,Jp,h,ov(h)),Lb(GM,f)}}function HM(h,f,w){h==="focusin"?(hT(),Kp=f,Jp=w,Kp.attachEvent("onpropertychange",dT)):h==="focusout"&&hT()}function qM(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return U_(Jp)}function ZM(h,f){if(h==="click")return U_(f)}function WM(h,f){if(h==="input"||h==="change")return U_(f)}function XM(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var pa=typeof Object.is=="function"?Object.is:XM;function Qp(h,f){if(pa(h,f))return!0;if(typeof h!="object"||h===null||typeof f!="object"||f===null)return!1;var w=Object.keys(h),A=Object.keys(f);if(w.length!==A.length)return!1;for(A=0;A<w.length;A++){var L=w[A];if(!F0.call(f,L)||!pa(h[L],f[L]))return!1}return!0}function pT(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function fT(h,f){var w=pT(h);h=0;for(var A;w;){if(w.nodeType===3){if(A=h+w.textContent.length,h<=f&&A>=f)return{node:w,offset:f-h};h=A}e:{for(;w;){if(w.nextSibling){w=w.nextSibling;break e}w=w.parentNode}w=void 0}w=pT(w)}}function mT(h,f){return h&&f?h===f?!0:h&&h.nodeType===3?!1:f&&f.nodeType===3?mT(h,f.parentNode):"contains"in h?h.contains(f):h.compareDocumentPosition?!!(h.compareDocumentPosition(f)&16):!1:!1}function _T(){for(var h=window,f=E_();f instanceof h.HTMLIFrameElement;){try{var w=typeof f.contentWindow.location.href=="string"}catch{w=!1}if(w)h=f.contentWindow;else break;f=E_(h.document)}return f}function Av(h){var f=h&&h.nodeName&&h.nodeName.toLowerCase();return f&&(f==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||f==="textarea"||h.contentEditable==="true")}function YM(h){var f=_T(),w=h.focusedElem,A=h.selectionRange;if(f!==w&&w&&w.ownerDocument&&mT(w.ownerDocument.documentElement,w)){if(A!==null&&Av(w)){if
vendor: 5,084 bytes, line 37
37(f=A.start,h=A.end,h===void 0&&(h=f),"selectionStart"in w)w.selectionStart=f,w.selectionEnd=Math.min(h,w.value.length);else if(h=(f=w.ownerDocument||document)&&f.defaultView||window,h.getSelection){h=h.getSelection();var L=w.textContent.length,F=Math.min(A.start,L);A=A.end===void 0?F:Math.min(A.end,L),!h.extend&&F>A&&(L=A,A=F,F=L),L=fT(w,F);var X=fT(w,A);L&&X&&(h.rangeCount!==1||h.anchorNode!==L.node||h.anchorOffset!==L.offset||h.focusNode!==X.node||h.focusOffset!==X.offset)&&(f=f.createRange(),f.setStart(L.node,L.offset),h.removeAllRanges(),F>A?(h.addRange(f),h.extend(X.node,X.offset)):(f.setEnd(X.node,X.offset),h.addRange(f)))}}for(f=[],h=w;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<f.length;w++)h=f[w],h.element.scrollLeft=h.left,h.element.scrollTop=h.top}}var KM=bl&&"documentMode"in document&&11>=document.documentMode,Ah=null,Cv=null,ef=null,Mv=!1;function gT(h,f,w){var A=w.window===w?w.document:w.nodeType===9?w:w.ownerDocument;Mv||Ah==null||Ah!==E_(A)||(A=Ah,"selectionStart"in A&&Av(A)?A={start:A.selectionStart,end:A.selectionEnd}:(A=(A.ownerDocument&&A.ownerDocument.defaultView||window).getSelection(),A={anchorNode:A.anchorNode,anchorOffset:A.anchorOffset,focusNode:A.focusNode,focusOffset:A.focusOffset}),ef&&Qp(ef,A)||(ef=A,A=q_(Cv,"onSelect"),0<A.length&&(f=new vv("onSelect","select",null,f,w),h.push({event:f,listeners:A}),f.target=Ah)))}function G_(h,f){var w={};return w[h.toLowerCase()]=f.toLowerCase(),w["Webkit"+h]="webkit"+f,w["Moz"+h]="moz"+f,w}var Ch={animationend:G_("Animation","AnimationEnd"),animationiteration:G_("Animation","AnimationIteration"),animationstart:G_("Animation","AnimationStart"),transitionend:G_("Transition","TransitionEnd")},Pv={},yT={};bl&&(yT=document.createElement("div").style,"AnimationEvent"in window||(delete Ch.animationend.animation,delete Ch.animationiteration.animation,delete Ch.animationstart.animation),"TransitionEvent"in window||delete Ch.transitionend.transition);function $_(h){if(Pv[h])return Pv[h];if(!Ch[h])return h;var f=Ch[h],w;for(w in f)if(f.hasOwnProperty(w)&&w in yT)return Pv[h]=f[w];return h}var vT=$_("animationend"),xT=$_("animationiteration"),wT=$_("animationstart"),bT=$_("transitionend"),TT=new Map,ST="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function pc(h,f){TT.set(h,f),au(f,[h])}for(var Rv=0;Rv<ST.length;Rv++){var Lv=ST[Rv],JM=Lv.toLowerCase(),QM=Lv[0].toUpperCase()+Lv.slice(1);pc(JM,"on"+QM)}pc(vT,"onAnimationEnd"),pc(xT,"onAnimationIteration"),pc(wT,"onAnimationStart"),pc("dblclick","onDoubleClick"),pc("focusin","onFocus"),pc("focusout","onBlur"),pc(bT,"onTransitionEnd"),yh("onMouseEnter",["mouseout","mouseover"]),yh("onMouseLeave",["mouseout","mouseover"]),yh("onPointerEnter",["pointerout","pointerover"]),yh("onPointerLeave",["pointerout","pointerover"]),au("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),au("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),au("onBeforeInput",["compositionend","keypress","textInput","paste"]),au("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),au("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),au("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),eP=new Set("cancel close invalid load scroll toggle".split(" ").concat(tf));function ET(h,f,w){var A=h.type||"unknown-event";h.currentTarget=w,JC(A,f,void 0,h),h.currentTarget=null}function IT(h,f){f=(f&4)!==0;for(var w=0;w<h.length;w++){var A=h[w],L=A.event;A=A.listeners;e:{var F=void 0;if(f)for(var X=A.length-1;0<=X;X--){var s=A[X],de=s.instance,Ee=s.currentTarget;if(s=s.listener,de!==F&&L.isPropagationStopped())break e;ET(L,s,Ee),F=de}else for(X=0;X<A.length;X++){if(s=A[X],de=s.instance,Ee=s.currentTarget,s=s.listener,de!==F&&L.isPropagationStopped())break e;ET(L,s,Ee),F=de}}}if(C_)throw h=cv,C_=!1,cv=null,h}function xr(h,f){var w=f[Vv];w===void 0&&(w=f[Vv]=new Set);var A=h+"__bubble";w.has(A)||(AT(f,h,2,!1),w.add(A))}function zv(h,f,w){var A=0;f&&(A|=4),AT(w,h,A,f)}var H_="_reactListening"+Math.random().toString(36).slice(2);
vendor: 4,190 bytes, line 37
37function nf(h){if(!h[H_]){h[H_]=!0,lb.forEach(function(w){w!=="selectionchange"&&(eP.has(w)||zv(w,!1,h),zv(w,!0,h))});var f=h.nodeType===9?h:h.ownerDocument;f===null||f[H_]||(f[H_]=!0,zv("selectionchange",!1,f))}}function AT(h,f,w,A){switch(Yb(f)){case 1:var L=fM;break;case 4:L=mM;break;default:L=_v}w=L.bind(null,f,w,h),L=void 0,!lv||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(L=!0),A?L!==void 0?h.addEventListener(f,w,{capture:!0,passive:L}):h.addEventListener(f,w,!0):L!==void 0?h.addEventListener(f,w,{passive:L}):h.addEventListener(f,w,!1)}function Dv(h,f,w,A,L){var F=A;if(!(f&1)&&!(f&2)&&A!==null)e:for(;;){if(A===null)return;var X=A.tag;if(X===3||X===4){var s=A.stateNode.containerInfo;if(s===L||s.nodeType===8&&s.parentNode===L)break;if(X===4)for(X=A.return;X!==null;){var de=X.tag;if((de===3||de===4)&&(de=X.stateNode.containerInfo,de===L||de.nodeType===8&&de.parentNode===L))return;X=X.return}for(;s!==null;){if(X=cu(s),X===null)return;if(de=X.tag,de===5||de===6){A=F=X;continue e}s=s.parentNode}}A=A.return}Lb(function(){var Ee=F,tt=ov(w),Ie=[];e:{var He=TT.get(h);if(He!==void 0){var vt=vv,mt=h;switch(h){case"keypress":if(N_(w)===0)break e;case"keydown":case"keyup":vt=PM;break;case"focusin":mt="focus",vt=bv;break;case"focusout":mt="blur",vt=bv;break;case"beforeblur":case"afterblur":vt=bv;break;case"click":if(w.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":vt=Qb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":vt=yM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":vt=zM;break;case vT:case xT:case wT:vt=wM;break;case bT:vt=kM;break;case"scroll":vt=_M;break;case"wheel":vt=FM;break;case"copy":case"cut":case"paste":vt=TM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":vt=tT}var at=(f&4)!==0,Ft=!at&&h==="scroll",Ve=at?He!==null?He+"Capture":null:He;at=[];for(var Se=Ee,Ce;Se!==null;){Ce=Se;var dt=Ce.stateNode;if(Ce.tag===5&&dt!==null&&(Ce=dt,Ve!==null&&(dt=Bp(Se,Ve),dt!=null&&at.push(rf(Se,dt,Ce)))),Ft)break;Se=Se.return}0<at.length&&(He=new vt(He,mt,null,w,tt),Ie.push({event:He,listeners:at}))}}if(!(f&7)){e:{if(He=h==="mouseover"||h==="pointerover",vt=h==="mouseout"||h==="pointerout",He&&w!==rv&&(mt=w.relatedTarget||w.fromElement)&&(cu(mt)||mt[Sl]))break e;if((vt||He)&&(He=tt.window===tt?tt:(He=tt.ownerDocument)?He.defaultView||He.parentWindow:window,vt?(mt=w.relatedTarget||w.toElement,vt=Ee,mt=mt?cu(mt):null,mt!==null&&(Ft=lu(mt),mt!==Ft||mt.tag!==5&&mt.tag!==6)&&(mt=null)):(vt=null,mt=Ee),vt!==mt)){if(at=Qb,dt="onMouseLeave",Ve="onMouseEnter",Se="mouse",(h==="pointerout"||h==="pointerover")&&(at=tT,dt="onPointerLeave",Ve="onPointerEnter",Se="pointer"),Ft=vt==null?He:Rh(vt),Ce=mt==null?He:Rh(mt),He=new at(dt,Se+"leave",vt,w,tt),He.target=Ft,He.relatedTarget=Ce,dt=null,cu(tt)===Ee&&(at=new at(Ve,Se+"enter",mt,w,tt),at.target=Ce,at.relatedTarget=Ft,dt=at),Ft=dt,vt&&mt)t:{for(at=vt,Ve=mt,Se=0,Ce=at;Ce;Ce=Mh(Ce))Se++;for(Ce=0,dt=Ve;dt;dt=Mh(dt))Ce++;for(;0<Se-Ce;)at=Mh(at),Se--;for(;0<Ce-Se;)Ve=Mh(Ve),Ce--;for(;Se--;){if(at===Ve||Ve!==null&&at===Ve.alternate)break t;at=Mh(at),Ve=Mh(Ve)}at=null}else at=null;vt!==null&&CT(Ie,He,vt,at,!1),mt!==null&&Ft!==null&&CT(Ie,Ft,mt,at,!0)}}e:{if(He=Ee?Rh(Ee):window,vt=He.nodeName&&He.nodeName.toLowerCase(),vt==="select"||vt==="input"&&He.type==="file")var Vt=$M;else if(aT(He))if(cT)Vt=WM;else{Vt=qM;var jt=HM}else(vt=He.nodeName)&&vt.toLowerCase()==="input"&&(He.type==="checkbox"||He.type==="radio")&&(Vt=ZM);if(Vt&&(Vt=Vt(h,Ee))){lT(Ie,Vt,w,tt);break e}jt&&jt(h,He,Ee),h==="focusout"&&(jt=He._wrapperState)&&jt.controlled&&He.type==="number"&&Q0(He,"number",He.value)}switch(jt=Ee?Rh(Ee):window,h){case"focusin":(aT(jt)||jt.contentEditable==="true")&&(Ah=jt,Cv=Ee,ef=null);break;case"focusout":ef=Cv=Ah=null;break;case"mousedown":Mv=!0;break;case"contextmenu":case"mouseup":case"dragend":Mv=!1,gT(Ie,w,tt);break;case"selectionchange":if(KM)break;case"keydown":case"keyup":gT(Ie,w,tt)}var qt;
vendor: 5,155 bytes, lines 37-38
37if(Sv)e:{switch(h){case"compositionstart":var si="onCompositionStart";break e;case"compositionend":si="onCompositionEnd";break e;case"compositionupdate":si="onCompositionUpdate";break e}si=void 0}else Ih?oT(h,w)&&(si="onCompositionEnd"):h==="keydown"&&w.keyCode===229&&(si="onCompositionStart");si&&(iT&&w.locale!=="ko"&&(Ih||si!=="onCompositionStart"?si==="onCompositionEnd"&&Ih&&(qt=Kb()):(dc=tt,yv="value"in dc?dc.value:dc.textContent,Ih=!0)),jt=q_(Ee,si),0<jt.length&&(si=new eT(si,h,null,w,tt),Ie.push({event:si,listeners:jt}),qt?si.data=qt:(qt=sT(w),qt!==null&&(si.data=qt)))),(qt=NM?VM(h,w):jM(h,w))&&(Ee=q_(Ee,"onBeforeInput"),0<Ee.length&&(tt=new eT("onBeforeInput","beforeinput",null,w,tt),Ie.push({event:tt,listeners:Ee}),tt.data=qt))}IT(Ie,f)})}function rf(h,f,w){return{instance:h,listener:f,currentTarget:w}}function q_(h,f){for(var w=f+"Capture",A=[];h!==null;){var L=h,F=L.stateNode;L.tag===5&&F!==null&&(L=F,F=Bp(h,w),F!=null&&A.unshift(rf(h,F,L)),F=Bp(h,f),F!=null&&A.push(rf(h,F,L))),h=h.return}return A}function Mh(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5);return h||null}function CT(h,f,w,A,L){for(var F=f._reactName,X=[];w!==null&&w!==A;){var s=w,de=s.alternate,Ee=s.stateNode;if(de!==null&&de===A)break;s.tag===5&&Ee!==null&&(s=Ee,L?(de=Bp(w,F),de!=null&&X.unshift(rf(w,de,s))):L||(de=Bp(w,F),de!=null&&X.push(rf(w,de,s)))),w=w.return}X.length!==0&&h.push({event:f,listeners:X})}var tP=/\r\n?/g,iP=/\u0000|\uFFFD/g;function MT(h){return(typeof h=="string"?h:""+h).replace(tP,`
38`).replace(iP,"")}function Z_(h,f,w){if(f=MT(f),MT(h)!==f&&w)throw Error(Zt(425))}function W_(){}var kv=null,Ov=null;function Fv(h,f){return h==="textarea"||h==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var Bv=typeof setTimeout=="function"?setTimeout:void 0,nP=typeof clearTimeout=="function"?clearTimeout:void 0,PT=typeof Promise=="function"?Promise:void 0,rP=typeof queueMicrotask=="function"?queueMicrotask:typeof PT<"u"?function(h){return PT.resolve(null).then(h).catch(oP)}:Bv;function oP(h){setTimeout(function(){throw h})}function Nv(h,f){var w=f,A=0;do{var L=w.nextSibling;if(h.removeChild(w),L&&L.nodeType===8)if(w=L.data,w==="/$"){if(A===0){h.removeChild(L),Zp(f);return}A--}else w!=="$"&&w!=="$?"&&w!=="$!"||A++;w=L}while(w);Zp(f)}function fc(h){for(;h!=null;h=h.nextSibling){var f=h.nodeType;if(f===1||f===3)break;if(f===8){if(f=h.data,f==="$"||f==="$!"||f==="$?")break;if(f==="/$")return null}}return h}function RT(h){h=h.previousSibling;for(var f=0;h;){if(h.nodeType===8){var w=h.data;if(w==="$"||w==="$!"||w==="$?"){if(f===0)return h;f--}else w==="/$"&&f++}h=h.previousSibling}return null}var Ph=Math.random().toString(36).slice(2),Xa="__reactFiber$"+Ph,of="__reactProps$"+Ph,Sl="__reactContainer$"+Ph,Vv="__reactEvents$"+Ph,sP="__reactListeners$"+Ph,aP="__reactHandles$"+Ph;function cu(h){var f=h[Xa];if(f)return f;for(var w=h.parentNode;w;){if(f=w[Sl]||w[Xa]){if(w=f.alternate,f.child!==null||w!==null&&w.child!==null)for(h=RT(h);h!==null;){if(w=h[Xa])return w;h=RT(h)}return f}h=w,w=h.parentNode}return null}function sf(h){return h=h[Xa]||h[Sl],!h||h.tag!==5&&h.tag!==6&&h.tag!==13&&h.tag!==3?null:h}function Rh(h){if(h.tag===5||h.tag===6)return h.stateNode;throw Error(Zt(33))}function X_(h){return h[of]||null}var jv=[],Lh=-1;function mc(h){return{current:h}}function wr(h){0>Lh||(h.current=jv[Lh],jv[Lh]=null,Lh--)}function pr(h,f){Lh++,jv[Lh]=h.current,h.current=f}var _c={},Po=mc(_c),ts=mc(!1),uu=_c;function zh(h,f){var w=h.type.contextTypes;if(!w)return _c;var A=h.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===f)return A.__reactInternalMemoizedMaskedChildContext;var L={},F;for(F in w)L[F]=f[F];return A&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=f,h.__reactInternalMemoizedMaskedChildContext=L),L}function is(h){return h=h.childContextTypes,h!=null}function Y_(){wr(ts),wr(Po)}function LT(h,f,w){if(Po.current!==_c)throw Error(Zt(168));pr(Po,f),pr(ts,w)}function zT(h,f,w){var A=h.stateNode;if(f=f.childContextTypes,typeof A.getChildContext!="function")return w;A=A.getChildContext();for(var L in A)if(!(L in f))throw Error(Zt(108,HC(h)||"Unknown",L));return zr({},w,A)}function K_(h){return h=(h=h.stateNode)&&h.__reactInternalMemoizedMergedChildContext||_c,uu=Po.current,pr(Po,h),pr(ts,ts.current),!0}function DT(h,f,w){var A=h.stateNode;if(!A)throw Error(Zt(169));w?(h=zT(h,f,uu),A.__reactInternalMemoizedMergedChildContext=h,wr(ts),wr(Po),pr(Po,h)):wr(ts),pr(ts,w)}var El=null,J_=!1,Uv=!1;function kT(h){El===null?El=[h]:El.push(h)}function lP(h){J_=!0,kT(h)}function gc(){if(!Uv&&El!==null){Uv=!0;var h=0,f=or;try{var w=El;for(or=1;h<w.length;h++){var A=w[h];do A=A(!0);while(A!==null)}El=null,J_=!1}catch(L){throw El!==null&&(El=El.slice(h+1)),Fb(uv,gc),L}finally{or=f,Uv=!1}}return null}var Dh=[],kh=0,Q_=null,eg=0,Bs=[],Ns=0,hu=null,Il=1,Al="";function du(h,f){Dh[kh++]=eg,Dh[kh++]=Q_,Q_=h,eg=f}function OT(h,f,w){Bs[Ns++]=Il,Bs[Ns++]=Al,Bs[Ns++]=hu,hu=h;var A=Il;h=Al;var L=32-da(A)-1;A&=~(1<<L),w+=1;var F=32-da(f)+L;
vendor: 5,140 bytes, line 38
38if(30<F){var X=L-L%5;F=(A&(1<<X)-1).toString(32),A>>=X,L-=X,Il=1<<32-da(f)+L|w<<L|A,Al=F+h}else Il=1<<F|w<<L|A,Al=h}function Gv(h){h.return!==null&&(du(h,1),OT(h,1,0))}function $v(h){for(;h===Q_;)Q_=Dh[--kh],Dh[kh]=null,eg=Dh[--kh],Dh[kh]=null;for(;h===hu;)hu=Bs[--Ns],Bs[Ns]=null,Al=Bs[--Ns],Bs[Ns]=null,Il=Bs[--Ns],Bs[Ns]=null}var ws=null,bs=null,Ar=!1,fa=null;function FT(h,f){var w=Gs(5,null,null,0);w.elementType="DELETED",w.stateNode=f,w.return=h,f=h.deletions,f===null?(h.deletions=[w],h.flags|=16):f.push(w)}function BT(h,f){switch(h.tag){case 5:var w=h.type;return f=f.nodeType!==1||w.toLowerCase()!==f.nodeName.toLowerCase()?null:f,f!==null?(h.stateNode=f,ws=h,bs=fc(f.firstChild),!0):!1;case 6:return f=h.pendingProps===""||f.nodeType!==3?null:f,f!==null?(h.stateNode=f,ws=h,bs=null,!0):!1;case 13:return f=f.nodeType!==8?null:f,f!==null?(w=hu!==null?{id:Il,overflow:Al}:null,h.memoizedState={dehydrated:f,treeContext:w,retryLane:1073741824},w=Gs(18,null,null,0),w.stateNode=f,w.return=h,h.child=w,ws=h,bs=null,!0):!1;default:return!1}}function Hv(h){return(h.mode&1)!==0&&(h.flags&128)===0}function qv(h){if(Ar){var f=bs;if(f){var w=f;if(!BT(h,f)){if(Hv(h))throw Error(Zt(418));f=fc(w.nextSibling);var A=ws;f&&BT(h,f)?FT(A,w):(h.flags=h.flags&-4097|2,Ar=!1,ws=h)}}else{if(Hv(h))throw Error(Zt(418));h.flags=h.flags&-4097|2,Ar=!1,ws=h}}}function NT(h){for(h=h.return;h!==null&&h.tag!==5&&h.tag!==3&&h.tag!==13;)h=h.return;ws=h}function tg(h){if(h!==ws)return!1;if(!Ar)return NT(h),Ar=!0,!1;var f;if((f=h.tag!==3)&&!(f=h.tag!==5)&&(f=h.type,f=f!=="head"&&f!=="body"&&!Fv(h.type,h.memoizedProps)),f&&(f=bs)){if(Hv(h))throw VT(),Error(Zt(418));for(;f;)FT(h,f),f=fc(f.nextSibling)}if(NT(h),h.tag===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(Zt(317));e:{for(h=h.nextSibling,f=0;h;){if(h.nodeType===8){var w=h.data;if(w==="/$"){if(f===0){bs=fc(h.nextSibling);break e}f--}else w!=="$"&&w!=="$!"&&w!=="$?"||f++}h=h.nextSibling}bs=null}}else bs=ws?fc(h.stateNode.nextSibling):null;return!0}function VT(){for(var h=bs;h;)h=fc(h.nextSibling)}function Oh(){bs=ws=null,Ar=!1}function Zv(h){fa===null?fa=[h]:fa.push(h)}var cP=Tl.ReactCurrentBatchConfig;function af(h,f,w){if(h=w.ref,h!==null&&typeof h!="function"&&typeof h!="object"){if(w._owner){if(w=w._owner,w){if(w.tag!==1)throw Error(Zt(309));var A=w.stateNode}if(!A)throw Error(Zt(147,h));var L=A,F=""+h;return f!==null&&f.ref!==null&&typeof f.ref=="function"&&f.ref._stringRef===F?f.ref:(f=function(X){var s=L.refs;X===null?delete s[F]:s[F]=X},f._stringRef=F,f)}if(typeof h!="string")throw Error(Zt(284));if(!w._owner)throw Error(Zt(290,h))}return h}function ig(h,f){throw h=Object.prototype.toString.call(f),Error(Zt(31,h==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":h))}function jT(h){var f=h._init;return f(h._payload)}function UT(h){function f(Ve,Se){if(h){var Ce=Ve.deletions;Ce===null?(Ve.deletions=[Se],Ve.flags|=16):Ce.push(Se)}}function w(Ve,Se){if(!h)return null;for(;Se!==null;)f(Ve,Se),Se=Se.sibling;return null}function A(Ve,Se){for(Ve=new Map;Se!==null;)Se.key!==null?Ve.set(Se.key,Se):Ve.set(Se.index,Se),Se=Se.sibling;return Ve}function L(Ve,Se){return Ve=Ec(Ve,Se),Ve.index=0,Ve.sibling=null,Ve}function F(Ve,Se,Ce){return Ve.index=Ce,h?(Ce=Ve.alternate,Ce!==null?(Ce=Ce.index,Ce<Se?(Ve.flags|=2,Se):Ce):(Ve.flags|=2,Se)):(Ve.flags|=1048576,Se)}function X(Ve){return h&&Ve.alternate===null&&(Ve.flags|=2),Ve}function s(Ve,Se,Ce,dt){return Se===null||Se.tag!==6?(Se=Bx(Ce,Ve.mode,dt),Se.return=Ve,Se):(Se=L(Se,Ce),Se.return=Ve,Se)}function de(Ve,Se,Ce,dt){var Vt=Ce.type;return Vt===xh?tt(Ve,Se,Ce.props.children,dt,Ce.key):Se!==null&&(Se.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===sc&&jT(Vt)===Se.type)?(dt=L(Se,Ce.props),dt.ref=af(Ve,Se,Ce),dt.return=Ve,dt):(dt=Ig(Ce.type,Ce.key,Ce.props,null,Ve.mode,dt),dt.ref=af(Ve,Se,Ce),dt.return=Ve,dt)}function Ee(Ve,Se,Ce,dt){return Se===null||Se.tag!==4||Se.stateNode.containerInfo!==Ce.containerInfo||Se.stateNode.implementation!==Ce.implementation?(Se=Nx(Ce,Ve.mode,dt),Se.return=Ve,Se):(Se=L(Se,Ce.children||[]),Se.return=Ve,Se)}function tt(Ve,Se,Ce,dt,Vt){return Se===null||Se.tag!==7?(Se=xu(Ce,Ve.mode,dt,Vt),Se.return=Ve,Se):(Se=L(Se,Ce),Se.return=Ve,Se)}function Ie(Ve,Se,Ce){if(typeof Se=="string"&&Se!==""||typeof Se=="number")return Se=Bx(""+Se,Ve.mode,Ce),Se.return=Ve,Se;if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case T_:return Ce=Ig(Se.type,Se.key,Se.props,null,Ve.mode,Ce),Ce.ref=af(Ve,null,Se),Ce.return=Ve,Ce;case vh:return Se=Nx(Se,Ve.mode,Ce),Se.return=Ve,Se;case sc:var dt=Se._init;return Ie(Ve,dt(Se._payload),Ce)}if(kp(Se)||zp(Se))return Se=xu(Se,Ve.mode,Ce,null),Se.return=Ve,Se;ig(Ve,Se)}return null}function He(Ve,Se,Ce,dt){var Vt=Se!==null?Se.key:null;if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number")return Vt!==null?null:s(Ve,Se,""+Ce,dt);if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case T_:return Ce.key===Vt?de(Ve,Se,Ce,dt):null;case vh:return Ce.key===Vt?Ee(Ve,Se,Ce,dt):null;case sc:return Vt=Ce._init,He(Ve,Se,Vt(Ce._payload),dt)}if(kp(Ce)||zp(Ce))return Vt!==null?null:tt(Ve,Se,Ce,dt,null);
vendor: 3,334 bytes, line 38
38ig(Ve,Ce)}return null}function vt(Ve,Se,Ce,dt,Vt){if(typeof dt=="string"&&dt!==""||typeof dt=="number")return Ve=Ve.get(Ce)||null,s(Se,Ve,""+dt,Vt);if(typeof dt=="object"&&dt!==null){switch(dt.$$typeof){case T_:return Ve=Ve.get(dt.key===null?Ce:dt.key)||null,de(Se,Ve,dt,Vt);case vh:return Ve=Ve.get(dt.key===null?Ce:dt.key)||null,Ee(Se,Ve,dt,Vt);case sc:var jt=dt._init;return vt(Ve,Se,Ce,jt(dt._payload),Vt)}if(kp(dt)||zp(dt))return Ve=Ve.get(Ce)||null,tt(Se,Ve,dt,Vt,null);ig(Se,dt)}return null}function mt(Ve,Se,Ce,dt){for(var Vt=null,jt=null,qt=Se,si=Se=0,ji=null;qt!==null&&si<Ce.length;si++){qt.index>si?(ji=qt,qt=null):ji=qt.sibling;var Ui=He(Ve,qt,Ce[si],dt);if(Ui===null){qt===null&&(qt=ji);break}h&&qt&&Ui.alternate===null&&f(Ve,qt),Se=F(Ui,Se,si),jt===null?Vt=Ui:jt.sibling=Ui,jt=Ui,qt=ji}if(si===Ce.length)return w(Ve,qt),Ar&&du(Ve,si),Vt;if(qt===null){for(;si<Ce.length;si++)qt=Ie(Ve,Ce[si],dt),qt!==null&&(Se=F(qt,Se,si),jt===null?Vt=qt:jt.sibling=qt,jt=qt);return Ar&&du(Ve,si),Vt}for(qt=A(Ve,qt);si<Ce.length;si++)ji=vt(qt,Ve,si,Ce[si],dt),ji!==null&&(h&&ji.alternate!==null&&qt.delete(ji.key===null?si:ji.key),Se=F(ji,Se,si),jt===null?Vt=ji:jt.sibling=ji,jt=ji);return h&&qt.forEach(function(ar){return f(Ve,ar)}),Ar&&du(Ve,si),Vt}function at(Ve,Se,Ce,dt){var Vt=zp(Ce);if(typeof Vt!="function")throw Error(Zt(150));if(Ce=Vt.call(Ce),Ce==null)throw Error(Zt(151));for(var jt=Vt=null,qt=Se,si=Se=0,ji=null,Ui=Ce.next();qt!==null&&!Ui.done;si++,Ui=Ce.next()){qt.index>si?(ji=qt,qt=null):ji=qt.sibling;var ar=He(Ve,qt,Ui.value,dt);if(ar===null){qt===null&&(qt=ji);break}h&&qt&&ar.alternate===null&&f(Ve,qt),Se=F(ar,Se,si),jt===null?Vt=ar:jt.sibling=ar,jt=ar,qt=ji}if(Ui.done)return w(Ve,qt),Ar&&du(Ve,si),Vt;if(qt===null){for(;!Ui.done;si++,Ui=Ce.next())Ui=Ie(Ve,Ui.value,dt),Ui!==null&&(Se=F(Ui,Se,si),jt===null?Vt=Ui:jt.sibling=Ui,jt=Ui);return Ar&&du(Ve,si),Vt}for(qt=A(Ve,qt);!Ui.done;si++,Ui=Ce.next())Ui=vt(qt,Ve,si,Ui.value,dt),Ui!==null&&(h&&Ui.alternate!==null&&qt.delete(Ui.key===null?si:Ui.key),Se=F(Ui,Se,si),jt===null?Vt=Ui:jt.sibling=Ui,jt=Ui);return h&&qt.forEach(function(fr){return f(Ve,fr)}),Ar&&du(Ve,si),Vt}function Ft(Ve,Se,Ce,dt){if(typeof Ce=="object"&&Ce!==null&&Ce.type===xh&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case T_:e:{for(var Vt=Ce.key,jt=Se;jt!==null;){if(jt.key===Vt){if(Vt=Ce.type,Vt===xh){if(jt.tag===7){w(Ve,jt.sibling),Se=L(jt,Ce.props.children),Se.return=Ve,Ve=Se;break e}}else if(jt.elementType===Vt||typeof Vt=="object"&&Vt!==null&&Vt.$$typeof===sc&&jT(Vt)===jt.type){w(Ve,jt.sibling),Se=L(jt,Ce.props),Se.ref=af(Ve,jt,Ce),Se.return=Ve,Ve=Se;break e}w(Ve,jt);break}else f(Ve,jt);jt=jt.sibling}Ce.type===xh?(Se=xu(Ce.props.children,Ve.mode,dt,Ce.key),Se.return=Ve,Ve=Se):(dt=Ig(Ce.type,Ce.key,Ce.props,null,Ve.mode,dt),dt.ref=af(Ve,Se,Ce),dt.return=Ve,Ve=dt)}return X(Ve);case vh:e:{for(jt=Ce.key;Se!==null;){if(Se.key===jt)if(Se.tag===4&&Se.stateNode.containerInfo===Ce.containerInfo&&Se.stateNode.implementation===Ce.implementation){w(Ve,Se.sibling),Se=L(Se,Ce.children||[]),Se.return=Ve,Ve=Se;break e}else{w(Ve,Se);break}else f(Ve,Se);Se=Se.sibling}Se=Nx(Ce,Ve.mode,dt),Se.return=Ve,Ve=Se}return X(Ve);case sc:return jt=Ce._init,Ft(Ve,Se,jt(Ce._payload),dt)}if(kp(Ce))return mt(Ve,Se,Ce,dt);if(zp(Ce))return at(Ve,Se,Ce,dt);
vendor: 18,209 bytes, lines 38-40
38ig(Ve,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,Se!==null&&Se.tag===6?(w(Ve,Se.sibling),Se=L(Se,Ce),Se.return=Ve,Ve=Se):(w(Ve,Se),Se=Bx(Ce,Ve.mode,dt),Se.return=Ve,Ve=Se),X(Ve)):w(Ve,Se)}return Ft}var Fh=UT(!0),GT=UT(!1),ng=mc(null),rg=null,Bh=null,Wv=null;function Xv(){Wv=Bh=rg=null}function Yv(h){var f=ng.current;wr(ng),h._currentValue=f}function Kv(h,f,w){for(;h!==null;){var A=h.alternate;if((h.childLanes&f)!==f?(h.childLanes|=f,A!==null&&(A.childLanes|=f)):A!==null&&(A.childLanes&f)!==f&&(A.childLanes|=f),h===w)break;h=h.return}}function Nh(h,f){rg=h,Wv=Bh=null,h=h.dependencies,h!==null&&h.firstContext!==null&&(h.lanes&f&&(ns=!0),h.firstContext=null)}function Vs(h){var f=h._currentValue;if(Wv!==h)if(h={context:h,memoizedValue:f,next:null},Bh===null){if(rg===null)throw Error(Zt(308));Bh=h,rg.dependencies={lanes:0,firstContext:h}}else Bh=Bh.next=h;return f}var pu=null;function Jv(h){pu===null?pu=[h]:pu.push(h)}function $T(h,f,w,A){var L=f.interleaved;return L===null?(w.next=w,Jv(f)):(w.next=L.next,L.next=w),f.interleaved=w,Cl(h,A)}function Cl(h,f){h.lanes|=f;var w=h.alternate;for(w!==null&&(w.lanes|=f),w=h,h=h.return;h!==null;)h.childLanes|=f,w=h.alternate,w!==null&&(w.childLanes|=f),w=h,h=h.return;return w.tag===3?w.stateNode:null}var yc=!1;function Qv(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function HT(h,f){h=h.updateQueue,f.updateQueue===h&&(f.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,effects:h.effects})}function Ml(h,f){return{eventTime:h,lane:f,tag:0,payload:null,callback:null,next:null}}function vc(h,f,w){var A=h.updateQueue;if(A===null)return null;if(A=A.shared,$n&2){var L=A.pending;return L===null?f.next=f:(f.next=L.next,L.next=f),A.pending=f,Cl(h,w)}return L=A.interleaved,L===null?(f.next=f,Jv(A)):(f.next=L.next,L.next=f),A.interleaved=f,Cl(h,w)}function og(h,f,w){if(f=f.updateQueue,f!==null&&(f=f.shared,(w&4194240)!==0)){var A=f.lanes;A&=h.pendingLanes,w|=A,f.lanes=w,pv(h,w)}}function qT(h,f){var w=h.updateQueue,A=h.alternate;if(A!==null&&(A=A.updateQueue,w===A)){var L=null,F=null;if(w=w.firstBaseUpdate,w!==null){do{var X={eventTime:w.eventTime,lane:w.lane,tag:w.tag,payload:w.payload,callback:w.callback,next:null};F===null?L=F=X:F=F.next=X,w=w.next}while(w!==null);F===null?L=F=f:F=F.next=f}else L=F=f;w={baseState:A.baseState,firstBaseUpdate:L,lastBaseUpdate:F,shared:A.shared,effects:A.effects},h.updateQueue=w;return}h=w.lastBaseUpdate,h===null?w.firstBaseUpdate=f:h.next=f,w.lastBaseUpdate=f}function sg(h,f,w,A){var L=h.updateQueue;yc=!1;var F=L.firstBaseUpdate,X=L.lastBaseUpdate,s=L.shared.pending;if(s!==null){L.shared.pending=null;var de=s,Ee=de.next;de.next=null,X===null?F=Ee:X.next=Ee,X=de;var tt=h.alternate;tt!==null&&(tt=tt.updateQueue,s=tt.lastBaseUpdate,s!==X&&(s===null?tt.firstBaseUpdate=Ee:s.next=Ee,tt.lastBaseUpdate=de))}if(F!==null){var Ie=L.baseState;X=0,tt=Ee=de=null,s=F;do{var He=s.lane,vt=s.eventTime;if((A&He)===He){tt!==null&&(tt=tt.next={eventTime:vt,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var mt=h,at=s;switch(He=f,vt=w,at.tag){case 1:if(mt=at.payload,typeof mt=="function"){Ie=mt.call(vt,Ie,He);break e}Ie=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=at.payload,He=typeof mt=="function"?mt.call(vt,Ie,He):mt,He==null)break e;Ie=zr({},Ie,He);break e;case 2:yc=!0}}s.callback!==null&&s.lane!==0&&(h.flags|=64,He=L.effects,He===null?L.effects=[s]:He.push(s))}else vt={eventTime:vt,lane:He,tag:s.tag,payload:s.payload,callback:s.callback,next:null},tt===null?(Ee=tt=vt,de=Ie):tt=tt.next=vt,X|=He;if(s=s.next,s===null){if(s=L.shared.pending,s===null)break;He=s,s=He.next,He.next=null,L.lastBaseUpdate=He,L.shared.pending=null}}while(1);if(tt===null&&(de=Ie),L.baseState=de,L.firstBaseUpdate=Ee,L.lastBaseUpdate=tt,f=L.shared.interleaved,f!==null){L=f;do X|=L.lane,L=L.next;while(L!==f)}else F===null&&(L.shared.lanes=0);_u|=X,h.lanes=X,h.memoizedState=Ie}}function ZT(h,f,w){if(h=f.effects,f.effects=null,h!==null)for(f=0;f<h.length;f++){var A=h[f],L=A.callback;if(L!==null){if(A.callback=null,A=w,typeof L!="function")throw Error(Zt(191,L));L.call(A)}}}var lf={},Ya=mc(lf),cf=mc(lf),uf=mc(lf);function fu(h){if(h===lf)throw Error(Zt(174));return h}function ex(h,f){switch(pr(uf,f),pr(cf,h),pr(Ya,lf),h=f.nodeType,h){case 9:case 11:f=(f=f.documentElement)?f.namespaceURI:tv(null,"");break;default:h=h===8?f.parentNode:f,f=h.namespaceURI||null,h=h.tagName,f=tv(f,h)}wr(Ya),pr(Ya,f)}function Vh(){wr(Ya),wr(cf),wr(uf)}function WT(h){fu(uf.current);var f=fu(Ya.current),w=tv(f,h.type);f!==w&&(pr(cf,h),pr(Ya,w))}function tx(h){cf.current===h&&(wr(Ya),wr(cf))}var Dr=mc(0);function ag(h){for(var f=h;f!==null;){if(f.tag===13){var w=f.memoizedState;if(w!==null&&(w=w.dehydrated,w===null||w.data==="$?"||w.data==="$!"))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===h)break;for(;f.sibling===null;){if(f.return===null||f.return===h)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var ix=[];function nx(){for(var h=0;h<ix.length;h++)ix[h]._workInProgressVersionPrimary=null;ix.length=0}var lg=Tl.ReactCurrentDispatcher,rx=Tl.ReactCurrentBatchConfig,mu=0,kr=null,no=null,uo=null,cg=!1,hf=!1,df=0,uP=0;function Ro(){throw Error(Zt(321))}function ox(h,f){if(f===null)return!1;for(var w=0;w<f.length&&w<h.length;w++)if(!pa(h[w],f[w]))return!1;return!0}function sx(h,f,w,A,L,F){if(mu=F,kr=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,lg.current=h===null||h.memoizedState===null?fP:mP,h=w(A,L),hf){F=0;do{if(hf=!1,df=0,25<=F)throw Error(Zt(301));F+=1,uo=no=null,f.updateQueue=null,lg.current=_P,h=w(A,L)}while(hf)}if(lg.current=dg,f=no!==null&&no.next!==null,mu=0,uo=no=kr=null,cg=!1,f)throw Error(Zt(300));return h}function ax(){var h=df!==0;return df=0,h}function Ka(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return uo===null?kr.memoizedState=uo=h:uo=uo.next=h,uo}function js(){if(no===null){var h=kr.alternate;h=h!==null?h.memoizedState:null}else h=no.next;var f=uo===null?kr.memoizedState:uo.next;if(f!==null)uo=f,no=h;else{if(h===null)throw Error(Zt(310));no=h,h={memoizedState:no.memoizedState,baseState:no.baseState,baseQueue:no.baseQueue,queue:no.queue,next:null},uo===null?kr.memoizedState=uo=h:uo=uo.next=h}return uo}function pf(h,f){return typeof f=="function"?f(h):f}function lx(h){var f=js(),w=f.queue;if(w===null)throw Error(Zt(311));w.lastRenderedReducer=h;var A=no,L=A.baseQueue,F=w.pending;if(F!==null){if(L!==null){var X=L.next;L.next=F.next,F.next=X}A.baseQueue=L=F,w.pending=null}if(L!==null){F=L.next,A=A.baseState;var s=X=null,de=null,Ee=F;do{var tt=Ee.lane;if((mu&tt)===tt)de!==null&&(de=de.next={lane:0,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null}),A=Ee.hasEagerState?Ee.eagerState:h(A,Ee.action);else{var Ie={lane:tt,action:Ee.action,hasEagerState:Ee.hasEagerState,eagerState:Ee.eagerState,next:null};de===null?(s=de=Ie,X=A):de=de.next=Ie,kr.lanes|=tt,_u|=tt}Ee=Ee.next}while(Ee!==null&&Ee!==F);de===null?X=A:de.next=s,pa(A,f.memoizedState)||(ns=!0),f.memoizedState=A,f.baseState=X,f.baseQueue=de,w.lastRenderedState=A}if(h=w.interleaved,h!==null){L=h;do F=L.lane,kr.lanes|=F,_u|=F,L=L.next;while(L!==h)}else L===null&&(w.lanes=0);return[f.memoizedState,w.dispatch]}function cx(h){var f=js(),w=f.queue;if(w===null)throw Error(Zt(311));w.lastRenderedReducer=h;var A=w.dispatch,L=w.pending,F=f.memoizedState;if(L!==null){w.pending=null;var X=L=L.next;do F=h(F,X.action),X=X.next;while(X!==L);pa(F,f.memoizedState)||(ns=!0),f.memoizedState=F,f.baseQueue===null&&(f.baseState=F),w.lastRenderedState=F}return[F,A]}function XT(){}function YT(h,f){var w=kr,A=js(),L=f(),F=!pa(A.memoizedState,L);if(F&&(A.memoizedState=L,ns=!0),A=A.queue,ux(QT.bind(null,w,A,h),[h]),A.getSnapshot!==f||F||uo!==null&&uo.memoizedState.tag&1){if(w.flags|=2048,ff(9,JT.bind(null,w,A,L,f),void 0,null),ho===null)throw Error(Zt(349));mu&30||KT(w,f,L)}return L}function KT(h,f,w){h.flags|=16384,h={getSnapshot:f,value:w},f=kr.updateQueue,f===null?(f={lastEffect:null,stores:null},kr.updateQueue=f,f.stores=[h]):(w=f.stores,w===null?f.stores=[h]:w.push(h))}function JT(h,f,w,A){f.value=w,f.getSnapshot=A,e2(f)&&t2(h)}function QT(h,f,w){return w(function(){e2(f)&&t2(h)})}function e2(h){var f=h.getSnapshot;h=h.value;try{var w=f();return!pa(h,w)}catch{return!0}}function t2(h){var f=Cl(h,1);f!==null&&ya(f,h,1,-1)}function i2(h){var f=Ka();return typeof h=="function"&&(h=h()),f.memoizedState=f.baseState=h,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:pf,lastRenderedState:h},f.queue=h,h=h.dispatch=pP.bind(null,kr,h),[f.memoizedState,h]}function ff(h,f,w,A){return h={tag:h,create:f,destroy:w,deps:A,next:null},f=kr.updateQueue,f===null?(f={lastEffect:null,stores:null},kr.updateQueue=f,f.lastEffect=h.next=h):(w=f.lastEffect,w===null?f.lastEffect=h.next=h:(A=w.next,w.next=h,h.next=A,f.lastEffect=h)),h}function n2(){return js().memoizedState}function ug(h,f,w,A){var L=Ka();kr.flags|=h,L.memoizedState=ff(1|f,w,void 0,A===void 0?null:A)}function hg(h,f,w,A){var L=js();A=A===void 0?null:A;var F=void 0;if(no!==null){var X=no.memoizedState;if(F=X.destroy,A!==null&&ox(A,X.deps)){L.memoizedState=ff(f,w,F,A);return}}kr.flags|=h,L.memoizedState=ff(1|f,w,F,A)}function r2(h,f){return ug(8390656,8,h,f)}function ux(h,f){return hg(2048,8,h,f)}function o2(h,f){return hg(4,2,h,f)}function s2(h,f){return hg(4,4,h,f)}function a2(h,f){if(typeof f=="function")return h=h(),f(h),function(){f(null)};if(f!=null)return h=h(),f.current=h,function(){f.current=null}}function l2(h,f,w){return w=w!=null?w.concat([h]):null,hg(4,4,a2.bind(null,f,h),w)}function hx(){}function c2(h,f){var w=js();f=f===void 0?null:f;var A=w.memoizedState;return A!==null&&f!==null&&ox(f,A[1])?A[0]:(w.memoizedState=[h,f],h)}function u2(h,f){var w=js();f=f===void 0?null:f;var A=w.memoizedState;return A!==null&&f!==null&&ox(f,A[1])?A[0]:(h=h(),w.memoizedState=[h,f],h)}function h2(h,f,w){return mu&21?(pa(w,f)||(w=jb(),kr.lanes|=w,_u|=w,h.baseState=!0),f):(h.baseState&&(h.baseState=!1,ns=!0),h.memoizedState=w)}function hP(h,f){var w=or;or=w!==0&&4>w?w:4,h(!0);var A=rx.transition;rx.transition={};try{h(!1),f()}finally{or=w,rx.transition=A}}function d2(){return js().memoizedState}function dP(h,f,w){var A=Tc(h);if(w={lane:A,action:w,hasEagerState:!1,eagerState:null,next:null},p2(h))f2(f,w);else if(w=$T(h,f,w,A),w!==null){var L=Uo();ya(w,h,A,L),m2(w,f,A)}}function pP(h,f,w){var A=Tc(h),L={lane:A,action:w,hasEagerState:!1,eagerState:null,next:null};if(p2(h))f2(f,L);else{var F=h.alternate;if(h.lanes===0&&(F===null||F.lanes===0)&&(F=f.lastRenderedReducer,F!==null))try{var X=f.lastRenderedState,s=F(X,w);if(L.hasEagerState=!0,L.eagerState=s,pa(s,X)){var de=f.interleaved;de===null?(L.next=L,Jv(f)):(L.next=de.next,de.next=L),f.interleaved=L;return}}catch{}finally{}w=$T(h,f,L,A),w!==null&&(L=Uo(),ya(w,h,A,L),m2(w,f,A))}}function p2(h){var f=h.alternate;return h===kr||f!==null&&f===kr}function f2(h,f){hf=cg=!0;var w=h.pending;w===null?f.next=f:(f.next=w.next,w.next=f),h.pending=f}function m2(h,f,w){if(w&4194240){var A=f.lanes;A&=h.pendingLanes,w|=A,f.lanes=w,pv(h,w)}}var dg={readContext:Vs,useCallback:Ro,useContext:Ro,useEffect:Ro,useImperativeHandle:Ro,useInsertionEffect:Ro,useLayoutEffect:Ro,useMemo:Ro,useReducer:Ro,useRef:Ro,useState:Ro,useDebugValue:Ro,useDeferredValue:Ro,useTransition:Ro,useMutableSource:Ro,useSyncExternalStore:Ro,useId:Ro,unstable_isNewReconciler:!1},fP={readContext:Vs,useCallback:function(h,f){return Ka().memoizedState=[h,f===void 0?null:f],h},useContext:Vs,useEffect:r2,useImperativeHandle:function(h,f,w){return w=w!=null?w.concat([h]):null,ug(4194308,4,a2.bind(null,f,h),w)},useLayoutEffect:function(h,f){return ug(4194308,4,h,f)},useInsertionEffect:function(h,f){return ug(4,2,h,f)},useMemo:function(h,f){var w=Ka();return f=f===void 0?null:f,h=h(),w.memoizedState=[h,f],h},useReducer:function(h,f,w){var A=Ka();return f=w!==void 0?w(f):f,A.memoizedState=A.baseState=f,h={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:f},A.queue=h,h=h.dispatch=dP.bind(null,kr,h),[A.memoizedState,h]},useRef:function(h){var f=Ka();return h={current:h},f.memoizedState=h},useState:i2,useDebugValue:hx,useDeferredValue:function(h){return Ka().memoizedState=h},useTransition:function(){var h=i2(!1),f=h[0];return h=hP.bind(null,h[1]),Ka().memoizedState=h,[f,h]},useMutableSource:function(){},useSyncExternalStore:function(h,f,w){var A=kr,L=Ka();if(Ar){if(w===void 0)throw Error(Zt(407));w=w()}else{if(w=f(),ho===null)throw Error(Zt(349));mu&30||KT(A,f,w)}L.memoizedState=w;var F={value:w,getSnapshot:f};return L.queue=F,r2(QT.bind(null,A,F,h),[h]),A.flags|=2048,ff(9,JT.bind(null,A,F,w,f),void 0,null),w},useId:function(){var h=Ka(),f=ho.identifierPrefix;if(Ar){var w=Al,A=Il;w=(A&~(1<<32-da(A)-1)).toString(32)+w,f=":"+f+"R"+w,w=df++,0<w&&(f+="H"+w.toString(32)),f+=":"}else w=uP++,f=":"+f+"r"+w.toString(32)+":";return h.memoizedState=f},unstable_isNewReconciler:!1},mP={readContext:Vs,useCallback:c2,useContext:Vs,useEffect:ux,useImperativeHandle:l2,useInsertionEffect:o2,useLayoutEffect:s2,useMemo:u2,useReducer:lx,useRef:n2,useState:function(){return lx(pf)},useDebugValue:hx,useDeferredValue:function(h){var f=js();return h2(f,no.memoizedState,h)},useTransition:function(){var h=lx(pf)[0],f=js().memoizedState;return[h,f]},useMutableSource:XT,useSyncExternalStore:YT,useId:d2,unstable_isNewReconciler:!1},_P={readContext:Vs,useCallback:c2,useContext:Vs,useEffect:ux,useImperativeHandle:l2,useInsertionEffect:o2,useLayoutEffect:s2,useMemo:u2,useReducer:cx,useRef:n2,useState:function(){return cx(pf)},useDebugValue:hx,useDeferredValue:function(h){var f=js();return no===null?f.memoizedState=h:h2(f,no.memoizedState,h)},useTransition:function(){var h=cx(pf)[0],f=js().memoizedState;return[h,f]},useMutableSource:XT,useSyncExternalStore:YT,useId:d2,unstable_isNewReconciler:!1};function ma(h,f){if(h&&h.defaultProps){f=zr({},f),h=h.defaultProps;for(var w in h)f[w]===void 0&&(f[w]=h[w]);return f}return f}function dx(h,f,w,A){f=h.memoizedState,w=w(A,f),w=w==null?f:zr({},f,w),h.memoizedState=w,h.lanes===0&&(h.updateQueue.baseState=w)}var pg={isMounted:function(h){return(h=h._reactInternals)?lu(h)===h:!1},enqueueSetState:function(h,f,w){h=h._reactInternals;var A=Uo(),L=Tc(h),F=Ml(A,L);F.payload=f,w!=null&&(F.callback=w),f=vc(h,F,L),f!==null&&(ya(f,h,L,A),og(f,h,L))},enqueueReplaceState:function(h,f,w){h=h._reactInternals;var A=Uo(),L=Tc(h),F=Ml(A,L);F.tag=1,F.payload=f,w!=null&&(F.callback=w),f=vc(h,F,L),f!==null&&(ya(f,h,L,A),og(f,h,L))},enqueueForceUpdate:function(h,f){h=h._reactInternals;var w=Uo(),A=Tc(h),L=Ml(w,A);L.tag=2,f!=null&&(L.callback=f),f=vc(h,L,A),f!==null&&(ya(f,h,A,w),og(f,h,A))}};function _2(h,f,w,A,L,F,X){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(A,F,X):f.prototype&&f.prototype.isPureReactComponent?!Qp(w,A)||!Qp(L,F):!0}function g2(h,f,w){var A=!1,L=_c,F=f.contextType;return typeof F=="object"&&F!==null?F=Vs(F):(L=is(f)?uu:Po.current,A=f.contextTypes,F=(A=A!=null)?zh(h,L):_c),f=new f(w,F),h.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=pg,h.stateNode=f,f._reactInternals=h,A&&(h=h.stateNode,h.__reactInternalMemoizedUnmaskedChildContext=L,h.__reactInternalMemoizedMaskedChildContext=F),f}function y2(h,f,w,A){h=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(w,A),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(w,A),f.state!==h&&pg.enqueueReplaceState(f,f.state,null)}function px(h,f,w,A){var L=h.stateNode;L.props=w,L.state=h.memoizedState,L.refs={},Qv(h);var F=f.contextType;typeof F=="object"&&F!==null?L.context=Vs(F):(F=is(f)?uu:Po.current,L.context=zh(h,F)),L.state=h.memoizedState,F=f.getDerivedStateFromProps,typeof F=="function"&&(dx(h,f,F,w),L.state=h.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(f=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),f!==L.state&&pg.enqueueReplaceState(L,L.state,null),sg(h,w,L,A),L.state=h.memoizedState),typeof L.componentDidMount=="function"&&(h.flags|=4194308)}function jh(h,f){try{var w="",A=f;do w+=$C(A),A=A.return;while(A);var L=w}catch(F){L=`
39Error generating stack: `+F.message+`
40`+F.stack}return{value:h,source:f,stack:L,digest:null}}function fx(h,f,w){return{value:h,source:null,stack:w??null,digest:f??null}}function mx(h,f){try{console.error(f.value)}catch(w){setTimeout(function(){throw w})}}var gP=typeof WeakMap=="function"?WeakMap:Map;function v2(h,f,w){w=Ml(-1,w),w.tag=3,w.payload={element:null};var A=f.value;return w.callback=function(){xg||(xg=!0,Px=A),mx(h,f)},w}function x2(h,f,w){w=Ml(-1,w),w.tag=3;var A=h.type.getDerivedStateFromError;if(typeof A=="function"){var L=f.value;w.payload=function(){return A(L)},w.callback=function(){mx(h,f)}}var F=h.stateNode;return F!==null&&typeof F.componentDidCatch=="function"&&(w.callback=function(){mx(h,f),typeof A!="function"&&(wc===null?wc=new Set([this]):wc.add(this));var X=f.stack;this.componentDidCatch(f.value,{componentStack:X!==null?X:""})}),w}function w2(h,f,w){var A=h.pingCache;if(A===null){A=h.pingCache=new gP;var L=new Set;A.set(f,L)}else L=A.get(f),L===void 0&&(L=new Set,A.set(f,L));L.has(w)||(L.add(w),h=RP.bind(null,h,f,w),f.then(h,h))}function b2(h){do{var f;if((f=h.tag===13)&&(f=h.memoizedState,f=f!==null?f.dehydrated!==null:!0),f)return h;h=h.return}while(h!==null);return null}function T2(h,f,w,A,L){return h.mode&1?(h.flags|=65536,h.lanes=L,h):(h===f?h.flags|=65536:(h.flags|=128,w.flags|=131072,w.flags&=-52805,w.tag===1&&(w.alternate===null?w.tag=17:(f=Ml(-1,1),f.tag=2,vc(w,f,1))),w.lanes|=1),h)}var yP=Tl.ReactCurrentOwner,ns=!1;
vendor: 22,541 bytes, line 40
40function jo(h,f,w,A){f.child=h===null?GT(f,null,w,A):Fh(f,h.child,w,A)}function S2(h,f,w,A,L){w=w.render;var F=f.ref;return Nh(f,L),A=sx(h,f,w,A,F,L),w=ax(),h!==null&&!ns?(f.updateQueue=h.updateQueue,f.flags&=-2053,h.lanes&=~L,Pl(h,f,L)):(Ar&&w&&Gv(f),f.flags|=1,jo(h,f,A,L),f.child)}function E2(h,f,w,A,L){if(h===null){var F=w.type;return typeof F=="function"&&!Fx(F)&&F.defaultProps===void 0&&w.compare===null&&w.defaultProps===void 0?(f.tag=15,f.type=F,I2(h,f,F,A,L)):(h=Ig(w.type,null,A,f,f.mode,L),h.ref=f.ref,h.return=f,f.child=h)}if(F=h.child,!(h.lanes&L)){var X=F.memoizedProps;if(w=w.compare,w=w!==null?w:Qp,w(X,A)&&h.ref===f.ref)return Pl(h,f,L)}return f.flags|=1,h=Ec(F,A),h.ref=f.ref,h.return=f,f.child=h}function I2(h,f,w,A,L){if(h!==null){var F=h.memoizedProps;if(Qp(F,A)&&h.ref===f.ref)if(ns=!1,f.pendingProps=A=F,(h.lanes&L)!==0)h.flags&131072&&(ns=!0);else return f.lanes=h.lanes,Pl(h,f,L)}return _x(h,f,w,A,L)}function A2(h,f,w){var A=f.pendingProps,L=A.children,F=h!==null?h.memoizedState:null;if(A.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null,transitions:null},pr(Gh,Ts),Ts|=w;else{if(!(w&1073741824))return h=F!==null?F.baseLanes|w:w,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:h,cachePool:null,transitions:null},f.updateQueue=null,pr(Gh,Ts),Ts|=h,null;f.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=F!==null?F.baseLanes:w,pr(Gh,Ts),Ts|=A}else F!==null?(A=F.baseLanes|w,f.memoizedState=null):A=w,pr(Gh,Ts),Ts|=A;return jo(h,f,L,w),f.child}function C2(h,f){var w=f.ref;(h===null&&w!==null||h!==null&&h.ref!==w)&&(f.flags|=512,f.flags|=2097152)}function _x(h,f,w,A,L){var F=is(w)?uu:Po.current;return F=zh(f,F),Nh(f,L),w=sx(h,f,w,A,F,L),A=ax(),h!==null&&!ns?(f.updateQueue=h.updateQueue,f.flags&=-2053,h.lanes&=~L,Pl(h,f,L)):(Ar&&A&&Gv(f),f.flags|=1,jo(h,f,w,L),f.child)}function M2(h,f,w,A,L){if(is(w)){var F=!0;K_(f)}else F=!1;if(Nh(f,L),f.stateNode===null)mg(h,f),g2(f,w,A),px(f,w,A,L),A=!0;else if(h===null){var X=f.stateNode,s=f.memoizedProps;X.props=s;var de=X.context,Ee=w.contextType;typeof Ee=="object"&&Ee!==null?Ee=Vs(Ee):(Ee=is(w)?uu:Po.current,Ee=zh(f,Ee));var tt=w.getDerivedStateFromProps,Ie=typeof tt=="function"||typeof X.getSnapshotBeforeUpdate=="function";Ie||typeof X.UNSAFE_componentWillReceiveProps!="function"&&typeof X.componentWillReceiveProps!="function"||(s!==A||de!==Ee)&&y2(f,X,A,Ee),yc=!1;var He=f.memoizedState;X.state=He,sg(f,A,X,L),de=f.memoizedState,s!==A||He!==de||ts.current||yc?(typeof tt=="function"&&(dx(f,w,tt,A),de=f.memoizedState),(s=yc||_2(f,w,s,A,He,de,Ee))?(Ie||typeof X.UNSAFE_componentWillMount!="function"&&typeof X.componentWillMount!="function"||(typeof X.componentWillMount=="function"&&X.componentWillMount(),typeof X.UNSAFE_componentWillMount=="function"&&X.UNSAFE_componentWillMount()),typeof X.componentDidMount=="function"&&(f.flags|=4194308)):(typeof X.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=A,f.memoizedState=de),X.props=A,X.state=de,X.context=Ee,A=s):(typeof X.componentDidMount=="function"&&(f.flags|=4194308),A=!1)}else{X=f.stateNode,HT(h,f),s=f.memoizedProps,Ee=f.type===f.elementType?s:ma(f.type,s),X.props=Ee,Ie=f.pendingProps,He=X.context,de=w.contextType,typeof de=="object"&&de!==null?de=Vs(de):(de=is(w)?uu:Po.current,de=zh(f,de));var vt=w.getDerivedStateFromProps;(tt=typeof vt=="function"||typeof X.getSnapshotBeforeUpdate=="function")||typeof X.UNSAFE_componentWillReceiveProps!="function"&&typeof X.componentWillReceiveProps!="function"||(s!==Ie||He!==de)&&y2(f,X,A,de),yc=!1,He=f.memoizedState,X.state=He,sg(f,A,X,L);var mt=f.memoizedState;s!==Ie||He!==mt||ts.current||yc?(typeof vt=="function"&&(dx(f,w,vt,A),mt=f.memoizedState),(Ee=yc||_2(f,w,Ee,A,He,mt,de)||!1)?(tt||typeof X.UNSAFE_componentWillUpdate!="function"&&typeof X.componentWillUpdate!="function"||(typeof X.componentWillUpdate=="function"&&X.componentWillUpdate(A,mt,de),typeof X.UNSAFE_componentWillUpdate=="function"&&X.UNSAFE_componentWillUpdate(A,mt,de)),typeof X.componentDidUpdate=="function"&&(f.flags|=4),typeof X.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof X.componentDidUpdate!="function"||s===h.memoizedProps&&He===h.memoizedState||(f.flags|=4),typeof X.getSnapshotBeforeUpdate!="function"||s===h.memoizedProps&&He===h.memoizedState||(f.flags|=1024),f.memoizedProps=A,f.memoizedState=mt),X.props=A,X.state=mt,X.context=de,A=Ee):(typeof X.componentDidUpdate!="function"||s===h.memoizedProps&&He===h.memoizedState||(f.flags|=4),typeof X.getSnapshotBeforeUpdate!="function"||s===h.memoizedProps&&He===h.memoizedState||(f.flags|=1024),A=!1)}return gx(h,f,w,A,F,L)}function gx(h,f,w,A,L,F){C2(h,f);var X=(f.flags&128)!==0;if(!A&&!X)return L&&DT(f,w,!1),Pl(h,f,F);A=f.stateNode,yP.current=f;var s=X&&typeof w.getDerivedStateFromError!="function"?null:A.render();return f.flags|=1,h!==null&&X?(f.child=Fh(f,h.child,null,F),f.child=Fh(f,null,s,F)):jo(h,f,s,F),f.memoizedState=A.state,L&&DT(f,w,!0),f.child}function P2(h){var f=h.stateNode;f.pendingContext?LT(h,f.pendingContext,f.pendingContext!==f.context):f.context&&LT(h,f.context,!1),ex(h,f.containerInfo)}function R2(h,f,w,A,L){return Oh(),Zv(L),f.flags|=256,jo(h,f,w,A),f.child}var yx={dehydrated:null,treeContext:null,retryLane:0};function vx(h){return{baseLanes:h,cachePool:null,transitions:null}}function L2(h,f,w){var A=f.pendingProps,L=Dr.current,F=!1,X=(f.flags&128)!==0,s;if((s=X)||(s=h!==null&&h.memoizedState===null?!1:(L&2)!==0),s?(F=!0,f.flags&=-129):(h===null||h.memoizedState!==null)&&(L|=1),pr(Dr,L&1),h===null)return qv(f),h=f.memoizedState,h!==null&&(h=h.dehydrated,h!==null)?(f.mode&1?h.data==="$!"?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(X=A.children,h=A.fallback,F?(A=f.mode,F=f.child,X={mode:"hidden",children:X},!(A&1)&&F!==null?(F.childLanes=0,F.pendingProps=X):F=Ag(X,A,0,null),h=xu(h,A,w,null),F.return=f,h.return=f,F.sibling=h,f.child=F,f.child.memoizedState=vx(w),f.memoizedState=yx,h):xx(f,X));if(L=h.memoizedState,L!==null&&(s=L.dehydrated,s!==null))return vP(h,f,X,A,s,L,w);if(F){F=A.fallback,X=f.mode,L=h.child,s=L.sibling;var de={mode:"hidden",children:A.children};return!(X&1)&&f.child!==L?(A=f.child,A.childLanes=0,A.pendingProps=de,f.deletions=null):(A=Ec(L,de),A.subtreeFlags=L.subtreeFlags&14680064),s!==null?F=Ec(s,F):(F=xu(F,X,w,null),F.flags|=2),F.return=f,A.return=f,A.sibling=F,f.child=A,A=F,F=f.child,X=h.child.memoizedState,X=X===null?vx(w):{baseLanes:X.baseLanes|w,cachePool:null,transitions:X.transitions},F.memoizedState=X,F.childLanes=h.childLanes&~w,f.memoizedState=yx,A}return F=h.child,h=F.sibling,A=Ec(F,{mode:"visible",children:A.children}),!(f.mode&1)&&(A.lanes=w),A.return=f,A.sibling=null,h!==null&&(w=f.deletions,w===null?(f.deletions=[h],f.flags|=16):w.push(h)),f.child=A,f.memoizedState=null,A}function xx(h,f){return f=Ag({mode:"visible",children:f},h.mode,0,null),f.return=h,h.child=f}function fg(h,f,w,A){return A!==null&&Zv(A),Fh(f,h.child,null,w),h=xx(f,f.pendingProps.children),h.flags|=2,f.memoizedState=null,h}function vP(h,f,w,A,L,F,X){if(w)return f.flags&256?(f.flags&=-257,A=fx(Error(Zt(422))),fg(h,f,X,A)):f.memoizedState!==null?(f.child=h.child,f.flags|=128,null):(F=A.fallback,L=f.mode,A=Ag({mode:"visible",children:A.children},L,0,null),F=xu(F,L,X,null),F.flags|=2,A.return=f,F.return=f,A.sibling=F,f.child=A,f.mode&1&&Fh(f,h.child,null,X),f.child.memoizedState=vx(X),f.memoizedState=yx,F);if(!(f.mode&1))return fg(h,f,X,null);if(L.data==="$!"){if(A=L.nextSibling&&L.nextSibling.dataset,A)var s=A.dgst;return A=s,F=Error(Zt(419)),A=fx(F,A,void 0),fg(h,f,X,A)}if(s=(X&h.childLanes)!==0,ns||s){if(A=ho,A!==null){switch(X&-X){case 4:L=2;break;case 16:L=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:L=32;break;case 536870912:L=268435456;break;default:L=0}L=L&(A.suspendedLanes|X)?0:L,L!==0&&L!==F.retryLane&&(F.retryLane=L,Cl(h,L),ya(A,h,L,-1))}return Ox(),A=fx(Error(Zt(421))),fg(h,f,X,A)}return L.data==="$?"?(f.flags|=128,f.child=h.child,f=LP.bind(null,h),L._reactRetry=f,null):(h=F.treeContext,bs=fc(L.nextSibling),ws=f,Ar=!0,fa=null,h!==null&&(Bs[Ns++]=Il,Bs[Ns++]=Al,Bs[Ns++]=hu,Il=h.id,Al=h.overflow,hu=f),f=xx(f,A.children),f.flags|=4096,f)}function z2(h,f,w){h.lanes|=f;var A=h.alternate;A!==null&&(A.lanes|=f),Kv(h.return,f,w)}function wx(h,f,w,A,L){var F=h.memoizedState;F===null?h.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:A,tail:w,tailMode:L}:(F.isBackwards=f,F.rendering=null,F.renderingStartTime=0,F.last=A,F.tail=w,F.tailMode=L)}function D2(h,f,w){var A=f.pendingProps,L=A.revealOrder,F=A.tail;if(jo(h,f,A.children,w),A=Dr.current,A&2)A=A&1|2,f.flags|=128;else{if(h!==null&&h.flags&128)e:for(h=f.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&z2(h,w,f);else if(h.tag===19)z2(h,w,f);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===f)break e;for(;h.sibling===null;){if(h.return===null||h.return===f)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}A&=1}if(pr(Dr,A),!(f.mode&1))f.memoizedState=null;else switch(L){case"forwards":for(w=f.child,L=null;w!==null;)h=w.alternate,h!==null&&ag(h)===null&&(L=w),w=w.sibling;w=L,w===null?(L=f.child,f.child=null):(L=w.sibling,w.sibling=null),wx(f,!1,L,w,F);break;case"backwards":for(w=null,L=f.child,f.child=null;L!==null;){if(h=L.alternate,h!==null&&ag(h)===null){f.child=L;break}h=L.sibling,L.sibling=w,w=L,L=h}wx(f,!0,w,null,F);break;case"together":wx(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function mg(h,f){!(f.mode&1)&&h!==null&&(h.alternate=null,f.alternate=null,f.flags|=2)}function Pl(h,f,w){if(h!==null&&(f.dependencies=h.dependencies),_u|=f.lanes,!(w&f.childLanes))return null;if(h!==null&&f.child!==h.child)throw Error(Zt(153));if(f.child!==null){for(h=f.child,w=Ec(h,h.pendingProps),f.child=w,w.return=f;h.sibling!==null;)h=h.sibling,w=w.sibling=Ec(h,h.pendingProps),w.return=f;w.sibling=null}return f.child}function xP(h,f,w){switch(f.tag){case 3:P2(f),Oh();break;case 5:WT(f);break;case 1:is(f.type)&&K_(f);break;case 4:ex(f,f.stateNode.containerInfo);break;case 10:var A=f.type._context,L=f.memoizedProps.value;pr(ng,A._currentValue),A._currentValue=L;break;case 13:if(A=f.memoizedState,A!==null)return A.dehydrated!==null?(pr(Dr,Dr.current&1),f.flags|=128,null):w&f.child.childLanes?L2(h,f,w):(pr(Dr,Dr.current&1),h=Pl(h,f,w),h!==null?h.sibling:null);pr(Dr,Dr.current&1);break;case 19:if(A=(w&f.childLanes)!==0,h.flags&128){if(A)return D2(h,f,w);f.flags|=128}if(L=f.memoizedState,L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),pr(Dr,Dr.current),A)break;return null;case 22:case 23:return f.lanes=0,A2(h,f,w)}return Pl(h,f,w)}var k2,bx,O2,F2;k2=function(h,f){for(var w=f.child;w!==null;){if(w.tag===5||w.tag===6)h.appendChild(w.stateNode);else if(w.tag!==4&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===f)break;for(;w.sibling===null;){if(w.return===null||w.return===f)return;w=w.return}w.sibling.return=w.return,w=w.sibling}},bx=function(){},O2=function(h,f,w,A){var L=h.memoizedProps;if(L!==A){h=f.stateNode,fu(Ya.current);var F=null;switch(w){case"input":L=K0(h,L),A=K0(h,A),F=[];break;case"select":L=zr({},L,{value:void 0}),A=zr({},A,{value:void 0}),F=[];break;case"textarea":L=ev(h,L),A=ev(h,A),F=[];break;default:typeof L.onClick!="function"&&typeof A.onClick=="function"&&(h.onclick=W_)}iv(w,A);var X;w=null;for(Ee in L)if(!A.hasOwnProperty(Ee)&&L.hasOwnProperty(Ee)&&L[Ee]!=null)if(Ee==="style"){var s=L[Ee];for(X in s)s.hasOwnProperty(X)&&(w||(w={}),w[X]="")}else Ee!=="dangerouslySetInnerHTML"&&Ee!=="children"&&Ee!=="suppressContentEditableWarning"&&Ee!=="suppressHydrationWarning"&&Ee!=="autoFocus"&&(Lp.hasOwnProperty(Ee)?F||(F=[]):(F=F||[]).push(Ee,null));for(Ee in A){var de=A[Ee];if(s=L!=null?L[Ee]:void 0,A.hasOwnProperty(Ee)&&de!==s&&(de!=null||s!=null))if(Ee==="style")if(s){for(X in s)!s.hasOwnProperty(X)||de&&de.hasOwnProperty(X)||(w||(w={}),w[X]="");for(X in de)de.hasOwnProperty(X)&&s[X]!==de[X]&&(w||(w={}),w[X]=de[X])}else w||(F||(F=[]),F.push(Ee,w)),w=de;else Ee==="dangerouslySetInnerHTML"?(de=de?de.__html:void 0,s=s?s.__html:void 0,de!=null&&s!==de&&(F=F||[]).push(Ee,de)):Ee==="children"?typeof de!="string"&&typeof de!="number"||(F=F||[]).push(Ee,""+de):Ee!=="suppressContentEditableWarning"&&Ee!=="suppressHydrationWarning"&&(Lp.hasOwnProperty(Ee)?(de!=null&&Ee==="onScroll"&&xr("scroll",h),F||s===de||(F=[])):(F=F||[]).push(Ee,de))}w&&(F=F||[]).push("style",w);var Ee=F;(f.updateQueue=Ee)&&(f.flags|=4)}},F2=function(h,f,w,A){w!==A&&(f.flags|=4)};function mf(h,f){if(!Ar)switch(h.tailMode){case"hidden":f=h.tail;for(var w=null;f!==null;)f.alternate!==null&&(w=f),f=f.sibling;w===null?h.tail=null:w.sibling=null;break;case"collapsed":w=h.tail;for(var A=null;w!==null;)w.alternate!==null&&(A=w),w=w.sibling;A===null?f||h.tail===null?h.tail=null:h.tail.sibling=null:A.sibling=null}}function Lo(h){var f=h.alternate!==null&&h.alternate.child===h.child,w=0,A=0;if(f)for(var L=h.child;L!==null;)w|=L.lanes|L.childLanes,A|=L.subtreeFlags&14680064,A|=L.flags&14680064,L.return=h,L=L.sibling;else for(L=h.child;L!==null;)w|=L.lanes|L.childLanes,A|=L.subtreeFlags,A|=L.flags,L.return=h,L=L.sibling;return h.subtreeFlags|=A,h.childLanes=w,f}function wP(h,f,w){var A=f.pendingProps;switch($v(f),f.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lo(f),null;case 1:return is(f.type)&&Y_(),Lo(f),null;case 3:return A=f.stateNode,Vh(),wr(ts),wr(Po),nx(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(h===null||h.child===null)&&(tg(f)?f.flags|=4:h===null||h.memoizedState.isDehydrated&&!(f.flags&256)||(f.flags|=1024,fa!==null&&(zx(fa),fa=null))),bx(h,f),Lo(f),null;case 5:tx(f);var L=fu(uf.current);if(w=f.type,h!==null&&f.stateNode!=null)O2(h,f,w,A,L),h.ref!==f.ref&&(f.flags|=512,f.flags|=2097152);else{if(!A){if(f.stateNode===null)throw Error(Zt(166));return Lo(f),null}if(h=fu(Ya.current),tg(f)){A=f.stateNode,w=f.type;var F=f.memoizedProps;switch(A[Xa]=f,A[of]=F,h=(f.mode&1)!==0,w){case"dialog":xr("cancel",A),xr("close",A);break;case"iframe":case"object":case"embed":xr("load",A);break;case"video":case"audio":for(L=0;L<tf.length;L++)xr(tf[L],A);break;case"source":xr("error",A);break;case"img":case"image":case"link":xr("error",A),xr("load",A);break;case"details":xr("toggle",A);break;case"input":gb(A,F),xr("invalid",A);break;case"select":A._wrapperState={wasMultiple:!!F.multiple},xr("invalid",A);break;case"textarea":xb(A,F),xr("invalid",A)}iv(w,F),L=null;for(var X in F)if(F.hasOwnProperty(X)){var s=F[X];X==="children"?typeof s=="string"?A.textContent!==s&&(F.suppressHydrationWarning!==!0&&Z_(A.textContent,s,h),L=["children",s]):typeof s=="number"&&A.textContent!==""+s&&(F.suppressHydrationWarning!==!0&&Z_(A.textContent,s,h),L=["children",""+s]):Lp.hasOwnProperty(X)&&s!=null&&X==="onScroll"&&xr("scroll",A)}switch(w){case"input":S_(A),vb(A,F,!0);break;case"textarea":S_(A),bb(A);break;case"select":case"option":break;default:typeof F.onClick=="function"&&(A.onclick=W_)}A=L,f.updateQueue=A,A!==null&&(f.flags|=4)}else{X=L.nodeType===9?L:L.ownerDocument,h==="http://www.w3.org/1999/xhtml"&&(h=Tb(w)),h==="http://www.w3.org/1999/xhtml"?w==="script"?(h=X.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild)):typeof A.is=="string"?h=X.createElement(w,{is:A.is}):(h=X.createElement(w),w==="select"&&(X=h,A.multiple?X.multiple=!0:A.size&&(X.size=A.size))):h=X.createElementNS(h,w),h[Xa]=f,h[of]=A,k2(h,f,!1,!1),f.stateNode=h;e:{switch(X=nv(w,A),w){case"dialog":xr("cancel",h),xr("close",h),L=A;break;case"iframe":case"object":case"embed":xr("load",h),L=A;break;case"video":case"audio":for(L=0;L<tf.length;L++)xr(tf[L],h);L=A;break;case"source":xr("error",h),L=A;break;case"img":case"image":case"link":xr("error",h),xr("load",h),L=A;break;case"details":xr("toggle",h),L=A;break;case"input":gb(h,A),L=K0(h,A),xr("invalid",h);break;case"option":L=A;break;case"select":h._wrapperState={wasMultiple:!!A.multiple},L=zr({},A,{value:void 0}),xr("invalid",h);break;case"textarea":xb(h,A),L=ev(h,A),xr("invalid",h);break;default:L=A}iv(w,L),s=L;for(F in s)if(s.hasOwnProperty(F)){var de=s[F];F==="style"?Ib(h,de):F==="dangerouslySetInnerHTML"?(de=de?de.__html:void 0,de!=null&&Sb(h,de)):F==="children"?typeof de=="string"?(w!=="textarea"||de!=="")&&Op(h,de):typeof de=="number"&&Op(h,""+de):F!=="suppressContentEditableWarning"&&F!=="suppressHydrationWarning"&&F!=="autoFocus"&&(Lp.hasOwnProperty(F)?de!=null&&F==="onScroll"&&xr("scroll",h):de!=null&&V0(h,F,de,X))}switch(w){case"input":S_(h),vb(h,A,!1);break;case"textarea":S_(h),bb(h);break;case"option":A.value!=null&&h.setAttribute("value",""+ac(A.value));break;case"select":h.multiple=!!A.multiple,F=A.value,F!=null?wh(h,!!A.multiple,F,!1):A.defaultValue!=null&&wh(h,!!A.multiple,A.defaultValue,!0);break;default:typeof L.onClick=="function"&&(h.onclick=W_)}switch(w){case"button":case"input":case"select":case"textarea":A=!!A.autoFocus;break e;case"img":A=!0;break e;default:A=!1}}A&&(f.flags|=4)}f.ref!==null&&(f.flags|=512,f.flags|=2097152)}return Lo(f),null;case 6:if(h&&f.stateNode!=null)F2(h,f,h.memoizedProps,A);else{if(typeof A!="string"&&f.stateNode===null)throw Error(Zt(166));if(w=fu(uf.current),fu(Ya.current),tg(f)){if(A=f.stateNode,w=f.memoizedProps,A[Xa]=f,(F=A.nodeValue!==w)&&(h=ws,h!==null))switch(h.tag){case 3:Z_(A.nodeValue,w,(h.mode&1)!==0);break;case 5:h.memoizedProps.suppressHydrationWarning!==!0&&Z_(A.nodeValue,w,(h.mode&1)!==0)}F&&(f.flags|=4)}else A=(w.nodeType===9?w:w.ownerDocument).createTextNode(A),A[Xa]=f,f.stateNode=A}return Lo(f),null;case 13:if(wr(Dr),A=f.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(Ar&&bs!==null&&f.mode&1&&!(f.flags&128))VT(),Oh(),f.flags|=98560,F=!1;else if(F=tg(f),A!==null&&A.dehydrated!==null){if(h===null){if(!F)throw Error(Zt(318));if(F=f.memoizedState,F=F!==null?F.dehydrated:null,!F)throw Error(Zt(317));F[Xa]=f}else Oh(),!(f.flags&128)&&(f.memoizedState=null),f.flags|=4;Lo(f),F=!1}else fa!==null&&(zx(fa),fa=null),F=!0;if(!F)return f.flags&65536?f:null}return f.flags&128?(f.lanes=w,f):(A=A!==null,A!==(h!==null&&h.memoizedState!==null)&&A&&(f.child.flags|=8192,f.mode&1&&(h===null||Dr.current&1?ro===0&&(ro=3):Ox())),f.updateQueue!==null&&(f.flags|=4),Lo(f),null);case 4:return Vh(),bx(h,f),h===null&&nf(f.stateNode.containerInfo),Lo(f),null;case 10:return Yv(f.type._context),Lo(f),null;case 17:return is(f.type)&&Y_(),Lo(f),null;case 19:if(wr(Dr),F=f.memoizedState,F===null)return Lo(f),null;if(A=(f.flags&128)!==0,X=F.rendering,X===null)if(A)mf(F,!1);else{if(ro!==0||h!==null&&h.flags&128)for(h=f.child;h!==null;){if(X=ag(h),X!==null){for(f.flags|=128,mf(F,!1),A=X.updateQueue,A!==null&&(f.updateQueue=A,f.flags|=4),f.subtreeFlags=0,A=w,w=f.child;w!==null;)F=w,h=A,F.flags&=14680066,X=F.alternate,X===null?(F.childLanes=0,F.lanes=h,F.child=null,F.subtreeFlags=0,F.memoizedProps=null,F.memoizedState=null,F.updateQueue=null,F.dependencies=null,F.stateNode=null):(F.childLanes=X.childLanes,F.lanes=X.lanes,F.child=X.child,F.subtreeFlags=0,F.deletions=null,F.memoizedProps=X.memoizedProps,F.memoizedState=X.memoizedState,F.updateQueue=X.updateQueue,F.type=X.type,h=X.dependencies,F.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),w=w.sibling;return pr(Dr,Dr.current&1|2),f.child}h=h.sibling}F.tail!==null&&Hr()>$h&&(f.flags|=128,A=!0,mf(F,!1),f.lanes=4194304)}else{if(!A)if(h=ag(X),h!==null){if(f.flags|=128,A=!0,w=h.updateQueue,w!==null&&(f.updateQueue=w,f.flags|=4),mf(F,!0),F.tail===null&&F.tailMode==="hidden"&&!X.alternate&&!Ar)return Lo(f),null}else 2*Hr()-F.renderingStartTime>$h&&w!==1073741824&&(f.flags|=128,A=!0,mf(F,!1),f.lanes=4194304);F.isBackwards?(X.sibling=f.child,f.child=X):(w=F.last,w!==null?w.sibling=X:f.child=X,F.last=X)}return F.tail!==null?(f=F.tail,F.rendering=f,F.tail=f.sibling,F.renderingStartTime=Hr(),f.sibling=null,w=Dr.current,pr(Dr,A?w&1|2:w&1),f):(Lo(f),null);case 22:case 23:return kx(),A=f.memoizedState!==null,h!==null&&h.memoizedState!==null!==A&&(f.flags|=8192),A&&f.mode&1?Ts&1073741824&&(Lo(f),f.subtreeFlags&6&&(f.flags|=8192)):Lo(f),null;case 24:return null;case 25:return null}throw Error(Zt(156,f.tag))}function bP(h,f){switch($v(f),f.tag){case 1:return is(f.type)&&Y_(),h=f.flags,h&65536?(f.flags=h&-65537|128,f):null;case 3:return Vh(),wr(ts),wr(Po),nx(),h=f.flags,h&65536&&!(h&128)?(f.flags=h&-65537|128,f):null;case 5:return tx(f),null;case 13:if(wr(Dr),h=f.memoizedState,h!==null&&h.dehydrated!==null){if(f.alternate===null)throw Error(Zt(340));Oh()}return h=f.flags,h&65536?(f.flags=h&-65537|128,f):null;case 19:return wr(Dr),null;case 4:return Vh(),null;case 10:return Yv(f.type._context),null;case 22:case 23:return kx(),null;case 24:return null;default:return null}}var _g=!1,zo=!1,TP=typeof WeakSet=="function"?WeakSet:Set,bi=null;function Uh(h,f){var w=h.ref;if(w!==null)if(typeof w=="function")try{w(null)}catch(A){Vr(h,f,A)}else w.current=null}function Tx(h,f,w){try{w()}catch(A){Vr(h,f,A)}}var B2=!1;function SP(h,f){if(kv=O_,h=_T(),Av(h)){if("selectionStart"in h)var w={start:h.selectionStart,end:h.selectionEnd};else e:{w=(w=h.ownerDocument)&&w.defaultView||window;var A=w.getSelection&&w.getSelection();if(A&&A.rangeCount!==0){w=A.anchorNode;var L=A.anchorOffset,F=A.focusNode;A=A.focusOffset;try{w.nodeType,F.nodeType}catch{w=null;break e}var X=0,s=-1,de=-1,Ee=0,tt=0,Ie=h,He=null;t:for(;;){for(var vt;Ie!==w||L!==0&&Ie.nodeType!==3||(s=X+L),Ie!==F||A!==0&&Ie.nodeType!==3||(de=X+A),Ie.nodeType===3&&(X+=Ie.nodeValue.length),(vt=Ie.firstChild)!==null;)He=Ie,Ie=vt;for(;;){if(Ie===h)break t;if(He===w&&++Ee===L&&(s=X),He===F&&++tt===A&&(de=X),(vt=Ie.nextSibling)!==null)break;Ie=He,He=Ie.parentNode}Ie=vt}w=s===-1||de===-1?null:{start:s,end:de}}else w=null}w=w||{start:0,end:0}}else w=null;for(Ov={focusedElem:h,selectionRange:w},O_=!1,bi=f;bi!==null;)if(f=bi,h=f.child,(f.subtreeFlags&1028)!==0&&h!==null)h.return=f,bi=h;else for(;bi!==null;){f=bi;try{var mt=f.alternate;if(f.flags&1024)switch(f.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var at=mt.memoizedProps,Ft=mt.memoizedState,Ve=f.stateNode,Se=Ve.getSnapshotBeforeUpdate(f.elementType===f.type?at:ma(f.type,at),Ft);Ve.__reactInternalSnapshotBeforeUpdate=Se}break;case 3:var Ce=f.stateNode.containerInfo;Ce.nodeType===1?Ce.textContent="":Ce.nodeType===9&&Ce.documentElement&&Ce.removeChild(Ce.documentElement);break;
vendor: 4,750 bytes, line 40
40case 5:case 6:case 4:case 17:break;default:throw Error(Zt(163))}}catch(dt){Vr(f,f.return,dt)}if(h=f.sibling,h!==null){h.return=f.return,bi=h;break}bi=f.return}return mt=B2,B2=!1,mt}function _f(h,f,w){var A=f.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var L=A=A.next;do{if((L.tag&h)===h){var F=L.destroy;L.destroy=void 0,F!==void 0&&Tx(f,w,F)}L=L.next}while(L!==A)}}function gg(h,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var w=f=f.next;do{if((w.tag&h)===h){var A=w.create;w.destroy=A()}w=w.next}while(w!==f)}}function Sx(h){var f=h.ref;if(f!==null){var w=h.stateNode;switch(h.tag){case 5:h=w;break;default:h=w}typeof f=="function"?f(h):f.current=h}}function N2(h){var f=h.alternate;f!==null&&(h.alternate=null,N2(f)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(f=h.stateNode,f!==null&&(delete f[Xa],delete f[of],delete f[Vv],delete f[sP],delete f[aP])),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}function V2(h){return h.tag===5||h.tag===3||h.tag===4}function j2(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||V2(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function Ex(h,f,w){var A=h.tag;if(A===5||A===6)h=h.stateNode,f?w.nodeType===8?w.parentNode.insertBefore(h,f):w.insertBefore(h,f):(w.nodeType===8?(f=w.parentNode,f.insertBefore(h,w)):(f=w,f.appendChild(h)),w=w._reactRootContainer,w!=null||f.onclick!==null||(f.onclick=W_));else if(A!==4&&(h=h.child,h!==null))for(Ex(h,f,w),h=h.sibling;h!==null;)Ex(h,f,w),h=h.sibling}function Ix(h,f,w){var A=h.tag;if(A===5||A===6)h=h.stateNode,f?w.insertBefore(h,f):w.appendChild(h);else if(A!==4&&(h=h.child,h!==null))for(Ix(h,f,w),h=h.sibling;h!==null;)Ix(h,f,w),h=h.sibling}var wo=null,_a=!1;function xc(h,f,w){for(w=w.child;w!==null;)U2(h,f,w),w=w.sibling}function U2(h,f,w){if(Wa&&typeof Wa.onCommitFiberUnmount=="function")try{Wa.onCommitFiberUnmount(P_,w)}catch{}switch(w.tag){case 5:zo||Uh(w,f);case 6:var A=wo,L=_a;wo=null,xc(h,f,w),wo=A,_a=L,wo!==null&&(_a?(h=wo,w=w.stateNode,h.nodeType===8?h.parentNode.removeChild(w):h.removeChild(w)):wo.removeChild(w.stateNode));break;case 18:wo!==null&&(_a?(h=wo,w=w.stateNode,h.nodeType===8?Nv(h.parentNode,w):h.nodeType===1&&Nv(h,w),Zp(h)):Nv(wo,w.stateNode));break;case 4:A=wo,L=_a,wo=w.stateNode.containerInfo,_a=!0,xc(h,f,w),wo=A,_a=L;break;case 0:case 11:case 14:case 15:if(!zo&&(A=w.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){L=A=A.next;do{var F=L,X=F.destroy;F=F.tag,X!==void 0&&(F&2||F&4)&&Tx(w,f,X),L=L.next}while(L!==A)}xc(h,f,w);break;case 1:if(!zo&&(Uh(w,f),A=w.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=w.memoizedProps,A.state=w.memoizedState,A.componentWillUnmount()}catch(s){Vr(w,f,s)}xc(h,f,w);break;case 21:xc(h,f,w);break;case 22:w.mode&1?(zo=(A=zo)||w.memoizedState!==null,xc(h,f,w),zo=A):xc(h,f,w);break;default:xc(h,f,w)}}function G2(h){var f=h.updateQueue;if(f!==null){h.updateQueue=null;var w=h.stateNode;w===null&&(w=h.stateNode=new TP),f.forEach(function(A){var L=zP.bind(null,h,A);w.has(A)||(w.add(A),A.then(L,L))})}}function ga(h,f){var w=f.deletions;if(w!==null)for(var A=0;A<w.length;A++){var L=w[A];try{var F=h,X=f,s=X;e:for(;s!==null;){switch(s.tag){case 5:wo=s.stateNode,_a=!1;break e;case 3:wo=s.stateNode.containerInfo,_a=!0;break e;case 4:wo=s.stateNode.containerInfo,_a=!0;break e}s=s.return}if(wo===null)throw Error(Zt(160));U2(F,X,L),wo=null,_a=!1;var de=L.alternate;de!==null&&(de.return=null),L.return=null}catch(Ee){Vr(L,f,Ee)}}if(f.subtreeFlags&12854)for(f=f.child;f!==null;)$2(f,h),f=f.sibling}function $2(h,f){var w=h.alternate,A=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:if(ga(f,h),Ja(h),A&4){try{_f(3,h,h.return),gg(3,h)}catch(at){Vr(h,h.return,at)}try{_f(5,h,h.return)}catch(at){Vr(h,h.return,at)}}break;case 1:ga(f,h),Ja(h),A&512&&w!==null&&Uh(w,w.return);break;case 5:if(ga(f,h),Ja(h),A&512&&w!==null&&Uh(w,w.return),h.flags&32){var L=h.stateNode;try{Op(L,"")}catch(at){Vr(h,h.return,at)}}if(A&4&&(L=h.stateNode,L!=null)){var F=h.memoizedProps,X=w!==null?w.memoizedProps:F,s=h.type,de=h.updateQueue;if(h.updateQueue=null,de!==null)try{s==="input"&&F.type==="radio"&&F.name!=null&&yb(L,F),nv(s,X);var Ee=nv(s,F);for(X=0;X<de.length;X+=2){var tt=de[X],Ie=de[X+1];tt==="style"?Ib(L,Ie):tt==="dangerouslySetInnerHTML"?Sb(L,Ie):tt==="children"?Op(L,Ie):V0(L,tt,Ie,Ee)}switch(s){case"input":J0(L,F);break;case"textarea":wb(L,F);break;case"select":var He=L._wrapperState.wasMultiple;L._wrapperState.wasMultiple=!!F.multiple;var vt=F.value;
vendor: 4,571 bytes, line 40
40vt!=null?wh(L,!!F.multiple,vt,!1):He!==!!F.multiple&&(F.defaultValue!=null?wh(L,!!F.multiple,F.defaultValue,!0):wh(L,!!F.multiple,F.multiple?[]:"",!1))}L[of]=F}catch(at){Vr(h,h.return,at)}}break;case 6:if(ga(f,h),Ja(h),A&4){if(h.stateNode===null)throw Error(Zt(162));L=h.stateNode,F=h.memoizedProps;try{L.nodeValue=F}catch(at){Vr(h,h.return,at)}}break;case 3:if(ga(f,h),Ja(h),A&4&&w!==null&&w.memoizedState.isDehydrated)try{Zp(f.containerInfo)}catch(at){Vr(h,h.return,at)}break;case 4:ga(f,h),Ja(h);break;case 13:ga(f,h),Ja(h),L=h.child,L.flags&8192&&(F=L.memoizedState!==null,L.stateNode.isHidden=F,!F||L.alternate!==null&&L.alternate.memoizedState!==null||(Mx=Hr())),A&4&&G2(h);break;case 22:if(tt=w!==null&&w.memoizedState!==null,h.mode&1?(zo=(Ee=zo)||tt,ga(f,h),zo=Ee):ga(f,h),Ja(h),A&8192){if(Ee=h.memoizedState!==null,(h.stateNode.isHidden=Ee)&&!tt&&h.mode&1)for(bi=h,tt=h.child;tt!==null;){for(Ie=bi=tt;bi!==null;){switch(He=bi,vt=He.child,He.tag){case 0:case 11:case 14:case 15:_f(4,He,He.return);break;case 1:Uh(He,He.return);var mt=He.stateNode;if(typeof mt.componentWillUnmount=="function"){A=He,w=He.return;try{f=A,mt.props=f.memoizedProps,mt.state=f.memoizedState,mt.componentWillUnmount()}catch(at){Vr(A,w,at)}}break;case 5:Uh(He,He.return);break;case 22:if(He.memoizedState!==null){Z2(Ie);continue}}vt!==null?(vt.return=He,bi=vt):Z2(Ie)}tt=tt.sibling}e:for(tt=null,Ie=h;;){if(Ie.tag===5){if(tt===null){tt=Ie;try{L=Ie.stateNode,Ee?(F=L.style,typeof F.setProperty=="function"?F.setProperty("display","none","important"):F.display="none"):(s=Ie.stateNode,de=Ie.memoizedProps.style,X=de!=null&&de.hasOwnProperty("display")?de.display:null,s.style.display=Eb("display",X))}catch(at){Vr(h,h.return,at)}}}else if(Ie.tag===6){if(tt===null)try{Ie.stateNode.nodeValue=Ee?"":Ie.memoizedProps}catch(at){Vr(h,h.return,at)}}else if((Ie.tag!==22&&Ie.tag!==23||Ie.memoizedState===null||Ie===h)&&Ie.child!==null){Ie.child.return=Ie,Ie=Ie.child;continue}if(Ie===h)break e;for(;Ie.sibling===null;){if(Ie.return===null||Ie.return===h)break e;tt===Ie&&(tt=null),Ie=Ie.return}tt===Ie&&(tt=null),Ie.sibling.return=Ie.return,Ie=Ie.sibling}}break;case 19:ga(f,h),Ja(h),A&4&&G2(h);break;case 21:break;default:ga(f,h),Ja(h)}}function Ja(h){var f=h.flags;if(f&2){try{e:{for(var w=h.return;w!==null;){if(V2(w)){var A=w;break e}w=w.return}throw Error(Zt(160))}switch(A.tag){case 5:var L=A.stateNode;A.flags&32&&(Op(L,""),A.flags&=-33);var F=j2(h);Ix(h,F,L);break;case 3:case 4:var X=A.stateNode.containerInfo,s=j2(h);Ex(h,s,X);break;default:throw Error(Zt(161))}}catch(de){Vr(h,h.return,de)}h.flags&=-3}f&4096&&(h.flags&=-4097)}function EP(h,f,w){bi=h,H2(h)}function H2(h,f,w){for(var A=(h.mode&1)!==0;bi!==null;){var L=bi,F=L.child;if(L.tag===22&&A){var X=L.memoizedState!==null||_g;if(!X){var s=L.alternate,de=s!==null&&s.memoizedState!==null||zo;s=_g;var Ee=zo;if(_g=X,(zo=de)&&!Ee)for(bi=L;bi!==null;)X=bi,de=X.child,X.tag===22&&X.memoizedState!==null?W2(L):de!==null?(de.return=X,bi=de):W2(L);for(;F!==null;)bi=F,H2(F),F=F.sibling;bi=L,_g=s,zo=Ee}q2(h)}else L.subtreeFlags&8772&&F!==null?(F.return=L,bi=F):q2(h)}}function q2(h){for(;bi!==null;){var f=bi;if(f.flags&8772){var w=f.alternate;try{if(f.flags&8772)switch(f.tag){case 0:case 11:case 15:zo||gg(5,f);break;case 1:var A=f.stateNode;if(f.flags&4&&!zo)if(w===null)A.componentDidMount();else{var L=f.elementType===f.type?w.memoizedProps:ma(f.type,w.memoizedProps);A.componentDidUpdate(L,w.memoizedState,A.__reactInternalSnapshotBeforeUpdate)}var F=f.updateQueue;F!==null&&ZT(f,F,A);break;case 3:var X=f.updateQueue;if(X!==null){if(w=null,f.child!==null)switch(f.child.tag){case 5:w=f.child.stateNode;break;case 1:w=f.child.stateNode}ZT(f,X,w)}break;case 5:var s=f.stateNode;if(w===null&&f.flags&4){w=s;var de=f.memoizedProps;switch(f.type){case"button":case"input":case"select":case"textarea":de.autoFocus&&w.focus();break;case"img":de.src&&(w.src=de.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(f.memoizedState===null){var Ee=f.alternate;if(Ee!==null){var tt=Ee.memoizedState;if(tt!==null){var Ie=tt.dehydrated;Ie!==null&&Zp(Ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Zt(163))}zo||f.flags&512&&Sx(f)}catch(He){Vr(f,f.return,He)}}if(f===h){bi=null;break}if(w=f.sibling,w!==null){w.return=f.return,bi=w;break}bi=f.return}}function Z2(h){for(;bi!==null;){var f=bi;if(f===h){bi=null;break}var w=f.sibling;if(w!==null){w.return=f.return,bi=w;break}bi=f.return}}function W2(h){for(;bi!==null;){var f=bi;try{switch(f.tag){case 0:case 11:case 15:var w=f.return;try{gg(4,f)}
vendor: 9,436 bytes, line 40
40catch(de){Vr(f,w,de)}break;case 1:var A=f.stateNode;if(typeof A.componentDidMount=="function"){var L=f.return;try{A.componentDidMount()}catch(de){Vr(f,L,de)}}var F=f.return;try{Sx(f)}catch(de){Vr(f,F,de)}break;case 5:var X=f.return;try{Sx(f)}catch(de){Vr(f,X,de)}}}catch(de){Vr(f,f.return,de)}if(f===h){bi=null;break}var s=f.sibling;if(s!==null){s.return=f.return,bi=s;break}bi=f.return}}var IP=Math.ceil,yg=Tl.ReactCurrentDispatcher,Ax=Tl.ReactCurrentOwner,Us=Tl.ReactCurrentBatchConfig,$n=0,ho=null,Xr=null,bo=0,Ts=0,Gh=mc(0),ro=0,gf=null,_u=0,vg=0,Cx=0,yf=null,rs=null,Mx=0,$h=1/0,Rl=null,xg=!1,Px=null,wc=null,wg=!1,bc=null,bg=0,vf=0,Rx=null,Tg=-1,Sg=0;function Uo(){return $n&6?Hr():Tg!==-1?Tg:Tg=Hr()}function Tc(h){return h.mode&1?$n&2&&bo!==0?bo&-bo:cP.transition!==null?(Sg===0&&(Sg=jb()),Sg):(h=or,h!==0||(h=window.event,h=h===void 0?16:Yb(h.type)),h):1}function ya(h,f,w,A){if(50<vf)throw vf=0,Rx=null,Error(Zt(185));Up(h,w,A),(!($n&2)||h!==ho)&&(h===ho&&(!($n&2)&&(vg|=w),ro===4&&Sc(h,bo)),os(h,A),w===1&&$n===0&&!(f.mode&1)&&($h=Hr()+500,J_&&gc()))}function os(h,f){var w=h.callbackNode;cM(h,f);var A=z_(h,h===ho?bo:0);if(A===0)w!==null&&Bb(w),h.callbackNode=null,h.callbackPriority=0;else if(f=A&-A,h.callbackPriority!==f){if(w!=null&&Bb(w),f===1)h.tag===0?lP(Y2.bind(null,h)):kT(Y2.bind(null,h)),rP(function(){!($n&6)&&gc()}),w=null;else{switch(Ub(A)){case 1:w=uv;break;case 4:w=Nb;break;case 16:w=M_;break;case 536870912:w=Vb;break;default:w=M_}w=rS(w,X2.bind(null,h))}h.callbackPriority=f,h.callbackNode=w}}function X2(h,f){if(Tg=-1,Sg=0,$n&6)throw Error(Zt(327));var w=h.callbackNode;if(Hh()&&h.callbackNode!==w)return null;var A=z_(h,h===ho?bo:0);if(A===0)return null;if(A&30||A&h.expiredLanes||f)f=Eg(h,A);else{f=A;var L=$n;$n|=2;var F=J2();(ho!==h||bo!==f)&&(Rl=null,$h=Hr()+500,yu(h,f));do try{MP();break}catch(s){K2(h,s)}while(1);Xv(),yg.current=F,$n=L,Xr!==null?f=0:(ho=null,bo=0,f=ro)}if(f!==0){if(f===2&&(L=hv(h),L!==0&&(A=L,f=Lx(h,L))),f===1)throw w=gf,yu(h,0),Sc(h,A),os(h,Hr()),w;if(f===6)Sc(h,A);else{if(L=h.current.alternate,!(A&30)&&!AP(L)&&(f=Eg(h,A),f===2&&(F=hv(h),F!==0&&(A=F,f=Lx(h,F))),f===1))throw w=gf,yu(h,0),Sc(h,A),os(h,Hr()),w;switch(h.finishedWork=L,h.finishedLanes=A,f){case 0:case 1:throw Error(Zt(345));case 2:vu(h,rs,Rl);break;case 3:if(Sc(h,A),(A&130023424)===A&&(f=Mx+500-Hr(),10<f)){if(z_(h,0)!==0)break;if(L=h.suspendedLanes,(L&A)!==A){Uo(),h.pingedLanes|=h.suspendedLanes&L;break}h.timeoutHandle=Bv(vu.bind(null,h,rs,Rl),f);break}vu(h,rs,Rl);break;case 4:if(Sc(h,A),(A&4194240)===A)break;for(f=h.eventTimes,L=-1;0<A;){var X=31-da(A);F=1<<X,X=f[X],X>L&&(L=X),A&=~F}if(A=L,A=Hr()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*IP(A/1960))-A,10<A){h.timeoutHandle=Bv(vu.bind(null,h,rs,Rl),A);break}vu(h,rs,Rl);break;case 5:vu(h,rs,Rl);break;default:throw Error(Zt(329))}}}return os(h,Hr()),h.callbackNode===w?X2.bind(null,h):null}function Lx(h,f){var w=yf;return h.current.memoizedState.isDehydrated&&(yu(h,f).flags|=256),h=Eg(h,f),h!==2&&(f=rs,rs=w,f!==null&&zx(f)),h}function zx(h){rs===null?rs=h:rs.push.apply(rs,h)}function AP(h){for(var f=h;;){if(f.flags&16384){var w=f.updateQueue;if(w!==null&&(w=w.stores,w!==null))for(var A=0;A<w.length;A++){var L=w[A],F=L.getSnapshot;L=L.value;try{if(!pa(F(),L))return!1}catch{return!1}}}if(w=f.child,f.subtreeFlags&16384&&w!==null)w.return=f,f=w;else{if(f===h)break;for(;f.sibling===null;){if(f.return===null||f.return===h)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function Sc(h,f){for(f&=~Cx,f&=~vg,h.suspendedLanes|=f,h.pingedLanes&=~f,h=h.expirationTimes;0<f;){var w=31-da(f),A=1<<w;h[w]=-1,f&=~A}}function Y2(h){if($n&6)throw Error(Zt(327));Hh();var f=z_(h,0);if(!(f&1))return os(h,Hr()),null;var w=Eg(h,f);if(h.tag!==0&&w===2){var A=hv(h);A!==0&&(f=A,w=Lx(h,A))}if(w===1)throw w=gf,yu(h,0),Sc(h,f),os(h,Hr()),w;if(w===6)throw Error(Zt(345));return h.finishedWork=h.current.alternate,h.finishedLanes=f,vu(h,rs,Rl),os(h,Hr()),null}function Dx(h,f){var w=$n;$n|=1;try{return h(f)}finally{$n=w,$n===0&&($h=Hr()+500,J_&&gc())}}function gu(h){bc!==null&&bc.tag===0&&!($n&6)&&Hh();var f=$n;$n|=1;var w=Us.transition,A=or;try{if(Us.transition=null,or=1,h)return h()}finally{or=A,Us.transition=w,$n=f,!($n&6)&&gc()}}function kx(){Ts=Gh.current,wr(Gh)}function yu(h,f){h.finishedWork=null,h.finishedLanes=0;var w=h.timeoutHandle;if(w!==-1&&(h.timeoutHandle=-1,nP(w)),Xr!==null)for(w=Xr.return;w!==null;){var A=w;switch($v(A),A.tag){case 1:A=A.type.childContextTypes,A!=null&&Y_();break;case 3:Vh(),wr(ts),wr(Po),nx();break;case 5:tx(A);break;case 4:Vh();break;case 13:wr(Dr);break;case 19:wr(Dr);break;case 10:Yv(A.type._context);break;case 22:case 23:kx()}w=w.return}if(ho=h,Xr=h=Ec(h.current,null),bo=Ts=f,ro=0,gf=null,Cx=vg=_u=0,rs=yf=null,pu!==null){for(f=0;f<pu.length;f++)if(w=pu[f],A=w.interleaved,A!==null){w.interleaved=null;var L=A.next,F=w.pending;if(F!==null){var X=F.next;F.next=L,A.next=X}w.pending=A}pu=null}return h}function K2(h,f){do{var w=Xr;try{if(Xv(),lg.current=dg,cg){for(var A=kr.memoizedState;A!==null;){var L=A.queue;L!==null&&(L.pending=null),A=A.next}cg=!1}if(mu=0,uo=no=kr=null,hf=!1,df=0,Ax.current=null,w===null||w.return===null){ro=1,gf=f,Xr=null;break}e:{var F=h,X=w.return,s=w,de=f;if(f=bo,s.flags|=32768,de!==null&&typeof de=="object"&&typeof de.then=="function"){var Ee=de,tt=s,Ie=tt.tag;if(!(tt.mode&1)&&(Ie===0||Ie===11||Ie===15)){var He=tt.alternate;He?(tt.updateQueue=He.updateQueue,tt.memoizedState=He.memoizedState,tt.lanes=He.lanes):(tt.updateQueue=null,tt.memoizedState=null)}var vt=b2(X);if(vt!==null){vt.flags&=-257,T2(vt,X,s,F,f),vt.mode&1&&w2(F,Ee,f),f=vt,de=Ee;var mt=f.updateQueue;if(mt===null){var at=new Set;at.add(de),f.updateQueue=at}else mt.add(de);break e}else{if(!(f&1)){w2(F,Ee,f),Ox();break e}de=Error(Zt(426))}}else if(Ar&&s.mode&1){var Ft=b2(X);if(Ft!==null){!(Ft.flags&65536)&&(Ft.flags|=256),T2(Ft,X,s,F,f),Zv(jh(de,s));break e}}F=de=jh(de,s),ro!==4&&(ro=2),yf===null?yf=[F]:yf.push(F),F=X;do{switch(F.tag){case 3:F.flags|=65536,f&=-f,F.lanes|=f;var Ve=v2(F,de,f);qT(F,Ve);break e;case 1:s=de;var Se=F.type,Ce=F.stateNode;if(!(F.flags&128)&&(typeof Se.getDerivedStateFromError=="function"||Ce!==null&&typeof Ce.componentDidCatch=="function"&&(wc===null||!wc.has(Ce)))){F.flags|=65536,f&=-f,F.lanes|=f;var dt=x2(F,s,f);qT(F,dt);break e}}F=F.return}while(F!==null)}eS(w)}catch(Vt){f=Vt,Xr===w&&w!==null&&(Xr=w=w.return);continue}break}while(1)}function J2(){var h=yg.current;return yg.current=dg,h===null?dg:h}function Ox(){(ro===0||ro===3||ro===2)&&(ro=4),ho===null||!(_u&268435455)&&!(vg&268435455)||Sc(ho,bo)}function Eg(h,f){var w=$n;$n|=2;var A=J2();(ho!==h||bo!==f)&&(Rl=null,yu(h,f));do try{CP();break}catch(L){K2(h,L)}while(1);if(Xv(),$n=w,yg.current=A,Xr!==null)throw Error(Zt(261));return ho=null,bo=0,ro}function CP(){for(;Xr!==null;)Q2(Xr)}function MP(){for(;Xr!==null&&!eM();)Q2(Xr)}function Q2(h){var f=nS(h.alternate,h,Ts);h.memoizedProps=h.pendingProps,f===null?eS(h):Xr=f,Ax.current=null}function eS(h){var f=h;do{var w=f.alternate;if(h=f.return,f.flags&32768){if(w=bP(w,f),w!==null){w.flags&=32767,Xr=w;return}if(h!==null)h.flags|=32768,h.subtreeFlags=0,h.deletions=null;else{ro=6,Xr=null;return}}else if(w=wP(w,f,Ts),w!==null){Xr=w;return}if(f=f.sibling,f!==null){Xr=f;return}Xr=f=h}while(f!==null);ro===0&&(ro=5)}function vu(h,f,w){var A=or,L=Us.transition;try{Us.transition=null,or=1,PP(h,f,w,A)}finally{Us.transition=L,or=A}return null}function PP(h,f,w,A){do Hh();while(bc!==null);if($n&6)throw Error(Zt(327));w=h.finishedWork;var L=h.finishedLanes;if(w===null)return null;if(h.finishedWork=null,h.finishedLanes=0,w===h.current)throw Error(Zt(177));h.callbackNode=null,h.callbackPriority=0;var F=w.lanes|w.childLanes;if(uM(h,F),h===ho&&(Xr=ho=null,bo=0),!(w.subtreeFlags&2064)&&!(w.flags&2064)||wg||(wg=!0,rS(M_,function(){return Hh(),null})),F=(w.flags&15990)!==0,w.subtreeFlags&15990||F){F=Us.transition,Us.transition=null;var X=or;or=1;var s=$n;$n|=4,Ax.current=null,SP(h,w),$2(w,h),YM(Ov),O_=!!kv,Ov=kv=null,h.current=w,EP(w),tM(),$n=s,or=X,Us.transition=F}else h.current=w;if(wg&&(wg=!1,bc=h,bg=L),F=h.pendingLanes,F===0&&(wc=null),rM(w.stateNode),os(h,Hr()),f!==null)for(A=h.onRecoverableError,w=0;w<f.length;w++)L=f[w],A(L.value,{componentStack:L.stack,digest:L.digest});if(xg)throw xg=!1,h=Px,Px=null,h;return bg&1&&h.tag!==0&&Hh(),F=h.pendingLanes,F&1?h===Rx?vf++:(vf=0,Rx=h):vf=0,gc(),null}function Hh(){if(bc!==null){var h=Ub(bg),f=Us.transition,w=or;try{if(Us.transition=null,or=16>h?16:h,bc===null)var A=!1;else{if(h=bc,bc=null,bg=0,$n&6)throw Error(Zt(331));var L=$n;for($n|=4,bi=h.current;bi!==null;){var F=bi,X=F.child;if(bi.flags&16){var s=F.deletions;if(s!==null){for(var de=0;de<s.length;de++){var Ee=s[de];for(bi=Ee;bi!==null;){var tt=bi;switch(tt.tag){case 0:case 11:case 15:_f(8,tt,F)}var Ie=tt.child;if(Ie!==null)Ie.return=tt,bi=Ie;else for(;bi!==null;){tt=bi;var He=tt.sibling,vt=tt.return;if(N2(tt),tt===Ee){bi=null;break}if(He!==null){He.return=vt,bi=He;break}bi=vt}}}var mt=F.alternate;if(mt!==null){var at=mt.child;if(at!==null){mt.child=null;do{var Ft=at.sibling;at.sibling=null,at=Ft}while(at!==null)}}bi=F}}if(F.subtreeFlags&2064&&X!==null)X.return=F,bi=X;else e:for(;bi!==null;){if(F=bi,F.flags&2048)switch(F.tag){case 0:case 11:case 15:_f(9,F,F.return)}var Ve=F.sibling;if(Ve!==null){Ve.return=F.return,bi=Ve;break e}bi=F.return}}var Se=h.current;for(bi=Se;bi!==null;){X=bi;
vendor: 5,562 bytes, line 40
40var Ce=X.child;if(X.subtreeFlags&2064&&Ce!==null)Ce.return=X,bi=Ce;else e:for(X=Se;bi!==null;){if(s=bi,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:gg(9,s)}}catch(Vt){Vr(s,s.return,Vt)}if(s===X){bi=null;break e}var dt=s.sibling;if(dt!==null){dt.return=s.return,bi=dt;break e}bi=s.return}}if($n=L,gc(),Wa&&typeof Wa.onPostCommitFiberRoot=="function")try{Wa.onPostCommitFiberRoot(P_,h)}catch{}A=!0}return A}finally{or=w,Us.transition=f}}return!1}function tS(h,f,w){f=jh(w,f),f=v2(h,f,1),h=vc(h,f,1),f=Uo(),h!==null&&(Up(h,1,f),os(h,f))}function Vr(h,f,w){if(h.tag===3)tS(h,h,w);else for(;f!==null;){if(f.tag===3){tS(f,h,w);break}else if(f.tag===1){var A=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof A.componentDidCatch=="function"&&(wc===null||!wc.has(A))){h=jh(w,h),h=x2(f,h,1),f=vc(f,h,1),h=Uo(),f!==null&&(Up(f,1,h),os(f,h));break}}f=f.return}}function RP(h,f,w){var A=h.pingCache;A!==null&&A.delete(f),f=Uo(),h.pingedLanes|=h.suspendedLanes&w,ho===h&&(bo&w)===w&&(ro===4||ro===3&&(bo&130023424)===bo&&500>Hr()-Mx?yu(h,0):Cx|=w),os(h,f)}function iS(h,f){f===0&&(h.mode&1?(f=L_,L_<<=1,!(L_&130023424)&&(L_=4194304)):f=1);var w=Uo();h=Cl(h,f),h!==null&&(Up(h,f,w),os(h,w))}function LP(h){var f=h.memoizedState,w=0;f!==null&&(w=f.retryLane),iS(h,w)}function zP(h,f){var w=0;switch(h.tag){case 13:var A=h.stateNode,L=h.memoizedState;L!==null&&(w=L.retryLane);break;case 19:A=h.stateNode;break;default:throw Error(Zt(314))}A!==null&&A.delete(f),iS(h,w)}var nS;nS=function(h,f,w){if(h!==null)if(h.memoizedProps!==f.pendingProps||ts.current)ns=!0;else{if(!(h.lanes&w)&&!(f.flags&128))return ns=!1,xP(h,f,w);ns=!!(h.flags&131072)}else ns=!1,Ar&&f.flags&1048576&&OT(f,eg,f.index);switch(f.lanes=0,f.tag){case 2:var A=f.type;mg(h,f),h=f.pendingProps;var L=zh(f,Po.current);Nh(f,w),L=sx(null,f,A,h,L,w);var F=ax();return f.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,is(A)?(F=!0,K_(f)):F=!1,f.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,Qv(f),L.updater=pg,f.stateNode=L,L._reactInternals=f,px(f,A,h,w),f=gx(null,f,A,!0,F,w)):(f.tag=0,Ar&&F&&Gv(f),jo(null,f,L,w),f=f.child),f;case 16:A=f.elementType;e:{switch(mg(h,f),h=f.pendingProps,L=A._init,A=L(A._payload),f.type=A,L=f.tag=kP(A),h=ma(A,h),L){case 0:f=_x(null,f,A,h,w);break e;case 1:f=M2(null,f,A,h,w);break e;case 11:f=S2(null,f,A,h,w);break e;case 14:f=E2(null,f,A,ma(A.type,h),w);break e}throw Error(Zt(306,A,""))}return f;case 0:return A=f.type,L=f.pendingProps,L=f.elementType===A?L:ma(A,L),_x(h,f,A,L,w);case 1:return A=f.type,L=f.pendingProps,L=f.elementType===A?L:ma(A,L),M2(h,f,A,L,w);case 3:e:{if(P2(f),h===null)throw Error(Zt(387));A=f.pendingProps,F=f.memoizedState,L=F.element,HT(h,f),sg(f,A,null,w);var X=f.memoizedState;if(A=X.element,F.isDehydrated)if(F={element:A,isDehydrated:!1,cache:X.cache,pendingSuspenseBoundaries:X.pendingSuspenseBoundaries,transitions:X.transitions},f.updateQueue.baseState=F,f.memoizedState=F,f.flags&256){L=jh(Error(Zt(423)),f),f=R2(h,f,A,w,L);break e}else if(A!==L){L=jh(Error(Zt(424)),f),f=R2(h,f,A,w,L);break e}else for(bs=fc(f.stateNode.containerInfo.firstChild),ws=f,Ar=!0,fa=null,w=GT(f,null,A,w),f.child=w;w;)w.flags=w.flags&-3|4096,w=w.sibling;else{if(Oh(),A===L){f=Pl(h,f,w);break e}jo(h,f,A,w)}f=f.child}return f;case 5:return WT(f),h===null&&qv(f),A=f.type,L=f.pendingProps,F=h!==null?h.memoizedProps:null,X=L.children,Fv(A,L)?X=null:F!==null&&Fv(A,F)&&(f.flags|=32),C2(h,f),jo(h,f,X,w),f.child;case 6:return h===null&&qv(f),null;case 13:return L2(h,f,w);case 4:return ex(f,f.stateNode.containerInfo),A=f.pendingProps,h===null?f.child=Fh(f,null,A,w):jo(h,f,A,w),f.child;case 11:return A=f.type,L=f.pendingProps,L=f.elementType===A?L:ma(A,L),S2(h,f,A,L,w);case 7:return jo(h,f,f.pendingProps,w),f.child;case 8:return jo(h,f,f.pendingProps.children,w),f.child;case 12:return jo(h,f,f.pendingProps.children,w),f.child;case 10:e:{if(A=f.type._context,L=f.pendingProps,F=f.memoizedProps,X=L.value,pr(ng,A._currentValue),A._currentValue=X,F!==null)if(pa(F.value,X)){if(F.children===L.children&&!ts.current){f=Pl(h,f,w);break e}}else for(F=f.child,F!==null&&(F.return=f);F!==null;){var s=F.dependencies;if(s!==null){X=F.child;for(var de=s.firstContext;de!==null;){if(de.context===A){if(F.tag===1){de=Ml(-1,w&-w),de.tag=2;var Ee=F.updateQueue;if(Ee!==null){Ee=Ee.shared;var tt=Ee.pending;tt===null?de.next=de:(de.next=tt.next,tt.next=de),Ee.pending=de}}F.lanes|=w,de=F.alternate,de!==null&&(de.lanes|=w),Kv(F.return,w,f),s.lanes|=w;break}de=de.next}}else if(F.tag===10)X=F.type===f.type?null:F.child;else if(F.tag===18){if(X=F.return,X===null)throw Error(Zt(341));X.lanes|=w,s=X.alternate,s!==null&&(s.lanes|=w),Kv(X,w,f),X=F.sibling}else X=F.child;if(X!==null)X.return=F;else for(X=F;X!==null;){if(X===f){X=null;break}if(F=X.sibling,F!==null){F.return=X.return,X=F;break}X=X.return}F=X}jo(h,f,L.children,w),f=f.child}return f;case 9:return L=f.type,A=f.pendingProps.children,Nh(f,w),L=Vs(L),A=A(L),f.flags|=1,jo(h,f,A,w),f.child;case 14:return A=f.type,L=ma(A,f.pendingProps),L=ma(A.type,L),E2(h,f,A,L,w);case 15:return I2(h,f,f.type,f.pendingProps,w);case 17:return A=f.type,L=f.pendingProps,L=f.elementType===A?L:ma(A,L),mg(h,f),f.tag=1,is(A)?(h=!0,K_(f)):h=!1,Nh(f,w),g2(f,A,L),px(f,A,L,w),gx(null,f,A,!0,h,w);case 19:return D2(h,f,w);case 22:return A2(h,f,w)}throw Error(Zt(156,f.tag))};function rS(h,f){return Fb(h,f)}function DP(h,f,w,A){this.tag=h,this.key=w,this.sibling=this.child=this.return=this.stateNode=this.t
vendor: 4,560 bytes, line 40
40ype=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gs(h,f,w,A){return new DP(h,f,w,A)}function Fx(h){return h=h.prototype,!(!h||!h.isReactComponent)}function kP(h){if(typeof h=="function")return Fx(h)?1:0;if(h!=null){if(h=h.$$typeof,h===G0)return 11;if(h===q0)return 14}return 2}function Ec(h,f){var w=h.alternate;return w===null?(w=Gs(h.tag,f,h.key,h.mode),w.elementType=h.elementType,w.type=h.type,w.stateNode=h.stateNode,w.alternate=h,h.alternate=w):(w.pendingProps=f,w.type=h.type,w.flags=0,w.subtreeFlags=0,w.deletions=null),w.flags=h.flags&14680064,w.childLanes=h.childLanes,w.lanes=h.lanes,w.child=h.child,w.memoizedProps=h.memoizedProps,w.memoizedState=h.memoizedState,w.updateQueue=h.updateQueue,f=h.dependencies,w.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},w.sibling=h.sibling,w.index=h.index,w.ref=h.ref,w}function Ig(h,f,w,A,L,F){var X=2;if(A=h,typeof h=="function")Fx(h)&&(X=1);else if(typeof h=="string")X=5;else e:switch(h){case xh:return xu(w.children,L,F,f);case j0:X=8,L|=8;break;case U0:return h=Gs(12,w,f,L|2),h.elementType=U0,h.lanes=F,h;case $0:return h=Gs(13,w,f,L),h.elementType=$0,h.lanes=F,h;case H0:return h=Gs(19,w,f,L),h.elementType=H0,h.lanes=F,h;case pb:return Ag(w,L,F,f);default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case hb:X=10;break e;case db:X=9;break e;case G0:X=11;break e;case q0:X=14;break e;case sc:X=16,A=null;break e}throw Error(Zt(130,h==null?h:typeof h,""))}return f=Gs(X,w,f,L),f.elementType=h,f.type=A,f.lanes=F,f}function xu(h,f,w,A){return h=Gs(7,h,A,f),h.lanes=w,h}function Ag(h,f,w,A){return h=Gs(22,h,A,f),h.elementType=pb,h.lanes=w,h.stateNode={isHidden:!1},h}function Bx(h,f,w){return h=Gs(6,h,null,f),h.lanes=w,h}function Nx(h,f,w){return f=Gs(4,h.children!==null?h.children:[],h.key,f),f.lanes=w,f.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},f}function OP(h,f,w,A,L){this.tag=f,this.containerInfo=h,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dv(0),this.expirationTimes=dv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dv(0),this.identifierPrefix=A,this.onRecoverableError=L,this.mutableSourceEagerHydrationData=null}function Vx(h,f,w,A,L,F,X,s,de){return h=new OP(h,f,w,s,de),f===1?(f=1,F===!0&&(f|=8)):f=0,F=Gs(3,null,null,f),h.current=F,F.stateNode=h,F.memoizedState={element:A,isDehydrated:w,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qv(F),h}function FP(h,f,w){var A=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vh,key:A==null?null:""+A,children:h,containerInfo:f,implementation:w}}function oS(h){if(!h)return _c;h=h._reactInternals;e:{if(lu(h)!==h||h.tag!==1)throw Error(Zt(170));var f=h;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(is(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(Zt(171))}if(h.tag===1){var w=h.type;if(is(w))return zT(h,w,f)}return f}function sS(h,f,w,A,L,F,X,s,de){return h=Vx(w,A,!0,h,L,F,X,s,de),h.context=oS(null),w=h.current,A=Uo(),L=Tc(w),F=Ml(A,L),F.callback=f??null,vc(w,F,L),h.current.lanes=L,Up(h,L,A),os(h,A),h}function Cg(h,f,w,A){var L=f.current,F=Uo(),X=Tc(L);return w=oS(w),f.context===null?f.context=w:f.pendingContext=w,f=Ml(F,X),f.payload={element:h},A=A===void 0?null:A,A!==null&&(f.callback=A),h=vc(L,f,X),h!==null&&(ya(h,L,X,F),og(h,L,X)),X}function Mg(h){if(h=h.current,!h.child)return null;switch(h.child.tag){case 5:return h.child.stateNode;default:return h.child.stateNode}}function aS(h,f){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var w=h.retryLane;h.retryLane=w!==0&&w<f?w:f}}function jx(h,f){aS(h,f),(h=h.alternate)&&aS(h,f)}function BP(){return null}var lS=typeof reportError=="function"?reportError:function(h){console.error(h)};function Ux(h){this._internalRoot=h}Pg.prototype.render=Ux.prototype.render=function(h){var f=this._internalRoot;if(f===null)throw Error(Zt(409));Cg(h,f,null,null)},Pg.prototype.unmount=Ux.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var f=h.containerInfo;
vendor: 5,492 bytes, line 40
40gu(function(){Cg(null,h,null,null)}),f[Sl]=null}};function Pg(h){this._internalRoot=h}Pg.prototype.unstable_scheduleHydration=function(h){if(h){var f=Hb();h={blockedOn:null,target:h,priority:f};for(var w=0;w<hc.length&&f!==0&&f<hc[w].priority;w++);hc.splice(w,0,h),w===0&&Wb(h)}};function Gx(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function Rg(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11&&(h.nodeType!==8||h.nodeValue!==" react-mount-point-unstable "))}function cS(){}function NP(h,f,w,A,L){if(L){if(typeof A=="function"){var F=A;A=function(){var Ee=Mg(X);F.call(Ee)}}var X=sS(f,A,h,0,null,!1,!1,"",cS);return h._reactRootContainer=X,h[Sl]=X.current,nf(h.nodeType===8?h.parentNode:h),gu(),X}for(;L=h.lastChild;)h.removeChild(L);if(typeof A=="function"){var s=A;A=function(){var Ee=Mg(de);s.call(Ee)}}var de=Vx(h,0,!1,null,null,!1,!1,"",cS);return h._reactRootContainer=de,h[Sl]=de.current,nf(h.nodeType===8?h.parentNode:h),gu(function(){Cg(f,de,w,A)}),de}function Lg(h,f,w,A,L){var F=w._reactRootContainer;if(F){var X=F;if(typeof L=="function"){var s=L;L=function(){var de=Mg(X);s.call(de)}}Cg(f,X,h,L)}else X=NP(w,f,h,L,A);return Mg(X)}Gb=function(h){switch(h.tag){case 3:var f=h.stateNode;if(f.current.memoizedState.isDehydrated){var w=jp(f.pendingLanes);w!==0&&(pv(f,w|1),os(f,Hr()),!($n&6)&&($h=Hr()+500,gc()))}break;case 13:gu(function(){var A=Cl(h,1);if(A!==null){var L=Uo();ya(A,h,1,L)}}),jx(h,1)}},fv=function(h){if(h.tag===13){var f=Cl(h,134217728);if(f!==null){var w=Uo();ya(f,h,134217728,w)}jx(h,134217728)}},$b=function(h){if(h.tag===13){var f=Tc(h),w=Cl(h,f);if(w!==null){var A=Uo();ya(w,h,f,A)}jx(h,f)}},Hb=function(){return or},qb=function(h,f){var w=or;try{return or=h,f()}finally{or=w}},sv=function(h,f,w){switch(f){case"input":if(J0(h,w),f=w.name,w.type==="radio"&&f!=null){for(w=h;w.parentNode;)w=w.parentNode;for(w=w.querySelectorAll("input[name="+JSON.stringify(""+f)+'][type="radio"]'),f=0;f<w.length;f++){var A=w[f];if(A!==h&&A.form===h.form){var L=X_(A);if(!L)throw Error(Zt(90));_b(A),J0(A,L)}}}break;case"textarea":wb(h,w);break;case"select":f=w.value,f!=null&&wh(h,!!w.multiple,f,!1)}},Pb=Dx,Rb=gu;var VP={usingClientEntryPoint:!1,Events:[sf,Rh,X_,Cb,Mb,Dx]},xf={findFiberByHostInstance:cu,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jP={bundleType:xf.bundleType,version:xf.version,rendererPackageName:xf.rendererPackageName,rendererConfig:xf.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Tl.ReactCurrentDispatcher,findHostInstanceByFiber:function(h){return h=kb(h),h===null?null:h.stateNode},findFiberByHostInstance:xf.findFiberByHostInstance||BP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zg.isDisabled&&zg.supportsFiber)try{P_=zg.inject(jP),Wa=zg}catch{}}ys.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=VP,ys.createPortal=function(h,f){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Gx(f))throw Error(Zt(200));return FP(h,f,null,w)},ys.createRoot=function(h,f){if(!Gx(h))throw Error(Zt(299));var w=!1,A="",L=lS;return f!=null&&(f.unstable_strictMode===!0&&(w=!0),f.identifierPrefix!==void 0&&(A=f.identifierPrefix),f.onRecoverableError!==void 0&&(L=f.onRecoverableError)),f=Vx(h,1,!1,null,null,w,!1,A,L),h[Sl]=f.current,nf(h.nodeType===8?h.parentNode:h),new Ux(f)},ys.findDOMNode=function(h){if(h==null)return null;if(h.nodeType===1)return h;var f=h._reactInternals;if(f===void 0)throw typeof h.render=="function"?Error(Zt(188)):(h=Object.keys(h).join(","),Error(Zt(268,h)));return h=kb(f),h=h===null?null:h.stateNode,h},ys.flushSync=function(h){return gu(h)},ys.hydrate=function(h,f,w){if(!Rg(f))throw Error(Zt(200));return Lg(null,h,f,!0,w)},ys.hydrateRoot=function(h,f,w){if(!Gx(h))throw Error(Zt(405));var A=w!=null&&w.hydratedSources||null,L=!1,F="",X=lS;if(w!=null&&(w.unstable_strictMode===!0&&(L=!0),w.identifierPrefix!==void 0&&(F=w.identifierPrefix),w.onRecoverableError!==void 0&&(X=w.onRecoverableError)),f=sS(f,null,h,1,w??null,L,!1,F,X),h[Sl]=f.current,nf(h),A)for(h=0;h<A.length;h++)w=A[h],L=w._getVersion,L=L(w._source),f.mutableSourceEagerHydrationData==null?f.mutableSourceEagerHydrationData=[w,L]:f.mutableSourceEagerHydrationData.push(w,L);return new Pg(f)},ys.render=function(h,f,w){if(!Rg(f))throw Error(Zt(200));return Lg(null,h,f,!1,w)},ys.unmountComponentAtNode=function(h){if(!Rg(h))throw Error(Zt(40));return h._reactRootContainer?(gu(function(){Lg(null,null,h,!1,function(){h._reactRootContainer=null,h[Sl]=null})}),!0):!1},ys.unstable_batchedUpdates=Dx,ys.unstable_renderSubtreeIntoContainer=function(h,f,w,A){if(!Rg(w))throw Error(Zt(200));if(h==null||h._reactInternals===void 0)throw Error(Zt(38));return Lg(h,f,w,!1,A)},ys.version="18.3.1-next-f1338f8080-20240426";function uS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uS)}catch(h){console.error(h)}}uS(),ob.exports=ys;var UP=ob.exports,hS,dS=UP;hS=dS.createRoot,dS.hydrateRoot;var pS={exports:{}};(function(h,f){(function(w,A){h.exports=A()}
40)(mC,function(){var w,A,L;function F(s,de){if(!w)w=de;else if(!A)A=de;else{var Ee="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 = {}; ("+w+")(sharedChunk); ("+A+")(sharedChunk); self.onerror = null;",tt={};w(tt),L=de(tt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(L.workerUrl=window.URL.createObjectURL(new Blob([Ee],{type:"text/javascript"})))}}F(["exports"],function(s){var de=1e-6,Ee=typeof Float32Array<"u"?Float32Array:Array;function tt(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=i*u-a*o;return d?(n[0]=u*(d=1/d),n[1]=-o*d,n[2]=-a*d,n[3]=i*d,n):null}function Ie(){var n=new Ee(9);return Ee!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function He(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=e[4],m=e[5],y=e[6],x=e[7],T=e[8];return n[0]=d*T-m*x,n[1]=a*x-o*T,n[2]=o*m-a*d,n[3]=m*y-u*T,n[4]=i*T-a*y,n[5]=a*u-i*m,n[6]=u*x-d*y,n[7]=o*y-i*x,n[8]=i*d-o*u,n}function vt(n,e,i){var o=e[0],a=e[1],u=e[2],d=e[3],m=e[4],y=e[5],x=e[6],T=e[7],S=e[8],I=i[0],M=i[1],P=i[2],k=i[3],V=i[4],N=i[5],$=i[6],q=i[7],Y=i[8];return n[0]=I*o+M*d+P*x,n[1]=I*a+M*m+P*T,n[2]=I*u+M*y+P*S,n[3]=k*o+V*d+N*x,n[4]=k*a+V*m+N*T,n[5]=k*u+V*y+N*S,n[6]=$*o+q*d+Y*x,n[7]=$*a+q*m+Y*T,n[8]=$*u+q*y+Y*S,n}function mt(){var n=new Ee(16);return Ee!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n}function at(n){var e=new Ee(16);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e}function Ft(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Ve(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=e[4],m=e[5],y=e[6],x=e[7],T=e[8],S=e[9],I=e[10],M=e[11],P=e[12],k=e[13],V=e[14],N=e[15],$=i*m-o*d,q=i*y-a*d,Y=i*x-u*d,re=o*y-a*m,ee=o*x-u*m,ae=a*x-u*y,he=T*k-S*P,me=T*V-I*P,De=T*N-M
vendor: 6,939 bytes, line 40
40*P,xe=S*V-I*k,Be=S*N-M*k,Ge=I*N-M*V,$e=$*Ge-q*Be+Y*xe+re*De-ee*me+ae*he;return $e?(n[0]=(m*Ge-y*Be+x*xe)*($e=1/$e),n[1]=(a*Be-o*Ge-u*xe)*$e,n[2]=(k*ae-V*ee+N*re)*$e,n[3]=(I*ee-S*ae-M*re)*$e,n[4]=(y*De-d*Ge-x*me)*$e,n[5]=(i*Ge-a*De+u*me)*$e,n[6]=(V*Y-P*ae-N*q)*$e,n[7]=(T*ae-I*Y+M*q)*$e,n[8]=(d*Be-m*De+x*he)*$e,n[9]=(o*De-i*Be-u*he)*$e,n[10]=(P*ee-k*Y+N*$)*$e,n[11]=(S*Y-T*ee-M*$)*$e,n[12]=(m*me-d*xe-y*he)*$e,n[13]=(i*xe-o*me+a*he)*$e,n[14]=(k*q-P*re-V*$)*$e,n[15]=(T*re-S*q+I*$)*$e,n):null}function Se(n,e,i){var o=e[0],a=e[1],u=e[2],d=e[3],m=e[4],y=e[5],x=e[6],T=e[7],S=e[8],I=e[9],M=e[10],P=e[11],k=e[12],V=e[13],N=e[14],$=e[15],q=i[0],Y=i[1],re=i[2],ee=i[3];return n[0]=q*o+Y*m+re*S+ee*k,n[1]=q*a+Y*y+re*I+ee*V,n[2]=q*u+Y*x+re*M+ee*N,n[3]=q*d+Y*T+re*P+ee*$,n[4]=(q=i[4])*o+(Y=i[5])*m+(re=i[6])*S+(ee=i[7])*k,n[5]=q*a+Y*y+re*I+ee*V,n[6]=q*u+Y*x+re*M+ee*N,n[7]=q*d+Y*T+re*P+ee*$,n[8]=(q=i[8])*o+(Y=i[9])*m+(re=i[10])*S+(ee=i[11])*k,n[9]=q*a+Y*y+re*I+ee*V,n[10]=q*u+Y*x+re*M+ee*N,n[11]=q*d+Y*T+re*P+ee*$,n[12]=(q=i[12])*o+(Y=i[13])*m+(re=i[14])*S+(ee=i[15])*k,n[13]=q*a+Y*y+re*I+ee*V,n[14]=q*u+Y*x+re*M+ee*N,n[15]=q*d+Y*T+re*P+ee*$,n}function Ce(n,e,i){var o,a,u,d,m,y,x,T,S,I,M,P,k=i[0],V=i[1],N=i[2];return e===n?(n[12]=e[0]*k+e[4]*V+e[8]*N+e[12],n[13]=e[1]*k+e[5]*V+e[9]*N+e[13],n[14]=e[2]*k+e[6]*V+e[10]*N+e[14],n[15]=e[3]*k+e[7]*V+e[11]*N+e[15]):(a=e[1],u=e[2],d=e[3],m=e[4],y=e[5],x=e[6],T=e[7],S=e[8],I=e[9],M=e[10],P=e[11],n[0]=o=e[0],n[1]=a,n[2]=u,n[3]=d,n[4]=m,n[5]=y,n[6]=x,n[7]=T,n[8]=S,n[9]=I,n[10]=M,n[11]=P,n[12]=o*k+m*V+S*N+e[12],n[13]=a*k+y*V+I*N+e[13],n[14]=u*k+x*V+M*N+e[14],n[15]=d*k+T*V+P*N+e[15]),n}function dt(n,e,i){var o=i[0],a=i[1],u=i[2];return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*o,n[4]=e[4]*a,n[5]=e[5]*a,n[6]=e[6]*a,n[7]=e[7]*a,n[8]=e[8]*u,n[9]=e[9]*u,n[10]=e[10]*u,n[11]=e[11]*u,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function Vt(n,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[4],d=e[5],m=e[6],y=e[7],x=e[8],T=e[9],S=e[10],I=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=u*a+x*o,n[5]=d*a+T*o,n[6]=m*a+S*o,n[7]=y*a+I*o,n[8]=x*a-u*o,n[9]=T*a-d*o,n[10]=S*a-m*o,n[11]=I*a-y*o,n}function jt(n,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[0],d=e[1],m=e[2],y=e[3],x=e[8],T=e[9],S=e[10],I=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=u*a-x*o,n[1]=d*a-T*o,n[2]=m*a-S*o,n[3]=y*a-I*o,n[8]=u*o+x*a,n[9]=d*o+T*a,n[10]=m*o+S*a,n[11]=y*o+I*a,n}function qt(n,e,i){var o=Math.sin(i),a=Math.cos(i),u=e[0],d=e[1],m=e[2],y=e[3],x=e[4],T=e[5],S=e[6],I=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=u*a+x*o,n[1]=d*a+T*o,n[2]=m*a+S*o,n[3]=y*a+I*o,n[4]=x*a-u*o,n[5]=T*a-d*o,n[6]=S*a-m*o,n[7]=I*a-y*o,n}function si(n,e){return n[0]=e[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function ji(n,e,i){var o,a,u,d=i[0],m=i[1],y=i[2],x=Math.sqrt(d*d+m*m+y*y);return x<de?null:(d*=x=1/x,m*=x,y*=x,o=Math.sin(e),a=Math.cos(e),n[0]=d*d*(u=1-a)+a,n[1]=m*d*u+y*o,n[2]=y*d*u-m*o,n[3]=0,n[4]=d*m*u-y*o,n[5]=m*m*u+a,n[6]=y*m*u+d*o,n[7]=0,n[8]=d*y*u+m*o,n[9]=m*y*u-d*o,n[10]=y*y*u+a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n)}function Ui(n,e){var i=e[0],o=e[1],a=e[2],u=e[4],d=e[5],m=e[6],y=e[8],x=e[9],T=e[10];return n[0]=Math.sqrt(i*i+o*o+a*a),n[1]=Math.sqrt(u*u+d*d+m*m),n[2]=Math.sqrt(y*y+x*x+T*T),n}function ar(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=i+i,m=o+o,y=a+a,x=i*d,T=o*d,S=o*m,I=a*d,M=a*m,P=a*y,k=u*d,V=u*m,N=u*y;return n[0]=1-S-P,n[1]=T+N,n[2]=I-V,n[3]=0,n[4]=T-N,n[5]=1-x-P,n[6]=M+k,n[7]=0,n[8]=I+V,n[9]=M-k,n[10]=1-x-S,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}var fr=Se;function Ii(){var n=new Ee(3);return Ee!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Cr(n){var e=new Ee(3);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e}function Hn(n){var e=n[0],i=n[1],o=n[2];return Math.sqrt(e*e+i*i+o*o)}function ri(n,e,i){var o=new Ee(3);return o[0]=n,o[1]=e,o[2]=i,o}function Ei(n,e,i,o){return n[0]=e,n[1]=i,n[2]=o,n}function Gt(n,e,i){return n[0]=e[0]+i[0],n[1]=e[1]+i[1],n[2]=e[2]+i[2],n}function Ti(n,e,i){return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],n}function Ct(n,e,i){return n[0]=e[0]*i[0],n[1]=e[1]*i[1],n[2]=e[2]*i[2],n}function qe(n,e,i){return n[0]=Math.min(e[0],i[0]),n[1]=Math.min(e[1],i[1]),n[2]=Math.min(e[2],i[2]),n}function ti(n,e,i){return n[0]=Math.max(e[0],i[0]),n[1]=Math.max(e[1],i[1]),n[2]=Math.max(e[2],i[2]),n}function ai(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n}function Si(n,e,i,o){return n[0]=e[0]+i[0]*o,n[1]=e[1]+i[1]*o,n[2]=e[2]+i[2]*o,n}function Sn(n,e){var i=e[0]-n[0],o=e[1]-n[1],a=e[2]-n[2];return Math.sqrt(i*i+o*o+a*a)}function Kn(n,e){var i=e[0]-n[0],o=e[1]-n[1],a=e[2]-n[2];return i*i+o*o+a*a}function br(n){var e=n[0],i=n[1],o=n[2];return e*e+i*i+o*o}function Or(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function un(n,e){var i=e[0],o=e[1],a=e[2],u=i*i+o*o+a*a;return u>0&&(u=1/Math.sqrt(u)),n[0]=e[0]*u,n[1]=e[1]*u,n[2]=e[2]*u,n}function vn(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function nr(n,e,i){var o=e[0],a=e[1],u=e[2],d=i[0],m=i[1],y=i[2];return n[0]=a*y-u*m,n[1]=u*d-o*y,n[2]=o*m-a*d,n}function oo(n,e,i,o){var a=e[0],u=e[1],d=e[2];return n[0]=a+o*(i[0]-a),n[1]=u+o*(i[1]-u),n[2]=d+o*(i[2]-d),n}function qn(n,e,i){var o=e[0],a=e[1],u=e[2],d=i[3]*o+i[7]*a+i[11]*u+i[15];return n[0]=(i[0]*o+i[4]*a+i[8]*u+i[12])/(d=d||1),n[1]=(i[1]*o+i[5]*a+i[9]*u+i[13])/d,n[2]=(i[2]*o+i[6]*a+i[10]*u+i[14])/d,n}function Jn(n,e,i){var o=e[0],a=e[1],u=e[2];return n[0]=o*i[0]+a*i[3]+u*i[6],n[1]=o*i[1]+a*i[4]+u*i[7],n[2]=o*i[2]+a*i[5]+u*i[8],n}function Ss(n,e,i){var o=i[0],a=i[1],u=i[2],d=i[3],m=e[0],y=e[1],x=e[2],T=a*x-u*y,S=u*m-o*x,I=o*y-a*m;return n[0]=m+d*(T+=T)+a*(I+=I)-u*(S+=S),n[1]=y+d*S+u*T-o*I,n[2]=x+d*I+o*S-a*T,n}function so(n){return n[0]=0,n[1]=0,n[2]=0,n}function jr(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]}var rr=Ti,wu=Ct,Go=Hn;function xa(){var n=new Ee(4);return Ee!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function $s(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=e[3]*i,n}function Hs(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=i*i+o*o+a*a+u*u;return d>0&&(d=1/Math.sqrt(d)),n[0]=i*d,n[1]=o*d,n[2]=a*d,n[3]=u*d,n}function Ur(n,e,i){var o=e[0],a=e[1],u=e[2],d=e[3];return n[0]=i[0]*o+i[4]*a+i[8]*u+i[12]*d,n[1]=i[1]*o+i[5]*a+i[9]*u+i[13]*d,n[2]=i[2]*o+i[6]*a+i[10]*u+i[14]*d,n[3]=i[3]*o+i[7]*a+i[11]*u+i[15]*d,n}function Es(){var n=new Ee(4);return Ee!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function Qa(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function $o(n,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],d=e[3],m=Math.sin(i),y=Math.cos(i);return n[0]=o*y+d*m,n[1]=a*y+u*m,n[2]=u*y-a*m,n[3]=d*y-o*m,n}function Is(n,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],d=e[3],m=Math.sin(i),y=Math.cos(i);return n[0]=o*y-u*m,n[1]=a*y+d*m,n[2]=u*y+o*m,n[3]=d*y-a*m,n}
vendor: 3,974 bytes, line 40
40Ii(),xa();var Yr,wa,qs,ba=Hs,Zs=(Yr=Ii(),wa=ri(1,0,0),qs=ri(0,1,0),function(n,e,i){var o=vn(e,i);return o<-.999999?(nr(Yr,wa,e),Go(Yr)<1e-6&&nr(Yr,qs,e),un(Yr,Yr),function(a,u,d){d*=.5;var m=Math.sin(d);a[0]=m*u[0],a[1]=m*u[1],a[2]=m*u[2],a[3]=Math.cos(d)}(n,Yr,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(nr(Yr,e,i),n[0]=Yr[0],n[1]=Yr[1],n[2]=Yr[2],n[3]=1+o,ba(n,n))});function Qn(){var n=new Ee(2);return Ee!=Float32Array&&(n[0]=0,n[1]=0),n}function Gr(n,e){var i=new Ee(2);return i[0]=n,i[1]=e,i}function Ws(n,e,i){return n[0]=e,n[1]=i,n}function Xs(n,e,i){return n[0]=e[0]+i[0],n[1]=e[1]+i[1],n}function ss(n,e,i){return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n}function Do(n,e,i){return n[0]=e[0]*i,n[1]=e[1]*i,n}function Ho(n){var e=n[0],i=n[1];return Math.sqrt(e*e+i*i)}function Ll(n,e){var i=e[0],o=e[1],a=i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),n[0]=e[0]*a,n[1]=e[1]*a,n}function Wt(n,e){return n[0]*e[0]+n[1]*e[1]}Es(),Es(),Ie();var Dt,Pi,In=ss;function Tr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}Qn();var ko=function(){if(Pi)return Dt;function n(e,i,o,a){this.cx=3*e,this.bx=3*(o-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=o,this.p2y=a}return Pi=1,Dt=n,n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var o=e,a=0;a<8;a++){var u=this.sampleCurveX(o)-e;if(Math.abs(u)<i)return o;var d=this.sampleCurveDerivativeX(o);if(Math.abs(d)<1e-6)break;o-=u/d}var m=0,y=1;for(o=e,a=0;a<20&&(u=this.sampleCurveX(o),!(Math.abs(u-e)<i));a++)e>u?m=o:y=o,o=.5*(y-m)+m;return o},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Dt}(),Ic=Tr(ko);function Ke(n,e){this.x=n,this.y=e}function Ta(n,e){if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(!Ta(n[i],e[i]))return!1;return!0}if(typeof n=="object"&&n!==null&&e!==null){if(typeof e!="object"||Object.keys(n).length!==Object.keys(e).length)return!1;for(const i in n)if(!Ta(n[i],e[i]))return!1;return!0}return n===e}Ke.prototype={clone(){return new Ke(this.x,this.y)},add(n){return this.clone()._add(n)},sub(n){return this.clone()._sub(n)},multByPoint(n){return this.clone()._multByPoint(n)},divByPoint(n){return this.clone()._divByPoint(n)},mult(n){return this.clone()._mult(n)},div(n){return this.clone()._div(n)},rotate(n){return this.clone()._rotate(n)},rotateAround(n,e){return this.clone()._rotateAround(n,e)},matMult(n){return this.clone()._matMult(n)},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(n){return this.x===n.x&&this.y===n.y},dist(n){return Math.sqrt(this.distSqr(n))},distSqr(n){const e=n.x-this.x,i=n.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(n){return Math.atan2(this.y-n.y,this.x-n.x)},angleWith(n){return this.angleWithSep(n.x,n.y)},angleWithSep(n,e){return Math.atan2(this.x*e-this.y*n,this.x*n+this.y*e)},_matMult(n){const e=n[2]*this.x+n[3]*this.y;return this.x=n[0]*this.x+n[1]*this.y,this.y=e,this},_add(n){return this.x+=n.x,this.y+=n.y,this},_sub(n){return this.x-=n.x,this.y-=n.y,this},_mult(n){return this.x*=n,this.y*=n,this},_div(n){return this.x/=n,this.y/=n,this},_multByPoint(n){return this.x*=n.x,this.y*=n.y,this},_divByPoint(n){return this.x/=n.x,this.y/=n.y,this},_unit(){return this._div(this.mag()),this},_perp(){const n=this.y;return this.y=this.x,this.x=-n,this},_rotate(n){const e=Math.cos(n),i=Math.sin(n),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this},_rotateAround(n,e){const i=Math.cos(n),o=Math.sin(n),a=e.y+o*(this.x-e.x)+i*(this.y-e.y);
40return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ke},Ke.convert=function(n){if(n instanceof Ke)return n;if(Array.isArray(n))return new Ke(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new Ke(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};const Tf=Math.PI/180,zl=180/Math.PI;function qi(n){return n*Tf}function ao(n){return n*zl}const Sf=[[0,0],[1,0],[1,1],[0,1]];function Dl(n){if(n<=0)return 0;if(n>=1)return 1;const e=n*n,i=e*n;return 4*(n<.5?i:3*(n-e)+i-.75)}function bu(n,e,i,o){const a=new Ic(n,e,i,o);return function(u){return a.solve(u)}}const Te=bu(.25,.1,.25,1);function j(n,e,i){return Math.min(i,Math.max(e,n))}function H(n,e,i){return(i=j((i-n)/(e-n),0,1))*i*(3-2*i)}function J(n,e,i){const o=i-e,a=((n-e)%o+o)%o+e;return a===e?i:a}function pe(n,e,i){if(!n.length)return i(null,[]);let o=n.length;const a=new Array(n.length);let u=null;n.forEach((d,m)=>{e(d,(y,x)=>{y&&(u=y),a[m]=x,--o==0&&i(u,a)})})}let ue=1;function ye(){return ue++}function Re(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log2(n)))}function we(n,e){n.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Pe(n,e,i){const o={};for(const a in n)o[a]=e.call(this,n[a],a,n);return o}function it(n,e,i){const o={};for(const a in n)e.call(this,n[a],a,n)&&(o[a]=n[a]);return o}function Ue(n){return Array.isArray(n)?n.map(Ue):typeof n=="object"&&n?Pe(n,Ue):n}function It(n,e){for(let i=0;i<n.length;i++)if(e.indexOf(n[i])>=0)return!0;return!1}const $t={};function Tt(n){$t[n]||(typeof console<"u"&&console.warn(n),$t[n]=!0)}function mi(n,e,i){return(i.y-n.y)*(e.x-n.x)>(e.y-n.y)*(i.x-n.x)}function pi(n){let e=0;for(let i,o,a=0,u=n.length,d=u-1;a<u;d=a++)i=n[a],o=n[d],e+=(o.x-i.x)*(i.y+o.y);return e}function hi([n,e,i]){const o=qi(e+90),a=qi(i);return{x:n*Math.cos(o)*Math.sin(a),y:n*Math.sin(o)*Math.sin(a),z:n*Math.cos(a),azimuthal:e,polar:i}}function Fi(n){return(typeof self<"u"||n!==void 0)&&typeof WorkerGlobalScope<"u"&&(n!==void 0?n:self)instanceof WorkerGlobalScope}function jn(n){const e={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,o,a,u)=>{const d=a||u;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let lr=null;function Zn(n,e){return[n[4*e],n[4*e+1],n[4*e+2],n[4*e+3]]}function dr(n,e,i,o){for(;e<i;){const a=e+i>>1;n[a]<o?e=a+1:i=a}return e}function Fn(n,e,i,o){for(;e<i;){const a=e+i>>1;n[a]<=o?e=a+1:i=a}return e}function Gi(n){return n>0?1/(1.001-n):1+n}function Bn(n){return n>0?1-1/(1.001-n):-n}function gn(n,e,i){return(n-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Ri={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Ri.API_URL)return null;try{const n=new URL(Ri.API_URL);return n.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":n.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MES
40HOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Wn(n){return Ri.API_URL_REGEX.test(n)}function qr(n){return Ri.API_SPRITE_REGEX.test(n)}let Kr,To,kl,Fr,qo,lo;function Ys(){return Kr==null&&(Kr=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Kr}const Mr={now:()=>Fr!==void 0?Fr:performance.now(),setNow(n){Fr=n},restoreNow(){Fr=void 0},frame(n){const e=requestAnimationFrame(n);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(n,e=0){const{width:i,height:o}=n;qo||(qo=document.createElement("canvas"));const a=qo.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>qo.width||o>qo.height)&&(qo.width=i,qo.height=o),a.clearRect(-e,-e,i+2*e,o+2*e),a.drawImage(n,0,0,i,o),a.getImageData(-e,-e,i+2*e,o+2*e)},resolveURL:n=>(To||(To=document.createElement("a")),To.href=n,To.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(kl==null&&(kl=window.matchMedia("(prefers-reduced-motion: reduce)")),kl.matches)},hasCanvasFingerprintNoise(){if(lo!==void 0)return lo;if(!Ys())return lo=!1,!1;const n=new OffscreenCanvas(85,1),e=n.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<n.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const o=e.getImageData(0,0,n.width,n.height);i=0;for(let a=0;a<o.data.length;++a)if(a%4!=3&&i++!==o.data[a])return lo=!0,!0;return lo=!1,!1}};function Ol(n,e){const i=n.indexOf("?");if(i<0)return`${n}?${new URLSearchParams(e).toString()}`;const o=new URLSearchParams(n.slice(i));for(const a in e)o.set(a,e[a]);return`${n.slice(0,i)}?${o.toString()}`}
40function Ac(n,e={persistentParams:[]}){const i=n.indexOf("?");if(i<0)return n;const o=new URLSearchParams,a=new URLSearchParams(n.slice(i));for(const d of e.persistentParams){const m=a.get(d);m&&o.set(d,m)}const u=o.toString();return`${n.slice(0,i)}${u.length>0?`?${u}`:""}`}const qh="mapbox-tiles";let Zh=500,Wh=50;const Tu=["language","worldview","jobid"];let Ks,So;function As(){try{return caches}catch{}}function Cs(){const n=As();n&&Ks==null&&(Ks=n.open(qh))}let as=1/0;const Js={supported:!1,testSupport:function(n){!Xh&&Fl&&(Bl?kg(n):el=n)}};let el,Fl,Xh=!1,Bl=!1;const Yh=typeof self<"u"?self:{};function kg(n){const e=n.createTexture();n.bindTexture(n.TEXTURE_2D,e);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,Fl),n.isContextLost())return;Js.supported=!0}catch{}n.deleteTexture(e),Xh=!0}Yh.document&&(Fl=Yh.document.createElement("img"),Fl.onload=function(){el&&kg(el),el=null,Bl=!0},Fl.onerror=function(){Xh=!0,el=null},Fl.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Su={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Su);class Oo extends Error{constructor(e,i,o){i===401&&Wn(o)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=o}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Kh=Fi()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Nl=function(n,e){if(!(/^file:/.test(i=n.url)||/^file:/.test(Kh())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(o,a){const u=new AbortController,d=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,referrer:Kh(),referrerPolicy:o.referrerPolicy,signal:u.signal});let m=!1,y=!1;const x=(T=d.url).indexOf("sku=")>0&&Wn(T);var T;o.type==="json"&&d.headers.set("Accept","application/json");const S=(M,P,k)=>{if(y)return;if(M&&M.message!=="SecurityError"&&Tt(M.toString()),P&&k)return I(P);const V=Date.now();fetch(d).then(N=>{if(N.ok){const $=x?N.clone():null;return I(N,$,V)}return a(new Oo(N.statusText,N.status,o.url))}).catch(N=>{N.name!=="AbortError"&&a(new Error(`${N.message} ${o.url}`))})},I=(M,P,k)=>{(o.type==="arrayBuffer"?M.arrayBuffer():o.type==="json"?M.json():M.text()).then(V=>{y||(P&&k&&function(N,$,q){if(Cs(),Ks==null)return;const Y=jn($.headers.get("Cache-Control")||"");if(Y["no-store"])return;const re={status:$.status,statusText:$.statusText,headers:new Headers};$.headers.forEach((he,me)=>re.headers.set(me,he)),Y["max-age"]&&re.headers.set("Expires",new Date(q+1e3*Y["max-age"]).toUTCString());const ee=re.headers.get("Expires");if(!ee||new Date(ee).getTime()-q<42e4)return;
40let ae=Ac(N.url,{persistentParams:Tu});if($.status===206){const he=N.headers.get("Range");if(!he)return;re.status=200,ae=Ol(ae,{range:he})}(function(he,me){if(So===void 0)try{new Response(new ReadableStream),So=!0}catch{So=!1}So?me(he.body):he.blob().then(me).catch(De=>Tt(De.message))})($,he=>{const me=new Response((De=$.status)!==200&&De!==404&&[101,103,204,205,304].includes(De)?null:he,re);var De;Cs(),Ks!=null&&Ks.then(xe=>xe.put(ae,me)).catch(xe=>Tt(xe.message))})}(d,P,k),m=!0,a(null,V,M.headers))}).catch(V=>{y||a(new Error(V.message))})};return x?function(M,P){if(Cs(),Ks==null)return P(null);Ks.then(k=>{let V=Ac(M.url,{persistentParams:Tu});const N=M.headers.get("Range");N&&(V=Ol(V,{range:N})),k.match(V).then($=>{const q=function(Y){if(!Y)return!1;const re=new Date(Y.headers.get("Expires")||0),ee=jn(Y.headers.get("Cache-Control")||"");return Number(re)>Date.now()&&!ee["no-cache"]}($);k.delete(V).catch(P),q&&k.put(V,$.clone()).catch(P),P(null,$,q)}).catch(P)}).catch(P)}(d,S):S(null,null),{cancel:()=>{y=!0,m||u.abort()}}}(n,e);if(Fi(self)&&self.worker.actor)return self.worker.actor.send("getResource",n,e,void 0,!0)}var i;return function(o,a){const u=new XMLHttpRequest;u.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const d in o.headers)u.setRequestHeader(d,o.headers[d]);return o.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=o.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(o.type==="json")try{d=JSON.parse(u.response)}catch(y){return a(y)}const m=new Headers;u.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(y=>{const x=y.split(": "),T=x.shift(),S=x.join(": ");m.append(T,S)}),a(null,d,m)}else a(new Oo(u.statusText,u.status,o.url))},u.send(o.body),{cancel:()=>u.abort()}}(n,e)},Sa=function(n,e){return Nl(Object.assign(n,{type:"arrayBuffer"}),e)};function Hx(n){const e=document.createElement("a");return e.href=n,e.protocol===location.protocol&&e.host===location.host}const Og="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Eu,$i;Eu=[],$i=0;const Jh=function(n,e){if(Js.supported&&(n.headers||(n.headers={}),n.headers.accept="image/webp,*/*"),$i>=Ri.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:n,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Eu.push(u),u}$i++;let i=!1;const o=()=>{if(!i)for(i=!0,$i--;Eu.length&&$i<Ri.MAX_PARALLEL_IMAGE_REQUESTS;){const u=Eu.shift(),{requestParameters:d,callback:m,cancelled:y}=u;y||(u.cancel=Jh(d,m).cancel)}},a=Sa(n,(u,d,m)=>{o(),u?e(u):d&&(self.createImageBitmap?function(y,x){const T=new Blob([new Uint8Array(y)],{type:"image/png"});createImageBitmap(T).then(S=>{x(null,S)}).catch(S=>{x(new Error(`Could not load image because of ${S.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(d,(y,x)=>e(y,x,m)):function(y,x){const T=new Image;T.onload=()=>{x(null,T),URL.revokeObjectURL(T.src),T.onload=null,requestAnimationFrame(()=>{T.src=Og})},T.onerror=()=>x(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const S=new Blob([new Uint8Array(y)],{type:"image/png"});T.src=y.byteLength?URL.createObjectURL(S):Og}(d,(y,x)=>e(y,x,m)))});return{cancel:()=>{a.cancel(),o()}}};var Ef,Fg,Bg,tl={exports:{}},Iu={exports:{}},Au={exports:{}},If=function(){if(Bg)return tl.exports;Bg=1;var n=(Ef||(Ef=1,Iu.exports=function(i,o){var a,u,d,m,y,x,T,S;for(u=i.length-(a=3&i.length),d=o,y=3432918353,x=461845907,S=0;S<u;)T=255&i.charCodeAt(S)|(255&i.charCodeAt(++S))<<8|(255&i.charCodeAt(++S))<<16|(255&i.charCodeAt(++S))<<24,++S,d=27492+(65535&(m=5*(65535&(d=(d^=T=(65535&(T=(T=(65535&T)*y+(((T>>>16)*y&65535)<<16)&4294967295)<<15|T>>>17))*x+(((T>>>16)*x&65535)<<16)&4294967295)<<13|d>>>19))+((5*(d>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);
40switch(T=0,a){case 3:T^=(255&i.charCodeAt(S+2))<<16;case 2:T^=(255&i.charCodeAt(S+1))<<8;case 1:d^=T=(65535&(T=(T=(65535&(T^=255&i.charCodeAt(S)))*y+(((T>>>16)*y&65535)<<16)&4294967295)<<15|T>>>17))*x+(((T>>>16)*x&65535)<<16)&4294967295}return d^=i.length,d=2246822507*(65535&(d^=d>>>16))+((2246822507*(d>>>16)&65535)<<16)&4294967295,d=3266489909*(65535&(d^=d>>>13))+((3266489909*(d>>>16)&65535)<<16)&4294967295,(d^=d>>>16)>>>0}),Iu.exports),e=(Fg||(Fg=1,Au.exports=function(i,o){for(var a,u=i.length,d=o^u,m=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(a>>>16)&65535)<<16),d=1540483477*(65535&d)+((1540483477*(d>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++m;switch(u){case 3:d^=(255&i.charCodeAt(m+2))<<16;case 2:d^=(255&i.charCodeAt(m+1))<<8;case 1:d=1540483477*(65535&(d^=255&i.charCodeAt(m)))+((1540483477*(d>>>16)&65535)<<16)}return d=1540483477*(65535&(d^=d>>>13))+((1540483477*(d>>>16)&65535)<<16),(d^=d>>>15)>>>0}),Au.exports);return tl.exports=n,tl.exports.murmur3=n,tl.exports.murmur2=e,tl.exports}(),Qh=Tr(If);class Qs{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class Cu extends Qs{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function Af(n,e,i){i[n]&&i[n].indexOf(e)!==-1||(i[n]=i[n]||[],i[n].push(e))}function il(n,e,i){if(i&&i[n]){const o=i[n].indexOf(e);o!==-1&&i[n].splice(o,1)}}class Vl{on(e,i){return this._listeners=this._listeners||{},Af(e,i,this._listeners),this}off(e,i){return il(e,i,this._listeners),il(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Af(e,i,this._oneTimeListeners),this):new Promise(o=>{this.once(e,o)})}fire(e,i){const o=typeof e=="string"?new Qs(e,i):e,a=o.type;if(this.listens(a)){o.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const y of u)y.call(this,o);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const y of d)il(a,y,this._oneTimeListeners),y.call(this,o);const m=this._eventedParent;if(m){const y=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(o,y),m.fire(o)}}else o instanceof Cu&&console.error(o.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class co{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new co(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,o]=e.split("�");return new co({name:i,iconsetId:o})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return co.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var ed,Mu={},ls=function(){if(ed)return Mu;ed=1;var n={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 e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}function o(u){return(d=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:d>1?1:d;var d}function a(u,d,m){return m<0?m+=1:m>1&&(m-=1),6*m<1?u+(d-u)*m*6:2*m<1?d:3*m<2?u+(d-u)*(2/3-m)*6:u}try{Mu.parseCSSColor=function(u){var d,m=u.replace(/ /g,"").toLowerCase();if(m in n)return n[m].slice();if(m[0]==="#")return m.length===4?(d=parseInt(m.substr(1),16))>=0&&d<=4095?[(3840&d)>>4|(3840&d)>>8,240&d|(240&d)>>4,15&d|(15&d)<<4,1]:null:m.length===7&&(d=parseInt(m.substr(1),16))>=0&&d<=16777215?[(16711680&d)>>16,(65280&d)>>8,255&d,1]:null;var y=m.indexOf("("),x=m.indexOf(")");if(y!==-1&&x+1===m.length){var T=m.substr(0,y),S=m.substr(y+1,x-(y+1)).split(","),I=1;switch(T){case"rgba":if(S.length!==4)return null;I=o(S.pop());case"rgb":return S.length!==3?null:[i(S[0]),i(S[1]),i(S[2]),I];case"hsla":if(S.length!==4)return null;I=o(S.pop());case"hsl":if(S.length!==3)return null;var M=(parseFloat(S[0])%360+360)%360/360,P=o(S[1]),k=o(S[2]),V=k<=.5?k*(P+1):k+P-k*P,N=2*k-V;return[e(255*a(N,V,M+1/3)),e(255*a(N,V,M)),e(255*a(N,V,M-1/3)),I];default:return null}}return null}}catch{}return Mu}();class rn{constructor(e,i,o,a=1){this.r=e,this.g=i,this.b=o,this.a=a}static parse(e){if(!e)return;if(e instanceof rn)return e;if(typeof e!="string")return;const i=ls.parseCSSColor(e);return i?new rn(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,o,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*o)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:u}=this;return new Vg(e,i,o,a,u)}toPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:u}=this;return new jg(e,i*u,o*u,a*u,u)}clone(){return new rn(this.r,this.g,this.b,this.a)}}class Ng{constructor(e,i,o,a,u,d=!1){if(this.premultiplied=!1,this.premultiplied=d,e){const m=e.image.height,y=m*m;this.premultiplied?(i=u===0?0:i/u*(m-1),o=u===0?0:o/u*(m-1),a=u===0?0:a/u*(m-1)):(i*=m-1,o*=m-1,a*=m-1);const x=Math.floor(i),T=Math.floor(o),S=Math.floor(a),I=Math.ceil(i),M=Math.ceil(o),P=Math.ceil(a),k=i-x,V=o-T,N=a-S,$=e.image.data,q=4*(x+T*y+S*m),Y=4*(x+T*y+P*m),re=4*(x+M*y+S*m),ee=4*(x+M*y+P*m),ae=4*(I+T*y+S*m),he=4*(I+T*y+P*m),me=4*(I+M*y+S*m),De=4*(I+M*y+P*m);if(q<0||De>=$.length)throw new Error("out of range");this.r=Qt(Qt(Qt($[q],$[Y],N),Qt($[re],$[ee],N),V),Qt(Qt($[ae],$[he],N),Qt($[me],$[De],N),V),k)/255*(this.premultiplied?u:1),this.g=Qt(Qt(Qt($[q+1],$[Y+1],N),Qt($[re+1],$[ee+1],N),V),Qt(Qt($[ae+1
40],$[he+1],N),Qt($[me+1],$[De+1],N),V),k)/255*(this.premultiplied?u:1),this.b=Qt(Qt(Qt($[q+2],$[Y+2],N),Qt($[re+2],$[ee+2],N),V),Qt(Qt($[ae+2],$[he+2],N),Qt($[me+2],$[De+2],N),V),k)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=o,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:o,a}=this;return[255*e,255*i,255*o,a]}toHslaArray(){let{r:e,g:i,b:o,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];const P=1/a;e*=P,i*=P,o*=P}const u=Math.min(Math.max(e,0),1),d=Math.min(Math.max(i,0),1),m=Math.min(Math.max(o,0),1),y=Math.min(u,d,m),x=Math.max(u,d,m),T=x-y,S=.5*(y+x);if(T===0)return[0,0,100*S,a];const I=S>.5?T/(2-x-y):T/(x+y);let M;switch(x){case u:M=60*((d-m)/T+(d<m?6:0));break;case d:M=60*((m-u)/T+2);break;default:M=60*((u-d)/T+4)}return[M,100*I,100*S,a]}toArray01(){const{r:e,g:i,b:o,a}=this;return[e,i,o,a]}toArray01Scaled(e){const{r:i,g:o,b:a}=this;return[i*e,o*e,a*e]}toArray01Linear(){const{r:e,g:i,b:o,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(o,2.2),a]}}class Vg extends Ng{constructor(e,i,o,a,u){super(e,i,o,a,u,!1)}}class jg extends Ng{constructor(e,i,o,a,u){super(e,i,o,a,u,!0)}}function Qt(n,e,i){return n*(1-i)+e*i}function Cf(n,e,i){return n.map((o,a)=>Qt(o,e[a],i))}rn.black=new rn(0,0,0,1),rn.white=new rn(1,1,1,1),rn.transparent=new rn(0,0,0,0),rn.red=new rn(1,0,0,1),rn.blue=new rn(0,0,1,1);var Pu=Object.freeze({__proto__:null,array:Cf,color:function(n,e,i){return new rn(Qt(n.r,e.r,i),Qt(n.g,e.g,i),Qt(n.b,e.b,i),Qt(n.a,e.a,i))},number:Qt});class cs extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Cc{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[o,a]of i)this.bindings[o]=a}concat(e){return new Cc(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Ms={kind:"null"},Nt={kind:"number"},Oi={kind:"string"},ln={kind:"boolean"},Eo={kind:"color"},ea={kind:"object"},nn={kind:"value"},td={kind:"collator"},Ru={kind:"formatted"},Lu={kind:"resolvedImage"};function Jr(n,e){return{kind:"array",itemType:n,N:e}}function cr(n){if(n.kind==="array"){const e=cr(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}return n.kind}const qx=[Ms,Nt,Oi,ln,Eo,Ru,ea,Jr(nn),Lu];function nl(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!nl(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const i of qx)if(!nl(i,e))return null}}return`Expected ${cr(n)} but found ${cr(e)} instead.`}function Mf(n,e){return e.some(i=>i.kind===n.kind)}function zu(n,e){return e.some(i=>i==="null"?n===null:i==="array"?Array.isArray(n):i==="object"?n&&!Array.isArray(n)&&typeof n=="object":i===typeof n)}function id(n,e){return n.kind==="array"&&e.kind==="array"?n.N===e.N&&id(n.itemType,e.itemType):n.kind===e.kind}class Pf{constructor(e,i,o){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class nd{constructor(e,i,o,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=o,this.fontStack=a,this.textColor=u}}class po{constructor(e){this.sections=e}static fromString(e){return new po([new nd(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof po?e:po.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const o={};i.fontStack&&(o["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(o["font-scale"]=i.scale),i.textColor&&(o["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(o)}return e}}class Ea{constructor(e,i={}){this.id=co.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,o,a,u;try{({id:i,params:o,sx:a,sy:u}=JSON.parse(e)||{})}catch{return null}return i?new Ea(i,{params:o,sx:a,sy:u}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class fo{constructor(e,i,o,a,u=!1){this.primaryId=co.from(e),this.primaryOptions=i,o&&(this.secondaryId=co.from(o)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Ea(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ea(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?fo.build({name:e}):e}static build(e,i,o,a){return!e||typeof e=="object"&&!("name"in e)?null:new fo(e,o,i,a)}}function jl(n,e,i,o){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[n,e,i,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[n,e,i,o]:[n,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Mc(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof rn||n instanceof Pf||n instanceof po||n instanceof fo)return!0;
40if(Array.isArray(n)){for(const e of n)if(!Mc(e))return!1;return!0}if(typeof n=="object"){for(const e in n)if(!Mc(n[e]))return!1;return!0}return!1}function Pr(n){if(n===null)return Ms;if(typeof n=="string")return Oi;if(typeof n=="boolean")return ln;if(typeof n=="number")return Nt;if(n instanceof rn)return Eo;if(n instanceof Pf)return td;if(n instanceof po)return Ru;if(n instanceof fo)return Lu;if(Array.isArray(n)){const e=n.length;let i;for(const o of n){const a=Pr(o);if(i){if(i===a)continue;i=nn;break}i=a}return Jr(i||nn,e)}return ea}function us(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof po||n instanceof fo||n instanceof rn?n.toString():JSON.stringify(n)}class Ia{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Mc(e[1]))return i.error("invalid value");const o=e[1];let a=Pr(o);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new Ia(a,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof rn?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof po?this.value.serialize():this.value}}class Sr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Rf={string:Oi,number:Nt,boolean:ln,object:ea};class Ps{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let o,a=1;const u=e[0];if(u==="array"){let m,y;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Rf)||x==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);m=Rf[x],a++}else m=nn;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);y=e[2],a++}o=Jr(m,y)}else o=Rf[u];const d=[];for(;a<e.length;a++){const m=i.parse(e[a],a,nn);if(!m)return null;d.push(m)}return new Ps(o,d)}evaluate(e){for(let i=0;i<this.args.length;i++){const o=this.args[i].evaluate(e);if(!nl(this.type,Pr(o)))return o;if(i===this.args.length-1)throw new Sr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${cr(Pr(o))} but was expected to be of type ${cr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const o=e.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){i.push(o.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(o=>o.serialize()))}}class ta{constructor(e){this.type=Ru,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let d=1;d<=e.length-1;++d){const m=e[d];if(u&&typeof m=="object"&&!Array.isArray(m)){u=!1;let y=null;if(m["font-scale"]&&(y=i.parseObjectValue(m["font-scale"],d,"font-scale",Nt),!y))return null;let x=null;if(m["text-font"]&&(x=i.parseObjectValue(m["text-font"],d,"text-font",Jr(Oi)),!x))return null;let T=null;if(m["text-color"]&&(T=i.parseObjectValue(m["text-color"],d,"text-color",Eo),!T))return null;const S=a[a.length-1];S.scale=y,S.font=x,S.textColor=T}else{const y=i.parse(e[d],d,nn);if(!y)return null;const x=y.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:y,scale:null,font:null,textColor:null})}}return new ta(a)}evaluate(e){return new po(this.sections.map(i=>{const o=i.content.evaluate(e);return id(Pr(o),Lu)?new nd("",o,null,null,null):new nd(us(o),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const o={};i.scale&&(o["font-scale"]=i.scale.serialize()),i.font&&(o["text-font"]=i.font.serialize()),i.textColor&&(o["text-color"]=i.textColor.serialize()),e.push(o)}return e}}class fi{constructor(e,i,o,a){this._imageWarnHistory={},this.type=Lu,this.namePrimary=e,this.nameSecondary=i,o&&(this.paramsPrimary=o.params,this.iconsetIdPrimary=o.iconset?o.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let o=1;const a=[];function u(){if(o<e.length){const m=i.parse(e[o],o++,Oi);return m?(a.push({image:m,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function d(){if(o<e.length){const y=e[o];if((m=y)===null||typeof m!="object"||Array.isArray(m))return!0;const x=y.params,T=y.iconset,S=i.concat(o);if(!x&&!T)return o++,!0;if(x){if(typeof x!="object"||x.constructor!==Object)return S.error('Image options "params" should be an object'),!1;const I={},M=S.concat(void 0,"params");for(const P in x){if(!P)return M.error("Image parameter name should be non-empty"),!1;const k=M.concat(void 0,P).parse(x[P],void 0,Eo,void 0,{typeAnnotation:"coerce"});if(!k)return!1;I[P]=k}a[a.length-1].options.params=I}if(T){if(typeof T!="object"||T.constructor!==Object)return S.error('Image options "iconset" should be an object'),!1;if(!T.id)return S.error('Image options "iconset" should have an "i
40d" property'),!1;a[a.length-1].options.iconset=T}return o++,!0}var m;return!0}for(let m=0;m<2;m++)if(!u()||!d())return;return new fi(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const o={};if(i){for(const a in i)if(i[a])try{o[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(o).length!==0)return{params:o}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},o=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=fo.build(i,o,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(d=>co.isEqual(d,u)),a.available){const d=a.getSecondary()?a.getSecondary().id:null;d&&(a.available=e.availableImages.some(m=>co.isEqual(m,d)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const o={};if(i&&(o.iconset={id:i}),e){o.params={};for(const a in e)e[a]&&(o.params[a]=e[a].serialize())}return Object.keys(o).length>0?o:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function kt(n){return ii(n)?"string":Pc(n)?"number":od(n)?"boolean":Array.isArray(n)?"array":n===null?"null":rd(n)?"object":typeof n}function rd(n){return n!=null&&!Array.isArray(n)&&typeof n!="function"&&!(n instanceof String||n instanceof Number||n instanceof Boolean)&&typeof n=="object"}function ii(n){return typeof n=="string"||n instanceof String}function Pc(n){return typeof n=="number"||n instanceof Number}function od(n){return typeof n=="boolean"||n instanceof Boolean}const ei={"to-boolean":ln,"to-color":Eo,"to-number":Nt,"to-string":Oi};class ia{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[0],a=[];let u=Ms;if(o==="to-array"){if(!Array.isArray(e[1]))return null;const d=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=Jr(i.expectedType.itemType,d)}else{if(!(d>0&&Mc(e[1][0])))return null;u=Jr(Pr(e[1][0]),d)}for(let m=0;m<d;m++){const y=e[1][m];let x;if(Array.isArray(y))x=i.parse(y,void 0,u.itemType);else{const T=kt(y);if(T!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${T}.`);x=i.registry.literal.parse(["literal",y===void 0?null:y],i)}if(!x)return null;a.push(x)}}else{if((o==="to-boolean"||o==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=ei[o];for(let d=1;d<e.length;d++){const m=i.parse(e[d],d,nn);if(!m)return null;a.push(m)}}return new ia(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,o;for(const a of this.args){if(i=a.evaluate(e),o=null,i instanceof rn)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(o=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:jl(i[0],i[1],i[2],i[3]),!o))return new rn(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Sr(o||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const o of this.args){if(i=o.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new Sr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?po.fromString(us(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?fo.build(us(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):us(this.args[0].evaluate(e))}
40eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ta([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fi(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Lf=["Unknown","Point","LineString","Polygon"];class sd{constructor(e,i,o){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=o}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Lf[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:o,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=rn.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class mo{constructor(e,i,o,a,u){this.name=e,this.type=i,this._evaluate=o,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=mo.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const o=e[0],a=mo.definitions[o];if(!a)return i.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,d=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,m=[];let y=null,x=-1;for(const[T,S]of d){if(Array.isArray(T)&&T.length!==e.length-1)continue;m.push(T),x++,y=new yd(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const I=[];let M=!1;for(let P=1;P<e.length;P++){const k=e[P],V=Array.isArray(T)?T[P-1]:T.type,N=y.parse(k,1+I.length,V);if(!N){M=!0;break}I.push(N)}if(!M)if(Array.isArray(T)&&T.length!==I.length)y.error(`Expected ${T.length} arguments, but found ${I.length} instead.`);else{for(let P=0;P<I.length;P++){const k=Array.isArray(T)?T[P]:T.type,V=I[P];y.concat(P+1).checkSubtype(k,V.type)}if(y.errors.length===0)return new mo(o,u,S,I,x)}}if(m.length===1)i.errors.push(...y.errors);else{const T=(m.length?m:d.map(([I])=>I)).map(ad).join(" | "),S=[];for(let I=1;I<e.length;I++){const M=i.parse(e[I],1+S.length);if(!M)return null;S.push(cr(M.type))}i.error(`Expected arguments of type ${T}, but found (${S.join(", ")}) instead.`)}return null}static register(e,i){mo.definitions=i;for(const o in i)e[o]=mo}}function ad(n){return Array.isArray(n)?`(${n.map(cr).join(", ")})`:`(${cr(n.type)}...)`}class Br{constructor(e,i,o){this.type=td,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return i.error("Collator options argument must be an object.");const a=o["case-sensitive"]===void 0?i.parse(!1,1,ln):i.parseObjectValue(o["case-sensitive"],1,"case-sensitive",ln);if(!a)return null;const u=o["diacritic-sensitive"]===void 0?i.parse(!1,1,ln):i.parseObjectValue(o["diacritic-sensitive"],1,"diacritic-sensitive",ln);if(!u)return null;let d=null;return o.locale&&(d=i.parseObjectValue(o.locale,1,"locale",Oi),!d)?null:new Br(a,u,d)}evaluate(e){return new Pf(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function ld(n,e,i=0,o=n.length-1,a=zf){for(;o>i;){if(o-i>600){const y=o-i+1,x=e-i+1,T=Math.log(y),S=.5*Math.exp(2*T/3),I=.5*Math.sqrt(T*S*(y-S)/y)*(x-y/2<0?-1:1);ld(n,e,Math.max(i,Math.floor(e-x*S/y+I)),Math.min(o,Math.floor(e+(y-x)*S/y+I)),a)}const u=n[e];let d=i,m=o;for(Rs(n,i,e),a(n[o],u)>0&&Rs(n,i,o);d<m;){for(Rs(n,d,m),d++,m--;a(n[d],u)<0;)d++;for(;a(n[m],u)>0;)m--}a(n[i],u)===0?Rs(n,i,m):(m++,Rs(n,m,o)),m<=e&&(i=m+1),e<=m&&(o=m-1)}}function Rs(n,e,i){const o=n[e];n[e]=n[i],n[i]=o}function zf(n,e){return n<e?-1:n>e?1:0}function rl(n){let e=0;for(let i,o,a=0,u=n.length,d=u-1;a<u;d=a++)i=n[a],o=n[d],e+=(o.x-i.x)*(i.y+o.y);return e}function hs(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Du(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function Zx(n,e,i){const o=n[0]-e[0],a=n[1]-e[1],u=n[0]-i[0],d=n[1]-i[1];return o*d-u*a==0&&o*u<=0&&a*d<=0}function Rc(n,e,i=!1){let o=!1;for(let m=0,y=e.length;m<y;m++){const x=e[m];for(let T=0,S=x.length,I=S-1;T<S;I=T++){const M=x[I],P=x[T];if(Zx(n,M,P))return i;(u=M)[1]>(a=n)[1]!=(d=P)[1]>a[1]&&a[0]<(d[0]-u[0])*(a[1]-u[1])/(d[1]-u[1])+u[0]&&(o=!o)}}var a,u,d;return o}function ku(n,e,i,o){const a=o[0]-i[0],u=o[1]-i[1],d=(n[0]-i[0])*u-a*(n[1]-i[1]),m=(e[0]-i[0])*u-a*(e[1]-i[1]);return d>0&&m<0||d<0&&m>0}function Ou(n,e,i,o){return(a=[o[0]-i[0],o[1]-i[1]])[0]*(u=[e[0]-n[0],e[1]-n[1]])[1]-a[1]*u[0]!=0&&!(!ku(n,e,i,o)||!ku(i,o,n,e));var a,u}function Aa(n){const e=new Ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const o of n[0])e.x>o.x&&(e.x=o.x),e.y>o.y&&(e.y=o.y),i.x<o.x&&(i.x=o.x),i.y<o.y&&(i.y=o.y);return{min:e,max:i}}const ol=8192;function Wx(n,e){const i=(180+n[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*ol),Math.round(o*a*ol)]}function Df(n,e){for(let i=0;i<e.length;i++)if(Rc(n,e[i]))return!0;return!1}function Xx(n,e,i){for(const o of i)for(let a=0,u=o.length,d=u-1;a<u;d=a++)if(Ou(n,e,o[d],o[a]))return!0;return!1}function Ug(n,e){for(let i=0;i<n.length;++i)if(!Rc(n[i],e))return!1;for(let i=0;i<n.length-1;++i)if(Xx(n[i],n[i+1],e))return!1;return!0}function Gg(n,e){for(let i=0;i<e.length;i++)if(Ug(n,e[i]))return!0;return!1}function kf(n,e,i){const o=[];for(let a=0;a<n.length;a++){const u=[];for(let d=0;d<n[a].length;d++){const m=Wx(n[a][d],i);hs(e,m),u.push(m)}o.push(u)}return o}function sl(n,e,i){const o=[];for(let a=0;a<n.length;a++){const u=kf(n[a],e,i);o.push(u)}return o}function $g(n,e,i,o){if(n[0]<i[0]||n[0]>i[2]){const a=.5*o;let u=n[0]-i[0]>a?-o:i[0]-n[0]>a?o:0;u===0&&(u=n[0]-i[2]>a?-o:i[2]-n[0]>a?o:0),n[0]+=u}hs(e,n)}function Hg(n,e,i,o){const a=Math.pow(2,o.z)*ol,u=[o.x*ol,o.y*ol],d=[];if(!n)return d;for(const m of n)for(const y of m){const x=[y.x+u[0],y.y+u[1]];$g(x,e,i,a),d.push(x)}return d}function cd(n,e,i,o){const a=Math.pow(2,o.z)*ol,u=[o.x*ol,o.y*ol],d=[];if(!n)return d;for(const y of n){const x=[];for(const T of y){const S=[T.x+u[0],T.y+u[1]];hs(e,S),x.push(S)}d.push(x)}if(e[2]-e[0]<=a/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of d)for(const x of y)$g(x,e,i,a)}var m;return d}class al{constructor(e,i){this.type=ln,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Mc(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let a=0;a<o.features.length;++a){const u=o.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new al(o,o.features[a].geometry)}else if(o.type==="Feature"){const a=o.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new al(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new al(o,o)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,o){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=i.canonicalID();if(!d)return!1;if(o.type==="Polygon"){const m=kf(o.coordinates,u,d),y=Hg(i.geometry(),a,u,d);if(!Du(a,u))return!1;for(const x of y)if(!Rc(x,m))return!1}if(o.type==="MultiPolygon"){const m=sl(o.coordinates,u,d),y=Hg(i.geometry(),a,u,d);if(!Du(a,u))return!1;for(const x of y)if(!Df(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,o){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],d=i.canonicalID();if(!d)return!1;if(o.type==="Polygon"){const m=kf(o.coordinates,u,d),y=cd(i.geometry(),a,u,d);if(!Du(a,u))return!1;for(const x of y)if(!Ug(x,m))return!1}if(o.type==="MultiPolygon"){const m=sl(o.coordinates,u,d),y=cd(i.geometry(),a,u,d);if(!Du(a,u))return!1;for(const x of y)if(!Gg(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Fu={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},ds=1/298.257223563,qg=ds*(2-ds),Lc=Math.PI/180;class zc{static fromTile(e,i,o){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/Lc;return new zc(u,o)}static get units(){return Fu}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Fu[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Fu).join(", ")}`);const o=6378.137*Lc*(i?Fu[i]:1),a=Math.cos(e*Lc),u=1/(1-qg*(1-a*a)),d=Math.sqrt(u);this.kx=o*d*a,this.ky=o*d*u*(1-qg)}distance(e,i){const o=Zo(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(o*o+a*a)}bearing(e,i){const o=Zo(i[0]-e[0])*this.kx;return Math.atan2(o,(i[1]-e[1])*this.ky)/Lc}destination(e,i,o){const a=o*Lc;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,o){return[e[0]+i/this.kx,e[1]+o/this.ky]}lineDistance(e){let i=0;for(let o=0;o<e.length-1;o++)i+=this.distance(e[o],e[o+1]);return i}area(e){let i=0;for(let o=0;o<e.length;o++){const a=e[o];for(let u=0,d=a.length,m=d-1;u<d;m=u++)i+=Zo(a[u][0]-a[m][0])*(a[u][1]+a[m][1])*(o?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let o=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],d=e[a+1],m=this.distance(u,d);if(o+=m,o>i)return ud(u,d,(i-(o-m))/m)}return e[e.length-1]}pointToSegmentDistance(e,i,o){let[a,u]=i,d=Zo(o[0]-a)*this.kx,m=(o[1]-u)*this.ky;if(d!==0||m!==0){const y=(Zo(e[0]-a)*this.kx*d+(e[1]-u)*this.ky*m)/(d*d+m*m);y>1?(a=o[0],u=o[1]):y>0&&(a+=d/this.kx*y,u+=m/this.ky*y)}return d=Zo(e[0]-a)*this.kx,m=(e[1]-u)*this.ky,Math.sqrt(d*d+m*m)}pointOnLine(e,i){let o=1/0,a=e[0][0],u=e[0][1],d=0,m=0;for(let y=0;y<e.length-1;y++){let x=e[y][0],T=e[y][1],S=Zo(e[y+1][0]-x)*this.kx,I=(e[y+1][1]-T)*this.ky,M=0;S===0&&I===0||(M=(Zo(i[0]-x)*this.kx*S+(i[1]-T)*this.ky*I)/(S*S+I*I),M>1?(x=e[y+1][0],T=e[y+1][1]):M>0&&(x+=S/this.kx*M,T+=I/this.ky*M)),S=Zo(i[0]-x)*this.kx,I=(i[1]-T)*this.ky;const P=S*S+I*I;P<o&&(o=P,a=x,u=T,d=y,m=M)}return{point:[a,u],index:d,t:Math.max(0,Math.min(1,m))}}lineSlice(e,i,o){let a=this.pointOnLine(o,e),u=this.pointOnLine(o,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const x=a;a=u,u=x}const d=[a.point],m=a.index+1,y=u.index;!Of(o[m],d[0])&&m<=y&&d.push(o[m]);for(let x=m+1;x<=y;x++)d.push(o[x]);return Of(o[y],u.point)||d.push(u.point),d}lineSliceAlong(e,i,o){let a=0;const u=[];for(let d=0;d<o.length-1;d++){const m=o[d],y=o[d+1],x=this.distance(m,y);if(a+=x,a>e&&u.length===0&&u.push(ud(m,y,(e-(a-x))/x)),a>=i)return u.push(ud(m,y,(i-(a-x))/x)),u;a>e&&u.push(y)}return u}bufferPoint(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[0]+a,e[1]+o]}bufferBBox(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[2]+a,e[3]+o]}insideBBox(e,i){return Zo(e[0]-i[0])>=0&&Zo(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Of(n,e){return n[0]===e[0]&&n[1]===e[1]}function ud(n,e,i){const o=Zo(e[0]-n[0]);return[n[0]+o*i,n[1]+(e[1]-n[1])*i]}function Zo(n){for(;n<-180;)n+=360;for(;n>180;)n-=360;return n}class hd{constructor(e=[],i=(o,a)=>o<a?-1:o>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:o}=this,a=i[e];for(;e>0;){const u=e-1>>1,d=i[u];if(o(a,d)>=0)break;i[e]=d,e=u}i[e]=a}_down(e){const{data:i,compare:o}=this,a=this.length>>1,u=i[e];for(;e<a;){let d=1+(e<<1);const m=d+1;if(m<this.length&&o(i[m],i[d])<0&&(d=m),o(i[d],u)>=0)break;i[e]=i[d],e=d}i[e]=u}}var ht=8192;function Ff(n,e){return e.dist-n.dist}const dd=100,pd=50;function Bf(n){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}function Bu(n){return n[1]-n[0]+1}function na(n,e){const i=n[1]>=n[0]&&n[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function Nf(n,e){if(n[0]>
40n[1])return[null,null];const i=Bu(n);if(e){if(i===2)return[n,null];const o=Math.floor(i/2);return[[n[0],n[0]+o],[n[0]+o,n[1]]]}{if(i===1)return[n,null];const o=Math.floor(i/2)-1;return[[n[0],n[0]+o],[n[0]+o+1,n[1]]]}}function Ul(n,e){const i=[1/0,1/0,-1/0,-1/0];if(!na(e,n.length))return i;for(let o=e[0];o<=e[1];++o)hs(i,n[o]);return i}function Gl(n){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<n.length;++i)for(let o=0;o<n[i].length;++o)hs(e,n[i][o]);return e}function ll(n,e,i){if(Bf(n)||Bf(e))return NaN;let o=0,a=0;return n[2]<e[0]&&(o=e[0]-n[2]),n[0]>e[2]&&(o=n[0]-e[2]),n[1]>e[3]&&(a=n[1]-e[3]),n[3]<e[1]&&(a=e[1]-n[3]),i.distance([0,0],[o,a])}function fd(n){return 360*n-180}function Zg(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function md(n,e){const i=Math.pow(2,e.z),o=(n.y/ht+e.y)/i;return[fd((n.x/ht+e.x)/i),Zg(o)]}function Yx(n,e){const i=[];for(let o=0;o<n.length;++o)i.push(md(n[o],e));return i}function Wg(n,e,i){const o=i.pointOnLine(e,n).point;return i.distance(n,o)}function Vf(n,e,i,o,a){const u=i.slice(o[0],o[1]+1);let d=1/0;for(let m=e[0];m<=e[1];++m)if((d=Math.min(d,Wg(n[m],u,a)))===0)return 0;return d}function cl(n,e,i,o,a){const u=Math.min(a.pointToSegmentDistance(n,i,o),a.pointToSegmentDistance(e,i,o)),d=Math.min(a.pointToSegmentDistance(i,n,e),a.pointToSegmentDistance(o,n,e));return Math.min(u,d)}function Bi(n,e,i,o,a){if(!na(e,n.length)||!na(o,i.length))return NaN;let u=1/0;for(let d=e[0];d<e[1];++d)for(let m=o[0];m<o[1];++m){if(Ou(n[d],n[d+1],i[m],i[m+1]))return 0;u=Math.min(u,cl(n[d],n[d+1],i[m],i[m+1],a))}return u}function Kx(n,e,i,o,a){if(!na(e,n.length)||!na(o,i.length))return NaN;let u=1/0;for(let d=e[0];d<=e[1];++d)for(let m=o[0];m<=o[1];++m)if((u=Math.min(u,a.distance(n[d],i[m])))===0)return u;return u}function Jx(n,e,i){if(Rc(n,e,!0))return 0;let o=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(o=Math.min(o,i.pointToSegmentDistance(n,a[u-1],a[0])))===0||(o=Math.min(o,Wg(n,a,i)))===0)return o}return o}function Qx(n,e,i,o){if(!na(e,n.length))return NaN;for(let u=e[0];u<=e[1];++u)if(Rc(n[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const d of i)for(let m=0,y=d.length,x=y-1;m<y;x=m++){if(Ou(n[u],n[u+1],d[x],d[m]))return 0;a=Math.min(a,cl(n[u],n[u+1],d[x],d[m],o))}return a}function jf(n,e){for(const i of n)for(let o=0;o<=i.length-1;++o)if(Rc(i[o],e,!0))return!0;return!1}function e1(n,e,i,o=1/0){const a=Gl(n),u=Gl(e);if(o!==1/0&&ll(a,u,i)>=o)return o;if(Du(a,u)){if(jf(n,e))return 0}else if(jf(e,n))return 0;let d=o;for(const m of n)for(let y=0,x=m.length,T=x-1;y<x;T=y++)for(const S of e)for(let I=0,M=S.length,P=M-1;I<M;P=I++){if(Ou(m[T],m[y],S[P],S[I]))return 0;d=Math.min(d,cl(m[T],m[y],S[P],S[I],i))}return d}function Rn(n,e,i,o,a,u,d){if(u===null||d===null)return;const m=ll(Ul(o,u),Ul(a,d),i);m<e&&n.push({dist:m,range1:u,range2:d})}function t1(n,e,i,o,a=1/0){let u=Math.min(o.distance(n[0],i[0][0]),a);if(u===0)return u;const d=new hd([{dist:0,range1:[0,n.length-1],range2:[0,0]}],Ff),m=e?pd:dd,y=Gl(i);for(;d.length;){const x=d.pop();if(x.dist>=u)continue;const T=x.range1;if(Bu(T)<=m){if(!na(T,n.length))return NaN;if(e){const S=Qx(n,T,i,o);if((u=Math.min(u,S))===0)return u}else for(let S=T[0];S<=T[1];++S){const I=Jx(n[S],i,o);if((u=Math.min(u,I))===0)return u}}else{const S=Nf(T,e);if(S[0]!==null){const I=ll(Ul(n,S[0]),y,o);I<u&&d.push({dist:I,range1:S[0],range2:[0,0]})}if(S[1]!==null){const I=ll(Ul(n,S[1]),y,o);I<u&&d.push({dist:I,range1:S[1],range2:[0,0]})}}}return u}function Xg(n,e,i,o,a,u=1/0){let d=Math.min(u,a.distance(n[0],i[0]));if(d===0)return d;const m=new hd([{dist:0,range1:[0,n.length-1],range2:[0,i.length-1]}],Ff),y=e?pd:dd,x=o?pd:dd;for(;m.length;){const T=m.pop();if(T.dist>=d)continue;const S=T.range1,I=T.range2;if(Bu(S)<=y&&Bu(I)<=x){if(!na(S,n.length)||!na(I,i.length))return NaN;if(e&&o?d=Math.min(d,Bi(n,S,i,I,a)):e||o?e&&!o?d=Math.min(d,Vf(i,I,n,S,a)):!e&&o&&(d=Math.min(d,Vf(n,S,i,I,a))):d=Math.min(d,Kx(n,S,i,I,a)),d===0)return d}else{const M=Nf(S,e),P=Nf(I,o);Rn(m,d,a,n,i,M[0],P[0]),Rn(m,d,a,n,i,M[0],P[1]),Rn(m,d,a,n,i,M[1],P[0]),Rn(m,d,a,n,i,M[1],P[1])}}return d}function Uf(n,e,i,o,a=1/0){let u=a;const d=Ul(n,[0,n.length-1]);for(const m of i)if(!(u!==1/0&&ll(d,Ul(m,[0,m.length-1]),o)>=u)&&(u=Math.min(u,Xg(n,e,m,!0,o,u)),u===0))return u;return u}function _d(n,e,i,o,a=1/0){let u=a;const d=Ul(n,[0,n.length-1]);for(const m of i){if(u!==1/0&&ll(d,Gl(m),o)>=u)continue;const y=t1(n,e,m,o,u);if(isNaN(y))return y;if((u=Math.min(u,y))===0)return u}return u}function Gf(n){return n==="Point"||n==="MultiPoint"||n==="LineString"||n==="MultiLineString"||n==="Polygon"||n==="MultiPolygon"}class $l{constructor(e,i){this.type=Nt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Mc(e[1])){const o=e[1];if(o.type==="FeatureCollection"){for(let a=0;a<o.features.length;++a)if(Gf(o.features[a].geometry.type))return new $l(o,o.features[a].geometry)}else if(o.type==="Feature"){if(Gf(o.geometry.type))return new $l(o,o.geometry)}else if(Gf(o.type))return new $l(o,o)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),o=e.canonicalID();if(i!=null&&o!=null){if(e.geometryType()==="Point")return function(a,u,d){const m=[];for(const x of a)for(const T of x)m.push(md(T,u));const y=new zc(m[0][1],"meters");return d.type==="Point"||d.type==="MultiPoint"||d.type==="LineString"?Xg(m,!1,d.type==="Point"?[d.coordinates]:d.coordinates,d.type==="LineString",y):d.type==="MultiLineString"?Uf(m,!1,d.coordinates,y):d.type==="Polygon"||d.type==="MultiPolygon"?_d(m,!1,d.type==="Polygon"?[d.coordinates]:d.coordinates,y):null}(i,o,this.geometries);if(e.geometryType()==="LineString")return function(a,u,d){const m=[];for(const x of a){const T=[];for(const S of x)T.push(md(S,u));m.push(T)}const y=new zc(m[0][0][1],"meters");if(d.type==="Point"||d.type==="MultiPoint"||d.type==="LineString")return Uf(d.type==="Point"?[d.coordinates]:d.coordinates,d.type==="LineString",m,y);if(d.type==="MultiLineString"){let x=1/0;for(let T=0;T<d.coordinates.length;T++){const S=Uf(d.coordinates[T],!0,m,y,x);if(isNaN(S))return S;if((x=Math.min(x,S))===0)return x}return x}if(d.type==="Polygon"||d.type==="MultiPolygon"){let x=1/0;for(let T=0;T<m.length;T++){const S=_d(m[T],!0,d.type==="Polygon"?[d.coordinates]:d.coordinates,y,x);if(isNaN(S))return S;if((x=Math.min(x,S))===0)return x}return x}return null}(i,o,this.geometries);if(e.geometryType()==="Polygon")return function(a,u,d){const m=[];for(const x of function(T,S){const I=T.length;if(I<=1)return[T];const M=[];let P,k;for(let V=0;V<I;V++){const N=rl(T[V]);N!==0&&(T[V].area=Math.abs(N),k===void 0&&(k=N<0),k===N<0?(P&&M.push(P),P=[T[V]]):P.push(T[V]))}return P&&M.push(P),M}(a)){const T=[];for(let S=0;S<x.length;++S)T.push(Yx(x[S],u));m.push(T)}const y=new zc(m[0][0][0][1],"meters");if(d.type==="Point"||d.type==="MultiPoint"||d.type==="LineString")return _d(d.type==="Point"?[d.coordinates]:d.coordinates,d.type==="LineString",m,y);if(d.type==="MultiLineString"){let x=1/0;for(let T=0;T<d.coordinates.length;T++){const S=_d(d.coordinates[T],!0,m,y,x);if(isNaN(S))return S;if((x=Math.min(x,S))===0)return x}return x}return d.type==="Polygon"||d.type==="MultiPolygon"?function(x,T,S){let I=1/0;for(const M of x)for(const P of T){const k=e1(M,P,S,I);if(isNaN(k))return k;if((I=Math.min(I,k))===0)return I}return I}(d.type==="Polygon"?[d.coordinates]:d.coordinates,m,y):null}(i,o,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Dc(n){if(n instanceof mo&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof al||n instanceof $l)return!1;if(n instanceof Oc)return n.featureConstant;let e=!0;return n.eachChild(i=>{e&&!Dc(i)&&(e=!1)}),e}function Nu(n){if(n instanceof mo&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(i=>{e&&!Nu(i)&&(e=!1)}),e}function kc(n,e){if(n instanceof mo&&e.indexOf(n.name)>=0)return!1;let i=!0;return n.eachChild(o=>{i&&!kc(o,e)&&(i=!1)}),i}
40function Yg(n,e,i){return[n,e,i].filter(Boolean).join("�")}function $f(n,e){switch(n){case"string":return us(e);case"number":return+e;case"boolean":return!!e;case"color":return rn.parse(e);case"formatted":return po.fromString(us(e));case"resolvedImage":return fo.build(us(e))}return e}function Kg(n,e,i,o){return o!==void 0&&(n=o*Math.round(n/o)),e!==void 0&&n<e&&(n=e),i!==void 0&&n>i&&(n=i),n}class Oc{constructor(e,i,o,a=!1){this.type=e,this.key=i,this.scope=o,this.featureConstant=a}static parse(e,i){let o=i.expectedType;if(o==null&&(o=nn),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof Ia))return i.error("Key name of 'config' expression must be a string literal.");let u,d=!0;const m=us(a.value);if(e.length>=3){const y=i.parse(e[2],2);if(!(y instanceof Ia))return i.error("Scope of 'config' expression must be a string literal.");u=us(y.value)}if(i.options){const y=Yg(m,u,i._scope),x=i.options.get(y);x&&(d=Dc(x.value||x.default))}return new Oc(o,m,u,d)}evaluate(e){const i=Yg(this.key,this.scope,e.scope),o=e.getConfig(i);if(!o)return null;const{type:a,value:u,values:d,minValue:m,maxValue:y,stepValue:x}=o,T=o.default.evaluate(e);let S=T;if(u){const I=e.scope;e.scope=(I||"").split("�").slice(1).join("�"),S=u.evaluate(e),e.scope=I}return a&&(S=$f(a,S)),S===void 0||m===void 0&&y===void 0&&x===void 0||(typeof S=="number"?S=Kg(S,m,y,x):Array.isArray(S)&&(S=S.map(I=>typeof I=="number"?Kg(I,m,y,x):I))),u!==void 0&&S!==void 0&&d&&!d.includes(S)&&(S=T,a&&(S=$f(a,S))),(a&&a!==this.type||S!==void 0&&!id(Pr(S),this.type))&&(S=$f(this.type.kind,S)),S}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class gd{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const o=e[1];return i.scope.has(o)?new gd(o,i.scope.get(o)):i.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class yd{constructor(e,i=[],o,a=new Cc,u=[],d,m,y){this.registry=e,this.path=i,this.key=i.map(x=>typeof x=="string"?`['${x}']`:`[${x}]`).join(""),this.scope=a,this.errors=u,this.expectedType=o,this._scope=d,this.options=m,this.iconImageUseTheme=y}parse(e,i,o,a,u={}){return i||o?this.concat(i,null,o,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,o,a,u,d={}){return this.concat(i,o,a,u)._parse(e,d)}_parse(e,i){function o(a,u,d){return d==="assert"?new Ps(u,[a]):d==="coerce"?new ia(u,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const d=this.expectedType,m=u.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||m.kind!=="value")if(d.kind!=="color"&&d.kind!=="formatted"&&d.kind!=="resolvedImage"||m.kind!=="value"&&m.kind!=="string"){if(this.checkSubtype(d,m))return null}else u=o(u,d,i.typeAnnotation||"coerce");else u=o(u,d,i.typeAnnotation||"assert")}if(!(u instanceof Ia)&&u.type.kind!=="resolvedImage"&&Hf(u)){const d=new sd(this._scope,this.options,this.iconImageUseTheme);try{u=new Ia(u.type,u.evaluate(d))}catch(m){return this.error(m.message),null}}return u}return ia.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,o,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const d=a?this.scope.concat(a):this.scope;return new yd(this.registry,u,o||null,d,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const o=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new cs(o,e))}checkSubtype(e,i){const o=nl(e,i);return o&&this.error(o),o}}function Hf(n){if(n instanceof gd)return Hf(n.boundExpression);if(n instanceof mo&&n.name==="error"||n instanceof Br||n instanceof al||n instanceof $l||n instanceof Oc)return!1;const e=n instanceof ia||n instanceof Ps;let i=!0;return n.eachChild(o=>{i=e?i&&Hf(o):i&&o instanceof Ia}),!!i&&Dc(n)&&kc(n,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function vd(n,e){const i=n.length-1;let o,a,u=0,d=i,m=0;for(;u<=d;)if(m=Math.floor((u+d)/2),o=n[m],a=n[m+1],o<=e){if(m===i||e<a)return m;u=m+1}else{if(!(o>e))throw new Sr("Input is not a number.");d=m-1}return 0}class Vu{constructor(e,i,o){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of o)this.labels.push(a),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const o=i.parse(e[1],1,Nt);if(!o)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let d=1;d<e.length;d+=2){const m=d===1?-1/0:e[d],y=e[d+1],x=d,T=d+1;if(typeof m!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
40omputed expressions) for the input values.',x);if(a.length&&a[a.length-1][0]>=m)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const S=i.parse(y,T,u);if(!S)return null;u=u||S.type,a.push([m,S])}return new Vu(u,o,a)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const u=i.length;return a>=i[u-1]?o[u-1].evaluate(e):o[vd(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Jg=.95047,Qg=1.08883,ey=4/29,Fc=6/29,ty=3*Fc*Fc,i1=Fc*Fc*Fc,n1=Math.PI/180,r1=180/Math.PI;function qf(n){return n>i1?Math.pow(n,1/3):n/ty+ey}function Zf(n){return n>Fc?n*n*n:ty*(n-ey)}function Wf(n){return 255*(n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055)}function Xf(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function iy(n){const e=Xf(n.r),i=Xf(n.g),o=Xf(n.b),a=qf((.4124564*e+.3575761*i+.1804375*o)/Jg),u=qf((.2126729*e+.7151522*i+.072175*o)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-qf((.0193339*e+.119192*i+.9503041*o)/Qg)),alpha:n.a}}function xd(n){let e=(n.l+16)/116,i=isNaN(n.a)?e:e+n.a/500,o=isNaN(n.b)?e:e-n.b/200;return e=1*Zf(e),i=Jg*Zf(i),o=Qg*Zf(o),new rn(Wf(3.2404542*i-1.5371385*e-.4985314*o),Wf(-.969266*i+1.8760108*e+.041556*o),Wf(.0556434*i-.2040259*e+1.0572252*o),n.alpha)}function wd(n,e,i){const o=e-n;return n+i*(o>180||o<-180?o-360*Math.round(o/360):o)}const Bc={forward:iy,reverse:xd,interpolate:function(n,e,i){return{l:Qt(n.l,e.l,i),a:Qt(n.a,e.a,i),b:Qt(n.b,e.b,i),alpha:Qt(n.alpha,e.alpha,i)}}},ju={forward:function(n){const{l:e,a:i,b:o}=iy(n),a=Math.atan2(o,i)*r1;return{h:a<0?a+360:a,c:Math.sqrt(i*i+o*o),l:e,alpha:n.a}},reverse:function(n){const e=n.h*n1,i=n.c;return xd({l:n.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:n.alpha})},interpolate:function(n,e,i){return{h:wd(n.h,e.h,i),c:Qt(n.c,e.c,i),l:Qt(n.l,e.l,i),alpha:Qt(n.alpha,e.alpha,i)}}};var ny=Object.freeze({__proto__:null,hcl:ju,lab:Bc});class Wo{constructor(e,i,o,a,u){this.type=e,this.operator=i,this.interpolation=o,this.input=a,this.labels=[],this.outputs=[];for(const[d,m]of u)this.labels.push(d),this.outputs.push(m)}static interpolationFactor(e,i,o,a){let u=0;if(e.name==="exponential")u=bd(i,e.base,o,a);else if(e.name==="linear")u=bd(i,1,o,a);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new Ic(d[0],d[1],d[2],d[3]).solve(bd(i,1,o,a))}return u}static parse(e,i){let[o,a,u,...d]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const x=a[1];if(typeof x!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:x}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const x=a.slice(1);if(x.length!==4||x.some(T=>typeof T!="number"||T<0||T>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,Nt),!u)return null;const m=[];let y=null;o==="interpolate-hcl"||o==="interpolate-lab"?y=Eo:i.expectedType&&i.expectedType.kind!=="value"&&(y=i.expectedType);for(let x=0;x<d.length;x+=2){const T=d[x],S=d[x+1],I=x+3,M=x+4;if(typeof T!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(m.length&&m[m.length-1][0]>=T)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',I);const P=i.parse(S,M,y);if(!P)return null;y=y||P.type,m.push([T,P])}return y.kind==="number"||y.kind==="color"||y.kind==="array"&&y.itemType.kind==="number"&&typeof y.N=="number"?new Wo(y,o,a,u,m):i.error(`Type ${cr(y)} is not interpolatable.`)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const u=i.length;if(a>=i[u-1])return o[u-1].evaluate(e);const d=vd(i,a),m=Wo.interpolationFactor(this.interpolation,a,i[d],i[d+1]),y=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Pu[this.type.kind.toLowerCase()](y,x,m):this.operator==="interpolate-hcl"?ju.reverse(ju.interpolate(ju.forward(y),ju.forward(x),m)):Bc.reverse(Bc.interpolate(Bc.forward(y),Bc.forward(x),m))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let o=0;o<this.labels.length;o++)i.push(this.labels[o],this.outputs[o].serialize());return i}}function bd(n,e,i,o){const a=o-i,u=n-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class Uu{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let o=null;const a=i.expectedType;a&&a.kind!=="value"&&(o=a);const u=[];for(const m of e.slice(1)){const y=i.parse(m,1+u.length,o,void 0,{typeAnnotation:"omit"});if(!y)return null;o=o||y.type,u.push(y)}const d=a&&u.some(m=>nl(a,m.type));return new Uu(d?nn:o,u)}evaluate(e){let i,o=null,a=0;for(const u of this.args){if(a++,o=u.evaluate(e),o&&o instanceof fo&&!o.available&&(i||(i=o),o=null,a===this.args.length))return i;if(o!==null)break}return o}
40eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Ca{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let u=1;u<e.length-1;u+=2){const d=e[u];if(typeof d!="string")return i.error(`Expected string, but found ${typeof d} instead.`,u);if(/[^a-zA-Z0-9_]/.test(d))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const m=i.parse(e[u+1],u+1);if(!m)return null;o.push([d,m])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,o);return a?new Ca(o,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,o]of this.bindings)e.push(i,o.serialize());return e.push(this.result.serialize()),e}}class Td{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,Nt),a=i.parse(e[2],2,Jr(i.expectedType||nn));return o&&a?new Td(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new Sr("Array index out of bounds: negative index");if(i>=o.length)throw new Sr("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new Sr("Array index must be an integer. Use at-interpolated for fractional indices");return o[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Sd{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,Nt),a=i.parse(e[2],2,Jr(i.expectedType||nn));return o&&a?new Sd(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new Sr(`Array index out of bounds: ${i} < 0.`);if(i>o.length-1)throw new Sr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i===Math.floor(i))return o[i];const a=Math.floor(i),u=Math.ceil(i),d=o[a],m=o[u];if(typeof d!="number"||typeof m!="number")throw new Sr(`Cannot interpolate between non-number values at index ${i}.`);const y=i-a;return d*(1-y)+m*y}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Yf{constructor(e,i){this.type=ln,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,nn),a=i.parse(e[2],2,nn);return o&&a?Mf(o.type,[ln,Oi,Nt,Ms,nn])?new Yf(o,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${cr(o.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(o==null)return!1;if(!zu(i,["boolean","string","number","null"]))throw new Sr(`Expected first argument to be of type boolean, string, number or null, but found ${cr(Pr(i))} instead.`);if(!zu(o,["string","array"]))throw new Sr(`Expected second argument to be of type array or string, but found ${cr(Pr(o))} instead.`);return o.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Nc{constructor(e,i,o){this.type=Nt,this.needle=e,this.haystack=i,this.fromIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,nn),a=i.parse(e[2],2,nn);if(!o||!a)return null;if(!Mf(o.type,[ln,Oi,Nt,Ms,nn]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${cr(o.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Nt);return u?new Nc(o,a,u):null}return new Nc(o,a)}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!zu(i,["boolean","string","number","null"]))throw new Sr(`Expected first argument to be of type boolean, string, number or null, but found ${cr(Pr(i))} instead.`);if(!zu(o,["string","array"]))throw new Sr(`Expected second argument to be of type array or string, but found ${cr(Pr(o))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return o.indexOf(i,a)}return o.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Gu{constructor(e,i,o,a,u,d){this.inputType=e,this.type=i,this.input=o,this.cases=a,this.outputs=u,this.otherwise=d}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let o,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},d=[];for(let x=2;x<e.length-1;x+=2){let T=e[x];const S=e[x+1];Array.isArray(T)||(T=[T]);const I=i.concat(x);if(T.length===0)return I.error("Expected at least one branch label.");for(const P of T){if(typeof P!="number"&&typeof P!="string")return I.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return I.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return I.error("Numeric branch labels must be integer values.");if(o){if(I.checkSubtype(o,Pr(P)))return null}else o=Pr(P);if(u[String(P)]!==void 0)return I.error("Branch labels must be unique.");u[String(P)]=d.length}const M=i.parse(S,x,a);if(!M)return null;a=a||M.type,d.push(M)}const m=i.parse(e[1],1,nn);if(!m)return null;const y=i.parse(e[e.length-1],e.length-1,a);return y?m.type.kind!=="value"&&i.concat(1).checkSubtype(o,m.type)?null:new Gu(o,a,m,u,d,y):null}evaluate(e){const i=this.input.evaluate(e);return(id(Pr(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
40eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),o=[],a={};for(const d of i){const m=a[this.cases[d]];m===void 0?(a[this.cases[d]]=o.length,o.push([this.cases[d],[d]])):o[m][1].push(d)}const u=d=>this.inputType.kind==="number"?Number(d):d;for(const[d,m]of o)e.push(m.length===1?u(m[0]):m.map(u)),e.push(this.outputs[d].serialize());return e.push(this.otherwise.serialize()),e}}class $u{constructor(e,i,o){this.type=e,this.branches=i,this.otherwise=o}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const a=[];for(let d=1;d<e.length-1;d+=2){const m=i.parse(e[d],d,ln);if(!m)return null;const y=i.parse(e[d+1],d+1,o);if(!y)return null;a.push([m,y]),o=o||y.type}const u=i.parse(e[e.length-1],e.length-1,o);return u?new $u(o,a,u):null}evaluate(e){for(const[i,o]of this.branches)if(i.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,o]of this.branches)e(i),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Ed{constructor(e,i,o,a){this.type=e,this.input=i,this.beginIndex=o,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,nn),a=i.parse(e[2],2,Nt);if(!o||!a)return null;if(!Mf(o.type,[Jr(nn),Oi,nn]))return i.error(`Expected first argument to be of type array or string, but found ${cr(o.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Nt);return u?new Ed(o.type,o,a,u):null}return new Ed(o.type,o,a)}evaluate(e){const i=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!zu(i,["string","array"]))throw new Sr(`Expected first argument to be of type array or string, but found ${cr(Pr(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(o,a)}return i.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Kf{constructor(e,i){this.type=Jr(Oi),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,Oi),a=i.parse(e[2],2,Oi);return o&&a?new Kf(o,a):void 0}evaluate(e){const i=this.str.evaluate(e),o=this.delimiter.evaluate(e);return i.split(o)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Jf(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Qf(n,e,i,o){return o.compare(e,i)===0}function Vc(n,e,i){const o=n!=="=="&&n!=="!=";return class fC{constructor(u,d,m){this.type=ln,this.lhs=u,this.rhs=d,this.collator=m,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const m=u[0];let y=d.parse(u[1],1,nn);if(!y)return null;if(!Jf(m,y.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${cr(y.type)}'.`);let x=d.parse(u[2],2,nn);if(!x)return null;if(!Jf(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${cr(x.type)}'.`);if(y.type.kind!==x.type.kind&&y.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${cr(y.type)}' and '${cr(x.type)}'.`);o&&(y.type.kind==="value"&&x.type.kind!=="value"?y=new Ps(x.type,[y]):y.type.kind!=="value"&&x.type.kind==="value"&&(x=new Ps(y.type,[x])));let T=null;if(u.length===4){if(y.type.kind!=="string"&&x.type.kind!=="string"&&y.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(T=d.parse(u[3],3,td),!T)return null}return new fC(y,x,T)}evaluate(u){const d=this.lhs.evaluate(u),m=this.rhs.evaluate(u);if(o&&this.hasUntypedArgument){const y=Pr(d),x=Pr(m);if(y.kind!==x.kind||y.kind!=="string"&&y.kind!=="number")throw new Sr(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const y=Pr(d),x=Pr(m);if(y.kind!=="string"||x.kind!=="string")return e(u,d,m)}return this.collator?i(u,d,m,this.collator.evaluate(u)):e(u,d,m)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[n];return this.eachChild(d=>{u.push(d.serialize())}),u}}}const o1=Vc("==",function(n,e,i){return e===i},Qf),s1=Vc("!=",function(n,e,i){return e!==i},function(n,e,i,o){return!Qf(0,e,i,o)}),ry=Vc("<",function(n,e,i){return e<i},function(n,e,i,o){return o.compare(e,i)<0}),oy=Vc(">",function(n,e,i){return e>i},function(n,e,i,o){return o.compare(e,i)>0}),Id=Vc("<=",function(n,e,i){return e<=i},function(n,e,i,o){return o.compare(e,i)<=0}),a1=Vc(">=",function(n,e,i){return e>=i},function(n,e,i,o){return o.compare(e,i)>=0});class Ad{constructor(e,i,o,a,u,d){this.type=Oi,this.number=e,this.locale=i,this.currency=o,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=d}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const o=i.parse(e[1],1,Nt);if(!o)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",Oi),!u))return null;let d=null;if(a.currency&&(d=i.parseObjectValue(a.currency,2,"currency",Oi),!d))return null;let m=null;if(a.unit&&(m=i.parseObjectValue(a.unit,2,"unit",Oi),!m))return null;let y=null;if(a["min-fraction-digits"]&&(y=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",Nt),!y))return null;let x=null;return a["max-fraction-digits"]&&(x=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",Nt),!x)?null:new Ad(o,u,d,m,y,x)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class em{constructor(e){this.type=Nt,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=i.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${cr(o.type)} instead.`):new em(o):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new Sr(`Expected value to be of type string or array, but found ${cr(Pr(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function sy(n){return function(){n=1831565813+(n|=0)|0;let e=Math.imul(n^n>>>15,1|n);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const jc={"==":o1,"!=":s1,">":oy,"<":ry,">=":a1,"<=":Id,array:Ps,at:Td,"at-interpolated":Sd,boolean:Ps,case:$u,coalesce:Uu,collator:Br,format:ta,image:fi,in:Yf,"index-of":Nc,interpolate:Wo,"interpolate-hcl":Wo,"interpolate-lab":Wo,length:em,let:Ca,literal:Ia,match:Gu,number:Ps,"number-format":Ad,object:Ps,slice:Ed,step:Vu,string:Ps,"to-boolean":ia,"to-color":ia,"to-number":ia,"to-string":ia,var:gd,within:al,distance:$l,config:Oc,split:Kf};function tm(n,[e,i,o,a]){e=e.evaluate(n),i=i.evaluate(n),o=o.evaluate(n);const u=a?a.evaluate(n):1,d=jl(e,i,o,u);if(d)throw new Sr(d);return new rn(e/255,i/255,o/255,u)}function im(n,[e,i,o,a]){e=e.evaluate(n),i=i.evaluate(n),o=o.evaluate(n);const u=a?a.evaluate(n):1,d=function(x,T,S,I){return typeof x=="number"&&x>=0&&x<=360?typeof T=="number"&&T>=0&&T<=100&&typeof S=="number"&&S>=0&&S<=100?I===void 0||typeof I=="number"&&I>=0&&I<=1?null:`Invalid hsla value [${[x,T,S,I].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof I=="number"?[x,T,S,I]:[x,T,S]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof I=="number"?[x,T,S,I]:[x,T,S]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,o,u);if(d)throw new Sr(d);const m=`hsla(${e}, ${i}%, ${o}%, ${u})`,y=rn.parse(m);
40if(!y)throw new Sr(`Failed to parse HSLA color: ${m}`);return y}function ay(n,e){return n in e}function nm(n,e){const i=e[n];return i===void 0?null:i}function ul(n){return{type:n}}function Hl(n){if(n instanceof Oc)return new Set([n.key]);let e=new Set;return n.eachChild(i=>{e=new Set([...e,...Hl(i)])}),e}function Cd(n){if(n instanceof mo&&n.name==="is-active-floor")return!0;let e=!1;return n.eachChild(i=>{!e&&Cd(i)&&(e=!0)}),e}function ly(n){return{result:"success",value:n}}function hl(n){return{result:"error",value:n}}function rm(n,e){return!!n&&!!n.parameters&&n.parameters.indexOf(e)>-1}function Hu(n){return n["property-type"]==="data-driven"}function cy(n){return rm(n.expression,"measure-light")}function uy(n){return rm(n.expression,"zoom")}function Md(n){return!!n.expression&&n.expression.interpolated}function Pd(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function hy(n){return n}function dy(n,e){const i=e.type==="color",o=n.stops&&typeof n.stops[0][0]=="object",a=o||!(o||n.property!==void 0),u=n.type||(Md(e)?"exponential":"interval");if(i&&((n=Object.assign({},n)).stops&&(n.stops=n.stops.map(x=>[x[0],rn.parse(x[1])])),n.default=rn.parse(n.default?n.default:e.default)),n.colorSpace&&n.colorSpace!=="rgb"&&!ny[n.colorSpace])throw new Error(`Unknown color space: ${n.colorSpace}`);let d,m,y;if(u==="exponential")d=py;else if(u==="interval")d=c1;else if(u==="categorical"){d=l1,m=Object.create(null);for(const x of n.stops)m[x[0]]=x[1];y=typeof n.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);d=fy}if(o){const x={},T=[];for(let M=0;M<n.stops.length;M++){const P=n.stops[M],k=P[0].zoom;x[k]===void 0&&(x[k]={zoom:k,type:n.type,property:n.property,default:n.default,stops:[]},T.push(k)),x[k].stops.push([P[0].value,P[1]])}const S=[];for(const M of T)S.push([x[M].zoom,dy(x[M],e)]);const I={name:"linear"};return{kind:"composite",interpolationType:I,interpolationFactor:Wo.interpolationFactor.bind(void 0,I),zoomStops:S.map(M=>M[0]),evaluate:({zoom:M},P)=>py({stops:S,base:n.base},e,M).evaluate(M,P)}}if(a){const x=u==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Wo.interpolationFactor.bind(void 0,x),zoomStops:n.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(n,e,T,m,y)}}return{kind:"source",evaluate(x,T){const S=T&&T.properties?T.properties[n.property]:void 0;return S===void 0?ra(n.default,e.default):d(n,e,S,m,y)}}}function ra(n,e,i){return n!==void 0?n:e!==void 0?e:i!==void 0?i:void 0}function l1(n,e,i,o,a){return ra(typeof i===a?o[i]:void 0,n.default,e.default)}function c1(n,e,i){if(!Pc(i))return ra(n.default,e.default);const o=n.stops.length;if(o===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[o-1][0])return n.stops[o-1][1];const a=vd(n.stops.map(u=>u[0]),i);return n.stops[a][1]}function py(n,e,i){const o=n.base!==void 0?n.base:1;if(!Pc(i))return ra(n.default,e.default);const a=n.stops.length;if(a===1||i<=n.stops[0][0])return n.stops[0][1];if(i>=n.stops[a-1][0])return n.stops[a-1][1];const u=vd(n.stops.map(T=>T[0]),i),d=function(T,S,I,M){const P=M-I,k=T-I;return P===0?0:S===1?k/P:(Math.pow(S,k)-1)/(Math.pow(S,P)-1)}(i,o,n.stops[u][0],n.stops[u+1][0]),m=n.stops[u][1],y=n.stops[u+1][1];let x=Pu[e.type]||hy;if(n.colorSpace&&n.colorSpace!=="rgb"){const T=ny[n.colorSpace];x=(S,I)=>T.reverse(T.interpolate(T.forward(S),T.forward(I),d))}return typeof m.evaluate=="function"?{evaluate(...T){const S=m.evaluate.apply(void 0,T),I=y.evaluate.apply(void 0,T);if(S!==void 0&&I!==void 0)return x(S,I,d)}}:x(m,y,d)}function fy(n,e,i){return e.type==="color"?i=rn.parse(i):e.type==="formatted"?i=p
vendor: 5,495 bytes, line 40
40o.fromString(i.toString()):e.type==="resolvedImage"?i=fo.build(i.toString()):kt(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),ra(i,n.default,e.default)}mo.register(jc,{error:[{kind:"error"},[Oi],(n,[e])=>{throw new Sr(e.evaluate(n))}],typeof:[Oi,[nn],(n,[e])=>cr(Pr(e.evaluate(n)))],"to-rgba":[Jr(Nt,4),[Eo],(n,[e])=>e.evaluate(n).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Jr(Nt,4),[Eo],(n,[e])=>e.evaluate(n).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Eo,[Nt,Nt,Nt],tm],rgba:[Eo,[Nt,Nt,Nt,Nt],tm],hsl:[Eo,[Nt,Nt,Nt],im],hsla:[Eo,[Nt,Nt,Nt,Nt],im],has:{type:ln,overloads:[[[Oi],(n,[e])=>ay(e.evaluate(n),n.properties())],[[Oi,ea],(n,[e,i])=>ay(e.evaluate(n),i.evaluate(n))]]},get:{type:nn,overloads:[[[Oi],(n,[e])=>nm(e.evaluate(n),n.properties())],[[Oi,ea],(n,[e,i])=>nm(e.evaluate(n),i.evaluate(n))]]},"feature-state":[nn,[Oi],(n,[e])=>nm(e.evaluate(n),n.featureState||{})],properties:[ea,[],n=>n.properties()],"geometry-type":[Oi,[],n=>n.geometryType()],worldview:[Oi,[],n=>n.globals.worldview||""],"is-active-floor":[ln,ul(Oi),(n,e)=>{if(!(n.globals.activeFloors&&n.globals.activeFloors.size>0))return!1;const i=n.globals.activeFloors;return e.some(o=>{const a=o.evaluate(n);return i.has(a)})}],id:[nn,[],n=>n.id()],zoom:[Nt,[],n=>n.globals.zoom],pitch:[Nt,[],n=>n.globals.pitch||0],"distance-from-center":[Nt,[],n=>n.distanceFromCenter()],"measure-light":[Nt,[Oi],(n,[e])=>n.measureLight(e.evaluate(n))],"heatmap-density":[Nt,[],n=>n.globals.heatmapDensity||0],"line-progress":[Nt,[],n=>n.globals.lineProgress||0],"raster-value":[Nt,[],n=>n.globals.rasterValue||0],"raster-particle-speed":[Nt,[],n=>n.globals.rasterParticleSpeed||0],"sky-radial-progress":[Nt,[],n=>n.globals.skyRadialProgress||0],accumulated:[nn,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Nt,ul(Nt),(n,e)=>{let i=0;for(const o of e)i+=o.evaluate(n);return i}],"*":[Nt,ul(Nt),(n,e)=>{let i=1;for(const o of e)i*=o.evaluate(n);return i}],"-":{type:Nt,overloads:[[[Nt,Nt],(n,[e,i])=>e.evaluate(n)-i.evaluate(n)],[[Nt],(n,[e])=>-e.evaluate(n)]]},"/":[Nt,[Nt,Nt],(n,[e,i])=>e.evaluate(n)/i.evaluate(n)],"%":[Nt,[Nt,Nt],(n,[e,i])=>e.evaluate(n)%i.evaluate(n)],ln2:[Nt,[],()=>Math.LN2],pi:[Nt,[],()=>Math.PI],e:[Nt,[],()=>Math.E],"^":[Nt,[Nt,Nt],(n,[e,i])=>Math.pow(e.evaluate(n),i.evaluate(n))],sqrt:[Nt,[Nt],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[Nt,[Nt],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[Nt,[Nt],(n,[e])=>Math.log(e.evaluate(n))],log2:[Nt,[Nt],(n,[e])=>Math.log2(e.evaluate(n))],sin:[Nt,[Nt],(n,[e])=>Math.sin(e.evaluate(n))],cos:[Nt,[Nt],(n,[e])=>Math.cos(e.evaluate(n))],tan:[Nt,[Nt],(n,[e])=>Math.tan(e.evaluate(n))],asin:[Nt,[Nt],(n,[e])=>Math.asin(e.evaluate(n))],acos:[Nt,[Nt],(n,[e])=>Math.acos(e.evaluate(n))],atan:[Nt,[Nt],(n,[e])=>Math.atan(e.evaluate(n))],min:[Nt,ul(Nt),(n,e)=>Math.min(...e.map(i=>i.evaluate(n)))],max:[Nt,ul(Nt),(n,e)=>Math.max(...e.map(i=>i.evaluate(n)))],abs:[Nt,[Nt],(n,[e])=>Math.abs(e.evaluate(n))],round:[Nt,[Nt],(n,[e])=>{const i=e.evaluate(n);return i<0?-Math.round(-i):Math.round(i)}],floor:[Nt,[Nt],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[Nt,[Nt],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[ln,[Oi,nn],(n,[e,i])=>n.properties()[e.value]===i.value],"filter-id-==":[ln,[nn],(n,[e])=>n.id()===e.value],"filter-type-==":[ln,[Oi],(n,[e])=>n.geometryType()===e.value],"filter-<":[ln,[Oi,nn],(n,[e,i])=>{const o=n.properties()[e.value],a=i.value;return typeof o==typeof a&&o<a}],"filter-id-<":[ln,[nn],(n,[e])=>{const i=n.id(),o=e.value;return typeof i==typeof o&&i<o}],"filter->":[ln,[Oi,nn],(n,[e,i])=>{const o=n.properties()[e.value],a=i.value;return typeof o==typeof a&&o>a}],"filter-id->":[ln,[nn],(n,[e])=>{const i=n.id(),o=e.value;return typeof i==typeof o&&i>o}],"filter-<=":[ln,[Oi,nn],(n,[e,i])=>{const o=n.properties()[e.value],a=i.value;return typeof o==typeof a&&o<=a}],"filter-id-<=":[ln,[nn],(n,[e])=>{const i=n.id(),o=e.value;return typeof i==typeof o&&i<=o}],"filter->=":[ln,[Oi,nn],(n,[e,i])=>{const o=n.properties()[e.value],a=i.value;return typeof o==typeof a&&o>=a}],"filter-id->=":[ln,[nn],(n,[e])=>{const i=n.id(),o=e.value;return typeof i==typeof o&&i>=o}],"filter-has":[ln,[nn],(n,[e])=>e.value in n.properties()],"filter-has-id":[ln,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[ln,[Jr(Oi)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[ln,[Jr(nn)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[ln,[Oi,Jr(nn)],(n,[e,i])=>i.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[ln,[Oi,Jr(nn)],(n,[e,i])=>function(o,a,u,d){for(;u<=d;){const m=u+d>>1;if(a[m]===o)return!0;a[m]>o?d=m-1:u=m+1}return!1}(n.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ln,overloads:[[[ln,ln],(n,[e,i])=>e.evaluate(n)&&i.evaluate(n)],[ul(ln),(n,e)=>{for(const i of e)if(!i.evaluate(n))return!1;return!0}]]},any:{type:ln,overloads:[[[ln,ln],(n,[e,i])=>e.evaluate(n)||i.evaluate(n)],[ul(ln),(n,e)=>{for(const i of e)if(i.evaluate(n))return!0;return!1}]]},"!":[ln,[ln],(n,[e])=>!e.evaluate(n)],"is-supported-script":[ln,[Oi],(n,[e])=>{const i=n.globals&&n.globals.isSupportedScript;return!i||i(e.evaluate(n))}],upcase:[Oi,[Oi],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Oi,[Oi],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Oi,ul(nn),(n,e)=>e.map(i=>us(i.evaluate(n))).join("")],"resolved-locale":[Oi,[td],(n,[e])=>e.evaluate(n).resolvedLocale()],random:[Nt,[Nt,Nt,nn],(n,e)=>{const[i,o,a]=e.map(d=>d.evaluate(n));if(i>o||i===o)return i;let u;
40if(typeof a=="string")u=function(d){let m=0;if(d.length===0)return m;for(let y=0;y<d.length;y++)m=(m<<5)-m+d.charCodeAt(y),m|=0;return m}(a);else{if(typeof a!="number")throw new Sr(`Invalid seed input: ${a}`);u=a}return i+sy(u)()*(o-i)}]});class Rd{constructor(e,i,o,a,u){this.expression=e,this._warningHistory={},this._scope=o,this._options=a,this._iconImageUseTheme=u,this._evaluator=new sd(o,a,u),this._defaultValue=i?function(d){return d.type==="color"&&(Pd(d.default)||Array.isArray(d.default))?new rn(0,0,0,0):d.type==="color"?rn.parse(d.default)||null:d.default===void 0?null:d.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Hl(e),this.isIndoorDependent=Cd(e)}evaluateWithoutErrorHandling(e,i,o,a,u,d,m,y){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=o,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=y||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,o,a,u,d,m,y,x){this._evaluator||(this._evaluator=new sd(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=o||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null,this._evaluator.featureTileCoord=m||null,this._evaluator.featureDistanceData=y||null,this._evaluator.iconImageUseTheme=x||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new Sr(`Expected value to be one of ${Object.keys(this._enumValues).map(S=>
40JSON.stringify(S)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){const S=T;return this._warningHistory[S.message]||(this._warningHistory[S.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${S.message}`)),this._defaultValue}}}function qu(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in jc}function dl(n,e,i,o,a){const u=new yd(jc,[],e?function(m){const y={color:Eo,string:Oi,number:Nt,enum:Oi,boolean:ln,formatted:Ru,resolvedImage:Lu};return m.type==="array"?Jr(y[m.value]||nn,m.length):y[m.type]}(e):void 0,void 0,void 0,i,o,a),d=u.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?ly(new Rd(d,e,i,o,a)):hl(u.errors)}class Uc{constructor(e,i,o,a){this.kind=e,this._styleExpression=i,this.isLightConstant=o,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Nu(i.expression),this.configDependencies=Hl(i.expression),this.isIndoorDependent=Cd(i.expression)}evaluateWithoutErrorHandling(e,i,o,a,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,u,d)}evaluate(e,i,o,a,u,d,m){return this._styleExpression.evaluate(e,i,o,a,u,d,void 0,void 0,m)}}class ql{constructor(e,i,o,a,u,d){this.kind=e,this.zoomStops=o,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Nu(i.expression),this.isIndoorDependent=Cd(i.expression),this.isLightConstant=u,this.isLineProgressConstant=d,this.configDependencies=Hl(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,o,a,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,u,d)}evaluate(e,i,o,a,u,d){return this._styleExpression.evaluate(e,i,o,a,u,d)}interpolationFactor(e,i,o){return this.interpolationType?Wo.interpolationFactor(this.interpolationType,e,i,o):0}}function om(n,e,i,o,a){if((n=dl(n,e,i,o,a)).result==="error")return n;const u=n.value.expression,d=Dc(u);if(!d&&!Hu(e))return hl([new cs("","data expressions not supported")]);const m=kc(u,["zoom","pitch","distance-from-center"]);if(!m&&!uy(e))return hl([new cs("","zoom expressions not supported")]);const y=kc(u,["measure-light"]);if(!y&&!cy(e))return hl([new cs("","measure-light expression not supported")]);const x=kc(u,["line-progress"]);if(!x&&!function(I){return rm(I.expression,"line-progress")}(e))return hl([new cs("","line-progress expression not supported")]);const T=e.expression&&e.expression.relaxZoomRestriction,S=Ls(u);return S||m||T?S instanceof cs?hl([S]):S instanceof Wo&&!Md(e)?hl([new cs("",'"interpolate" expressions cannot be used with this property')]):ly(S?new ql(d&&x?"camera":"composite",n.value,S.labels,S instanceof Wo?S.interpolation:void 0,y,x):new Uc(d&&x?"constant":"source",n.value,y,x)):hl([new cs("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ld{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,dy(this._parameters,this._specification))}static deserialize(e){return new Ld(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ls(n){let e=null;if(n instanceof Ca)e=Ls(n.result);else if(n instanceof Uu){for(const i of n.args)if(e=Ls(i),e)break}else(n instanceof Vu||n instanceof Wo)&&n.input instanceof mo&&n.input.name==="zoom"&&(e=n);return e instanceof cs||n.eachChild(i=>{const o=Ls(i);o instanceof cs?e=o:e&&o&&e!==o&&(e=new cs("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var sm,my,_y=function(){if(my)return sm;my=1,sm=e;var n=3;function e(i,o,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var d=new Int32Array(this.arrayBuffer);i=d[0],this.d=(o=d[1])+2*(a=d[2]);for(var m=0;m<this.d*this.d;m++){var y=d[n+m],x=d[n+m+1];u.push(y===x?null:d.subarray(y,x))}var T=d[n+u.length+1];this.keys=d.subarray(d[n+u.length],T),this.bboxes=d.subarray(T),this.insert=this._insertReadonly}else{this.d=o+2*a;for(var S=0;S<this.d*this.d;S++)u.push([]);this.keys=[],this.bboxes=[]}this.n=o,this.extent=i,this.padding=a,this.scale=o/i,this.uid=0;var I=a/o*i;this.min=-I,this.max=i+I}
40return e.prototype.insert=function(i,o,a,u,d){this._forEachCell(o,a,u,d,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(d)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,o,a,u,d,m){this.cells[d].push(m)},e.prototype.query=function(i,o,a,u,d){var m=this.min,y=this.max;if(i<=m&&o<=m&&y<=a&&y<=u&&!d)return Array.prototype.slice.call(this.keys);var x=[];return this._forEachCell(i,o,a,u,this._queryCell,x,{},d),x},e.prototype._queryCell=function(i,o,a,u,d,m,y,x){var T=this.cells[d];if(T!==null)for(var S=this.keys,I=this.bboxes,M=0;M<T.length;M++){var P=T[M];if(y[P]===void 0){var k=4*P;(x?x(I[k+0],I[k+1],I[k+2],I[k+3]):i<=I[k+2]&&o<=I[k+3]&&a>=I[k+0]&&u>=I[k+1])?(y[P]=!0,m.push(S[P])):y[P]=!1}}},e.prototype._forEachCell=function(i,o,a,u,d,m,y,x){for(var T=this._convertToCellCoord(i),S=this._convertToCellCoord(o),I=this._convertToCellCoord(a),M=this._convertToCellCoord(u),P=T;P<=I;P++)for(var k=S;k<=M;k++){var V=this.d*k+P;if((!x||x(this._convertFromCellCoord(P),this._convertFromCellCoord(k),this._convertFromCellCoord(P+1),this._convertFromCellCoord(k+1)))&&d.call(this,i,o,a,u,V,m,y,x))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,o=n+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var d=new Int32Array(o+a+this.keys.length+this.bboxes.length);d[0]=this.extent,d[1]=this.n,d[2]=this.padding;for(var m=o,y=0;y<i.length;y++){var x=i[y];d[n+y]=m,d.set(x,m),m+=x.length}return d[n+i.length]=m,d.set(this.keys,m),d[n+i.length+1]=m+=this.keys.length,d.set(this.bboxes,m),m+=this.bboxes.length,d.buffer},sm}(),Gc=Tr(_y);const Zl={};function At(n,e,i={}){Object.defineProperty(n,"_classRegistryKey",{value:e,writable:!1}),Zl[e]={klass:n,omit:i.omit||[]}}At(Object,"Object"),Gc.serialize=function(n,e){const i=n.toArrayBuffer();return e&&e.add(i),{buffer:i}},Gc.deserialize=function(n){return new Gc(n.buffer)},Object.defineProperty(Gc,"name",{value:"Grid"}),At(Gc,"Grid"),delete Ke.prototype.constructor,At(rn,"Color"),At(Error,"Error"),At(po,"Formatted"),At(nd,"FormattedSection"),At(Oo,"AJAXError"),At(fo,"ResolvedImage"),At(Ld,"StylePropertyFunction"),At(Rd,"StyleExpression",{omit:["_evaluator"]}),At(co,"ImageId"),At(Ea,"ImageVariant"),At(ql,"ZoomDependentExpression"),At(Uc,"ZoomConstantExpression"),At(mo,"CompoundExpression",{omit:["_evaluate"]});for(const n in jc)Zl[jc[n]._classRegistryKey]||At(jc[n],`Expression${n}`);function Zu(n){return n&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Ma(n,e){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp)return n;if(Zu(n)||n instanceof ImageBitmap)return e&&e.add(n),n;if(ArrayBuffer.isView(n))return e&&e.add(n.buffer),n;if(n instanceof ImageData)return e&&e.add(n.data.buffer),n;if(Array.isArray(n)){const i=[];for(const o of n)i.push(Ma(o,e));return i}if(n instanceof Map){const i={$name:"Map",entries:[]};for(const[o,a]of n.entries())i.entries.push(Ma(o),Ma(a,e));return i}if(n instanceof Set){const i={$name:"Set"};let o=0;for(const a of n.values())i[++o]=Ma(a);return i}if(typeof n=="bigint")return{$name:"BigInt",value:n.toString()};if(typeof n=="object"){const i=n.constructor,o=i._classRegistryKey;if(!o)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(n,e):{};if(!i.serialize){for(const u in n)n.hasOwnProperty(u)&&(Zl[o].omit.indexOf(u)>=0||(a[u]=Ma(n[u],e)));n instanceof Error&&(a.message=n.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(a.$name=o),a}throw new Error("can't serialize object of type "+typeof n)}function pl(n){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||Zu(n)||n instanceof ImageBitmap||ArrayBuffer.isView(n)||n instanceof ImageData)return n;if(Array.isArray(n))return n.map(pl);
40if(typeof n=="object"){const e=n.$name||"Object";if(e==="Map"){const a=n.entries||[],u=new Map;for(let d=0;d<a.length;d+=2)u.set(pl(a[d]),pl(a[d+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(n))u!=="$name"&&a.add(pl(n[u]));return a}if(e==="BigInt")return BigInt(n.value);const{klass:i}=Zl[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(n);const o=Object.create(i.prototype);for(const a of Object.keys(n))a!=="$name"&&(o[a]=pl(n[a]));return o}throw new Error("can't deserialize object of type "+typeof n)}const Xt={"Latin-1 Supplement":n=>n>=128&&n<=255,Arabic:n=>n>=1536&&n<=1791,"Arabic Supplement":n=>n>=1872&&n<=1919,"Arabic Extended-A":n=>n>=2208&&n<=2303,"Hangul Jamo":n=>n>=4352&&n<=4607,"Unified Canadian Aboriginal Syllabics":n=>n>=5120&&n<=5759,Khmer:n=>n>=6016&&n<=6143,"Unified Canadian Aboriginal Syllabics Extended":n=>n>=6320&&n<=6399,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"CJK Radicals Supplement":n=>n>=11904&&n<=12031,"Kangxi Radicals":n=>n>=12032&&n<=12255,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Bopomofo:n=>n>=12544&&n<=12591,"Hangul Compatibility Jamo":n=>n>=12592&&n<=12687,Kanbun:n=>n>=12688&&n<=12703,"Bopomofo Extended":n=>n>=12704&&n<=12735,"CJK Strokes":n=>n>=12736&&n<=12783,"Katakana Phonetic Extensions":n=>n>=12784&&n<=12799,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"CJK Unified Ideographs Extension A":n=>n>=13312&&n<=19903,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Yi Syllables":n=>n>=40960&&n<=42127,"Yi Radicals":n=>n>=42128&&n<=42191,"Hangul Jamo Extended-A":n=>n>=43360&&n<=43391,"Hangul Syllables":n=>n>=44032&&n<=55215,"Hangul Jamo Extended-B":n=>n>=55216&&n<=55295,"Private Use Area":n=>n>=57344&&n<=63743,"CJK Compatibility Ideographs":n=>n>=63744&&n<=64255,"Arabic Presentation Forms-A":n=>n>=64336&&n<=65023,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Arabic Presentation Forms-B":n=>n>=65136&&n<=65279,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519,Osage:n=>n>=66736&&n<=66815,"CJK Unified Ideographs Extension B":n=>n>=131072&&n<=173791};function Wu(n){for(const e of n)if(zd(e.charCodeAt(0)))return!0;return!1}function am(n){for(const e of n)if(!gy(e.charCodeAt(0)))return!1;return!0}function gy(n){return!(Xt.Arabic(n)||Xt["Arabic Supplement"](n)||Xt["Arabic Extended-A"](n)||Xt["Arabic Presentation Forms-A"](n)||Xt["Arabic Presentation Forms-B"](n))}function zd(n){return!(n!==746&&n!==747&&(n<4352||!(Xt["Bopomofo Extended"](n)||Xt.Bopomofo(n)||Xt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||Xt["CJK Compatibility Ideographs"](n)||Xt["CJK Compatibility"](n)||Xt["CJK Radicals Supplement"](n)||Xt["CJK Strokes"](n)||!(!Xt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||Xt["CJK Unified Ideographs Extension A"](n)||Xt["CJK Unified Ideographs"](n)||Xt["Enclosed CJK Letters and Months"](n)||Xt["Hangul Compatibility Jamo"](n)||Xt["Hangul Jamo Extended-A"](n)||Xt["Hangul Jamo Extended-B"](n)||Xt["Hangul Jamo"](n)||Xt["Hangul Syllables"](n)||Xt.Hiragana(n)||Xt["Ideographic Description Characters"](n)||Xt.Kanbun(n)||Xt["Kangxi Radicals"](n)||Xt["Katakana Phonetic Extensions"](n)||Xt.Katakana(n)&&n!==12540||!(!Xt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!Xt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||Xt["Unified Canadian Aboriginal Syllabics"](n)||Xt["Unified Canadian Aboriginal Syllabics Extended"](n)||Xt["Vertical Forms"](n)||Xt["Yijing Hexagram Symbols"](n)||Xt["Yi Syllables"](n)||Xt["Yi Radicals"](n))))}function Dd(n){return!(zd(n)||function(e){return!!(Xt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Xt["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Xt["Letterlike Symbols"](e)||Xt["Number Forms"](e)||Xt["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Xt["Control Pictures"](e)&&e!==9251||Xt["Optical Character Recognition"](e)||Xt["Enclosed Alphanumerics"](e)||Xt["Geometric Shapes"](e)||Xt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Xt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Xt["CJK Symbols and Punctuation"](e)||Xt.Katakana(e)||
40Xt["Private Use Area"](e)||Xt["CJK Compatibility Forms"](e)||Xt["Small Form Variants"](e)||Xt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(n))}function kd(n){return Xt.Arabic(n)||Xt["Arabic Supplement"](n)||Xt["Arabic Extended-A"](n)||Xt["Arabic Presentation Forms-A"](n)||Xt["Arabic Presentation Forms-B"](n)}function lm(n){return n>=1424&&n<=2303||Xt["Arabic Presentation Forms-A"](n)||Xt["Arabic Presentation Forms-B"](n)}function Pa(n,e){return!(!e&&lm(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||Xt.Khmer(n))}function u1(n){for(const e of n)if(lm(e.charCodeAt(0)))return!0;return!1}const Fo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let cm=null,_o=Fo.unavailable,Ra=null;const Xu=function(n){n&&typeof n=="string"&&n.indexOf("NetworkError")>-1&&(_o=Fo.error),cm&&cm(n)};function Od(){Fd.fire(new Qs("pluginStateChange",{pluginStatus:_o,pluginURL:Ra}))}const Fd=new Vl,Yu=function(){return _o},yy=function(){if(_o!==Fo.deferred||!Ra)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");_o=Fo.loading,Od(),Ra&&Sa({url:Ra},n=>{n?Xu(n):(_o=Fo.loaded,Od())})},La={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>_o===Fo.loaded||La.applyArabicShaping!=null,isLoading:()=>_o===Fo.loading,setState(n){_o=n.pluginStatus,Ra=n.pluginURL},isParsing:()=>_o===Fo.parsing,isParsed:()=>_o===Fo.parsed,getPluginURL:()=>Ra};class bn{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,o){for(const a of i)if(!Pa(a.charCodeAt(0),o))return!1;return!0}(e,La.isLoaded())}}class Bd{constructor(e,i,o,a,u){this.property=e,this.value=i,this.expression=function(d,m,y,x,T){if(Pd(d))return new Ld(d,m);if(qu(d)||Array.isArray(d)&&d.length>0){const S=om(d,m,y,x,T);if(S.result==="error")throw new Error(S.value.map(I=>`${I.key}: ${I.message}`).join(", "));return S.value}{let S=d;return typeof d=="string"&&m.type==="color"&&(S=rn.parse(d)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>S}}}(i===void 0?e.specification.default:i,e.specification,o,a,u)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,o,a){return this.property.possiblyEvaluate(this,e,i,o,a)}}class um{constructor(e,i,o,a){this.property=e,this.value=new Bd(e,void 0,i,o,a)}transitioned(e,i){return new xy(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new xy(this.property,this.value,null,{},0)}}class vy{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Ue(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new um(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Bd(this._values[e].property,i===null?void 0:Ue(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const o=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const d=a.slice(0,-11);o[d]&&this.setTransition(d,u)}else o.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return Ue(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new um(this._values[e].property)),this._values[e].transition=Ue(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const o=new wy(this._properties);for(const a of Object.keys(this._values))o._values[a]=this._values[a].transitioned(e,i._values[a]);return o}untransitioned(){const e=new wy(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class xy{constructor(e,i,o,a,u){const d=a.delay||0,m=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+d,this.end=this.begin+m,e.specification.transition&&(a.delay||a.duration)&&(this.prior=o)}possiblyEvaluate(e,i,o){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,o),d=this.prior;if(d){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return d.possiblyEvaluate(e,i,o);{const m=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,i,o),u,Dl(m))}}return u}}class wy{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,o){const a=new Xl(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,o);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class by{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Ue(this._values[e].value)}setValue(e,i){this._values[e]=new Bd(this._values[e].property,i===null?void 0:Ue(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndo
40orDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o)}return e}possiblyEvaluate(e,i,o,a){const u=new Xl(this._properties);for(const d of Object.keys(this._values))u._values[d]=this._values[d].possiblyEvaluate(e,i,o,a);return u}isIndoorDependent(){return this._isIndoorDependent}}class Wl{constructor(e,i,o,a){this.property=e,this.value=i,this.parameters=o,this.iconImageUseTheme=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,o,a){return this.property.evaluate(this.value,this.parameters,e,i,o,a,this.iconImageUseTheme)}}class Xl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ct{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,o){const a=Pu[this.specification.type];return a?a(e,i,o):e}}class _t{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,o,a,u){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Wl(this,{kind:"constant",value:e.expression.evaluate(i,null,{},o,a,void 0,u)},i):new Wl(this,e.expression,i,u)}interpolate(e,i,o){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Wl(this,{kind:"constant",value:void 0},e.parameters);const a=Pu[this.specification.type];return a?new Wl(this,{kind:"constant",value:a(e.value.value,i.value.value,o)},e.parameters):e}evaluate(e,i,o,a,u,d,m){return e.kind==="constant"?e.value:e.evaluate(i,o,a,u,d,void 0,m)}}class Yl{constructor(e){this.specification=e}possiblyEvaluate(e,i,o,a){return!!e.expression.evaluate(i,null,{},o,a)}interpolate(){return!1}}class Un{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new bn(0,{});for(const o in e){const a=e[o];a.specification.overridable&&this.overridableProperties.push(o);const u=this.defaultPropertyValues[o]=new Bd(a,void 0),d=this.defaultTransitionablePropertyValues[o]=new um(a);this.defaultTransitioningPropertyValues[o]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=u.possiblyEvaluate(i)}}}At(_t,"DataDrivenProperty"),At(ct,"DataConstantProperty"),At(Yl,"ColorRampProperty");var be=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}}
40,"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
40,"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","value":"number","length":3,"default":[0,0,0],"period":360}},"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","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"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}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
40,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_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","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
40ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
40,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
40":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Ty(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Nd(n){if(Array.isArray(n))return n.map(Nd);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const e={};for(const i in n)e[i]=Nd(n[i]);return e}return Ty(n)}function oa(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!oa(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Vd(n,e="",i=null,o="fill"){if(n==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};oa(n)||(n=jd(n));const a=n;let u=!0;try{u=function(T){if(!$c(T))return T;let S=Nd(T);return Sy(S),S=Kl(S),S}(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
41This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
42and paste the contents of this message in the report.
43Thank you!
44Filter Expression:
45${JSON.stringify(a,null,2)}
46        `)}let d=null,m=null;if(o!=="background"&&o!=="sky"&&o!=="slot"){m=be[`filter_${o}`];const T=dl(u,m,e,i);if(T.result==="error")throw new Error(T.value.map(S=>`${S.key}: ${S.message}`).join(", "));d=(S,I,M)=>T.value.evaluate(S,I,{},M)}let y=null,x=null;if(u!==a){const T=dl(a,m,e,i);if(T.result==="error")throw new Error(T.value.map(S=>`${S.key}: ${S.message}`).join(", "));y=(S,I,M,P,k)=>T.value.evaluate(S,I,{},M,void 0,void 0,P,k),x=!Dc(T.value.expression)}return{filter:d,dynamicFilter:y||void 0,needGeometry:Ey(u),needFeature:!!x}}function Kl(n){if(!Array.isArray(n))return n;const e=function(i){if(h1.has(i[0])){for(let o=1;o<i.length;o++)if($c(i[o]))return!0}return i}(n);return e===!0?e:e.map(i=>Kl(i))}function Sy(n){let e=!1;const i=[];if(n[0]==="case"){for(let o=1;o<n.length-1;o+=2)e=e||$c(n[o]),i.push(n[o+1]);i.push(n[n.length-1])}else if(n[0]==="match"){e=e||$c(n[1]);for(let o=2;o<n.length-1;o+=2)i.push(n[o+1]);i.push(n[n.length-1])}else if(n[0]==="step"){e=e||$c(n[1]);for(let o=1;o<n.length-1;o+=2)i.push(n[o+1])}e&&(n.length=0,n.push("any",...i));for(let o=1;o<n.length;o++)Sy(n[o])}function $c(n){if(!Array.isArray(n))return!1;if((e=n[0])==="pitch"||e==="distance-from-center")return!0;var e;
46for(let i=1;i<n.length;i++)if($c(n[i]))return!0;return!1}const h1=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function d1(n,e){return n<e?-1:n>e?1:0}function Ey(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(Ey(n[e]))return!0;return!1}function jd(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Ud(n[1],n[2],"=="):e==="!="?Ku(Ud(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Ud(n[1],n[2],e):e==="any"?(i=n.slice(1),["any"].concat(i.map(jd))):e==="all"?["all"].concat(n.slice(1).map(jd)):e==="none"?["all"].concat(n.slice(1).map(jd).map(Ku)):e==="in"?Gd(n[1],n.slice(2)):e==="!in"?Ku(Gd(n[1],n.slice(2))):e==="has"?$d(n[1]):e!=="!has"||Ku($d(n[1]));var i}function Ud(n,e,i){switch(n){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,n,e]}}function Gd(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",n,["literal",e.sort(d1)]]:["filter-in-small",n,["literal",e]]}}function $d(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Ku(n){return["!",n]}const Jl="�";function zs(n,e){return e?`${n}${Jl}${e}`:n}let Iy;const Ay=()=>Iy||(Iy=new Un({"icon-size":new _t(be.layout_symbol["icon-size"]),"icon-image":new _t(be.layout_symbol["icon-image"]),"icon-rotate":new _t(be.layout_symbol["icon-rotate"]),"icon-offset":new _t(be.layout_symbol["icon-offset"]),"text-size":new _t(be.layout_symbol["text-size"]),"text-rotate":new _t(be.layout_symbol["text-rotate"]),"text-offset":new _t(be.layout_symbol["text-offset"])}));class Cy{constructor(e,i,o,a,u,d){const m=dl(e,be.appearance.condition);if(m.result==="success"&&(this.condition=m.value),this.name=i,o){this.properties=new Xl(Ay()),this.unevaluatedLayout=new by(Ay(),a,u,d);for(const y in o)this.unevaluatedLayout.setValue(y,o[y])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,o){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,o))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),o=this.hasProperty("icon-offset"),a=this.hasProperty("icon-rotate");return e||i||o||a}hasTextProperties(){const e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),o=this.hasProperty("text-rotate");return e||i||o}hasProperty(e){return this.getUnevaluatedProperty(e).value!==void 0}}const My="-transition",sa=new Set(["fill","line","background","hillshade","raster"]);class go extends Vl{constructor(e,i,o,a,u,d){if(super(),this.id=e.id,this.fqid=zs(this.id,o),this.type=e.type,this.scope=o,this.lut=a,this.options=u,this.iconImageUseTheme=d,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const m=dl(this.filter,be[`filter_${e.type}`]);m.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...m.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||m.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new by(i.layout,this.scope,u,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new vy(i.paint,this.scope,u);for(const m in e.paint)this.setPaintProperty(m,e.paint[m]);for(const m in e.layout)this.setLayoutProperty(m,e.layout[m]);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 Xl(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&sa.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
46setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const o=this._unevaluatedLayout;o._properties.properties[e]&&(o.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...o.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||o.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new Cy(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(My)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const o=this._transitionablePaint,a=o._properties.properties;if(e.endsWith(My)){const S=e.slice(0,-11);return a[S]&&o.setTransition(S,i||void 0),!1}if(!a[e])return!1;const u=o._values[e],d=u.value.isDataDriven(),m=u.value;o.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...o.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||o.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const y=o._values[e].value,x=y.isDataDriven(),T=e.endsWith("pattern")||e==="line-dasharray";return x||d||T||this._handleOverridablePaintPropertyUpdate(e,m,y)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,o){return null}_handleOverridablePaintPropertyUpdate(e,i,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 4,765 bytes, line 46
46serialize(){const e={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 this.appearances.length!==0&&(e.appearances=this.appearances.map(i=>i.serialize())),it(e,(i,o)=>!(i===void 0||o==="layout"&&!Object.keys(i).length||o==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Wl&&Hu(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Nu(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Vd(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,o){return{}}queryRadius(e){}queryIntersectsFeature(e,i,o,a,u,d,m,y,x){}}const Py={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ju{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const p1=new ArrayBuffer(0);class An{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=p1),i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ai(n,e=1){let i=0,o=0;return{members:n.map(a=>{const u=Py[a.type].BYTES_PER_ELEMENT,d=i=Ry(i,Math.max(e,u)),m=a.components||1;return o=Math.max(o,u),i+=u*m,{name:a.name,type:a.type,components:m,offset:d}}),size:Ry(i,Math.max(o,e)),alignment:e}}function Ry(n,e){return Math.ceil(n/e)*e}class fl extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=o,e}}fl.prototype.bytesPerElement=4,At(fl,"StructArrayLayout2i4");class Hc extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,e}}Hc.prototype.bytesPerElement=6,At(Hc,"StructArrayLayout3i6");class qc extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const d=4*e;return this.int16[d+0]=i,this.int16[d+1]=o,this.int16[d+2]=a,this.int16[d+3]=u,e}}
vendor: 19,624 bytes, line 46
46qc.prototype.bytesPerElement=8,At(qc,"StructArrayLayout4i8");class za extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}za.prototype.bytesPerElement=4,At(za,"StructArrayLayout1f4");class hm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=4*e,d=2*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.float32[d+1]=a,e}}hm.prototype.bytesPerElement=8,At(hm,"StructArrayLayout2i1f8");class dm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,e}}dm.prototype.bytesPerElement=8,At(dm,"StructArrayLayout3i8");class pm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,o,a,u)}emplace(e,i,o,a,u,d){const m=5*e;return this.int16[m+0]=i,this.int16[m+1]=o,this.int16[m+2]=a,this.int16[m+3]=u,this.int16[m+4]=d,e}}pm.prototype.bytesPerElement=10,At(pm,"StructArrayLayout5i10");class Hd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,o,a,u,d,m)}emplace(e,i,o,a,u,d,m,y){const x=6*e,T=12*e,S=3*e;return this.int16[x+0]=i,this.int16[x+1]=o,this.uint8[T+4]=a,this.uint8[T+5]=u,this.uint8[T+6]=d,this.uint8[T+7]=m,this.float32[S+2]=y,e}}Hd.prototype.bytesPerElement=12,At(Hd,"StructArrayLayout2i4ub1f12");class Xo extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=o,this.float32[u+2]=a,e}}Xo.prototype.bytesPerElement=12,At(Xo,"StructArrayLayout3f12");class Io extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,o,a,u)}emplace(e,i,o,a,u,d){const m=6*e,y=3*e;return this.uint16[m+0]=i,this.uint16[m+1]=o,this.uint16[m+2]=a,this.uint16[m+3]=u,this.float32[y+2]=d,e}}Io.prototype.bytesPerElement=12,At(Io,"StructArrayLayout4ui1f12");class Ql extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const d=4*e;return this.uint16[d+0]=i,this.uint16[d+1]=o,this.uint16[d+2]=a,this.uint16[d+3]=u,e}}Ql.prototype.bytesPerElement=8,At(Ql,"StructArrayLayout4ui8");class qd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,o,a,u,d)}emplace(e,i,o,a,u,d,m){const y=6*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.int16[y+2]=a,this.int16[y+3]=u,this.int16[y+4]=d,this.int16[y+5]=m,e}}qd.prototype.bytesPerElement=12,At(qd,"StructArrayLayout6i12");class fm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S,I){const M=this.length;return this.resize(M+1),this.emplace(M,e,i,o,a,u,d,m,y,x,T,S,I)}emplace(e,i,o,a,u,d,m,y,x,T,S,I,M){const P=12*e;return this.int16[P+0]=i,this.int16[P+1]=o,this.int16[P+2]=a,this.int16[P+3]=u,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=y,this.uint16[P+7]=x,this.int16[P+8]=T,this.int16[P+9]=S,this.int16[P+10]=I,this.int16[P+11]=M,e}}fm.prototype.bytesPerElement=24,At(fm,"StructArrayLayout4i4ui4i24");class mm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,o,a,u,d)}emplace(e,i,o,a,u,d,m){const y=10*e,x=5*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.int16[y+2]=a,this.float32[x+2]=u,this.float32[x+3]=d,this.float32[x+4]=m,e}}mm.prototype.bytesPerElement=20,At(mm,"StructArrayLayout3i3f20");class ml extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const d=4*e;return this.float32[d+0]=i,this.float32[d+1]=o,this.float32[d+2]=a,this.float32[d+3]=u,e}}ml.prototype.bytesPerElement=16,At(ml,"StructArrayLayout4f16");class Zd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Zd.prototype.bytesPerElement=4,At(Zd,"StructArrayLayout1ul4");class Yo extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=o,e}}Yo.prototype.bytesPerElement=4,At(Yo,"StructArrayLayout2ui4");class Wd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S,I,M){const P=this.length;return this.resize(P+1),this.emplace(P,e,i,o,a,u,d,m,y,x,T,S,I,M)}emplace(e,i,o,a,u,d,m,y,x,T,S,I,M,P){const k=20*e,V=10*e;return this.int16[k+0]=i,this.int16[k+1]=o,this.int16[k+2]=a,this.int16[k+3]=u,this.int16[k+4]=d,this.float32[V+3]=m,this.float32[V+4]=y,this.float32[V+5]=x,this.float32[V+6]=T,this.int16[k+14]=S,this.uint32[V+8]=I,this.uint16[k+18]=M,this.uint16[k+19]=P,e}}Wd.prototype.bytesPerElement=40,At(Wd,"StructArrayLayout5i4f1i1ul2ui40");class Xd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,o,a,u,d,m)}emplace(e,i,o,a,u,d,m,y){const x=8*e;return this.int16[x+0]=i,this.int16[x+1]=o,this.int16[x+2]=a,this.int16[x+4]=u,this.int16[x+5]=d,this.int16[x+6]=m,this.int16[x+7]=y,e}}Xd.prototype.bytesPerElement=16,At(Xd,"StructArrayLayout3i2i2i16");class Yd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,o,a,u)}emplace(e,i,o,a,u,d){const m=4*e,y=8*e;return this.float32[m+0]=i,this.float32[m+1]=o,this.float32[m+2]=a,this.int16[y+6]=u,this.int16[y+7]=d,e}}Yd.prototype.bytesPerElement=16,At(Yd,"StructArrayLayout2f1f2i16");class _m extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,o,a,u,d)}emplace(e,i,o,a,u,d,m){const y=20*e,x=5*e;return this.uint8[y+0]=i,this.uint8[y+1]=o,this.float32[x+1]=a,this.float32[x+2]=u,this.float32[x+3]=d,this.float32[x+4]=m,e}}_m.prototype.bytesPerElement=20,At(_m,"StructArrayLayout2ub4f20");class mr extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=o,this.uint16[u+2]=a,e}}mr.prototype.bytesPerElement=6,At(mr,"StructArrayLayout3ui6");class Zc extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re){const ee=this.length;return this.resize(ee+1),this.emplace(ee,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re)}emplace(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re,ee){const ae=30*e,he=15*e,me=60*e;return this.int16[ae+0]=i,this.int16[ae+1]=o,this.int16[ae+2]=a,this.float32[he+2]=u,this.float32[he+3]=d,this.uint16[ae+8]=m,this.uint16[ae+9]=y,this.uint32[he+5]=x,this.uint32[he+6]=T,this.uint32[he+7]=S,this.uint16[ae+16]=I,this.uint16[ae+17]=M,this.uint16[ae+18]=P,this.float32[he+10]=k,this.float32[he+11]=V,this.uint8[me+48]=N,this.uint8[me+49]=$,this.uint8[me+50]=q,this.uint32[he+13]=Y,this.int16[ae+28]=re,this.uint8[me+58]=ee,e}}Zc.prototype.bytesPerElement=60,At(Zc,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class gm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re,ee,ae,he,me,De,xe,Be,Ge,$e,Je,et,We){const Xe=this.length;return this.resize(Xe+1),this.emplace(Xe,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re,ee,ae,he,me,De,xe,Be,Ge,$e,Je,et,We)}emplace(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re,ee,ae,he,me,De,xe,Be,Ge,$e,Je,et,We,Xe){const Fe=20*e,ke=40*e,Ye=80*e;return this.float32[Fe+0]=i,this.float32[Fe+1]=o,this.int16[ke+4]=a,this.int16[ke+5]=u,this.int16[ke+6]=d,this.int16[ke+7]=m,this.int16[ke+8]=y,this.int16[ke+9]=x,this.int16[ke+10]=T,this.int16[ke+11]=S,this.int16[ke+12]=I,this.uint16[ke+13]=M,this.uint16[ke+14]=P,this.uint16[ke+15]=k,this.uint16[ke+16]=V,this.uint16[ke+17]=N,this.uint16[ke+18]=$,this.uint16[ke+19]=q,this.uint16[ke+20]=Y,this.uint16[ke+21]=re,this.uint16[ke+22]=ee,this.uint16[ke+23]=ae,this.uint16[ke+24]=he,this.uint16[ke+25]=me,this.uint16[ke+26]=De,this.uint16[ke+27]=xe,this.uint32[Fe+14]=Be,this.float32[Fe+15]=Ge,this.float32[Fe+16]=$e,this.float32[Fe+17]=Je,this.float32[Fe+18]=et,this.uint8[Ye+76]=We,this.uint16[ke+39]=Xe,e}}gm.prototype.bytesPerElement=80,At(gm,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ym extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,o,a,u,d)}emplace(e,i,o,a,u,d,m){const y=6*e;return this.float32[y+0]=i,this.float32[y+1]=o,this.float32[y+2]=a,this.float32[y+3]=u,this.float32[y+4]=d,this.float32[y+5]=m,e}}ym.prototype.bytesPerElement=24,At(ym,"StructArrayLayout6f24");class ec extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,o,a,u)}emplace(e,i,o,a,u,d){const m=5*e;return this.float32[m+0]=i,this.float32[m+1]=o,this.float32[m+2]=a,this.float32[m+3]=u,this.float32[m+4]=d,e}}ec.prototype.bytesPerElement=20,At(ec,"StructArrayLayout5f20");class vm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,o,a,u,d,m)}emplace(e,i,o,a,u,d,m,y){const x=7*e;return this.float32[x+0]=i,this.float32[x+1]=o,this.float32[x+2]=a,this.float32[x+3]=u,this.float32[x+4]=d,this.float32[x+5]=m,this.float32[x+6]=y,e}}vm.prototype.bytesPerElement=28,At(vm,"StructArrayLayout7f28");class xm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,o,a,u,d,m,y,x,T,S)}emplace(e,i,o,a,u,d,m,y,x,T,S,I){const M=11*e;return this.float32[M+0]=i,this.float32[M+1]=o,this.float32[M+2]=a,this.float32[M+3]=u,this.float32[M+4]=d,this.float32[M+5]=m,this.float32[M+6]=y,this.float32[M+7]=x,this.float32[M+8]=T,this.float32[M+9]=S,this.float32[M+10]=I,e}}xm.prototype.bytesPerElement=44,At(xm,"StructArrayLayout11f44");class Wc extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x){const T=this.length;return this.resize(T+1),this.emplace(T,e,i,o,a,u,d,m,y,x)}emplace(e,i,o,a,u,d,m,y,x,T){const S=9*e;return this.float32[S+0]=i,this.float32[S+1]=o,this.float32[S+2]=a,this.float32[S+3]=u,this.float32[S+4]=d,this.float32[S+5]=m,this.float32[S+6]=y,this.float32[S+7]=x,this.float32[S+8]=T,e}}Wc.prototype.bytesPerElement=36,At(Wc,"StructArrayLayout9f36");class aa extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=o,e}}aa.prototype.bytesPerElement=8,At(aa,"StructArrayLayout2f8");class Ao extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a)}emplace(e,i,o,a,u){const d=6*e;return this.uint32[3*e+0]=i,this.uint16[d+2]=o,this.uint16[d+3]=a,this.uint16[d+4]=u,e}}Ao.prototype.bytesPerElement=12,At(Ao,"StructArrayLayout1ul3ui12");class _l extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}_l.prototype.bytesPerElement=2,At(_l,"StructArrayLayout1ui2");class wm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V){const N=this.length;return this.resize(N+1),this.emplace(N,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V)}emplace(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N){const $=16*e;return this.float32[$+0]=i,this.float32[$+1]=o,this.float32[$+2]=a,this.float32[$+3]=u,this.float32[$+4]=d,this.float32[$+5]=m,this.float32[$+6]=y,this.float32[$+7]=x,this.float32[$+8]=T,this.float32[$+9]=S,this.float32[$+10]=I,this.float32[$+11]=M,this.float32[$+12]=P,this.float32[$+13]=k,this.float32[$+14]=V,this.float32[$+15]=N,e}}wm.prototype.bytesPerElement=64,At(wm,"StructArrayLayout16f64");class Kd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,u,d,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,o,a,u,d,m)}emplace(e,i,o,a,u,d,m,y){const x=10*e,T=5*e;return this.uint16[x+0]=i,this.uint16[x+1]=o,this.uint16[x+2]=a,this.uint16[x+3]=u,this.float32[T+2]=d,this.float32[T+3]=m,this.float32[T+4]=y,e}}Kd.prototype.bytesPerElement=20,At(Kd,"StructArrayLayout4ui3f20");class bm extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}bm.prototype.bytesPerElement=2,At(bm,"StructArrayLayout1i2");class Jd extends An{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Jd.prototype.bytesPerElement=1,At(Jd,"StructArrayLayout1ub1");class Qd extends Ju{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]}}Qd.prototype.size=40;class Ly extends Wd{get(e){return new Qd(this,e)}}At(Ly,"CollisionBoxArray");class ep extends Ju{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}ep.prototype.size=60;class zy extends Zc{get(e){return new ep(this,e)}}At(zy,"PlacedSymbolArray");class Dy extends Ju{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 4,550 bytes, line 46
46get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Dy.prototype.size=80;class Tm extends gm{get(e){return new Dy(this,e)}}At(Tm,"SymbolInstanceArray");class tp extends za{getoffsetX(e){return this.float32[1*e+0]}}At(tp,"GlyphOffsetArray");class ky extends fl{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}At(ky,"SymbolLineVertexArray");class Sm extends Ju{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]}}Sm.prototype.size=12;class Em extends Ao{get(e){return new Sm(this,e)}}At(Em,"FeatureIndexArray");class Oy extends Yo{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}At(Oy,"FillExtrusionCentroidArray");class ip extends Ju{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]}}ip.prototype.size=6;class Qu extends Hc{get(e){return new ip(this,e)}}At(Qu,"FillExtrusionWallArray");const Fy=Ai([{name:"a_pos",components:2,type:"Int16"}],4),f1=Ai([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),By=Ai([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class zn{constructor(e=[]){this.segments=e}_prepareSegment(e,i,o,a){let u=this.segments[this.segments.length-1];return e>zn.MAX_VERTEX_ARRAY_LENGTH&&Tt(`Max vertices per segment is ${zn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>zn.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:o,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,o,a){return this._prepareSegment(e,i.length,o.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,o,a){return new zn([{vertexOffset:e,primitiveOffset:i,vertexLength:o,primitiveLength:a,vaos:{},sortKey:0}])}}function np(n,e){return 256*(n=j(Math.floor(n),0,255))+j(Math.floor(e),0,255)}zn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,At(zn,"SegmentVector");const m1=Ai([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),_1=Ai([{name:"a_pattern_b",components:4,type:"Uint16"}]),g1=Ai([{name:"a_dash",components:4,type:"Uint16"}]);class eh{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
46add(e,i,o,a){this.ids.push(Im(e)),this.positions.push(i,o,a)}eachPosition(e,i){const o=Im(e);let a=0,u=this.ids.length-1;for(;a<u;){const d=a+u>>1;this.ids[d]>=o?u=d:a=d+1}for(;this.ids[a]===o;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const o=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Am(o,a,0,o.length-1),i&&(i.add(o.buffer),i.add(a.buffer)),{ids:o,positions:a}}static deserialize(e){const i=new eh;let o;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==o&&i.uniqueIds.push(a),o=a;return i.indexed=!0,i}}function Im(n){const e=+n;return Number.isSafeInteger(e)?e:Qh(String(n))}function Am(n,e,i,o){for(;i<o;){const a=n[i+o>>1];let u=i-1,d=o+1;for(;;){do u++;while(n[u]<a);do d--;while(n[d]>a);if(u>=d)break;rp(n,u,d),rp(e,3*u,3*d),rp(e,3*u+1,3*d+1),rp(e,3*u+2,3*d+2)}d-i<o-d?(Am(n,e,i,d),i=d+1):(Am(n,e,d+1,o),o=d)}}function rp(n,e,i){const o=n[e];n[e]=n[i],n[i]=o}At(eh,"FeaturePositionMap");class Da{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,o){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class op extends Da{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}}class _r extends Da{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class la extends Da{constructor(e){super(e),this.current=[0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}}class th extends Da{constructor(e){super(e),this.current=[0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}}class sp extends Da{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3])))}}class ih extends Da{constructor(e){super(e),this.current=rn.transparent.toPremultipliedRenderColor(null)}set(e,i,o){this.fetchUniformLocation(e,i)&&(o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a)))}}const y1=new Float32Array(16);class nh extends Da{constructor(e){super(e),this.current=y1}set(e,i,o){if(this.fetchUniformLocation(e,i)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let a=1;a<16;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}}const ap=new Float32Array(9),v1=new Float32Array(4);class lp extends Da{constructor(e){super(e),this.current=v1}set(e,i,o){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}}function Cm(n){return[np(255*n.r,255*n.g),np(255*n.b,255*n.a)]}function rh(n,e,i,o,a,u,d,m){return!!n&&(n.kind==="composite"||n.kind==="source"?n.evaluate(new bn(0,{brightness:u,worldview:m}),e,i,a,o,d)==="none":n.value==="none")}class oh{constructor(e,i,o,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=o,this.context=a}setUniform(e,i,o,a,u){const d=a.constantOr(this.value);i.set(e,u,d instanceof rn?d.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):d)}getBinding(e,i){return this.type==="color"?new ih(e):new _r(e)}}class Xc{constructor(e,i){this.uniformNames=i.map(o=>`u_${o}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,o,a,u){let d=null;u!=="u_pattern"&&u!=="u_dash"||(d=this.pattern),u==="u_pattern_b"&&(d=this.patternTransition),u==="u_pixel_ratio"&&(d=this.pixelRatio),d&&i.set(e,u,d)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new sp(e):new _r(e)}}class ka{constructor(e,i,o,a){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,o,a,u,d,m,y){const x=this.paintVertexArray.length,T=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new bn(0,{brightness:d,worldview:y}),i,{},u,a,m):this.expression.kind==="constant"&&this.expression.value,S=rh(this.lutExpression,i,{},a,u,d,m,y);this.paintVertexArray.resize(e),this._setPaintValue(x,e,T,S?null:this.context.lut)}updatePaintArray(e,i,o,a,u,d,m,y){const x=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:m,worldview:y},o,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,T=rh(this.lutExpression,o,a,u,void 0,m,void 0,y);this._setPaintValue(e,i,x,T?null:this.context.lut)}
vendor: 5,846 bytes, line 46
46_setPaintValue(e,i,o,a){if(this.type==="color"){const u=Cm(o.toPremultipliedRenderColor(a));for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Oa{constructor(e,i,o,a,u,d){this.expression=e,this.uniformNames=i.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,i,o,a,u,d,m,y){const x=this.expression.evaluate(new bn(this.context.zoom,{brightness:d,worldview:y}),i,{},u,a,m),T=this.expression.evaluate(new bn(this.context.zoom+1,{brightness:d,worldview:y}),i,{},u,a,m),S=rh(this.lutExpression,i,{},a,u,d,m,y),I=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(I,e,x,T,S?null:this.context.lut)}updatePaintArray(e,i,o,a,u,d,m,y){const x=this.expression.evaluate({zoom:this.context.zoom,brightness:m,worldview:y},o,a,void 0,u),T=this.expression.evaluate({zoom:this.context.zoom+1,brightness:m,worldview:y},o,a,void 0,u),S=rh(this.lutExpression,o,a,u,void 0,m,void 0,y);this._setPaintValue(e,i,x,T,S?null:this.context.lut)}_setPaintValue(e,i,o,a,u){if(this.type==="color"){const d=Cm(o.toPremultipliedRenderColor(u)),m=Cm(o.toPremultipliedRenderColor(u));for(let y=e;y<i;y++)this.paintVertexArray.emplace(y,d[0],d[1],m[0],m[1])}else{for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,o,a);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,o,a,u){const d=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,m=j(this.expression.interpolationFactor(d,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,m)}getBinding(e,i){return new _r(e)}}class Fa{constructor(e,i,o,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(o==="array"?g1:m1).members;for(let d=0;d<i.length;++d);this.paintVertexArray=new a,this.paintTransitionVertexArray=new Ql}populatePaintArray(e,i,o,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],o)}updatePaintArray(e,i,o,a,u,d,m){this._setPaintValues(e,i,o.patterns&&o.patterns[this.layerId],d)}_setPaintValues(e,i,o,a){if(!a||!o)return;const u=a[o[0]],d=a[o[1]];if(u){if(u){const{tl:m,br:y,pixelRatio:x}=u;for(let T=e;T<i;T++)this.paintVertexArray.emplace(T,m[0],m[1],y[0],y[1],x)}if(d){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:m,br:y}=d;for(let x=e;x<i;x++)this.paintTransitionVertexArray.emplace(x,m[0],m[1],y[0],y[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,_1.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class gl{constructor(e,i,o=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const d=e.paint.get(u);if(u.endsWith("-use-theme")||!o(u)||!(d instanceof Wl&&Hu(d.property.specification)))continue;const m=w1(u,e.type),y=d.value,x=d.property.specification.type,T=!!d.property.useIntegerZoom,S=u==="line-dasharray"||u.endsWith("pattern"),I=e.paint.get(`${u}-use-theme`),M=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||I&&I.value.kind!=="constant";if(y.kind!=="constant"||M)if(y.kind==="source"||M||S){const P=Mm(u,x,"source");this.binders[u]=S?new Fa(y,m,x,P,e.id):new ka(y,m,x,P),a.push(`/a_${u}`)}else{const P=Mm(u,x,"composite");this.binders[u]=new Oa(y,m,x,T,i,P),a.push(`/z_${u}`)}else this.binders[u]=S?new Xc(y.value,m):new oh(y.value,m,x,i),a.push(`/u_${u}`);I&&(this.binders[u].lutExpression=I.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof ka||i instanceof Oa?i.maxValue:0}populatePaintArrays(e,i,o,a,u,d,m,y){for(const x in this.binders){const T=this.binders[x];T.context=this.context,(T instanceof ka||T instanceof Oa||T instanceof Fa)&&T.populatePaintArray(e,i,o,a,u,d,m,y)}}setConstantPatternPositions(e,i){for(const o in this.binders){const a=this.binders[o];a instanceof Xc&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof Fa?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,o,a,u,d,m,y,x,T){let S=!1;const I=Object.keys(e),M=I.length!==0&&!y,P=M?I:i.uniqueIds;this.context.lut=u.lut;for(const k in this.binders){const V=this.binders[k];
vendor: 4,516 bytes, line 46
46if(V.context=this.context,(V instanceof ka||V instanceof Oa||V instanceof Fa)&&V.expression&&V.expression.kind&&V.expression.kind!=="constant"&&(V.expression.isStateDependent===!0||V.expression.isLightConstant===!1)){const N=u.paint.get(k);V.expression=N.value;for(const $ of P){const q=e[$.toString()];i.eachPosition($,(Y,re,ee)=>{const ae=a.feature(Y);V.updatePaintArray(re,ee,ae,q,d,m,x,T)})}if(!M)for(const $ of o.uniqueIds){const q=e[$.toString()];o.eachPosition($,(Y,re,ee)=>{const ae=a.feature(Y);V.updatePaintArray(re,ee,ae,q,d,m,x,T)})}S=!0}}return S}defines(){const e=[];for(const i in this.binders){const o=this.binders[i];(o instanceof oh||o instanceof Xc)&&e.push(...o.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const o in this.binders){const a=this.binders[o];if(a instanceof oh||a instanceof Xc||a instanceof Oa)for(const u of a.uniformNames)i.push({name:u,property:o,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,o,a,u){for(const{name:d,property:m,binding:y}of o)this.binders[m].setUniform(e,y,u,a.get(m),d)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ka||i instanceof Oa||i instanceof Fa)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof Fa&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const o=this.binders[i];(o instanceof ka||o instanceof Oa||o instanceof Fa)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ka||i instanceof Oa||i instanceof Fa)&&i.destroy()}}}class Ds{constructor(e,i,o=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new gl(a,i,o);this.needsUpload=!1,this._featureMap=new eh,this._featureMapWithoutIds=new eh,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,o,a,u,d,m,y,x){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(e,i,a,u,d,m,y,x);i.id!==void 0?this._featureMap.add(i.id,o,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,o,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,o,a,u,d,m,y){for(const x of o)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,x,a,u,d,m||0,y)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const x1={"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":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function w1(n,e){return x1[n]||[n.replace(`${e}-`,"").replace(/-/g,"_")]}const b1={"line-pattern":{source:Io,composite:Io},"fill-pattern":{source:Io,composite:Io},"fill-extrusion-pattern":{source:Io,composite:Io},"line-dasharray":{source:Ql,composite:Ql}},T1={color:{source:aa,composite:ml},number:{source:za,composite:aa}};function Mm(n,e,i){const o=b1[n];return o&&o[i]||T1[e][i]}At(oh,"ConstantBinder"),At(Xc,"PatternConstantBinder"),At(ka,"SourceExpressionBinder"),At(Fa,"PatternCompositeBinder"),At(Oa,"CompositeExpressionBinder"),At(gl,"ProgramConfiguration",{omit:["_buffers"]}),At(Ds,"ProgramConfigurationSet");const Qr=ht/Math.PI/2,ps=5,cp=6,S1=16383,Yc=64,Pm=[Yc,32,16],fs=-Qr,ms=Qr;function tc(n,e,i,o=Qr){return i=qi(i),[n*Math.sin(i)*o,-e*o,n*Math.cos(i)*o]}function Kc(n,e,i){return tc(Math.cos(qi(n)),Math.sin(qi(n)),e,i)}const l=63710088e-1,t=2*Math.PI*l;
vendor: 6,401 bytes, line 46
46class r{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new r(J(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,o=this.lat*i,a=e.lat*i,u=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return l*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,o=i/Math.cos(Math.PI/180*this.lat);return new c({lng:this.lng-o,lat:this.lat-i},{lng:this.lng+o,lat:this.lat+i})}toEcef(e){return Kc(this.lat,this.lng,Qr+e*Qr/l)}static convert(e){if(e instanceof r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new r(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class c{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof r?new r(e.lng,e.lat):r.convert(e),this}setSouthWest(e){return this._sw=e instanceof r?new r(e.lng,e.lat):r.convert(e),this}extend(e){const i=this._sw,o=this._ne;let a,u;if(e instanceof r)a=e,u=e;else{if(!(e instanceof c))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(c.convert(e)):this.extend(r.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(r.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||o?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),o.lng=Math.max(u.lng,o.lng),o.lat=Math.max(u.lat,o.lat)):(this._sw=new r(a.lng,a.lat),this._ne=new r(u.lng,u.lat)),this}getCenter(){return new r((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new r(this.getWest(),this.getNorth())}getSouthEast(){return new r(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:o}=r.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(e){if(e)return e instanceof c?e:new c(e)}}const p=0,_=25.5;function g(n){return t*Math.cos(n*Math.PI/180)}function v(n){return(180+n)/360}function b(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function E(n,e){return n/g(e)}function C(n){return 360*n-180}function z(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function R(n,e){return n*g(z(e))}const D=85.051129;function B(n){return Math.cos(qi(j(n,-D,D)))}function O(n,e){const i=j(e,p,_),o=Math.pow(2,i);return B(n)*t/(512*o)}function G(n){return 1/Math.cos(n*Math.PI/180)}function U(n,e=0){const i=Math.exp(Math.PI*(1-(n.y+e/ht)/(1<<n.z)*2));return 80150034*i/(i*i+1)/ht/(1<<n.z)}class Z{constructor(e,i,o=0){this.x=+e,this.y=+i,this.z=+o}static fromLngLat(e,i=0){const o=r.convert(e);return new Z(v(o.lng),b(o.lat),E(i,o.lat))}toLngLat(){return new r(C(this.x),z(this.y))}toAltitude(){return R(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/t*G(z(this.y))}}function K(n,e,i,o,a,u,d,m,y){const x=(e+o)/2,T=(i+a)/2,S=new Ke(x,T);m(S),function(I,M,P,k,V,N){const $=P-V,q=k-N;return Math.abs((k-M)*$-(P-I)*q)/Math.hypot($,q)}(S.x,S.y,u.x,u.y,d.x,d.y)>=y?(K(n,e,i,x,T,u,S,m,y),K(n,x,T,o,a,S,d,m,y)):n.push(d)}function W(n,e,i){let o=n[0],a=o.x,u=o.y;e(o);const d=[o];for(let m=1;m<n.length;m++){const y=n[m],{x,y:T}=y;e(y),K(d,a,u,x,T,o,y,e,i),a=x,u=T,o=y}return d}function le(n,e,i,o){if(o(e,i)){const a=e.add(i)._mult(.5);le(n,e,a,o),le(n,a,i,o)}else n.push(i)}function ne(n,e){let i=n[0];const o=[i];for(let a=1;a<n.length;a++){const u=n[a];le(o,i,u,e),i=u}return o}const se=Math.pow(2,14)-1,ie=-se-1;function Q(n,e){const i=Math.round(n.x*e),o=Math.round(n.y*e);return n.x=j(i,ie,se),n.y=j(o,ie,se),(i<n.x||i>n.x+1||o<n.y||o>n.y+1)&&Tt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),n}function ce(n,e,i){const o=n.loadGeometry(),a=n.extent,u=ht/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const d=1<<e.z,{scale:m,x:y,y:x,projection:T}=i,S=I=>{const M=C((e.x+I.x/a)/d),P=z((e.y+I.y/a)/d),k=T.project(M,P);I.x=(k.x*m-y)*a,I.y=(k.y*m-x)*a};for(let I=0;I<o.length;I++)if(n.type!==1)o[I]=W(o[I],S,1);else{const M=[];for(const P of o[I])P.x<0||P.x>=a||P.y<0||P.y>=a||(S(P),M.push(P));o[I]=M}}for(const d of o)for(const m of d)Q(m,u);return o}function ve(n,e){return{type:n.type,id:n.id,properties:n.properties,geometry:e?ce(n):[]}}class ge{constructor(e,i,o,a,u){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=u,e.readFields(Le,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,o=[];let a,u=1,d=0,m=0,y=0;for(;e.pos<i;){if(d<=0){const x=e.readVarint();u=7&x,d=x>>3}if(d--,u===1||u===2)m+=e.readSVarint(),y+=e.readSVarint(),u===1&&(a&&o.push(a),a=[]),a&&a.push(new Ke(m,y));else{if(u!==7)throw new Error(`unknown command ${u}`);a&&a.push(a[0].clone())}}return a&&o.push(a),o}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let o=1,a=0,u=0,d=0,m=1/0,y=-1/0,x=1/0,T=-1/0;for(;e.pos<i;){if(a<=0){const S=e.readVarint();o=7&S,a=S>>3}if(a--,o===1||o===2)u+=e.readSVarint(),d+=e.readSVarint(),u<m&&(m=u),u>y&&(y=u),d<x&&(x=d),d>T&&(T=d);else if(o!==7)throw new Error(`unknown command ${o}`)}return[m,x,y,T]}toGeoJSON(e,i,o){const a=this.extent*Math.pow(2,o),u=this.extent*e,d=this.extent*i,m=this.loadGeometry();function y(I){return[360*(I.x+u)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(I.y+d)/a)*Math.PI))-90]}function x(I){return I.map(y)}let T;
46if(this.type===1){const I=[];for(const P of m)I.push(P[0]);const M=x(I);T=I.length===1?{type:"Point",coordinates:M[0]}:{type:"MultiPoint",coordinates:M}}else if(this.type===2){const I=m.map(x);T=I.length===1?{type:"LineString",coordinates:I[0]}:{type:"MultiLineString",coordinates:I}}else{if(this.type!==3)throw new Error("unknown feature type");{const I=function(P){const k=P.length;if(k<=1)return[P];const V=[];let N,$;for(let q=0;q<k;q++){const Y=ze(P[q]);Y!==0&&($===void 0&&($=Y<0),$===Y<0?(N&&V.push(N),N=[P[q]]):N&&N.push(P[q]))}return N&&V.push(N),V}(m),M=[];for(const P of I)M.push(P.map(x));T=M.length===1?{type:"Polygon",coordinates:M[0]}:{type:"MultiPolygon",coordinates:M}}}const S={type:"Feature",geometry:T,properties:this.properties};return this.id!=null&&(S.id=this.id),S}}function Le(n,e,i){n===1?e.id=i.readVarint():n===2?function(o,a){const u=o.readVarint()+o.pos;for(;o.pos<u;){const d=a._keys[o.readVarint()],m=a._values[o.readVarint()];a.properties[d]=m}}(i,e):n===3?e.type=i.readVarint():n===4&&(e._geometry=i.pos)}function ze(n){let e=0;for(let i,o,a=0,u=n.length,d=u-1;a<u;d=a++)i=n[a],o=n[d],e+=(o.x-i.x)*(i.y+o.y);return e}ge.types=["Unknown","Point","LineString","Polygon"];class je{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(nt,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new ge(this._pbf,i,this.extent,this._keys,this._values)}}function nt(n,e,i){n===15?e.version=i.readVarint():n===1?e.name=i.readString():n===5?e.extent=i.readVarint():n===2?e._features.push(i.pos):n===3?e._keys.push(i.readString()):n===4&&e._values.push(function(o){let a=null;const u=o.readVarint()+o.pos;for(;o.pos<u;){const d=o.readVarint()>>3;a=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a}(i))}class Ae{constructor(e,i){this.layers=e.readFields(fe,{},i)}}function fe(n,e,i){if(n===3){const o=new je(i,i.readVarint()+i.pos);o.length&&(e[o.name]=o)}}const Oe="3d_elevation_id",Me="level";class Ze{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,o){return this.get(e,!0,i,o)}optional(e,i,o){return this.get(e,!1,i,o)}success(){return this._valid}get(e,i,o,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?o(a?a(u):u):i&&(this._valid=!1),this}}class ft{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,o){return this.featureFunc(e,i,o)}parseVertex(e,i,o){return this.vertexFunc(e,i,o)}}const bt=new ft((n,e,i)=>n.reset(e).require(Oe,o=>{i.id=o}).optional("fixed_height_relative",o=>{i.constantHeight=o},rt.decodeRelativeHeight).geometry(o=>{i.bounds=o},Aa).success(),(n,e,i)=>n.reset(e).require(Oe,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height_relative",o=>{i.height=o},rt.decodeRelativeHeight).geometry(o=>{i.position=o},rt.getPoint).success()),ut=new ft((n,e,i)=>n.reset(e).require(Oe,o=>{i.id=o}).optional("fixed_height",o=>{i.constantHeight=o},rt.decodeMetricHeight).geometry(o=>{i.bounds=o},Aa).success(),(n,e,i)=>n.reset(e).require(Oe,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height",o=>{i.height=o},rt.decodeMetricHeight).geometry(o=>{i.position=o},rt.getPoint).success());class rt{static getPoint(e){return Gr(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?ut:void 0:bt}static parse(e){const i=[],o=[],a=e.length,u=new Ze;for(let d=0;d<a;d++){const m=e.feature(d),y=m.properties.version,x=rt.getVersionSchema(y);if(x===void 0){Tt(`Unknown elevation feature version number ${y||"(unknown)"}`);continue}const T=m.properties.type;if(!T)continue;const S=ge.types[m.type];if(S==="Point"&&T==="curve_point"){const I={};x.parseVertex(u,m,I)&&i.push(I)}else if(S==="Polygon"&&T==="curve_meta"){const I={};x.parseFeature(u,m,I)&&o.push(I)}}return{vertices:i,features:o}}}class Lt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Wt(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return o[0]=this.pos[0]+this.dir[0]*u,o[1]=this.pos[1]+this.dir[1]*u,!0}}class Mt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=vn(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return o[0]=this.pos[0]+this.dir[0]*u,o[1]=this.pos[1]+this.dir[1]*u,o[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,o){if(function(M,P){var k=M[0],V=M[1],N=M[2],$=P[0],q=P[1],Y=P[2];return Math.abs(k-$)<=de*Math.max(1,Math.abs(k),Math.abs($))&&Math.abs(V-q)<=de*Math.max(1,Math.abs(V),Math.abs(q))&&Math.abs(N-Y)<=de*Math.max(1,Math.abs(N),Math.abs(Y))}(this.pos,e)||i===0)return o[0]=o[1]=o[2]=0,!1;const[a,u,d]=this.dir,m=this.pos[0]-e[0],y=this.pos[1]-e[1],x=this.pos[2]-e[2],T=a*a+u*u+d*d,S=2*(m*a+y*u+x*d),I=S*S-4*T*(m*m+y*y+x*x-i*i);if(I<0){const M=Math.max(-S/2,0),P=m+a*M,k=y+u*M,V=x+d*M,N=Math.hypot(P,k,V);return o[0]=P*i/N,o[1]=k*i/N,o[2]=V*i/N,!1}{const M=(-S-Math.sqrt(I))/(2*T);if(M<0){const P=Math.hypot(m,y,x);return o[0]=m*i/P,o[1]=y*i/P,o[2]=x*i/P,!1}return o[0]=m+a*M,o[1]=y+u*M,o[2]=x+d*M,!0}}}class xt{constructor(e,i,o,a,u){this.TL=e,this.TR=i,this.BR=o,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,o){const a=[-1,1,1],u=[1,1,1],d=[1,-1,1],m=[-1,-1,1],y=qn(a,a,e),x=qn(u,u,e),T=qn(d,d,e),S=qn(m,m,e);return new xt(y,x,T,S,i/o)}}function St(n,e,i){let o=1/0,a=-1/0;const u=[];for(const d of n){rr(u,d,e);const m=vn(u,i);o=Math.min(o,m),a=Math.max(a,m)}return[o,a]}function Ht(n,e){let i=!0;for(let o=0;o<n.planes.length;o++){const a=n.planes[o];let u=0;for(let d=0;d<e.length;d++)u+=+(vn(a,e[d])+a[3]>=0);if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function ci(n,e){for(const i of n.projections){const o=St(e,n.points[0],i.axis);if(i.projection[1]<o[0]||i.projection[0]>o[1])return 0}return 1}function Li(n,e){let i=0;const o=[0,0,0,0];for(let d=0;d<n.length;
vendor: 4,553 bytes, line 46
46d++)o[0]=n[d][0],o[1]=n[d][1],o[2]=n[d][2],o[3]=1,(a=o)[0]*(u=e)[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3]>=0&&i++;var a,u;return i}class Yi{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=zt.fromPoints(this.points),this.projections=[],this.frustumEdges=[rr([],this.points[2],this.points[3]),rr([],this.points[0],this.points[3]),rr([],this.points[4],this.points[0]),rr([],this.points[5],this.points[1]),rr([],this.points[6],this.points[2]),rr([],this.points[7],this.points[3])];for(const o of this.frustumEdges){const a=[0,-o[2],o[1]],u=[o[2],0,-o[0]];this.projections.push({axis:a,projection:St(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:St(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,o,a){const u=Math.pow(2,o),d=[[-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(x=>{const T=Ur([],x,e),S=1/T[3]/i*u;return(I=T)[0]=(M=T)[0]*(P=[S,S,a?1/T[3]:S,S])[0],I[1]=M[1]*P[1],I[2]=M[2]*P[2],I[3]=M[3]*P[3],I;var I,M,P}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(x=>{const T=un([],nr([],rr([],d[x[0]],d[x[1]]),rr([],d[x[2]],d[x[1]]))),S=-vn(T,d[x[1]]);return T.concat(S)}),y=[];for(let x=0;x<d.length;x++)y.push([d[x][0],d[x][1],d[x][2]]);return new Yi(y,m)}intersectsPrecise(e,i,o){for(let a=0;a<i.length;a++)if(!Li(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Li(e,this.planes[a]))return 0;for(const a of o)for(const u of this.frustumEdges){const d=nr([],a,u),m=Hn(d);if(m===0)continue;ai(d,d,1/m);const y=St(this.points,this.points[0],d),x=St(e,this.points[0],d);if(y[0]>x[1]||x[0]>y[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const o=i[3];if(vn([i[0],i[1],i[2]],e)+o<0)return!1}return!0}}class zt{static fromPoints(e){const i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(const a of e)qe(i,i,a),ti(o,o,a);return new zt(i,o)}static fromTileIdAndHeight(e,i,o){const a=1<<e.canonical.z,u=e.canonical.x,d=e.canonical.y;return new zt([u/a,d/a,i],[(u+1)/a,(d+1)/a,o])}static applyTransform(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)qn(o[a],o[a],i);return zt.fromPoints(o)}static applyTransformFast(e,i){const o=[i[12],i[13],i[14]],a=[...o];for(let u=0;u<3;u++)for(let d=0;d<3;d++){const m=i[4*d+u],y=m*e.min[d],x=m*e.max[d];o[u]+=Math.min(y,x),a[u]+=Math.max(y,x)}return new zt(o,a)}static projectAabbCorners(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)qn(o[a],o[a],i);return o}constructor(e,i){this.min=e,this.max=i,this.center=ai([],Gt([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],o=Cr(this.min),a=Cr(this.max);for(let u=0;u<i.length;u++)o[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new zt(o,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Ht(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Ht(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?ci(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?ci(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}At(zt,"Aabb");class Zi{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,o=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;
vendor: 5,710 bytes, line 46
46return[new Ke(Math.trunc(e.position[0]+o*u),Math.trunc(e.position[1]+a*u)),new Ke(Math.trunc(e.position[0]-o*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class li{constructor(e,i,o,a,u,d){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Qn(),Qn(),Qn(),Qn(),Qn(),Qn(),Qn()],this.id=e,this.heightRange={min:o,max:o},this.safeArea=i,this.constantHeight=o,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(m=>{return m.a<this.vertices.length&&m.b<this.vertices.length&&!((y=this.vertices[m.a].position)[0]===(x=this.vertices[m.b].position)[0]&&y[1]===x[1]);var y,x}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const m of this.vertices)this.vertexProps.push({dir:Gr(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,m.height),this.heightRange.max=Math.max(this.heightRange.max,m.height);for(const m of this.edges){const y=this.vertices[m.a].position,x=this.vertices[m.b].position,T=ss(Qn(),x,y),S=Ho(T),I=Do(Qn(),T,1/S);this.edgeProps.push({vec:T,dir:I,len:S});const M=this.vertexProps[m.a].dir,P=this.vertexProps[m.b].dir;Xs(M,M,I),Xs(P,P,I)}for(const m of this.vertexProps)m.dir[0]===0&&m.dir[1]===0||Ll(m.dir,m.dir);this.tessellate(d)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[o,a]=i;return Qt(this.vertices[this.edges[o].a].height,this.vertices[this.edges[o].b].height,a)}computeSlopeNormal(e,i){const o=this.getClosestEdge(e);if(!o)return ri(0,0,1);const a=o[0],u=this.edges[a],d=this.edgeProps[a].vec,m=ri(d[0],d[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),y=ri(m[1],-m[0],0);nr(y,y,m);const x=Hn(y);return x>0?ai(y,y,1/x):Ei(y,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,o=Number.POSITIVE_INFINITY,a=0;const[u,d,m,y,x,T,S]=this._tmpVec2;Ws(S,e.x,e.y);const I=new Lt(S,null);for(let M=0;M<this.edges.length;M++){const P=this.edges[M],k=this.edgeProps[M].dir;I.dir=k;const V=this.vertices[P.a].position,N=this.vertices[P.b].position,$=I.intersectsPlane(V,this.vertexProps[P.a].dir,u),q=I.intersectsPlane(N,this.vertexProps[P.b].dir,d);if(!$||!q)continue;ss(m,d,u),ss(y,S,u);const Y=Wt(m,m),re=Y>0?Wt(y,m)/Y:0,ee=j(re,0,1),ae=Math.abs((re-ee)*this.edgeProps[M].len);ss(x,S,V),Ws(T,k[1],-k[0]);const he=ae+Math.abs(Wt(x,T));he<o&&(i=M,o=he,a=ee)}return[i,a]}tessellate(e){const i=Ii(),o=Ii(),a=Ii(),u=Ii();for(let d=this.edges.length-1;d>=0;--d){const m=this.edges[d].a,y=this.edges[d].b,{position:x,height:T,extent:S}=this.vertices[m],{position:I,height:M,extent:P}=this.vertices[y],k=this.vertexProps[m].dir,V=this.vertexProps[y].dir;if(Ei(i,x[0]/e,x[1]/e,T),Ei(o,I[0]/e,I[1]/e,M),Ei(a,k[1],-k[0],0),ai(a,a,S),Ei(u,V[1],-V[0],0),ai(u,u,P),this.distSqLines(ri(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),ri(o[0]-.5*u[0],o[1]-.5*u[1],o[2]-.5*u[2]),ri(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),ri(o[0]+.5*u[0],o[1]+.5*u[1],o[2]+.5*u[2]))<=.0025000000000000005)continue;const N=this.vertices.length,$=Xs(Qn(),x,I);this.vertices.push({position:Do($,$,.5),height:.5*(T+M),extent:.5*(S+P)});const q=Xs(Qn(),k,V);this.vertexProps.push({dir:Ll(q,q)}),this.edges.splice(d,1),this.edgeProps.splice(d,1),this.edges.push({a:m,b:N}),this.edges.push({a:N,b:y});const Y=ss(Qn(),this.vertices[N].position,x),re=Ho(Y),ee={vec:Y,dir:Do(Qn(),Y,1/re),len:re};this.edgeProps.push(ee),this.edgeProps.push(ee)}}distSqLines(e,i,o,a){const u=Ti(Ii(),i,e),d=Ti(Ii(),a,o),m=Ti(Ii(),e,o),y=vn(u,u),x=vn(u,d),T=vn(u,m),S=vn(d,d),I=vn(d,m),M=y*S-x*x;if(M===0)return Kn(oo(u,o,a,vn(m,d)/vn(d,d)),e);const P=(y*I-x*T)/M;return Kn(oo(u,e,i,(x*I-T*S)/M),oo(d,o,a,P))}}class Qi{static parseFrom(e,i){const o=rt.parse(e);if(!o)return[];let{vertices:a,features:u}=o;const d=1/U(i);u.sort((T,S)=>T.id-S.id),a.sort((T,S)=>T.id-S.id||T.idx-S.idx),a=a.filter((T,S,I)=>S===I.findIndex(M=>M.id===T.id&&M.idx===T.idx));const m=new Array;let y=0;const x=a.length;for(const T of u){if(T.constantHeight){m.push(new li(T.id,T.bounds,T.constantHeight));continue}for(;y!==x&&a[y].id<T.id;)y++;if(y===x||a[y].id!==T.id)continue;const S=new Array,I=new Array,M=y;for(;y!==x&&a[y].id===T.id;){const P=a[y];if(S.push({position:P.position,height:P.height,extent:P.extent}),y!==M&&a[y-1].idx===P.idx-1){const k=y-M;I.push({a:k-1,b:k})}y++}m.push(new li(T.id,T.bounds,void 0,S,I,d))}return m}static getElevationFeature(e,i){if(!i)return;const o=+e.properties[Oe];return Number.isNaN(o)?void 0:i.find(a=>a.id===o)}}class cn{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*ht,this.yOffset=(e.y*this.zScale-i.y)*ht)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,o){const a=this.constantElevation(i,o);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),o))}computeBiasedHeight(e,i){return i<=0?e:e+i*H(0,i,e>=0?e:Math.abs(.5*e))}}At(li,"ElevationFeature");class on{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new fl,this.indexArray=new mr,this.segments=new zn,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>
46i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new za),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){const u=this.layers[0],d=[];let m=null;u.type==="circle"&&(m=u.layout.get("circle-sort-key"));for(const{feature:x,id:T,index:S,sourceLayerIndex:I}of e){const M=this.layers[0]._featureFilter.needGeometry,P=ve(x,M);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),P,o))continue;const k=m?m.evaluate(P,{},o):void 0,V={id:T,properties:x.properties,type:x.type,sourceLayerIndex:I,index:S,geometry:M?P.geometry:ce(x,o,a),patterns:{},sortKey:k};d.push(V)}m&&d.sort((x,T)=>x.sortKey-T.sortKey);let y=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new qd,y=a.projection);for(const x of d){const{geometry:T,index:S,sourceLayerIndex:I}=x,M=e[S].feature;this.addFeature(x,T,S,i.availableImages,o,y,i.brightness,i.elevationFeatures),i.featureIndex.insert(M,T,S,I,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,o,a,u,d,m){this.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,By.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,f1.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,o,a,u,d,m,y){let x;this.elevationMode!=="none"&&(x=Qi.getElevationFeature(e,y));for(const T of i)for(const S of T){const I=S.x,M=S.y;if(I<0||I>=ht||M<0||M>=ht)continue;if(d){const V=d.projectTilePoint(I,M,u),N=d.upVector(u,I,M);this.addGlobeExtVertex(V,N),this.addGlobeExtVertex(V,N),this.addGlobeExtVertex(V,N),this.addGlobeExtVertex(V,N)}const P=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),k=P.vertexLength;if(this.addCircleVertex(I,M,-1,-1),this.addCircleVertex(I,M,1,-1),this.addCircleVertex(I,M,1,1),this.addCircleVertex(I,M,-1,1),this.elevationMode!=="none"){const V=x?x.pointElevation(new Ke(I,M)):0;this.hasElevation=this.hasElevation||V!==0;for(let N=0;N<4;N++)this.elevatedLayoutVertexArray.emplaceBack(V)}this.indexArray.emplaceBack(k,k+1,k+2),this.indexArray.emplaceBack(k,k+2,k+3),P.vertexLength+=4,P.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},a,u,m,void 0,this.worldview)}addCircleVertex(e,i,o,a){this.layoutVertexArray.emplaceBack(2*e+(o+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function Hi(n,e){for(let i=0;i<n.length;i++)if(fn(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(fn(n,e[i]))return!0;return!!Cn(n,e)}function _i(n,e,i){return!!fn(n,e)||!!En(e,n,i)}function Ji(n,e){if(n.length===1)return Dn(e,n[0]);for(let i=0;i<e.length;i++){const o=e[i];for(let a=0;a<o.length;a++)if(fn(n,o[a]))return!0}for(let i=0;i<n.length;i++)if(Dn(e,n[i]))return!0;for(let i=0;i<e.length;i++)if(Cn(n,e[i]))return!0;return!1}function Nn(n,e,i){if(n.length>1){if(Cn(n,e))return!0;for(let o=0;o<e.length;o++)if(En(e[o],n,i))return!0}for(let o=0;o<n.length;o++)if(En(n[o],e,i))return!0;return!1}function Cn(n,e){if(n.length===0||e.length===0)return!1;for(let i=0;i<n.length-1;i++){const o=n[i],a=n[i+1];for(let u=0;u<e.length-1;u++)if(en(o,a,e[u],e[u+1]))return!0}return!1}function en(n,e,i,o){return mi(n,i,o)!==mi(e,i,o)&&mi(n,e,i)!==mi(n,e,o)}function Ni(n,e,i){return(n.x-i.x)*(e.y-i.y)-(n.y-i.y)*(e.x-i.x)}function gi(n,e,i,o){const a=Ni(n,e,o),u=Ni(n,e,i);if(Math.sign(a)===Math.sign(u))return;const d=Ni(i,o,n),m=d+u-a;return Math.sign(d)!==Math.sign(m)?[d/(d-m),u/(u-a)]:void 0}function En(n,e,i){const o=i*i;if(e.length===1)return n.distSqr(e[0])<o;for(let a=1;a<e.length;a++)if(Xn(n,e[a-1],e[a])<o)return!0;return!1}function Xn(n,e,i){const o=e.distSqr(i);if(o===0)return n.distSqr(e);const a=((n.x-e.x)*(i.x-e.x)+(n.y-e.y)*(i.y-e.y))/o;return n.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Dn(n,e){let i,o,a,u=!1;for(let d=0;d<n.length;d++){i=n[d];for(let m=0,y=i.length-1;m<i.length;y=m++)o=i[m],a=i[y],o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(u=!u)}return u}function fn(n,e){let i=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){const u=n[o],d=n[a];u.y>e.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(i=!i)}return i}function yo(n,e,i,o,a){for(const d of n)if(e<=d.x&&i<=d.y&&o>=d.x&&a>=d.y)return!0;const u=[new Ke(e,i),new Ke(e,a),new Ke(o,a),new Ke(o,i)];if(n.length>2){for(const d of u)if(fn(n,d))return!0}for(let d=0;d<n.length-1;d++)if(Zr(n[d],n[d+1],u))return!0;return!1}function Zr(n,e,i){const o=i[0],a=i[2];if(n.x<o.x&&e.x<o.x||n.x>a.x&&e.x>a.x||n.y<o.y&&e.y<o.y||n.y>a.y&&e.y>a.y)return!1;const u=mi(n,e,i[0]);return u!==mi(n,e,i[1])||u!==mi(n,e,i[2])||u!==mi(n,e,i[3])}function gr(n,e,i,o,a,u){let d=e.y-n.y,m=n.x-e.x;if(u=u||0){const y=d*d+m*m;if(y===0)return!0;const x=Math.sqrt(y);d/=x,m/=x}return!((i.x-n.x)*d+(i.y-n.y)*m-u<0||(o.x-n.x)*d+(o.y-n.y)*m-u<0||(a.x-n.x)*d+(a.y-n.y)*m-u<0)}function eo(n,e,i,o,a,u,d){return!(gr(n,e,o,a,u,d)||gr(e,i,o,a,u,d)||gr(i,n,o,a,u,d)||gr(o,a,n,e,i,d)||gr(a,u,n,e,i,d)||gr(u,o,n,e,i,d))}function to(n,e,i){const o=e.paint.get(n).value;return o.kind==="constant"?o.value:i.programConfigurations.get(e.id).getMaxValue(n)}function $r(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Ko(n,e,i,o,a){if(!e[0]&&!e[1])return n;const u=Ke.convert(e)._mult(a);i==="viewport"&&u._rotate(-o);const d=[];for(let m=0;m<n.length;m++)d.push(n[m].sub(u));return d}function _s(n,e,i,o){const a=Ke.convert(n)._mult(o);return e==="viewport"&&a._rotate(-i),a}let Co,Gn;function er(n,e,i){var o=2*Math.PI*6378137/256/Math.pow(2,i);return[n*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}At(on,"CircleBucket",{omit:["layers"]});class mn{constructor(e,i,o){this.z=e,this.x=i,this.y=o,this.key=kn(0,e,e,i,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const o=function(u,d,m){var y=er(256*u,256*(d=Math.pow(2,m)-d-1),m),x=er(256*(u+1),256*(d+1),m);
vendor: 5,802 bytes, line 46
46return y[0]+","+y[1]+","+x[0]+","+x[1]}(this.x,this.y,this.z),a=function(u,d,m){let y,x="";for(let T=u;T>0;T--)y=1<<T-1,x+=(d&y?1:0)+(m&y?2:0);return x}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",o)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sr{constructor(e,i){this.wrap=e,this.canonical=i,this.key=kn(e,i.z,i.z,i.x,i.y)}}class Vn{constructor(e,i,o,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new mn(o,+a,+u),this.key=i===0&&e===o?this.canonical.key:kn(i,e,o,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Vn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Vn(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return kn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const o=this.canonical.z-e;return kn(this.wrap*+i,e,e,this.canonical.x>>o,this.canonical.y>>o)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Vn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,o=2*this.canonical.x,a=2*this.canonical.y;return[new Vn(i,this.wrap,i,o,a),new Vn(i,this.wrap,i,o+1,a),new Vn(i,this.wrap,i,o,a+1),new Vn(i,this.wrap,i,o+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Vn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Vn(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new sr(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function kn(n,e,i,o,a){const u=1<<Math.min(i,22);let d=u*(a%u)+o%u;return n&&i<22&&(d+=u*u*((n<0?-2*n-1:2*n)%(1<<2*(22-i)))),16*(32*d+i)+(e-i)}const gs=[n=>{let e=n.canonical.x-1,i=n.wrap;return e<0&&(e=(1<<n.canonical.z)-1,i--),new Vn(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>{let e=n.canonical.x+1,i=n.wrap;return e===1<<n.canonical.z&&(e=0,i++),new Vn(n.overscaledZ,i,n.canonical.z,e,n.canonical.y)},n=>new Vn(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,(n.canonical.y===0?1<<n.canonical.z:n.canonical.y)-1),n=>new Vn(n.overscaledZ,n.wrap,n.canonical.z,n.canonical.x,n.canonical.y===(1<<n.canonical.z)-1?0:n.canonical.y+1)];At(mn,"CanonicalTileID"),At(Vn,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const sh=Ai([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:ks}=sh,ah=Ai([{name:"a_pos_3",components:3,type:"Int16"}]);var Jc=Ai([{name:"a_pos",type:"Int16",components:2}]);function ca(n){return n*Qr/l}const Ba=[new zt([fs,fs,fs],[ms,ms,ms]),new zt([fs,fs,fs],[0,0,ms]),new zt([0,fs,fs],[ms,0,ms]),new zt([fs,0,fs],[0,ms,ms]),new zt([0,0,fs],[ms,ms,ms])];function Qc(n,e,i,o=!0){const a=ai([],n._camera.position,n.worldSize),u=[e,i,1,1];Ur(u,u,n.pixelMatrixInverse),$s(u,u,1/u[3]);const d=un([],rr([],u,a)),m=n.globeMatrix,y=[m[12],m[13],m[14]],x=rr([],y,a),T=Hn(x),S=un([],x),I=n.worldSize/(2*Math.PI),M=vn(S,d),P=Math.asin(I/T);if(P<Math.acos(M)){if(!o)return null;const De=[],xe=[];ai(De,d,T/M),un(xe,rr(xe,De,x)),un(d,Gt(d,x,ai(d,xe,Math.tan(P)*T)))}const k=[];new Mt(a,d).closestPointOnSphere(y,I,k);const V=un([],Zn(m,0)),N=un([],Zn(m,1)),$=un([],Zn(m,2)),q=vn(V,k),Y=vn(N,k),re=vn($,k),ee=ao(Math.asin(-Y/I));let ae=ao(Math.atan2(q,re));ae=n.center.lng+function(De,xe){const Be=(xe-De+180)%360-180;return Be<-180?Be+360:Be}(n.center.lng,ae);const he=v(ae),me=j(b(ee),0,1);return new Z(he,me)}class yl{constructor(e,i,o){this.a=rr([],e,o),this.b=rr([],i,o),this.center=o;const a=un([],this.a),u=un([],this.b);this.angle=Math.acos(vn(a,u))}}function Na(n,e){if(n.angle===0)return null;let i;return i=n.a[e]===0?1/n.angle*.5*Math.PI:1/n.angle*Math.atan(n.b[e]/n.a[e]/Math.sin(n.angle)-1/Math.tan(n.angle)),i<0||i>1?null:function(o,a,u,d){const m=Math.sin(u);return o*(Math.sin((1-d)*u)/m)+a*(Math.sin(d*u)/m)}(n.a[e],n.b[e],n.angle,j(i,0,1))+n.center[e]}function Os(n){if(n.z<=1)return Ba[n.z+2*n.y+n.x];const e=E1(Ny(n));return zt.fromPoints(e)}function Va(n,e,i){return ai(n,n,1-i),Si(n,n,e,i)}function yS(n,e,i){for(const o of n)qn(o,o,e),ai(o,o,i)}function vS(n,e,i,o){const a=e/n.worldSize,u=n.globeMatrix;if(i.z<=1){const me=Os(i).getCorners();return yS(me,u,a),zt.fromPoints(me)}const d=Ny(i,o),m=E1(d,Qr+ca(n._tileCoverLift));yS(m,u,a);const y=Number.MAX_VALUE,x=[-y,-y,-y],T=[y,y,y];if(d.contains(n.center)){for(const xe of m)qe(T,T,xe),ti(x,x,xe);x[2]=0;const me=n.point,De=[me.x*a,me.y*a,0];return qe(T,T,De),ti(x,x,De),new zt(T,x)}if(n._tileCoverLift>0){for(const me of m)qe(T,T,me),ti(x,x,me);return new zt(T,x)}const S=[u[12]*a,u[13]*a,u[14]*a],I=d.getCenter(),M=j(n.center.lat,-D,D),P=j(I.lat,-D,D),k=v(n.center.lng),V=b(M);let N=k-v(I.lng);const $=V-b(P);N>.5?N-=1:N<-.5&&(N+=1);let q=0;Math.abs(N)>Math.abs($)?q=N>=0?1:3:(q=$>=0?0:2,Si(S,S,[u[4]*a,u[5]*a,u[6]*a],-Math.sin(qi($>
vendor: 5,827 bytes, line 46
46=0?d.getSouth():d.getNorth()))*Qr));const Y=m[q],re=m[(q+1)%4],ee=new yl(Y,re,S),ae=[Na(ee,0)||Y[0],Na(ee,1)||Y[1],Na(ee,2)||Y[2]],he=eu(n.zoom);if(he>0){const me=function({x:xe,y:Be,z:Ge},$e,Je,et,We){const Xe=1/(1<<Ge);let Fe=xe*Xe,ke=Fe+Xe,Ye=Be*Xe,pt=Ye+Xe,ot=0;const Ot=(Fe+ke)/2-et;return Ot>.5?ot=-1:Ot<-.5&&(ot=1),Fe=((Fe+ot)*$e-(et*=$e))*Je+et,ke=((ke+ot)*$e-et)*Je+et,Ye=(Ye*$e-(We*=$e))*Je+We,pt=(pt*$e-We)*Je+We,[[Fe,pt,0],[ke,pt,0],[ke,Ye,0],[Fe,Ye,0]]}(i,e,n._pixelsPerMercatorPixel,k,V);for(let xe=0;xe<m.length;xe++)Va(m[xe],me[xe],he);const De=Gt([],me[q],me[(q+1)%4]);ai(De,De,.5),Va(ae,De,he)}for(const me of m)qe(T,T,me),ti(x,x,me);return T[2]=Math.min(Y[2],re[2]),qe(T,T,ae),ti(x,x,ae),new zt(T,x)}function Ny({x:n,y:e,z:i},o=!1){const a=1/(1<<i),u=new r(C(n*a),e===(1<<i)-1&&o?-90:z((e+1)*a)),d=new r(C((n+1)*a),e===0&&o?90:z(e*a));return new c(u,d)}function E1(n,e=Qr){const i=qi(n.getNorth()),o=qi(n.getSouth()),a=Math.cos(i),u=Math.cos(o),d=Math.sin(i),m=Math.sin(o),y=n.getWest(),x=n.getEast();return[tc(u,m,y,e),tc(u,m,x,e),tc(a,d,x,e),tc(a,d,y,e)]}function Rm(n,e,i,o){const a=1<<i.z,u=(n/ht+i.x)/a;return Kc(z((e/ht+i.y)/a),C(u),o)}function Vy({min:n,max:e}){return S1/Math.max(e[0]-n[0],e[1]-n[1],e[2]-n[2])}const xS=new Float64Array(16);function jy(n){const e=Vy(n),i=si(xS,[e,e,e]);return Ce(i,i,Or([],n.min))}function I1(n){const e=(o=n.min,(i=xS)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=o[0],i[13]=o[1],i[14]=o[2],i[15]=1,i);var i,o;const a=1/Vy(n);return dt(e,e,[a,a,a])}function A1(n){const e=ht/(2*Math.PI);return n/(2*Math.PI)/e}function wS(n,e){return ht/(512*Math.pow(2,n))*Vy(Os(e))}function bS(n,e,i,o,a){const u=A1(i),d=[n,e,-i/(2*Math.PI)],m=Ft(new Float64Array(16));return Ce(m,m,d),dt(m,m,[u,u,u]),Vt(m,m,qi(-a)),jt(m,m,qi(-o)),m}function eu(n){return H(ps,cp,n)}function TS(n,e){const i=Kc(e.lat,e.lng),o=function(P){const k=Kc(P._center.lat,P._center.lng);let V=nr([],ri(0,1,0),k);const N=ji([],-P.angle,k);V=qn(V,V,N),ji(N,-P._pitch,V);const $=un([],k);return ai($,$,ca(P.cameraToCenterDistance/P.pixelsPerMeter)),qn($,$,N),Gt([],k,$)}(n);return d=(a=Ti([],o,i))[0],m=a[1],y=a[2],x=(u=i)[0],T=u[1],S=u[2],M=(I=Math.sqrt((d*d+m*m+y*y)*(x*x+T*T+S*S)))&&vn(a,u)/I,Math.acos(Math.min(Math.max(M,-1),1));var a,u,d,m,y,x,T,S,I,M}function C1(n,e){return TS(n,e)>Math.PI/2*1.01}const SS=qi(85),wR=Math.cos(SS),bR=Math.sin(SS),TR=mt(),ES=n=>{const e=[];return n.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),n.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function IS(n,e,i,o,a,u,d,m,y){if(u&&n.queryGeometry.isAboveHorizon)return!1;u&&(y*=n.pixelToTileUnitsFactor);const x=n.tileID.canonical,T=i.projection.upVectorScale(x,i.center.lat,i.worldSize).metersToTile;for(const S of e)for(const I of S){const M=I.add(m),P=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(M.x,M.y,!0):0,k=i.projection.projectTilePoint(M.x,M.y,x);if(P>0){const q=i.projection.upVector(x,M.x,M.y);k.x+=q[0]*T*P,k.y+=q[1]*T*P,k.z+=q[2]*T*P}const V=u?M:SR(k.x,k.y,k.z,o),N=u?n.tilespaceRays.map(q=>IR(q,P)):n.queryGeometry.screenGeometry,$=Ur([],[k.x,k.y,k.z,1],o);if(!d&&u?y*=$[3]/i.cameraToCenterDistance:d&&!u&&(y*=i.cameraToCenterDistance/$[3]),u){const q=z((I.y/ht+x.y)/(1<<x.z));y/=i.projection.pixelsPerMeter(q,1)/E(1,q)}if(_i(N,V,y))return!0}return!1}function SR(n,e,i,o){const a=Ur([],[n,e,i,1],o);return new Ke(a[0]/a[3],a[1]/a[3])}const AS=ri(0,0,0),ER=ri(0,0,1);function IR(n,e){const i=Ii();return AS[2]=e,n.intersectsPlane(AS,ER,i),new Ke(i[0],i[1])}class CS extends on{}let MS,PS,RS,LS;function zS(n,{width:e,height:i},o,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*o)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*o);return n.width=e,n.height=i,n.data=a,n}function DS(n,e,i){const{width:o,height:a}=e;o===n.width&&a===n.height||(M1(n,e,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,o),height:Math.min(n.height,a)},i,null),n.width=o,n.height=a,n.data=e.data)}function M1(n,e,i,o,a,u,d,m){if(a.width===0||a.height===0)return e;if(a.width>n.width||a.height>n.height||i.x>n.width-a.width||i.y>n.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||o.x>e.width-a.width||o.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const y=n.data,x=e.data,T=u===4&&m;for(let S=0;S<a.height;S++){const I=((i.y+S)*n.width+i.x)*u,M=((o.y+S)*e.width+o.x)*u;if(T)for(let P=0;P<a.width;P++){const k=I+P*u+3,V=M+P*u;x[V+0]=255,x[V+1]=255,x[V+2]=255,x[V+3]=y[k]}else if(d)for(let P=0;P<a.width;P++){const k=I+P*u,V=M+P*u,N=new rn(y[k+0]/255,y[k+1]/255,y[k+2]/255,y[k+3]).toNonPremultipliedRenderColor(d).toArray();x[V+0]=N[0],x[V+1]=N[1],x[V+2]=N[2],x[V+3]=N[3]}else for(let P=0;P<a.width*u;P++)x[M+P]=y[I+P]}return e}At(CS,"HeatmapBucket",{omit:["layers"]});class tu{constructor(e,i){zS(this,e,1,i)}resize(e){DS(this,new tu(e),1)}clone(){return new tu({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,u){M1(e,i,o,a,u,1,null)}}class io{constructor(e,i){zS(this,e,4,i)}resize(e){DS(this,new io(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new io({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,u,d,m){M1(e,i,o,a,u,4,d,m)}}class kS{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Lm(n){const e={},i=n.resolution||256,o=n.clips?n.clips.length:1,a=n.image||new io({width:i,height:o}),u=(d,m,y)=>{e[n.evaluationKey]=y;const x=n.expression.evaluate(e),T=x?x.toNonPremultipliedRenderColor(null):null;
vendor: 6,607 bytes, line 46
46T&&(a.data[d+m+0]=Math.floor(255*T.r),a.data[d+m+1]=Math.floor(255*T.g),a.data[d+m+2]=Math.floor(255*T.b),a.data[d+m+3]=Math.floor(255*T.a))};if(n.clips)for(let d=0,m=0;d<o;++d,m+=4*i)for(let y=0,x=0;y<i;y++,x+=4){const T=y/(i-1),{start:S,end:I}=n.clips[d];u(m,x,S*(1-T)+I*T)}else for(let d=0,m=0;d<i;d++,m+=4)u(0,m,d/(i-1));return a}At(tu,"AlphaImage"),At(io,"RGBAImage");const AR=Ai([{name:"a_pos",components:2,type:"Int16"}],4),CR=Ai([{name:"a_road_z_offset",components:1,type:"Float32"}],4),MR=Ai([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),PR=Ai([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function up(n,e,i=2){const o=e&&e.length,a=o?e[0]*i:n.length;let u=OS(n,0,a,i,!0);const d=[];if(!u||u.next===u.prev)return d;let m,y,x;if(o&&(u=function(T,S,I,M){const P=[];for(let k=0,V=S.length;k<V;k++){const N=OS(T,S[k]*M,k<V-1?S[k+1]*M:T.length,M,!1);N===N.next&&(N.steiner=!0),P.push(BR(N))}P.sort(kR);for(let k=0;k<P.length;k++)I=OR(P[k],I);return I}(n,e,u,i)),n.length>80*i){m=n[0],y=n[1];let T=m,S=y;for(let I=i;I<a;I+=i){const M=n[I],P=n[I+1];M<m&&(m=M),P<y&&(y=P),M>T&&(T=M),P>S&&(S=P)}x=Math.max(T-m,S-y),x=x!==0?32767/x:0}return zm(u,d,i,m,y,x,0),d}function OS(n,e,i,o,a){let u;if(a===function(d,m,y,x){let T=0;for(let S=m,I=y-x;S<y;S+=x)T+=(d[I]-d[S])*(d[S+1]+d[I+1]),I=S;return T}(n,e,i,o)>0)for(let d=e;d<i;d+=o)u=VS(d/o|0,n[d],n[d+1],u);else for(let d=i-o;d>=e;d-=o)u=VS(d/o|0,n[d],n[d+1],u);return u&&hp(u,u.next)&&(Om(u),u=u.next),u}function lh(n,e){if(!n)return n;e||(e=n);let i,o=n;do if(i=!1,o.steiner||!hp(o,o.next)&&Nr(o.prev,o,o.next)!==0)o=o.next;else{if(Om(o),o=e=o.prev,o===o.next)break;i=!0}while(i||o!==e);return e}function zm(n,e,i,o,a,u,d){if(!n)return;!d&&u&&function(y,x,T,S){let I=y;do I.z===0&&(I.z=P1(I.x,I.y,x,T,S)),I.prevZ=I.prev,I.nextZ=I.next,I=I.next;while(I!==y);I.prevZ.nextZ=null,I.prevZ=null,function(M){let P,k=1;do{let V,N=M;M=null;let $=null;for(P=0;N;){P++;let q=N,Y=0;for(let ee=0;ee<k&&(Y++,q=q.nextZ,q);ee++);let re=k;for(;Y>0||re>0&&q;)Y!==0&&(re===0||!q||N.z<=q.z)?(V=N,N=N.nextZ,Y--):(V=q,q=q.nextZ,re--),$?$.nextZ=V:M=V,V.prevZ=$,$=V;N=q}$.nextZ=null,k*=2}while(P>1)}(I)}(n,o,a,u);let m=n;for(;n.prev!==n.next;){const y=n.prev,x=n.next;if(u?LR(n,o,a,u):RR(n))e.push(y.i,n.i,x.i),Om(n),n=x.next,m=x.next;else if((n=x)===m){d?d===1?zm(n=zR(lh(n),e),e,i,o,a,u,2):d===2&&DR(n,e,i,o,a,u):zm(lh(n),e,i,o,a,u,1);break}}}function RR(n){const e=n.prev,i=n,o=n.next;if(Nr(e,i,o)>=0)return!1;const a=e.x,u=i.x,d=o.x,m=e.y,y=i.y,x=o.y,T=Math.min(a,u,d),S=Math.min(m,y,x),I=Math.max(a,u,d),M=Math.max(m,y,x);let P=o.next;for(;P!==e;){if(P.x>=T&&P.x<=I&&P.y>=S&&P.y<=M&&Dm(a,m,u,y,d,x,P.x,P.y)&&Nr(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function LR(n,e,i,o){const a=n.prev,u=n,d=n.next;if(Nr(a,u,d)>=0)return!1;const m=a.x,y=u.x,x=d.x,T=a.y,S=u.y,I=d.y,M=Math.min(m,y,x),P=Math.min(T,S,I),k=Math.max(m,y,x),V=Math.max(T,S,I),N=P1(M,P,e,i,o),$=P1(k,V,e,i,o);let q=n.prevZ,Y=n.nextZ;for(;q&&q.z>=N&&Y&&Y.z<=$;){if(q.x>=M&&q.x<=k&&q.y>=P&&q.y<=V&&q!==a&&q!==d&&Dm(m,T,y,S,x,I,q.x,q.y)&&Nr(q.prev,q,q.next)>=0||(q=q.prevZ,Y.x>=M&&Y.x<=k&&Y.y>=P&&Y.y<=V&&Y!==a&&Y!==d&&Dm(m,T,y,S,x,I,Y.x,Y.y)&&Nr(Y.prev,Y,Y.next)>=0))return!1;Y=Y.nextZ}for(;q&&q.z>=N;){if(q.x>=M&&q.x<=k&&q.y>=P&&q.y<=V&&q!==a&&q!==d&&Dm(m,T,y,S,x,I,q.x,q.y)&&Nr(q.prev,q,q.next)>=0)return!1;q=q.prevZ}for(;Y&&Y.z<=$;){if(Y.x>=M&&Y.x<=k&&Y.y>=P&&Y.y<=V&&Y!==a&&Y!==d&&Dm(m,T,y,S,x,I,Y.x,Y.y)&&Nr(Y.prev,Y,Y.next)>=0)return!1;Y=Y.nextZ}return!0}function zR(n,e){let i=n;do{const o=i.prev,a=i.next.next;!hp(o,a)&&BS(o,i,i.next,a)&&km(o,a)&&km(a,o)&&(e.push(o.i,i.i,a.i),Om(i),Om(i.next),i=n=a),i=i.next}while(i!==n);return lh(i)}function DR(n,e,i,o,a,u){let d=n;do{let m=d.next.next;for(;m!==d.prev;){if(d.i!==m.i&&NR(d,m)){let y=NS(d,m);return d=lh(d,d.next),y=lh(y,y.next),zm(d,e,i,o,a,u,0),void zm(y,e,i,o,a,u,0)}m=m.next}d=d.next}while(d!==n)}function kR(n,e){let i=n.x-e.x;return i===0&&(i=n.y-e.y,i===0)&&(i=(n.next.y-n.y)/(n.next.x-n.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function OR(n,e){const i=function(a,u){let d=u;const m=a.x,y=a.y;let x,T=-1/0;if(hp(a,d))return d;do{if(hp(a,d.next))return d.next;if(y<=d.y&&y>=d.next.y&&d.next.y!==d.y){const k=d.x+(y-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(k<=m&&k>T&&(T=k,x=d.x<d.next.x?d:d.next,k===m))return x}d=d.next}while(d!==u);if(!x)return null;const S=x,I=x.x,M=x.y;let P=1/0;d=x;do{if(m>=d.x&&d.x>=I&&m!==d.x&&FS(y<M?m:T,y,I,M,y<M?T:m,y,d.x,d.y)){const k=Math.abs(y-d.y)/(m-d.x);km(d,a)&&(k<P||k===P&&(d.x>x.x||d.x===x.x&&FR(x,d)))&&(x=d,P=k)}d=d.next}while(d!==S);return x}(n,e);if(!i)return e;const o=NS(i,n);return lh(o,o.next),lh(i,i.next)}function FR(n,e){return Nr(n.prev,n,e.prev)<0&&Nr(e.next,n,n.next)<0}function P1(n,e,i,o,a){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*a|0)|n<<8))|n<<4))|n<<2))|n<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function BR(n){let e=n,i=n;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==n);return i}function FS(n,e,i,o,a,u,d,m){return(a-d)*(e-m)>=(n-d)*(u-m)&&(n-d)*(o-m)>=(i-d)*(e-m)&&(i-d)*(u-m)>=(a-d)*(o-m)}function Dm(n,e,i,o,a,u,d,m){return!(n===d&&e===m)&&FS(n,e,i,o,a,u,d,m)}function NR(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!function(i,o){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==o.i&&a.next.i!==o.i&&BS(a,a.next,i,o))return!0;a=a.next}while(a!==i);return!1}(n,e)&&(km(n,e)&&km(e,n)&&function(i,o){let a=i,u=!1;const d=(i.x+o.x)/2,m=(i.y+o.y)/2;do a.y>m!=a.next.y>m&&a.next.y!==a.y&&d<(a.next.x-a.x)*(m-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u}(n,e)&&(Nr(n.prev,n,e.prev)||Nr(n,e.prev,e))||hp(n,e)&&Nr(n.prev,n,n.next)>0&&Nr(e.prev,e,e.next)>0)}function Nr(n,e,i){return(e.y-n.y)*(i.x-e.x)-(e.x-n.x)*(i.y-e.y)}function hp(n,e){return n.x===e.x&&n.y===e.y}function BS(n,e,i,o){const a=Gy(Nr(n,e,i)),u=Gy(Nr(n,e,o)),d=Gy(Nr(i,o,n)),m=Gy(Nr(i,o,e));return a!==u&&d!==m||!(a!==0||!Uy(n,i,e))||!(u!==0||!Uy(n,o,e))||!(d!==0||!Uy(i,n,o))||!(m!==0||!Uy(i,e,o))}function Uy(n,e,i){return e.x<=Math.max(n.x,i.x)&&e.x>=Math.min(n.x,i.x)&&e.y<=Math.max(n.y,i.y)&&e.y>=Math.min(n.y,i.y)}function Gy(n){return n>0?1:n<0?-1:0}function km(n,e){return Nr(n.prev,n,n.next)<0?Nr(n,e,n.next)>=0&&Nr(n,n.prev,e)>=0:Nr(n,e,n.prev)<0||Nr(n,n.next,e)<0}function NS(n,e){const i=R1(n.i,n.x,n.y),o=R1(e.i,e.x,e.y),a=n.next,u=e.prev;return n.next=e,e.prev=n,i.next=a,a.prev=i,o.next=i,i.prev=o,u.next=o,o.prev=u,o}function VS(n,e,i,o){const a=R1(n,e,i);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}
46function Om(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function R1(n,e,i){return{i:n,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Fm(n,e){const i=n.length;if(i<=1)return[n];const o=[];let a,u;for(let d=0;d<i;d++){const m=pi(n[d]);m!==0&&(n[d].area=Math.abs(m),u===void 0&&(u=m<0),u===m<0?(a&&o.push(a),a=[n[d]]):a.push(n[d]))}if(a&&o.push(a),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(ld(o[d],e,1,o[d].length-1,VR),o[d]=o[d].slice(0,e));return o}function VR(n,e){return e.area-n.area}function jS(n,e,i=1){if(!n)return null;const o=typeof n=="string"?fo.from(n).getPrimary():n.getPrimary(),a=typeof n=="string"?null:n.getSecondary();for(const u of[o,a]){if(!u)continue;const d=u.id.toString();e.has(d)||e.set(d,[]),u.scaleSelf(i),e.get(d).push(u)}return{primary:o.toString(),secondary:a?a.toString():null}}function L1(n,e,i,o){const a=o.patternDependencies;let u=!1;for(const d of e){const m=d.paint.get(`${n}-pattern`);m.isConstant()||(u=!0),jS(m.constantOr(null),a,i)&&(u=!0)}return u}function z1(n,e,i,o,a,u){const d=u.patternDependencies;for(const m of e){const y=m.paint.get(`${n}-pattern`).value;if(y.kind!=="constant"){let x=y.evaluate({zoom:o},i,{},u.availableImages);x=x&&x.name?x.name:x;const T=jS(x,d,a);if(!T)continue;const{primary:S,secondary:I}=T;S&&(i.patterns[m.id]=[S,I].filter(Boolean))}}return i}class US{constructor(){this.polygons=new Map}add(e,...i){const o=this.polygons.get(e);o?o.push(...i):this.polygons.set(e,i)}merge(e){for(const[i,o]of e.polygons)this.add(i,...o)}}class ic{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=ht&&i>=ht}static evaluate(e){if(e.length===0)return new ic;let i=[];for(const y of e)i.push(...y.portals);if(i.length===0)return new ic;for(const y of i){const x=y.va,T=y.vb;(ic.isOnBorder(x.x,T.x)||ic.isOnBorder(x.y,T.y))&&(y.type="border")}const o=i.filter(y=>y.type!=="unevaluated"),a=i.filter(y=>y.type==="unevaluated");if(a.length===0)return new ic;a.sort((y,x)=>y.hash===x.hash?y.isTunnel===x.isTunnel?0:y.isTunnel?-1:1:y.hash<x.hash?1:-1),i=o.concat(a);let u=o.length,d=u,m=u;do if(d++,d===i.length||i[u].hash!==i[d].hash){if(d-u==2){m<u&&(i[m]=i[u],i[u]=null);const y=i[m],x=i[d-1];y.type=y.isTunnel!==x.isTunnel?"tunnel":"polygon",y.connection={a:y.connection.a,b:x.connection.a},m++}u=d}while(u!==i.length);return i.splice(m),i.sort((y,x)=>y.hash<x.hash?1:-1),{portals:i}}}At(ic,"ElevationPortalGraph"),At(US,"ElevationPolygons");class jR{constructor(e,i,o){this.outPositions=e,this.outNormals=i,this.outIndices=o,this.vertexLookup=new Map}addVertex(e,i,o){let a=e[2];o!=null&&(a*=o);const u=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,d=this.vertexLookup.get(u);if(d!=null)return d;const m=this.outPositions.length;this.vertexLookup.set(u,m);const y=Math.trunc(16384*i[0]),x=Math.trunc(16384*i[1]),T=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(y,x,T),m}addTriangle(e,i,o){this.outIndices.emplaceBack(e,i,o)}addTriangles(e,i,o){if(e.length===0)return;const a=o.length===1,u=Ii(),d=Ii();for(let m=0;m<e.length;m+=3){const y=i[e[m+0]],x=i[e[m+1]],T=i[e[m+2]],S=a?o[0]:o[e[m+1]],I=a?o[0]:o[e[m+2]];Ei(u,y.x,y.y,a?o[0]:o[e[m+0]]);const M=this.addVertex(u,d);Ei(u,x.x,x.y,S);const P=this.addVertex(u,d);Ei(u,T.x,T.y,I);const k=this.addVertex(u,d);this.outIndices.emplaceBack(M,P,k)}}addQuad(e,i,o,a,u,d){const m=this.addVertex(e,u,d),y=this.addVertex(i,u,d),x=this.addVertex(o,u,d),T=this.addVertex(a,u,d);this.addTriangle(m,y,x),this.addTriangle(x,T,m)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Jo{constructor(e,i,o,a){this.unevaluatedPortals=new ic,this.portalPolygons=new US,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new hm,this.vertexNormals=new dm,this.indexArray=new mr,this.tileToMeters=U(e),this.bridgeProgramConfigurations=new Ds(i,{zoom:o,lut:a},u=>u!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Ds(i,{zoom:o,lut:a},u=>u!=="fill-bridge-guard-rail-color")}addVertices(e,i){const o=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return o}addTriangles(e,i,o){const a=o?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,o,a,u,d){const m=[new Ke(u.min.x,u.min.y),new Ke(u.max.x,u.min.y),new Ke(u.max.x,u.max.y),new Ke(u.min.x,u.max.y)];for(let y=0;y<o-1;y++){const x=i+y,T=x+1,S=this.unevalVertices[x],I=this.unevalVertices[T];if(!(S.x>=u.min.x&&S.x<=u.max.x&&S.y>=u.min.y&&S.y<=u.max.y||I.x>=u.min.x&&I.x<=u.max.x&&I.y>=u.min.y&&I.y<=u.max.y||Zr(S,I,m))||this.isOnBorder(S.x,I.x)||this.isOnBorder(S.y,I.y))continue;const M=Jo.computeEdgeHash(this.unevalVertices[x],this.unevalVertices[T]);let P,k=this.vertexHashLookup.get(Jo.computePosHash(S));k!=null?P=k.next:(k=this.vertexHashLookup.get(Jo.computePosHash(I)),P=k!=null?k.prev:M),this.unevalEdges.push({polygonIdx:e,a:x,b:T,hash:M,portalHash:P,isTunnel:a,type:"unevaluated",featureInfo:d})}}addPortalCandidates(e,i,o,a,u){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:u});const d=i[0];this.vertexHashLookup.clear();let m=Jo.computeEdgeHash(d[d.length-2],d[d.length-1]);for(let y=0;y<d.length-1;y++){const x=d[y+0],T=d[y+1],S=Gr(T.x-x.x,T.y-x.y),I=Ho(S);if(I===0)continue;let M="unevaluated";const P=a.pointElevation(x),k=a.pointElevation(T);Math.abs(P)<.01&&Math.abs(k)<.01?M="entrance":(this.isOnBorder(x.x,T.x)||this.isOnBorder(x.y,T.y))&&(M="border");const V=Jo.computeEdgeHash(x,T);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:x,vb:T,vab:S,length:I,hash:V,isTunnel:o,type:M});const N=Jo.computePosHash(x);this.vertexHashLookup.set(N,{prev:m,next:V}),m=V}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),o=I=>{I.primitiveLength=this.indexArray.length-I.primitiveOffset},a=new jR(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),d=i(),m=i(),y=(I,M)=>{I.sort((k,V)=>k.type===M&&V.type!==M?-1:k.type!==M&&V.type===M?1:0);const P=I.findIndex(k=>k.type!==M);return P>=0?P:I.length};let x=0;this.unevalEdges.length>0&&(x=y(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:x},this.tileToMeters)),o(m);const T=i(),S=i();if(this.unevalEdges.length>
vendor: 5,248 bytes, line 46
460){const I=this.unevalEdges.splice(x),M=y(I,"tunnel")+x;this.unevalEdges.push(...I),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:x},{min:x,max:M})}o(T),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),o(S),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),o(d),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),o(u),this.maskSegments=zn.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength),this.depthSegments=zn.simpleSegment(0,d.primitiveOffset,0,d.primitiveLength),this.renderableBridgeSegments=zn.simpleSegment(0,m.primitiveOffset,0,m.primitiveLength),this.renderableTunnelSegments=zn.simpleSegment(0,T.primitiveOffset,0,T.primitiveLength),this.shadowCasterSegments=zn.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,o,a,u,d,m,y){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,o,a,d,m,y),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,o,a,d,m,y)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,MR.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,PR.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,o,a,u){const d=(m,y)=>{for(let x=0;x<y.length-1;x++){const T=y[x].featureIndex,S=y[x+1].vertexStart,I=e.feature(T);m.populatePaintArrays(S,I,T,{},o,i,a,void 0,u)}};d(this.bridgeProgramConfigurations,this.bridgeFeatureSections),d(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,o,a,u){const d=new Map;for(let m=a;m<u;m++){const y=o[m],x=y.a,T=y.b,S=Jo.computePosHash(e[x]),I=Jo.computePosHash(e[T]);let M=d.get(S);M||(M={},d.set(S,M));let P=d.get(I);P||(P={},d.set(I,P)),i[x]<=0&&i[T]<=0||(M.to=T,P.from=x)}return d}isTerminalVertex(e,i){const o=Jo.computePosHash(this.unevalVertices[e]),a=i.get(o);return!a||!a.from||!a.to}constructBridgeStructures(e,i,o,a,u,d){e.clearVertexLookup();const m=this.computeVertexConnections(i,o,a,u.min,u.max),y=1/d,x=.5*y,T=(Je,et)=>Ei(Je,i[et].x,i[et].y,o[et]*y),S=Ii(),I=Ii(),M=Ii(),P=Ii(),k=Ii(),V=(Je,et)=>{const We=m.get(Jo.computePosHash(i[et])),Xe=We.from,Fe=We.to;if(!Xe||!Fe)return;T(S,Xe),T(I,et),T(M,Fe),so(P),jr(S,I)||(rr(k,I,S),un(P,k)),jr(M,I)||(rr(k,M,I),Gt(P,P,un(k,k)));const ke=Go(P);return ke>0?ai(Je,P,1/ke):void 0};let N=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,(Je,et)=>Je.featureInfo.featureIndex-et.featureInfo.featureIndex);const $=Ii(),q=Ii(),Y=Ii(),re=Ii(),ee=Ii(),ae=Ii(),he=Ii(),me=Ii(),De=Ii(),xe=[Ii(),Ii(),Ii(),Ii()],Be=[Ii(),Ii(),Ii(),Ii()],Ge=[{coord:new Ke(0,0),height:0},{coord:new Ke(0,0),height:0}],$e=(Je,et)=>Je>et;for(let Je=u.min;Je<u.max;Je++){const et=a[Je];if(!et.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ge,i,o,et,$e))continue;const[We,Xe]=Ge;if(Ei($,We.coord.x,We.coord.y,y*We.height),Ei(q,Xe.coord.x,Xe.coord.y,y*Xe.height),jr($,q))continue;rr(Y,q,$),un(Y,Y);const Fe=V(me,et.a)||Y,ke=V(De,et.b)||Y;Ei(re,Fe[1],-Fe[0],0),un(re,re),Ei(ee,ke[1],-ke[0],0),un(ee,ee),nr(me,re,Fe),un(ae,me),nr(me,ee,ke),un(he,me),Gt(xe[0],$,ai(me,rr(me,re,ae),x)),Gt(xe[1],$,ai(me,Gt(me,re,ae),x)),Gt(xe[2],$,ai(me,ae,x)),xe[3]=$,Gt(Be[0],q,ai(me,rr(me,ee,he),x)),Gt(Be[1],q,ai(me,Gt(me,ee,he),x)),Gt(Be[2],q,ai(me,he,x)),Be[3]=q,N=this.addFeatureSection(et.featureInfo.featureIndex,N,this.bridgeFeatureSections,e);const Ye=e.addVertex(xe[0],re,d),pt=e.addVertex(xe[1],re,d),ot=e.addVertex(Be[0],ee,d),Ot=e.addVertex(Be[1],ee,d);e.addTriangle(Ye,pt,ot),e.addTriangle(pt,Ot,ot);const wt=e.addVertex(xe[1],ae,d),Et=e.addVertex(xe[2],ae,d),Pt=e.addVertex(Be[1],he,d),wi=e.addVertex(Be[2],he,d);e.addTriangle(wt,Et,Pt),e.addTriangle(Et,wi,Pt),Or(re,re),Or(ee,ee);const lt=e.addVertex(xe[2],re,d),Rt=e.addVertex(xe[3],re,d),oi=e.addVertex(Be[2],ee,d),zi=e.addVertex(Be[3],ee,d);e.addTriangle(lt,Rt,oi),e.addTriangle(Rt,zi,oi);const ki=this.isTerminalVertex(et.a,m),di=this.isTerminalVertex(et.b,m);We.height<.01&&ki&&e.addQuad(xe[3],xe[2],xe[1],xe[0],Or(Fe,Fe),d),Xe.height<.01&&di&&e.addQuad(Be[0],Be[1],Be[2],Be[3],ke,d)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,o,a,u,d){e.clearVertexLookup();let m=Number.POSITIVE_INFINITY;const y=(N,$)=>N.featureInfo.featureIndex-$.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,y),this.sortSubarray(a,d.min,d.max,y);const x=N=>un(N,N),T=[{coord:new Ke(0,0),height:0},{coord:new Ke(0,0),height:0}],S=(N,$)=>N<$,I=Ii(),M=Ii(),P=Ii(),k=Ii(),V=Ii();for(let N=u.min;N<u.max;N++){if(!this.prepareEdgePoints(T,i,o,a[N],S))continue;
vendor: 1,377 bytes, line 46
46const[$,q]=T,Y=x(Ei(V,-(q.coord.y-$.coord.y),q.coord.x-$.coord.x,0));m=this.addFeatureSection(a[N].featureInfo.featureIndex,m,this.tunnelFeatureSections,e),e.addQuad(Ei(I,$.coord.x,$.coord.y,$.height),Ei(M,q.coord.x,q.coord.y,q.height),Ei(P,q.coord.x,q.coord.y,a[N].isTunnel?-.1:0),Ei(k,$.coord.x,$.coord.y,a[N].isTunnel?-.1:0),Y)}for(let N=d.min;N<d.max;N++){const $=a[N];$.isTunnel&&([$.a,$.b]=[$.b,$.a]);const q=i[$.a],Y=i[$.b],re=x(Ei(V,-(Y.y-q.y),Y.x-q.x,0));m=this.addFeatureSection($.featureInfo.featureIndex,m,this.tunnelFeatureSections,e),e.addQuad(Ei(I,Y.x,Y.y,0),Ei(M,q.x,q.y,0),Ei(P,q.x,q.y,o[$.a]+4),Ei(k,Y.x,Y.y,o[$.b]+4),re),e.addQuad(Ei(I,q.x,q.y,0),Ei(M,Y.x,Y.y,0),Ei(P,Y.x,Y.y,o[$.b]+4),Ei(k,q.x,q.y,o[$.a]+4),re)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,o,a){e.coord.x=i,e.coord.y=o,e.height=a}prepareEdgePoints(e,i,o,a,u){let d=i[a.a].x,m=i[a.a].y,y=i[a.b].x,x=i[a.b].y,T=o[a.a],S=o[a.b];const I=u(T,0),M=u(S,0);if(I&&M)return this.setElevatedPoint(e[0],d,m,T),this.setElevatedPoint(e[1],y,x,S),!0;if(!I&&!M)return!1;if(I){if(!M){const P=S/(S-T);y=Qt(y,d,P),x=Qt(x,m,P),S=Qt(S,T,P)}}else{const P=T/(T-S);d=Qt(d,y,P),m=Qt(m,x,P),T=Qt(T,S,P)}return this.setElevatedPoint(e[0],d,m,T),this.setElevatedPoint(e[1],y,x,S),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((m,y)=>
46m.hash===y.hash?y.polygonIdx-m.polygonIdx:y.hash>m.hash?1:-1);let o=0,a=0,u=0,d=i[o].polygonIdx;do a++,(a===i.length||i[o].hash!==i[a].hash)&&((a-o==1||i[a-1].polygonIdx!==d)&&(u<o&&(i[u]=i[o],i[o]=null),i[u].type="none",u++),o=a,o!==i.length&&(d=i[o].polygonIdx));while(o!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((x,T)=>x.portalHash<T.portalHash?1:-1);let m=0,y=0;for(;m!==i.length&&y!==e.length;){const x=i[m],T=e[y];x.portalHash>T.hash?m++:T.hash>x.portalHash?y++:(x.type=T.type,m++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=ht&&i>=ht}addFeatureSection(e,i,o,a){return e!==i&&(i=e,o.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,o,a){const u=e.slice(i,o);u.sort(a),e.splice(i,u.length,...u)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Jo.computePosHash(e))<<32n|BigInt(Jo.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var GS,$S={exports:{}},HS=(GS||(GS=1,function(n){function e(te,oe){return te>oe?1:te<oe?-1:0}var i=function(te,oe){te===void 0&&(te=e),oe===void 0&&(oe=!1),this._compare=te,this._root=null,this._size=0,this._noDuplicates=!!oe},o={size:{configurable:!0}};function a(te,oe,Ne,Qe,gt){var yt=gt-Qe;if(yt>0){var Bt=Qe+Math.floor(yt/2),Ut={key:oe[Bt],data:Ne[Bt],parent:te};return Ut.left=a(Ut,oe,Ne,Qe,Bt),Ut.right=a(Ut,oe,Ne,Bt+1,gt),Ut}return null}function u(te,oe,Ne,Qe,gt){if(!(Ne>=Qe)){for(var yt=te[Ne+Qe>>1],Bt=Ne-1,Ut=Qe+1;;){do Bt++;while(gt(te[Bt],yt)<0);do Ut--;while(gt(te[Ut],yt)>0);if(Bt>=Ut)break;var ui=te[Bt];te[Bt]=te[Ut],te[Ut]=ui,ui=oe[Bt],oe[Bt]=oe[Ut],oe[Ut]=ui}u(te,oe,Ne,Ut,gt),u(te,oe,Ut+1,Qe,gt)}}i.prototype.rotateLeft=function(te){var oe=te.right;oe&&(te.right=oe.left,oe.left&&(oe.left.parent=te),oe.parent=te.parent),te.parent?te===te.parent.left?te.parent.left=oe:te.parent.right=oe:this._root=oe,oe&&(oe.left=te),te.parent=oe},i.prototype.rotateRight=function(te){var oe=te.left;oe&&(te.left=oe.right,oe.right&&(oe.right.parent=te),oe.parent=te.parent),te.parent?te===te.parent.left?te.parent.left=oe:te.parent.right=oe:this._root=oe,oe&&(oe.right=te),te.parent=oe},i.prototype._splay=function(te){for(;te.parent;){var oe=te.parent;oe.parent?oe.left===te&&oe.parent.left===oe?(this.rotateRight(oe.parent),this.rotateRight(oe)):oe.right===te&&oe.parent.right===oe?(this.rotateLeft(oe.parent),this.rotateLeft(oe)):oe.left===te&&oe.parent.right===oe?(this.rotateRight(oe),this.rotateLeft(oe)):(this.rotateLeft(oe),this.rotateRight(oe)):oe.left===te?this.rotateRight(oe):this.rotateLeft(oe)}},i.prototype.splay=function(te){for(var oe,Ne,Qe,gt,yt;te.parent;)(Ne=(oe=te.parent).parent)&&Ne.parent?((Qe=Ne.parent).left===Ne?Qe.left=te:Qe.right=te,te.parent=Qe):(te.parent=null,this._root=te),gt=te.left,yt=te.right,te===oe.left?(Ne&&(Ne.left===oe?(oe.right?(Ne.left=oe.right,Ne.left.parent=Ne):Ne.left=null,oe.right=Ne,Ne.parent=oe):(gt?(Ne.right=gt,gt.parent=Ne):Ne.right=null,te.left=Ne,Ne.parent=te)),yt?(oe.left=yt,yt.parent=oe):oe.left=null,te.right=oe,oe.parent=te):(Ne&&(Ne.right===oe?(oe.left?(Ne.right=oe.left,Ne.right.parent=Ne):Ne.right=null,oe.left=Ne,Ne.parent=oe):(yt?(Ne.left=yt,yt.parent=Ne):Ne.left=null,te.right=Ne,Ne.parent=te)),gt?(oe.right=gt,gt.parent=oe):oe.right=null,te.left=oe,oe.parent=te)},i.prototype.replace=function(te,oe){te.parent?te===te.parent.left?te.parent.left=oe:te.parent.right=oe:this._root=oe,oe&&(oe.parent=te.parent)},i.prototype.minNode=function(te){if(te===void 0&&(te=this._root),te)for(;te.left;)te=te.left;return te},i.prototype.maxNode=function(te){if(te===void 0&&(te=this._root),te)for(;te.right;)te=te.right;return te},i.prototype.insert=function(te,oe){var Ne=this._root,Qe=null,gt=this._compare;if(this._noDuplicates)for(;Ne;){if(Qe=Ne,gt(Ne.key,te)===0)return;Ne=gt(Ne.key,te)<0?Ne.right:Ne.left}else for(;Ne;)Qe=Ne,Ne=gt(Ne.key,te)<0?Ne.right:Ne.left;return Ne={key:te,data:oe,left:null,right:null,parent:Qe},Qe?gt(Qe.key,Ne.key)<0?Qe.right=Ne:Qe.left=Ne:this._root=Ne,this.splay(Ne),this._size++,Ne},i.prototype.find=function(te){for(var oe=this._root,Ne=this._compare;oe;){var Qe=Ne(oe.key,te);if(Qe<0)oe=oe.right;else{if(!(Qe>0))return oe;oe=oe.left}}return null},i.prototype.contains=function(te){for(var oe=this._root,Ne=this._compare;oe;){var Qe=Ne(te,oe.key);if(Qe===0)return!0;oe=Qe<0?oe.left:oe.right}return!1},i.prototype.remove=function(te){var oe=this.find(te);if(!oe)return!1;if(this.splay(oe),oe.left)if(oe.right){var Ne=this.minNode(oe.right);Ne.parent!==oe&&(this.replace(Ne,Ne.right),Ne.right=oe.right,Ne.right.parent=Ne),this.replace(oe,Ne),Ne.left=oe.left,Ne.left.parent=Ne}else this.replace(oe,oe.left);else this.replace(oe,oe.right);return this._size--,!0},i.prototype.removeNode=function(te){if(!te)return!1;if(this.splay(te),te.left)if(te.right){var oe=this.minNode(te.right);oe.parent!==te&&(this.replace(oe,oe.right),oe.right=te.right,oe.right.parent=oe),this.replace(te,oe),oe.left=te.left,oe.left.parent=oe}else this.replace(te,te.left);else this.replace(te,te.right);return this._size--,!0}
46,i.prototype.erase=function(te){var oe=this.find(te);if(oe){this.splay(oe);var Ne=oe.left,Qe=oe.right,gt=null;Ne&&(Ne.parent=null,gt=this.maxNode(Ne),this.splay(gt),this._root=gt),Qe&&(Ne?gt.right=Qe:this._root=Qe,Qe.parent=gt),this._size--}},i.prototype.pop=function(){var te=this._root,oe=null;if(te){for(;te.left;)te=te.left;oe={key:te.key,data:te.data},this.remove(te.key)}return oe},i.prototype.next=function(te){var oe=te;if(oe)if(oe.right)for(oe=oe.right;oe&&oe.left;)oe=oe.left;else for(oe=te.parent;oe&&oe.right===te;)te=oe,oe=oe.parent;return oe},i.prototype.prev=function(te){var oe=te;if(oe)if(oe.left)for(oe=oe.left;oe&&oe.right;)oe=oe.right;else for(oe=te.parent;oe&&oe.left===te;)te=oe,oe=oe.parent;return oe},i.prototype.forEach=function(te){for(var oe=this._root,Ne=[],Qe=!1,gt=0;!Qe;)oe?(Ne.push(oe),oe=oe.left):Ne.length>0?(te(oe=Ne.pop(),gt++),oe=oe.right):Qe=!0;return this},i.prototype.range=function(te,oe,Ne,Qe){for(var gt=[],yt=this._compare,Bt=this._root;gt.length!==0||Bt;)if(Bt)gt.push(Bt),Bt=Bt.left;else{if(yt((Bt=gt.pop()).key,oe)>0)break;if(yt(Bt.key,te)>=0&&Ne.call(Qe,Bt))return this;Bt=Bt.right}return this},i.prototype.keys=function(){for(var te=this._root,oe=[],Ne=[],Qe=!1;!Qe;)te?(oe.push(te),te=te.left):oe.length>0?(te=oe.pop(),Ne.push(te.key),te=te.right):Qe=!0;return Ne},i.prototype.values=function(){for(var te=this._root,oe=[],Ne=[],Qe=!1;!Qe;)te?(oe.push(te),te=te.left):oe.length>0?(te=oe.pop(),Ne.push(te.data),te=te.right):Qe=!0;return Ne},i.prototype.at=function(te){for(var oe=this._root,Ne=[],Qe=!1,gt=0;!Qe;)if(oe)Ne.push(oe),oe=oe.left;else if(Ne.length>0){if(oe=Ne.pop(),gt===te)return oe;gt++,oe=oe.right}else Qe=!0;return null},i.prototype.load=function(te,oe,Ne){if(te===void 0&&(te=[]),oe===void 0&&(oe=[]),Ne===void 0&&(Ne=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var Qe=te.length;return Ne&&u(te,oe,0,Qe-1,this._compare),this._root=a(null,te,oe,0,Qe),this._size=Qe,this},i.prototype.min=function(){var te=this.minNode(this._root);return te?te.key:null},i.prototype.max=function(){var te=this.maxNode(this._root);return te?te.key:null},i.prototype.isEmpty=function(){return this._root===null},o.size.get=function(){return this._size},i.createTree=function(te,oe,Ne,Qe,gt){return new i(Ne,gt).load(te,oe,Qe)},Object.defineProperties(i.prototype,o);var d=0,m=1,y=2,x=3,T=0,S=1,I=2,M=3;function P(te,oe,Ne){oe===null?(te.inOut=!1,te.otherInOut=!0):(te.isSubject===oe.isSubject?(te.inOut=!oe.inOut,te.otherInOut=oe.otherInOut):(te.inOut=!oe.otherInOut,te.otherInOut=oe.isVertical()?!oe.inOut:oe.inOut),oe&&(te.prevInResult=!k(oe,Ne)||oe.isVertical()?oe.prevInResult:oe));var Qe=k(te,Ne);te.resultTransition=Qe?function(gt,yt){var Bt,Ut=!gt.inOut,ui=!gt.otherInOut;switch(yt){case T:Bt=Ut&&ui;break;case S:Bt=Ut||ui;break;case M:Bt=Ut^ui;break;case I:Bt=gt.isSubject?Ut&&!ui:ui&&!Ut}return Bt?1:-1}(te,Ne):0}function k(te,oe){switch(te.type){case d:switch(oe){case T:return!te.otherInOut;case S:return te.otherInOut;case I:return te.isSubject&&te.otherInOut||!te.isSubject&&!te.otherInOut;case M:return!0}break;case y:return oe===T||oe===S;case x:return oe===I;case m:return!1}return!1}var V=function(te,oe,Ne,Qe,gt){this.left=oe,this.point=te,this.otherEvent=Ne,this.isSubject=Qe,this.type=gt||d,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},N={inResult:{configurable:!0}};function $(te,oe){return te[0]===oe[0]&&te[1]===oe[1]}V.prototype.isBelow=function(te){var oe=this.point,Ne=this.otherEvent.point;return this.left?(oe[0]-te[0])*(Ne[1]-te[1])-(Ne[0]-te[0])*(oe[1]-te[1])>0:(Ne[0]-te[0])*(oe[1]-te[1])-(oe[0]-te[0])*(Ne[1]-te[1])>0},V.prototype.isAbove=function(te){return!this.isBelow(te)},V.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},N.inResult.get=function(){return this.resultTransition!==0},V.prototype.clone=function(){var te=new V(this.point,this.left,this.otherEvent,this.isSubject,this.type);return te.contourId=this.contourId,te.resultTransition=this.resultTransition,te.prevInResult=this.prevInResult,te.isExteriorRing=this.isExteriorRing,te.inOut=this.inOut,te.otherInOut=this.otherInOut,te},Object.defineProperties(V.prototype,N);var q=11102230246251565e-32,Y=134217729,re=(3+8*q)*q;function ee(te,oe,Ne,Qe,gt){var yt,Bt,Ut,ui,yi=oe[0],xi=Qe[0],Ci=0,Jt=0;xi>yi==xi>-yi?(yt=yi,yi=oe[++Ci]):(yt=xi,xi=Qe[++Jt]);var ni=0;if(Ci<te&&Jt<Ne)for(xi>yi==xi>-yi?(Ut=yt-((Bt=yi+yt)-yi),yi=oe[++Ci]):(Ut=yt-((Bt=xi+yt)-xi),xi=Qe[++Jt]),yt=Bt,Ut!==0&&(gt[ni++]=Ut);Ci<te&&Jt<Ne;)xi>yi==xi>-yi?(Ut=yt-((Bt=yt+yi)-(ui=Bt-yt))+(yi-ui),yi=oe[++Ci]):(Ut=yt-((Bt=yt+xi)-(ui=Bt-yt))+(xi-ui),xi=Qe[++Jt]),yt=Bt,Ut!==0&&(gt[ni++]=Ut);for(;Ci<te;)Ut=yt-((Bt=yt+yi)-(ui=Bt-yt))+(yi-ui),yi=oe[++Ci],yt=Bt,Ut!==0&&(gt[ni++]=Ut);for(;Jt<Ne;)Ut=yt-((Bt=yt+xi)-(ui=Bt-yt))+(xi-ui),xi=Qe[++Jt],yt=Bt,Ut!==0&&(gt[ni++]=Ut);return yt===0&&ni!==0||(gt[ni++]=yt),ni}function ae(te){return new Float64Array(te)}var he=33306690738754716e-32,me=22204460492503146e-32,De=11093356479670487e-47,xe=ae(4),Be=ae(8),Ge=ae(12),$e=ae(16),Je=ae(4);function et(te,oe,Ne){var Qe=function(gt,yt,Bt,Ut,ui,yi){var xi=(yt-yi)*(Bt-ui),Ci=(gt-ui
46)*(Ut-yi),Jt=xi-Ci;if(xi===0||Ci===0||xi>0!=Ci>0)return Jt;var ni=Math.abs(xi+Ci);return Math.abs(Jt)>=he*ni?Jt:-function(Vi,Wi,Xi,sn,_n,dn,Ki){var tn,vi,Di,Ln,Yt,Mi,pn,yn,Tn,tr,xn,Kt,On,an,Mn,yr,Lr,ur,hr=Vi-_n,Ir=Xi-_n,Mo=Wi-dn,wn=sn-dn;xe[0]=(Mn=(yn=hr-(pn=(Mi=Y*hr)-(Mi-hr)))*(tr=wn-(Tn=(Mi=Y*wn)-(Mi-wn)))-((an=hr*wn)-pn*Tn-yn*Tn-pn*tr))-((xn=Mn-(Lr=(yn=Mo-(pn=(Mi=Y*Mo)-(Mi-Mo)))*(tr=Ir-(Tn=(Mi=Y*Ir)-(Mi-Ir)))-((yr=Mo*Ir)-pn*Tn-yn*Tn-pn*tr)))+(Yt=Mn-xn))+(Yt-Lr),xe[1]=(On=an-((Kt=an+xn)-(Yt=Kt-an))+(xn-Yt))-((xn=On-yr)+(Yt=On-xn))+(Yt-yr),xe[2]=Kt-((ur=Kt+xn)-(Yt=ur-Kt))+(xn-Yt),xe[3]=ur;var Yn=function(wl,Wr){for(var vo=Wr[0],es=1;es<4;es++)vo+=Wr[es];return vo}(0,xe),ir=me*Ki;if(Yn>=ir||-Yn>=ir||(tn=Vi-(hr+(Yt=Vi-hr))+(Yt-_n),Di=Xi-(Ir+(Yt=Xi-Ir))+(Yt-_n),vi=Wi-(Mo+(Yt=Wi-Mo))+(Yt-dn),Ln=sn-(wn+(Yt=sn-wn))+(Yt-dn),tn===0&&vi===0&&Di===0&&Ln===0)||(ir=De*Ki+re*Math.abs(Yn),(Yn+=hr*Ln+wn*tn-(Mo*Di+Ir*vi))>=ir||-Yn>=ir))return Yn;Je[0]=(Mn=(yn=tn-(pn=(Mi=Y*tn)-(Mi-tn)))*(tr=wn-(Tn=(Mi=Y*wn)-(Mi-wn)))-((an=tn*wn)-pn*Tn-yn*Tn-pn*tr))-((xn=Mn-(Lr=(yn=vi-(pn=(Mi=Y*vi)-(Mi-vi)))*(tr=Ir-(Tn=(Mi=Y*Ir)-(Mi-Ir)))-((yr=vi*Ir)-pn*Tn-yn*Tn-pn*tr)))+(Yt=Mn-xn))+(Yt-Lr),Je[1]=(On=an-((Kt=an+xn)-(Yt=Kt-an))+(xn-Yt))-((xn=On-yr)+(Yt=On-xn))+(Yt-yr),Je[2]=Kt-((ur=Kt+xn)-(Yt=ur-Kt))+(xn-Yt),Je[3]=ur;var Bo=ee(4,xe,4,Je,Be);Je[0]=(Mn=(yn=hr-(pn=(Mi=Y*hr)-(Mi-hr)))*(tr=Ln-(Tn=(Mi=Y*Ln)-(Mi-Ln)))-((an=hr*Ln)-pn*Tn-yn*Tn-pn*tr))-((xn=Mn-(Lr=(yn=Mo-(pn=(Mi=Y*Mo)-(Mi-Mo)))*(tr=Di-(Tn=(Mi=Y*Di)-(Mi-Di)))-((yr=Mo*Di)-pn*Tn-yn*Tn-pn*tr)))+(Yt=Mn-xn))+(Yt-Lr),Je[1]=(On=an-((Kt=an+xn)-(Yt=Kt-an))+(xn-Yt))-((xn=On-yr)+(Yt=On-xn))+(Yt-yr),Je[2]=Kt-((ur=Kt+xn)-(Yt=ur-Kt))+(xn-Yt),Je[3]=ur;var vr=ee(Bo,Be,4,Je,Ge);Je[0]=(Mn=(yn=tn-(pn=(Mi=Y*tn)-(Mi-tn)))*(tr=Ln-(Tn=(Mi=Y*Ln)-(Mi-Ln)))-((an=tn*Ln)-pn*Tn-yn*Tn-pn*tr))-((xn=Mn-(Lr=(yn=vi-(pn=(Mi=Y*vi)-(Mi-vi)))*(tr=Di-(Tn=(Mi=Y*Di)-(Mi-Di)))-((yr=vi*Di)-pn*Tn-yn*Tn-pn*tr)))+(Yt=Mn-xn))+(Yt-Lr),Je[1]=(On=an-((Kt=an+xn)-(Yt=Kt-an))+(xn-Yt))-((xn=On-yr)+(Yt=On-xn))+(Yt-yr),Je[2]=Kt-((ur=Kt+xn)-(Yt=ur-Kt))+(xn-Yt),Je[3]=ur;var ha=ee(vr,Ge,4,Je,$e);return $e[ha-1]}(gt,yt,Bt,Ut,ui,yi,ni)}(te[0],te[1],oe[0],oe[1],Ne[0],Ne[1]);return Qe>0?-1:Qe<0?1:0}function We(te,oe){var Ne=te.point,Qe=oe.point;return Ne[0]>Qe[0]?1:Ne[0]<Qe[0]?-1:Ne[1]!==Qe[1]?Ne[1]>Qe[1]?1:-1:function(gt,yt,Bt,Ut){return gt.left!==yt.left?gt.left?1:-1:et(Bt,gt.otherEvent.point,yt.otherEvent.point)!==0?gt.isBelow(yt.otherEvent.point)?-1:1:!gt.isSubject&&yt.isSubject?1:-1}(te,oe,Ne)}function Xe(te,oe,Ne){var Qe=new V(oe,!1,te,te.isSubject),gt=new V(oe,!0,te.otherEvent,te.isSubject);return $(te.point,te.otherEvent.point)&&console.warn("what is that, a collapsed segment?",te),Qe.contourId=gt.contourId=te.contourId,We(gt,te.otherEvent)>0&&(te.otherEvent.left=!0,gt.left=!1),te.otherEvent.otherEvent=gt,te.otherEvent=Qe,Ne.push(gt),Ne.push(Qe),Ne}function Fe(te,oe){return te[0]*oe[1]-te[1]*oe[0]}function ke(te,oe){return te[0]*oe[0]+te[1]*oe[1]}function Ye(te,oe,Ne){var Qe=function(ui,yi,xi,Ci,Jt){var ni=[yi[0]-ui[0],yi[1]-ui[1]],Vi=[Ci[0]-xi[0],Ci[1]-xi[1]];function Wi(Mi,pn,yn){return[Mi[0]+pn*yn[0],Mi[1]+pn*yn[1]]}var Xi=[xi[0]-ui[0],xi[1]-ui[1]],sn=Fe(ni,Vi),_n=sn*sn,dn=ke(ni,ni);if(_n>0){var Ki=Fe(Xi,Vi)/sn;if(Ki<0||Ki>1)return null;var tn=Fe(Xi,ni)/sn;return tn<0||tn>1?null:Ki===0||Ki===1?[Wi(ui,Ki,ni)]:tn===0||tn===1?[Wi(xi,tn,Vi)]:[Wi(ui,Ki,ni)]}if((_n=(sn=Fe(Xi,ni))*sn)>0)return null;var vi=ke(ni,Xi)/dn,Di=vi+ke(ni,Vi)/dn,Ln=Math.min(vi,Di),Yt=Math.max(vi,Di);return Ln<=1&&Yt>=0?Ln===1?[Wi(ui,Ln>0?Ln:0,ni)]:Yt===0?[Wi(ui,Yt<1?Yt:1,ni)]:[Wi(ui,Ln>0?Ln:0,ni),Wi(ui,Yt<1?Yt:1,ni)]:null}(te.point,te.otherEvent.point,oe.point,oe.otherEvent.point),gt=Qe?Qe.length:0;if(gt===0||gt===1&&($(te.point,oe.point)||$(te.otherEvent.point,oe.otherEvent.point))||gt===2&&te.isSubject===oe.isSubject)return 0;if(gt===1)return $(te.point,Qe[0])||$(te.otherEvent.point,Qe[0])||Xe(te,Qe[0],Ne),$(oe.point,Qe[0])||$(oe.otherEvent.point,Qe[0])||Xe(oe,Qe[0],Ne),1;var yt=[],Bt=!1,Ut=!1;return $(te.point,oe.point)?Bt=!0:We(te,oe)===1?yt.push(oe,te):yt.push(te,oe),$(te.otherEvent.point,oe.otherEvent.point)?Ut=!0:We(te.otherEvent,oe.otherEvent)===1?yt.push(oe.otherEvent,te.otherEvent):yt.push(te.otherEvent,oe.otherEvent),Bt&&Ut||Bt?(oe.type=m,te.type=oe.inOut===te.inOut?y:x,Bt&&!Ut&&Xe(yt[1].otherEvent,yt[0].point,Ne),2):Ut?(Xe(yt[0],yt[1].point,Ne),3):yt[0]!==yt[3].otherEvent?(Xe(yt[0],yt[1].point,Ne),Xe(yt[1],yt[2].point,Ne),3):(Xe(yt[0],yt[1].point,Ne),Xe(yt[3].otherEvent,yt[2].point,Ne),3)}function pt(te,oe){if(te===oe)return 0;if(et(te.point,te.otherEvent.point,oe.point)!==0||et(te.point,te.otherEvent.point,oe.otherEvent.point)!==0)return $(te.point,oe.point)?te.isBelow(oe.otherEvent.point)?-1:1:te.point[0]===oe.point[0]?te.point[1]<oe.point[1]?-1:1:We(te,oe)===1?oe.isAbove(te.point)?-1:1:te.isBelow(oe.point)?-1:1;if(te.isSubject!==oe.isSubject)return te.isSubject?-1:1;var Ne=te.point,Qe=oe.point;return Ne[0]===Qe[0]&&Ne[1]===Qe[1]?(Ne=te.otherEvent.point)[0]===(Qe=oe.otherEvent.point)[0]&&Ne[1]===Qe[1]?0:te.contourId>oe.contourId?1:-1:We(te,oe)===1?1:-1}var ot=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ot(te,oe,Ne,Qe){var gt,yt=te+1,Bt=oe[te].point,Ut=oe.length;for(yt<Ut&&(gt=oe[yt].point);yt<Ut&&gt[0]===Bt[0]&&gt[1]===Bt[1];){if(!Ne[yt])return yt;++yt<Ut&&(gt=oe[yt].point)}for(yt=te-1;Ne[yt]&&yt>Qe;)yt--;return yt}ot.prototype.isExterior=function(){return this.holeOf==null};var wt=Pt,Et=Pt;function Pt(te,oe){if(!(this instanceof Pt))return new Pt(te,oe);if(this.data=te||[],this.length=this.data.length,this.compare=oe||wi,this.length>0)for(var Ne=(this.length>>1)-1;Ne>=0;
46Ne--)this._down(Ne)}function wi(te,oe){return te<oe?-1:te>oe?1:0}Pt.prototype={push:function(te){this.data.push(te),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var te=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),te}},peek:function(){return this.data[0]},_up:function(te){for(var oe=this.data,Ne=this.compare,Qe=oe[te];te>0;){var gt=te-1>>1,yt=oe[gt];if(Ne(Qe,yt)>=0)break;oe[te]=yt,te=gt}oe[te]=Qe},_down:function(te){for(var oe=this.data,Ne=this.compare,Qe=this.length>>1,gt=oe[te];te<Qe;){var yt=1+(te<<1),Bt=yt+1,Ut=oe[yt];if(Bt<this.length&&Ne(oe[Bt],Ut)<0&&(yt=Bt,Ut=oe[Bt]),Ne(Ut,gt)>=0)break;oe[te]=Ut,te=yt}oe[te]=gt}},wt.default=Et;var lt=Math.max,Rt=Math.min,oi=0;function zi(te,oe,Ne,Qe,gt,yt){var Bt,Ut,ui,yi,xi,Ci;for(Bt=0,Ut=te.length-1;Bt<Ut;Bt++)if(yi=te[Bt+1],xi=new V(ui=te[Bt],!1,void 0,oe),Ci=new V(yi,!1,xi,oe),xi.otherEvent=Ci,ui[0]!==yi[0]||ui[1]!==yi[1]){xi.contourId=Ci.contourId=Ne,yt||(xi.isExteriorRing=!1,Ci.isExteriorRing=!1),We(xi,Ci)>0?Ci.left=!0:xi.left=!0;var Jt=ui[0],ni=ui[1];gt[0]=Rt(gt[0],Jt),gt[1]=Rt(gt[1],ni),gt[2]=lt(gt[2],Jt),gt[3]=lt(gt[3],ni),Qe.push(xi),Qe.push(Ci)}}var ki=[];function di(te,oe,Ne){typeof te[0][0][0]=="number"&&(te=[te]),typeof oe[0][0][0]=="number"&&(oe=[oe]);var Qe=function(ni,Vi,Wi){var Xi=null;return ni.length*Vi.length==0&&(Wi===T?Xi=ki:Wi===I?Xi=ni:Wi!==S&&Wi!==M||(Xi=ni.length===0?Vi:ni)),Xi}(te,oe,Ne);if(Qe)return Qe===ki?null:Qe;var gt=[1/0,1/0,-1/0,-1/0],yt=[1/0,1/0,-1/0,-1/0],Bt=function(ni,Vi,Wi,Xi,sn){var _n,dn,Ki,tn,vi,Di,Ln=new wt(null,We);for(Ki=0,tn=ni.length;Ki<tn;Ki++)for(vi=0,Di=(_n=ni[Ki]).length;vi<Di;vi++)(dn=vi===0)&&oi++,zi(_n[vi],!0,oi,Ln,Wi,dn);for(Ki=0,tn=Vi.length;Ki<tn;Ki++)for(vi=0,Di=(_n=Vi[Ki]).length;vi<Di;vi++)dn=vi===0,sn===I&&(dn=!1),dn&&oi++,zi(_n[vi],!1,oi,Ln,Xi,dn);return Ln}(te,oe,gt,yt,Ne);if(Qe=function(ni,Vi,Wi,Xi,sn){var _n=null;return(Wi[0]>Xi[2]||Xi[0]>Wi[2]||Wi[1]>Xi[3]||Xi[1]>Wi[3])&&(sn===T?_n=ki:sn===I?_n=ni:sn!==S&&sn!==M||(_n=ni.concat(Vi))),_n}(te,oe,gt,yt,Ne))return Qe===ki?null:Qe;for(var Ut=function(ni){var Vi,Wi,Xi=function(Ki){var tn,vi,Di,Ln,Yt=[];for(vi=0,Di=Ki.length;vi<Di;vi++)((tn=Ki[vi]).left&&tn.inResult||!tn.left&&tn.otherEvent.inResult)&&Yt.push(tn);for(var Mi=!1;!Mi;)for(Mi=!0,vi=0,Di=Yt.length;vi<Di;vi++)vi+1<Di&&We(Yt[vi],Yt[vi+1])===1&&(Ln=Yt[vi],Yt[vi]=Yt[vi+1],Yt[vi+1]=Ln,Mi=!1);for(vi=0,Di=Yt.length;vi<Di;vi++)(tn=Yt[vi]).otherPos=vi;for(vi=0,Di=Yt.length;vi<Di;vi++)(tn=Yt[vi]).left||(Ln=tn.otherPos,tn.otherPos=tn.otherEvent.otherPos,tn.otherEvent.otherPos=Ln);return Yt}(ni),sn={},_n=[],dn=function(){if(!sn[Vi]){var Ki=_n.length,tn=function(Yt,Mi,pn){var yn=new ot;if(Yt.prevInResult!=null){var Tn=Yt.prevInResult,tr=Tn.outputContourId;if(Tn.resultTransition>0){var xn=Mi[tr];if(xn.holeOf!=null){var Kt=xn.holeOf;Mi[Kt].holeIds.push(pn),yn.holeOf=Kt,yn.depth=Mi[tr].depth}else Mi[tr].holeIds.push(pn),yn.holeOf=tr,yn.depth=Mi[tr].depth+1}else yn.holeOf=null,yn.depth=Mi[tr].depth}else yn.holeOf=null,yn.depth=0;return yn}(Xi[Vi],_n,Ki),vi=function(Yt){sn[Yt]=!0,Yt<Xi.length&&Xi[Yt]&&(Xi[Yt].outputContourId=Ki)},Di=Vi,Ln=Vi;for(tn.points.push(Xi[Vi].point);vi(Di),vi(Di=Xi[Di].otherPos),tn.points.push(Xi[Di].point),!((Di=Ot(Di,Xi,sn,Ln))==Ln||Di>=Xi.length)&&Xi[Di];);_n.push(tn)}};for(Vi=0,Wi=Xi.length;Vi<Wi;Vi++)dn();return _n}(function(ni,Vi,Wi,Xi,sn,_n){for(var dn,Ki,tn,vi=new i(pt),Di=[],Ln=Math.min(Xi[2],sn[2]);ni.length!==0;){var Yt=ni.pop();if(Di.push(Yt),_n===T&&Yt.point[0]>Ln||_n===I&&Yt.point[0]>Xi[2])break;if(Yt.left){Ki=dn=vi.insert(Yt),dn=dn!==(tn=vi.minNode())?vi.prev(dn):null,Ki=vi.next(Ki);var Mi=dn?dn.key:null;if(P(Yt,Mi,_n),Ki&&Ye(Yt,Ki.key,ni)===2&&(P(Yt,Mi,_n),P(Ki.key,Yt,_n)),dn&&Ye(dn.key,Yt,ni)===2){var pn=dn;P(Mi,(pn=pn!==tn?vi.prev(pn):null)?pn.key:null,_n),P(Yt,Mi,_n)}}else Ki=dn=vi.find(Yt=Yt.otherEvent),dn&&Ki&&(dn=dn!==tn?vi.prev(dn):null,Ki=vi.next(Ki),vi.remove(Yt),Ki&&dn&&Ye(dn.key,Ki.key,ni))}return Di}(Bt,0,0,gt,yt,Ne)),ui=[],yi=0;yi<Ut.length;yi++){var xi=Ut[yi];if(xi.isExterior()){for(var Ci=[xi.points],Jt=0;Jt<xi.holeIds.length;Jt++)Ci.push(Ut[xi.holeIds[Jt]].points);ui.push(Ci)}}return ui}var hn={UNION:S,DIFFERENCE:I,INTERSECTION:T,XOR:M};n.diff=function(te,oe){return di(te,oe,I)},n.intersection=function(te,oe){return di(te,oe,T)},n.operations=hn,n.union=function(te,oe){return di(te,oe,S)},n.xor=function(te,oe){return di(te,oe,M)},Object.defineProperty(n,"__esModule",{value:!0})}
46($S.exports)),$S.exports);/**
47 * martinez v0.7.4
48 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
49 *
50 * @author Alex Milevski <[email protected]>
51 * @license MIT
52 * @preserve
53 */function $y(n,e,i,o){const a=[],u=o===0?(d,m,y,x,T,S)=>{d.push(new Ke(S,y+(S-m)/(x-m)*(T-y)))}:(d,m,y,x,T,S)=>{d.push(new Ke(m+(S-y)/(T-y)*(x-m),S))};for(const d of n){const m=[];for(const y of d){if(y.length<=2)continue;const x=[];for(let I=0;I<y.length-1;I++){const M=y[I].x,P=y[I].y,k=y[I+1].x,V=y[I+1].y,N=o===0?M:P,$=o===0?k:V;N<e?$>e&&u(x,M,P,k,V,e):N>i?$<i&&u(x,M,P,k,V,i):x.push(y[I]),$<e&&N>=e&&u(x,M,P,k,V,e),$>i&&N<=i&&u(x,M,P,k,V,i)}let T=y[y.length-1];const S=o===0?T.x:T.y;S>=e&&S<=i&&x.push(T),x.length&&(T=x[x.length-1],x[0].x===T.x&&x[0].y===T.y||x.push(x[0]),m.push(x))}m.length&&a.push(m)}return a}function UR(n,e){const i=D1(n),o=D1([e]),a=HS.intersection(i,o);return a==null?[]:qS(a)}function GR(n,e){let o=D1(n,65536);const a=[];for(;e.valid();e.next()){const[u,d]=e.get(),m=u.x*65536,y=u.y*65536,x=d.x*65536,T=d.y*65536,S=x-m,I=T-y,M=Math.hypot(S,I);if(M===0)continue;const P=Math.trunc(I/M*3),k=-Math.trunc(S/M*3);a.push([[[m,y],[x,T],[x+P,T+k],[m+P,y+k],[m,y]]])}return a.length>0&&(o=HS.diff(o,a)),qS(o,1/65536)}function D1(n,e=1){return[n.map(i=>i.map(o=>[o.x*e,o.y*e]))]}function qS(n,e=1){return n.map(i=>i.map((o,a)=>{const u=o.map(d=>new Ke(d[0]*e,d[1]*e).round());return a>0&&u.reverse(),u}))}class k1{constructor(e,i){this.layoutVertexArray=new fl,this.indexArray=new mr,this.lineIndexArray=new Yo,this.triangleSegments=new zn,this.lineSegments=new zn,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new za)}update(e,i,o,a,u,d,m,y){this.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,y)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,AR.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,CR.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,o,a,u,d,m){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,a,u,d,void 0,m)}}class O1{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new k1(e,!1),this.elevationBufferData=new k1(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.hasPattern=L1("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),d=[];for(const{feature:m,id:y,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,I=ve(m,S);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,o))continue;const M=u?u.evaluate(I,{},o,i.availableImages):void 0,P={id:y,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?I.geometry:ce(m,o,a),patterns:{},sortKey:M};d.push(P)}u&&d.sort((m,y)=>m.sortKey-y.sortKey);for(const m of d){const{geometry:y,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=z1("fill",this.layers,m,this.zoom,this.pixelRatio,i);this.patternFeatures.push(S)}else this.addFeature(m,y,x,o,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[x].feature,y,x,T,this.index)}}update(e,i,o,a,u,d,m){this.bufferData.update(e,i,o,a,u,d,m,this.worldview),this.elevationBufferData.update(e,i,o,a,u,d,m,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,o,a,u,d,m,this.worldview)}addFeatures(e,i,o,a,u,d){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,o,a,d,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
53addFeature(e,i,o,a,u,d=[],m,y){const x=Fm(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,x,a,o,y):this.addGeometry(x,this.bufferData),this.bufferData.populatePaintArrays(e,o,u,d,a,m,this.worldview),this.elevationBufferData.populatePaintArrays(e,o,u,d,a,m,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,o,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,o,a,u,this.worldview))}addElevatedRoadFeature(e,i,o,a,u){const d=new Array,m=Qi.getElevationFeature(e,u);if(!m)return void this.addGeometry(i,this.bufferData);{const x=this.clipPolygonsToTile(i,1);x.length>0&&d.push({polygons:x,elevationFeature:m,elevationTileID:o})}const y={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},o),featureIndex:a};for(const x of d)if(x.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Jo(x.elevationTileID,this.layers,this.zoom,this.lut));const S=x.elevationFeature.isTunnel();let I=0;e.properties.hasOwnProperty(Me)&&(I=+e.properties[Me]);for(const M of x.polygons)this.elevatedStructures.addPortalCandidates(x.elevationFeature.id,M,S,x.elevationFeature,I)}x.elevationFeature.constantHeight==null&&(x.polygons=this.prepareElevatedPolygons(x.polygons,x.elevationFeature,x.elevationTileID));const T=new cn(o,x.elevationTileID);this.addElevatedGeometry(x.polygons,T,x.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,y)}}addElevatedGeometry(e,i,o,a,u,d){const m={elevation:o,elevationSampler:i,bias:a,index:u,featureInfo:d},[y,x]=this.addGeometry(e,this.elevationBufferData,m);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:y,max:x}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,y),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,x))}addGeometry(e,i,o){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=null;o&&(d=o.elevationSampler.constantElevation(o.elevation,o.bias),d!=null&&(a=d,u=d));const m=(y,x,T)=>{if(o!=null)if(x.push(y),d!=null)i.elevatedLayoutVertexArray.emplaceBack(d),T.push(d);else{const S=o.elevationSampler.pointElevation(y,o.elevation,o.bias);i.elevatedLayoutVertexArray.emplaceBack(S),T.push(S),a=Math.min(a,S),u=Math.max(u,S)}};for(const y of e){let x=0;for(const q of y)x+=q.length;const T=i.triangleSegments.prepareSegment(x,i.layoutVertexArray,i.indexArray),S=T.vertexLength,I=[],M=[],P=[],k=[],V=[],N=i.layoutVertexArray.length;for(const q of y){if(q.length===0)continue;q!==y[0]&&M.push(I.length/2);const Y=i.lineSegments.prepareSegment(q.length,i.layoutVertexArray,i.lineIndexArray),re=Y.vertexLength;o&&V.push(i.layoutVertexArray.length-N),m(q[0],P,k),i.layoutVertexArray.emplaceBack(q[0].x,q[0].y),i.lineIndexArray.emplaceBack(re+q.length-1,re),I.push(q[0].x),I.push(q[0].y);for(let ee=1;ee<q.length;ee++)m(q[ee],P,k),i.layoutVertexArray.emplaceBack(q[ee].x,q[ee].y),i.lineIndexArray.emplaceBack(re+ee-1,re+ee),I.push(q[ee].x),I.push(q[ee].y);Y.vertexLength+=q.length,Y.primitiveLength+=q.length}const $=up(I,M);for(let q=0;q<$.length;q+=3)i.indexArray.emplaceBack(S+$[q],S+$[q+1],S+$[q+2]);if($.length>0&&o&&this.elevationMode==="hd-road-base"){const q=o.elevation.isTunnel(),Y=o.elevation.safeArea,re=this.elevatedStructures.addVertices(P,k);this.elevatedStructures.addTriangles($,re,q);const ee=V.length;if(ee>0){for(let ae=0;ae<ee-1;ae++)this.elevatedStructures.addRenderableRing(o.index,V[ae]+re,V[ae+1]-V[ae],q,Y,o.featureInfo);this.elevatedStructures.addRenderableRing(o.index,V[ee-1]+re,P.length-V[ee-1],q,Y,o.featureInfo)}}T.vertexLength+=x,T.primitiveLength+=$.length/3}return[a,u]}prepareElevatedPolygons(e,i,o){const a=1/U(o),u=[];for(const d of e){const m=GR(d,new Zi(i,a));u.push(...m)}return u}clipPolygonsToTile(e,i){const o=-i,a=-i,u=ht+i,d=ht+i;let m=0;const y=[],x=[];for(;m<e.length;m++){const I=e[m],M=Aa(I);(M.min.x>=o&&M.max.x<=u&&M.min.y>=a&&M.max.y<=d?y:x).push(I)}if(y.length===e.length)return e;const T=[new Ke(o,a),new Ke(u,a),new Ke(u,d),new Ke(o,d),new Ke(o,a)],S=y;for(const I of x)S.push(...UR(I,T));return S}}let ZS,WS,XS,YS;At(O1,"FillBucket",{omit:["layers","patternFeatures"]}),At(k1,"FillBufferData"),At(Jo,"ElevatedStructures");class Hy{constructor(e,i,o,a){if(this.triangleCount=i.length/3,this.min=new Ke(0,0),this.max=new Ke(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,d]=[e[0].clone(),e[0].clone()];for(let S=1;S<e.length;++S){const I=e[S];u.x=Math.min(u.x,I.x),u.y=Math.min(u.y,I.y),d.x=Math.max(d.x,I.x),d.y=Math.max(d.y,I.y)}if(a){const S=Math.ceil(Math.max(d.x-u.x,d.y-u.y)/a);o=Math.max(o,S)}if(o===0)return;this.min=u,this.max=d;const m=this.max.sub(this.min);m.x=Math.max(m.x,1),m.y=Math.max(m.y,1);const y=Math.max(m.x,m.y)/o;this.cellsX=Math.max(1,Math.ceil(m.x/y)),this.cellsY=Math.max(1,Math.ceil(m.y/y)),this.xScale=1/y,this.yScale=1/y;const x=[];for(let S=0;S<this.triangleCount;S++){const I=e[i[3*S+0]].sub(this.min),M=e[i[3*S+1]].sub(this.min),P=e[i[3*S+2]].sub(this.min),k=vl(M
vendor: 16,428 bytes, line 53
53ath.floor(Math.min(I.x,M.x,P.x)),this.xScale,this.cellsX),V=vl(Math.floor(Math.max(I.x,M.x,P.x)),this.xScale,this.cellsX),N=vl(Math.floor(Math.min(I.y,M.y,P.y)),this.yScale,this.cellsY),$=vl(Math.floor(Math.max(I.y,M.y,P.y)),this.yScale,this.cellsY),q=new Ke(0,0),Y=new Ke(0,0),re=new Ke(0,0),ee=new Ke(0,0);for(let ae=N;ae<=$;++ae){q.y=Y.y=ae*y,re.y=ee.y=(ae+1)*y;for(let he=k;he<=V;++he)q.x=re.x=he*y,Y.x=ee.x=(he+1)*y,(eo(I,M,P,q,Y,ee)||eo(I,M,P,q,ee,re))&&x.push({cellIdx:ae*this.cellsX+he,triIdx:S})}}if(x.length===0)return;x.sort((S,I)=>S.cellIdx-I.cellIdx||S.triIdx-I.triIdx);let T=0;for(;T<x.length;){const S=x[T].cellIdx,I={start:this.payload.length,len:0};for(;T<x.length&&x[T].cellIdx===S;)++I.len,this.payload.push(x[T++].triIdx);this.cells[S]=I}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const o=vl(e.x-this.min.x,this.xScale,this.cellsX),a=vl(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+o];if(u){this._lazyInitLookup();for(let d=0;d<u.len;d++){const m=this.payload[u.start+d],y=Math.floor(m/8),x=1<<m%8;if(!(this.lookup[y]&x)&&(this.lookup[y]|=x,i.push(m),i.length===this.triangleCount))return}}}query(e,i,o){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=vl(e.x-this.min.x,this.xScale,this.cellsX),u=vl(i.x-this.min.x,this.xScale,this.cellsX),d=vl(e.y-this.min.y,this.yScale,this.cellsY),m=vl(i.y-this.min.y,this.yScale,this.cellsY);for(let y=d;y<=m;y++)for(let x=a;x<=u;x++){const T=this.cells[y*this.cellsX+x];if(T)for(let S=0;S<T.len;S++){const I=this.payload[T.start+S],M=Math.floor(I/8),P=1<<I%8;if(!(this.lookup[M]&P)&&(this.lookup[M]|=P,o.push(I),o.length===this.triangleCount))return}}}}function vl(n,e,i){return Math.max(0,Math.min(i-1,Math.floor(n*e)))}At(Hy,"TriangleGridIndex");class KS{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}updateAppearances(e,i,o,a){}populate(e,i,o,a){const u=[];for(const{feature:d,id:m,index:y,sourceLayerIndex:x}of e){const T=this.layers[0]._featureFilter.needGeometry,S=ve(d,T);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),S,o))continue;const I={id:m,properties:d.properties,type:d.type,sourceLayerIndex:x,index:y,geometry:T?S.geometry:ce(d,o,a),patterns:{}};u.push(I)}for(const d of u){const{geometry:m,index:y,sourceLayerIndex:x}=d;this.addFeature(d,m,y,o,{},i.availableImages,i.brightness),i.featureIndex.insert(e[y].feature,m,y,x,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,o,a,u,d,m){}destroy(){}addFeature(e,i,o,a,u,d=[],m){for(const y of Fm(i,2)){const x=[],T=[],S=[],I=new Ke(1/0,1/0),M=new Ke(-1/0,-1/0);for(const V of y)if(V.length!==0){V!==y[0]&&S.push(T.length/2);for(let N=0;N<V.length;N++)T.push(V[N].x),T.push(V[N].y),x.push(V[N]),I.x=Math.min(I.x,V[N].x),I.y=Math.min(I.y,V[N].y),M.x=Math.max(M.x,V[N].x),M.y=Math.max(M.y,V[N].y)}const P=up(T,S),k=new Hy(x,P,8,256);this.footprints.push({vertices:x,indices:P,grid:k,min:I,max:M})}}}At(KS,"ClipBucket",{omit:["layers"]});const $R=Ai([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),HR=Ai([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),qR=Ai([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),ZR=Ai([{name:"a_centroid_pos",components:2,type:"Uint16"}]),WR=Ai([{name:"a_join_normal_inside",components:3,type:"Int16"}]),XR=Ai([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),YR=Ai([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:KR}=$R,Bm=Number.MAX_SAFE_INTEGER,JS=Bm-1;function QS(n,e,i,o){return n.order<e||n.order===Bm||!(n.clipMask&i)||function(a,u){return u.length!==0&&u.find(d=>d===a)===void 0}(o,n.clipScope)}function qy(n,e){return n.x-e.x||n.y-e.y}function eE(n,e){return qy(n.min,e.min)===0&&qy(n.max,e.max)===0}function F1(n,e){return!(n.min.x>e.max.x||n.max.x<e.min.x||n.min.y>e.max.y||n.max.y<e.min.y)}function Zy(n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(n[i].sourceId!==e[i].sourceId||!eE(n[i],e[i])||n[i].order!==e[i].order||n[i].clipMask!==e[i].clipMask||!Ta(n[i].clipScope,e[i].clipScope))return!1;return!0}function tE(n,e,i){const o=1/ht,a=1/(1<<i.canonical.z),u=(e.x*o+i.canonical.x)*a+i.wrap,d=(e.y*o+i.canonical.y)*a;return{min:new Ke((n.x*o+i.canonical.x)*a+i.wrap,(n.y*o+i.canonical.y)*a),max:new Ke(u,d)}}function JR(n,e,i){const o=1<<i.canonical.z,a=((e.x-i.wrap)*o-i.canonical.x)*ht,u=(e.y*o-i.canonical.y)*ht;return{min:new Ke(((n.x-i.wrap)*o-i.canonical.x)*ht,(n.y*o-i.canonical.y)*ht),max:new Ke(a,u)}}function B1(n,e,i,o,a,u,d){const m=n.indices,y=n.vertices,x=[];for(let T=o;T<o+a;T+=3){const S=e[i[T+0]+u],I=e[i[T+1]+u],M=e[i[T+2]+u],P=Math.min(S.x,I.x,M.x),k=Math.max(S.x,I.x,M.x),V=Math.min(S.y,I.y,M.y),N=Math.max(S.y,I.y,M.y);x.length=0,n.grid.query(new Ke(P,V),new Ke(k,N),x);for(let $=0;$<x.length;$++){const q=x[$];if(eo(y[m[3*q+0]],y[m[3*q+1]],y[m[3*q+2]],S,I,M,d))return!0}}return!1}function iE(n,e,i,o){if(!n||!i)return!1;let a=n.vertices;if(!e.canonical.equals(o.canonical)||e.wrap!==o.wrap){if(i.vertices.length<n.vertices.length)return iE(i,o,n,e);const u=e.canonical,d=o.canonical,m=Math.pow(2,d.z-u.z);a=n.vertices.map(y=>new Ke((y.x+u.x*ht)*m-d.x*ht,(y.y+u.y*ht)*m-d.y*ht))}return B1(i,a,n.indices,0,n.indices.length,0,0)}function nE(n,e,i,o){const a=Math.pow(2,o.z-i.z);return new Ke((n+i.x*ht)*a-o.x*ht,(e+i.y*ht)*a-o.y*ht)}function rE(n,e){const i=[];e.grid.queryPoint(n,i);const o=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const d=i[u];if(fn([a[o[3*d+0]],a[o[3*d+1]],a[o[3*d+2]]],n))return!0}return!1}const N1=[new Ke(0,0),new Ke(ht,0),new Ke(ht,ht),new Ke(0,ht)];function oE(n,e){const i=[];let o=[];if(!e||n.length<2)return[n];if(n.length===2)return Zr(n[0],n[1],N1)?[n]:[];for(let a=0;a<n.length+2;a++){const u=n[a%n.length],d=n[(a+1)%n.length],m=Zr(a===0?n[n.length-1]:n[(a-1)%n.length],u,N1),y=Zr(u,d,N1),x=m||y;x&&o.push(u),x&&y||o.length>0&&(o.length>1&&i.push(o),o=[])}return o.length>1&&i.push(o),i}const V1=ge.types,QR=["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"],eL=["fill-extrusion-flood-light-ground-radius"],tL=Math.pow(2,13),iL=Math.pow(2,15)-1,sE=new Ke(0,1),nc=2147483648,aE=7,lE=450;function Nm(n,e,i,o,a,u,d,m){n.emplaceBack((e<<1)+d,(i<<1)+u,(Math.floor(o*tL)<<1)+a,Math.round(m))}function Vm(n,e,i){n.emplaceBack(e.x*ht,e.y*ht,i?1:0)}function Wy(n,e,i,o,a,u){n.emplaceBack(e.x,e.y,(i.x<<1)+o,(i.y<<1)+a,u)}function jm(n,e,i){n.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class cE{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class uE{constructor(){this.centroidXY=new Ke(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 Ke(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ke(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Ke(this.max.x-this.min.x,this.max.y-this.min.y)}}class hE{constructor(){this.acc=new Ke(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,o){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===ht)&&i.x===o.x)!=((i.y===0||i.y===ht)&&i.y===o.y)&&this.processBorderOverlap(i,o),a&&this.checkBorderIntersection(i,o)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,Qt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>ht!=e.x>ht&&this.addBorderIntersection(1,Qt(i.y,e.y,(ht-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,Qt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>ht!=e.y>ht&&this.addBorderIntersection(3,Qt(i.x,e.x,(ht-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const o=this.borders[e];i<o[0]&&(o[0]=i),i>o[1]&&(o[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const o=e.x===0?0:1;this.addBorderIntersection(o,i.y),this.addBorderIntersection(o,e.y)}else{const o=e.y===0?2:3;this.addBorderIntersection(o,i.x),this.addBorderIntersection(o,e.x)}}centroid(){return this.accCount===0?new Ke(0,0):new Ke(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function dE(n,e){const i=n.add(e)._unit(),o=j(n.x*i.x+n.y*i.y,-1,1);var a,u,d;return a=Math.acos(o),Math.min(4,Math.max(-4,Math.tan(a)))/4*iL*((u=n).x*(d=e).y-u.y*d.x<0?-1:1)}const nL=[n=>n.x<0,n=>n.x>ht,n=>n.y<0,n=>n.y>ht];function rL(n,e,i,o){const a=[4];if(o===0)return a;i._mult(o);const u=n.sub(i),d=e.sub(i),m=[n,e,u,d];for(let y=0;y<4;y++)for(const x of m)if(nL[y](x)){a.push(y);break}return a}class j1{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new pm,this.indexArray=new mr,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut},i=>eL.includes(i)),this._segments=new zn,this.hiddenByLandmarkVertexArray=new Jd,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new zn}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,o,a=!1){const u=e.length;if(u>2){let d=Math.max(0,this._segments.get().length-1);const m=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[d].length);let y;d!==this._segments.get().length-1&&(d++,this._segmentToGroundQuads[d]=[],this._segmentToRegionTriCounts[d]=[0,0,0,0,0]);{const x=e[0],T=e[1];y=dE(x.sub(e[u-1])._perp()._unit(),T.sub(x)._perp()._unit())}for(let x=0;x<u;x++){const T=x===u-1?0:x+1,S=e[x],I=e[T],M=e[T===u-1?0:T+1],P=I.sub(S)._perp()._unit(),k=dE(P,M.sub(I)._perp()._unit()),V=y,N=k;if(U1(S,I,i)||a&&mE(S,i)&&mE(I,i)){y=k;continue}const $=m.vertexLength;Wy(this.vertexArray,S,I,1,1,V),Wy(this.vertexArray,S,I,1,0,V),Wy(this.vertexArray,S,I,0,1,N),Wy(this.vertexArray,S,I,0,0,N),m.vertexLength+=4;const q=rL(S,I,P,o);for(const Y of q)this._segmentToGroundQuads[d].push({id:$,region:Y}),this._segmentToRegionTriCounts[d][Y]+=2,m.primitiveLength+=2;y=k}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let o=0;o<i;o++)this._segmentToGroundQuads[o].sort((a,u)=>a.region-u.region);for(let o=0;o<i;o++){const a=this._segmentToGroundQuads[o],u=e[o],d=this._segmentToRegionTriCounts[o];d.reduce((y,x)=>y+x,0);let m=0;for(let y=0;y<=4;y++){const x=d[y];if(x!==0){let T=this.regionSegments[y];T||(T=this.regionSegments[y]=new zn);const S={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+m,vertexLength:u.vertexLength,primitiveLength:x};T.get().push(S)}m+=x}for(let y=0;y<a.length;y++){const x=a[y].id;this.indexArray.emplaceBack(x,x+1,x+3),this.indexArray.emplaceBack(x,x+3,x+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,o,a,u,d,m){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,o,a,u,d,void 0,m)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,HR.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,qR.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,o,a,u,d,m,y){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,o,a,u,d,m,y)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&nc))}updateHiddenByLandmarkRange(e,i,o){if(!this.hasData())return;const a=i+e;if(i!==0){for(let u=e;u<a;++u)this.hiddenByLandmarkVertexArray.emplace(u,o?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,XR.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 e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Xy{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new mr,this.footprintVertices=new fl,this.footprintSegments=[],this.layoutVertexArray=new qc,this.centroidVertexArray=new Oy,this.wallVertexArray=new Qu,this.indexArray=new mr,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut},i=>QR.includes(i)),this.segments=new zn,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new j1(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.features=[],this.hasPattern=L1("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=U(o),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:d,index:m,sourceLayerIndex:y}of e){const x=this.layers[0]._featureFilter.needGeometry,T=ve(u,x);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),T,o))continue;const S={id:d,sourceLayerIndex:y,index:m,geometry:x?T.geometry:ce(u,o,a),properties:u.properties,type:u.type,patterns:{}},I=this.layoutVertexArray.length,M=V1[S.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:u.id,feature:z1("fill-extrusion",this.layers,S,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const P of S.geometry)for(const k of oE(P,M))this.addFeature(u.id,S,[k],m,o,{},i.availableImages,a,i.brightness);else this.addFeature(u.id,S,S.geometry,m,o,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,S.geometry,m,y,this.index,I)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,o,a,u,d){for(const{featureId:m,feature:y}of this.features){const x=V1[y.type]==="Polygon",{geometry:T}=y;
53if(this.wallMode)for(const S of T)for(const I of oE(S,x))this.addFeature(m,y,[I],y.index,i,o,a,u,d);else this.addFeature(m,y,T,y.index,i,o,a,u,d)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,o,a,u,d,m){this.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,this.worldview),this.groundEffect.update(e,i,u,o,a,d,m,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,KR),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,WR.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,YR.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ZR.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,o,a,u,d,m,y,x){const T=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,S=[new Ke(0,0),new Ke(ht,ht)],I=y.projection,M=I.name==="globe",P=this.wallMode||V1[i.type]==="Polygon",k=new hE;k.centroidDataIndex=this.centroidData.length;const V=new uE;V.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(V.buildingId=i.properties.building_id);const N=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},u)<=0,$=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},u);let q;if(V.height=$,V.vertexArrayOffset=this.layoutVertexArray.length,V.groundVertexArrayOffset=this.groundEffect.vertexArray.length,M&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new qd),this.wallMode){if(M)return void Tt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(o.length!==1)return;q=function(xe){const Be=xe[0].x===xe[xe.length-1].x&&xe[0].y===xe[xe.length-1].y;(function(Et){let Pt=0;const wi=Et.length;for(let lt=0;lt<wi;lt++)Pt+=(Et[(lt+1)%wi].x-Et[lt].x)*(Et[(lt+1)%wi].y+Et[lt].y);return Pt>=0})(xe)||(xe=xe.reverse());const $e={geometry:[],joinNormals:[],indices:[]},Je=[],et=[],We=[];let Xe=xe.length;for(;Xe>=2&&xe[Xe-1].equals(xe[Xe-2]);)Xe--;if(Xe<(Be?3:2))return $e;let Fe,ke,Ye,pt,ot,Ot=0;for(;Ot<Xe-1&&xe[Ot].equals(xe[Ot+1]);)Ot++;Be&&(Fe=xe[Xe-2],ot=xe[Ot].sub(Fe)._unit()._perp());for(let Et=Ot;Et<Xe;Et++){if(Ye=Et===Xe-1?Be?xe[Ot+1]:void 0:xe[Et+1],Ye&&xe[Et].equals(Ye))continue;ot&&(pt=ot),Fe&&(ke=Fe),Fe=xe[Et],ot=Ye?Ye.sub(Fe)._unit()._perp():pt,pt=pt||ot;let Pt=pt.add(ot);Pt.x===0&&Pt.y===0||Pt._unit();const wi=Pt.x*ot.x+Pt.y*ot.y,lt=wi!==0?1/wi:1/0,Rt=pt.x*ot.y-pt.y*ot.x>0;let oi="miter";const zi=2;oi==="miter"&&lt>zi&&(oi="bevel"),oi==="bevel"&&(lt>100&&(oi="flipbevel"),lt<zi&&(oi="miter"));const ki=(di,hn,te,oe)=>{const Ne=new Ke(di.x,di.y),Qe=new Ke(di.x,di.y);Ne.x+=hn.x*oe,Ne.y+=hn.y*oe,Qe.x-=hn.x*Math.max(te,1),Qe.y-=hn.y*Math.max(te,1),We.push(hn),Je.push(Ne),et.push(Qe)};if(oi==="miter")Pt._mult(lt),ki(Fe,Pt,0,0);else if(oi==="flipbevel")Pt=ot.mult(-1),ki(Fe,Pt,0,0),ki(Fe,Pt.mult(-1),0,0);else{const di=-Math.sqrt(lt*lt-1),hn=Rt?di:0,te=Rt?0:di;ke&&ki(Fe,pt,hn,te),Ye&&ki(Fe,ot,hn,te)}}$e.geometry=[...Je,...et.reverse(),Je[0]],$e.joinNormals=[...We,...We.reverse(),We[We.length-1]];const wt=$e.geometry.length-1;for(let Et=0;Et<wt/2;Et++)if(Et+1<wt/2){let Pt=Et,wi=Et+1,lt=wt-1-Et,Rt=wt-2-Et;Pt=Pt===0?wt-1:Pt-1,wi=wi===0?wt-1:wi-1,lt=lt===0?wt-1:lt-1,Rt=Rt===0?wt-1:Rt-1,$e.indices.push(lt),$e.indices.push(wi),$e.indices.push(Pt),$e.indices.push(lt),$e.indices.push(Rt),$e.indices.push(wi)}return $e}(o[0]),o=[q.geometry]}const Y=(xe,Be)=>xe<(Be.length-1)/2||xe===Be.length-1,re=this.wallMode?[o]:Fm(o,500);for(let xe=re.length-1;xe>=0;xe--){const Be=re[xe];(Be.length===0||(ee=Be[0]).every(Ge=>Ge.x<=0)||ee.every(Ge=>Ge.x>=ht)||ee.every(Ge=>Ge.y<=0)||ee.every(Ge=>Ge.y>
vendor: 21,163 bytes, line 53
53=ht))&&re.splice(xe,1)}var ee;let ae;if(M)ae=vE(re,S,u);else{ae=[];for(const xe of re)ae.push({polygon:xe,bounds:S})}const he=P?this.edgeRadius:0,me=he>0&&this.zoom<17,De=(xe,Be)=>{if(xe.length===0)return!1;const Ge=xe[xe.length-1];return Be.x===Ge.x&&Be.y===Ge.y};for(const{polygon:xe,bounds:Be}of ae){let Ge=0,$e=0;for(const Xe of xe)P&&!Xe[0].equals(Xe[Xe.length-1])&&Xe.push(Xe[0]),$e+=P?Xe.length-1:Xe.length;const Je=this.segments.prepareSegment((P?5:4)*$e,this.layoutVertexArray,this.indexArray);V.footprintSegIdx<0&&(V.footprintSegIdx=this.footprintSegments.length),V.polygonSegIdx<0&&(V.polygonSegIdx=this.polygonSegments.length);const et={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},We=new cE;if(We.vertexOffset=this.footprintVertices.length,We.indexOffset=3*this.footprintIndices.length,We.ringIndices=[],P){const Xe=[],Fe=[];Ge=Je.vertexLength;for(let Ye=0;Ye<xe.length;Ye++){const pt=xe[Ye];pt.length&&Ye!==0&&Fe.push(Xe.length/2);const ot=[];let Ot,wt;Ot=pt[1].sub(pt[0])._perp()._unit(),We.ringIndices.push(pt.length-1);for(let Et=1;Et<pt.length;Et++){const Pt=pt[Et],wi=pt[Et===pt.length-1?1:Et+1],lt=Pt.clone();if(he){wt=wi.sub(Pt)._perp()._unit();const Rt=Ot.add(wt)._unit(),oi=he*Math.min(4,1/(Ot.x*Rt.x+Ot.y*Rt.y));lt.x+=oi*Rt.x,lt.y+=oi*Rt.y,lt.x=Math.round(lt.x),lt.y=Math.round(lt.y),Ot=wt}if(!N||he!==0&&!me||De(ot,lt)||ot.push(lt),Nm(this.layoutVertexArray,lt.x,lt.y,0,0,1,1,0),this.wallMode){const Rt=Y(Et,pt);Vm(this.wallVertexArray,q.joinNormals[Et],!Rt)}Je.vertexLength++,this.footprintVertices.emplaceBack(Pt.x,Pt.y),Xe.push(Pt.x,Pt.y),M&&jm(this.layoutVertexExtArray,I.projectTilePoint(lt.x,lt.y,u),I.upVector(u,lt.x,lt.y))}N&&(he===0||me)&&(ot.length!==0&&De(ot,ot[0])&&ot.pop(),this.groundEffect.addData(ot,Be,T))}const ke=this.wallMode?q.indices:up(Xe,Fe);for(let Ye=0;Ye<ke.length;Ye+=3)this.footprintIndices.emplaceBack(We.vertexOffset+ke[Ye+0],We.vertexOffset+ke[Ye+1],We.vertexOffset+ke[Ye+2]),this.indexArray.emplaceBack(Ge+ke[Ye],Ge+ke[Ye+2],Ge+ke[Ye+1]),Je.primitiveLength++;We.indexCount+=ke.length,We.vertexCount+=this.footprintVertices.length-We.vertexOffset}for(let Xe=0;Xe<xe.length;Xe++){const Fe=xe[Xe];k.startRing(V,Fe[0]);let ke=Fe.length>4&&_E(Fe[Fe.length-2],Fe[0],Fe[1]),Ye=he?oL(Fe[Fe.length-2],Fe[0],Fe[1],he):0;const pt=[];let ot,Ot,wt;Ot=Fe[1].sub(Fe[0])._perp()._unit();let Et=!0;for(let Pt=1,wi=0;Pt<Fe.length;Pt++){let lt=Fe[Pt-1],Rt=Fe[Pt];const oi=Fe[Pt===Fe.length-1?1:Pt+1];if(k.appendEdge(V,Rt,lt),U1(Rt,lt,Be)){he&&(Ot=oi.sub(Rt)._perp()._unit(),Et=!Et);continue}const zi=Rt.sub(lt)._perp(),ki=zi.x/(Math.abs(zi.x)+Math.abs(zi.y)),di=zi.y>0?1:0,hn=lt.dist(Rt);if(wi+hn>32768&&(wi=0),he){wt=oi.sub(Rt)._perp()._unit();let Qe=fE(lt,Rt,oi,pE(Ot,wt),he);isNaN(Qe)&&(Qe=0);const gt=Rt.sub(lt)._unit();lt=lt.add(gt.mult(Ye))._round(),Rt=Rt.add(gt.mult(-Qe))._round(),Ye=Qe,Ot=wt,N&&this.zoom>=17&&(De(pt,lt)||pt.push(lt),De(pt,Rt)||pt.push(Rt))}const te=Je.vertexLength,oe=Fe.length>4&&_E(lt,Rt,oi);let Ne=gE(wi,ke,Et);if(Nm(this.layoutVertexArray,lt.x,lt.y,ki,di,0,0,Ne),Nm(this.layoutVertexArray,lt.x,lt.y,ki,di,0,1,Ne),this.wallMode){const Qe=Y(Pt-1,Fe),gt=q.joinNormals[Pt-1];Vm(this.wallVertexArray,gt,Qe),Vm(this.wallVertexArray,gt,Qe)}if(wi+=hn,Ne=gE(wi,oe,!Et),ke=oe,Nm(this.layoutVertexArray,Rt.x,Rt.y,ki,di,0,0,Ne),Nm(this.layoutVertexArray,Rt.x,Rt.y,ki,di,0,1,Ne),this.wallMode){const Qe=Y(Pt,Fe),gt=q.joinNormals[Pt];Vm(this.wallVertexArray,gt,Qe),Vm(this.wallVertexArray,gt,Qe)}if(Je.vertexLength+=4,this.indexArray.emplaceBack(te+0,te+1,te+2),this.indexArray.emplaceBack(te+1,te+3,te+2),Je.primitiveLength+=2,he){const Qe=Ge+(Pt===1?Fe.length-2:Pt-2),gt=Pt===1?Ge:Qe+1;if(this.indexArray.emplaceBack(te+1,Qe,te+3),this.indexArray.emplaceBack(Qe,gt,te+3),Je.primitiveLength+=2,ot===void 0&&(ot=te),!U1(oi,Fe[Pt],Be)){const yt=Pt===Fe.length-1?ot:Je.vertexLength;this.indexArray.emplaceBack(te+2,te+3,yt),this.indexArray.emplaceBack(te+3,yt+1,yt),this.indexArray.emplaceBack(te+3,gt,yt+1),Je.primitiveLength+=3}Et=!Et}if(M){const Qe=this.layoutVertexExtArray,gt=I.projectTilePoint(lt.x,lt.y,u),yt=I.projectTilePoint(Rt.x,Rt.y,u),Bt=I.upVector(u,lt.x,lt.y),Ut=I.upVector(u,Rt.x,Rt.y);jm(Qe,gt,Bt),jm(Qe,gt,Bt),jm(Qe,yt,Ut),jm(Qe,yt,Ut)}}P&&(Ge+=Fe.length-1),N&&he&&this.zoom>=17&&(pt.length!==0&&De(pt,pt[0])&&pt.pop(),this.groundEffect.addData(pt,Be,T,he>0))}this.footprintSegments.push(We),et.triangleCount=this.indexArray.length-et.triangleArrayOffset,this.polygonSegments.push(et),++V.footprintSegLen,++V.polygonSegLen}if(V.vertexCount=this.layoutVertexArray.length-V.vertexArrayOffset,V.groundVertexCount=this.groundEffect.vertexArray.length-V.groundVertexArrayOffset,V.vertexCount!==0){if(V.centroidXY=k.borders?sE:this.encodeCentroid(k,V),this.centroidData.push(V),k.borders){this.featuresOnBorder.push(k);const xe=this.featuresOnBorder.length-1;for(let Be=0;Be<k.borders.length;Be++)k.borders[Be][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Be].push(xe)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,d,m,u,x,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,d,m,u,x,this.worldview),this.maxHeight=Math.max(this.maxHeight,$)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,o)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[o].borders[e][0])}splitToSubtiles(){const e=[];for(let m=0;m<this.centroidData.length;m++){const y=this.centroidData[m],x=+(y.min.y+y.max.y>ht),T=2*x+(+(y.min.x+y.max.x>ht)^x);for(let S=0;S<y.polygonSegLen;S++){const I=y.polygonSegIdx+S;e.push({centroidIdx:m,subtile:T,polygonSegmentIdx:I,triangleSegmentIdx:this.polygonSegments[I].triangleSegIdx})}}const i=new mr;e.sort((m,y)=>m.triangleSegmentIdx===y.triangleSegmentIdx?m.subtile-y.subtile:m.triangleSegmentIdx-y.triangleSegmentIdx);let o=0,a=0,u=0;for(const m of e){if(m.triangleSegmentIdx!==o)break;u++}const d=e.length;for(;a!==e.length;){o=e[a].triangleSegmentIdx;let m=0,y=a,x=a;for(let T=y;T<u&&e[T].subtile===m;T++)x++;for(;y!==u;){const T=e[y];m=T.subtile;const S=this.centroidData[T.centroidIdx].min.clone(),I=this.centroidData[T.centroidIdx].max.clone(),M={vertexOffset:this.segments.segments[o].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[o].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let P=y;P<x;P++){const k=e[P],V=this.polygonSegments[k.polygonSegmentIdx],N=this.centroidData[k.centroidIdx].min,$=this.centroidData[k.centroidIdx].max,q=this.indexArray.uint16;for(let Y=V.triangleArrayOffset;Y<V.triangleArrayOffset+V.triangleCount;Y++)i.emplaceBack(q[3*Y],q[3*Y+1],q[3*Y+2]);M.primitiveLength+=V.triangleCount,S.x=Math.min(S.x,N.x),S.y=Math.min(S.y,N.y),I.x=Math.max(I.x,$.x),I.y=Math.max(I.y,$.y)}M.primitiveLength>0&&this.triangleSubSegments.push({segment:M,min:S,max:I}),y=x;for(let P=y;P<u&&e[P].subtile===e[y].subtile;P++)x++}a=u;for(let T=a;T<d&&e[T].triangleSegmentIdx===e[a].triangleSegmentIdx;T++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,o){const a=new zn;if(this.wallMode){for(const k of this.triangleSubSegments)a.segments.push(k.segment);return a}let u=0,d=0;const m=1<<e.canonical.z;if(i){const k=i.getMinMaxForTile(e);k&&(u=k.min,d=k.max)}d+=this.maxHeight;const y=e.toUnwrapped();let x;const T=[y.canonical.x/m+y.wrap,y.canonical.y/m],S=[(y.canonical.x+1)/m+y.wrap,(y.canonical.y+1)/m],I=(k,V,N)=>[k[0]*(1-N[0])+V[0]*N[0],k[1]*(1-N[1])+V[1]*N[1]],M=[],P=[];for(const k of this.triangleSubSegments){M[0]=k.min.x/ht,M[1]=k.min.y/ht,P[0]=k.max.x/ht,P[1]=k.max.y/ht;const V=I(T,S,M),N=I(T,S,P);if(new zt([V[0],V[1],u],[N[0],N[1],d]).intersectsPrecise(o)===0){x&&(a.segments.push(x),x=void 0);continue}const $=k.segment;x&&x.vertexOffset!==$.vertexOffset&&(a.segments.push(x),x=void 0),x?(x.vertexLength+=$.vertexLength,x.primitiveLength+=$.primitiveLength):x={vertexOffset:$.vertexOffset,primitiveLength:$.primitiveLength,vertexLength:$.vertexLength,primitiveOffset:$.primitiveOffset,sortKey:void 0,vaos:{}}}return x&&a.segments.push(x),a}encodeCentroid(e,i){const o=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),d=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Ke(j(o.x,1,ht-1)<<3|u,j(o.y,1,ht-1)<<3|d)}encodeBorderCentroid(e){if(!e.borders)return new Ke(0,0);const i=e.borders,o=Number.MAX_VALUE;if(i[0][0]!==o||i[1][0]!==o){const a=i[0][0]!==o?0:1;return new Ke(6|(i[0][0]!==o?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==o?2:3;return new Ke((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==o?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,o=e.vertexCount+e.vertexArrayOffset,a=e.flags&nc?sE:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let d=i;d<o;++d)this.centroidVertexArray.emplace(d,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Zy(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const d of this.centroidData)d.flags&=2147483647;const u=[];for(const d of this.activeReplacements){if(d.order<o)continue;const m=Math.max(1,Math.pow(2,d.footprintTileId.canonical.z-e.canonical.z));if(d.footprint.buildingIds)for(const y of this.centroidData)y.flags&nc||d.min.x>y.max.x||y.min.x>d.max.x||d.min.y>y.max.y||y.min.y>d.max.y||d.footprint.buildingIds.has(y.buildingId)&&(y.flags|=nc);else for(const y of this.centroidData)if(!(y.flags&nc||d.min.x>y.max.x||y.min.x>d.max.x||d.min.y>y.max.y||y.min.y>d.max.y))for(let x=0;x<y.footprintSegLen;x++){const T=this.footprintSegments[y.footprintSegIdx+x];if(u.length=0,sL(this.footprintVertices,T.vertexOffset,T.vertexCount,d.footprintTileId.canonical,e.canonical,u),B1(d.footprint,u,this.footprintIndices.uint16,T.indexOffset,T.indexCount,-T.vertexOffset,-m)){y.flags|=nc;break}}}for(const d of this.centroidData)this.writeCentroidToBuffer(d);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,o){let a=!1;for(let u=0;u<o.footprintSegLen;u++){const d=this.footprintSegments[o.footprintSegIdx+u];let m=0;for(const y of d.ringIndices){for(let x=m,T=y+m-1;x<y+m;T=x++){const S=this.footprintVertices.int16[2*(x+d.vertexOffset)+0],I=this.footprintVertices.int16[2*(x+d.vertexOffset)+1],M=this.footprintVertices.int16[2*(T+d.vertexOffset)+1];I>i!=M>i&&e<(this.footprintVertices.int16[2*(T+d.vertexOffset)+0]-S)*(i-I)/(M-I)+S&&(a=!a)}m=y}}return a}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+ht)*ht+(i+ht);if(this.partLookup.hasOwnProperty(u)){const d=this.partLookup[u];return d?{height:d.height,hidden:!!(d.flags&nc)}:void 0}for(const d of this.centroidData)e>d.max.x||d.min.x>e||i>d.max.y||d.min.y>i||d.height<=o||this.footprintContainsPoint(e,i,d)&&(o=d.height,this.partLookup[u]=d,a=!!(d.flags&nc));if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.partLookup[u]=void 0}}function pE(n,e){const i=n.add(e)._unit();return n.x*i.x+n.y*i.y}function oL(n,e,i,o){const a=e.sub(n)._perp()._unit(),u=i.sub(e)._perp()._unit();return fE(n,e,i,pE(a,u),o)}function fE(n,e,i,o,a){const u=Math.sqrt(1-o*o);return Math.min(n.dist(e)/3,e.dist(i)/3,a*u/o)}function U1(n,e,i){return n.x<i[0].x&&e.x<i[0].x||n.x>i[1].x&&e.x>i[1].x||n.y<i[0].y&&e.y<i[0].y||n.y>i[1].y&&e.y>i[1].y}function mE(n,e){return n.x<e[0].x||n.x>e[1].x||n.y<e[0].y||n.y>e[1].y}function _E(n,e,i){if(n.x<0||n.x>=ht||e.x<0||e.x>=ht||i.x<0||i.x>=ht)return!1;const o=i.sub(e),a=o.perp(),u=n.sub(e);return(o.x*u.x+o.y*u.y)/Math.sqrt((o.x*o.x+o.y*o.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function gE(n,e,i){const o=e?2|n:-3&n;return i?1|o:-2&o}function yE(){const n=Math.PI/32,e=Math.tan(n),i=l;return i*Math.sqrt(1+2*e*e)-i}function vE(n,e,i){const o=1<<i.z,a=C(i.x/o),u=C((i.x+1)/o),d=z(i.y/o),m=z((i.y+1)/o);return function(y,x,T,S,I=0,M){const P=[];if(!y.length||!T||!S)return P;const k=(ee,ae)=>{for(const he of ee)P.push({polygon:he,bounds:ae})},V=Math.ceil(Math.log2(T)),N=Math.ceil(Math.log2(S)),$=V-N,q=[];for(let ee=0;ee<Math.abs($);ee++)q.push($>0?0:1);for(let ee=0;ee<Math.min(V,N);ee++)q.push(0),q.push(1);let Y=y;if(Y=$y(Y,x[0].y-I,x[1].y+I,1),Y=$y(Y,x[0].x-I,x[1].x+I,0),!Y.length)return P;const re=[];for(q.length?re.push({polygons:Y,bounds:x,depth:0}):k(Y,x);re.length;){const ee=re.pop(),ae=ee.depth,he=q[ae],me=ee.bounds[0],De=ee.bounds[1],xe=he===0?me.x:me.y,Be=he===0?De.x:De.y,Ge=M?M(he,xe,Be):.5*(xe+Be),$e=$y(ee.polygons,xe-I,Ge+I,he),Je=$y(ee.polygons,Ge-I,Be+I,he);if($e.length){const et=[me,new Ke(he===0?Ge:De.x,he===1?Ge:De.y)];q.length>ae+1?re.push({polygons:$e,bounds:et,depth:ae+1}):k($e,et)}if(Je.length){const et=[new Ke(he===0?Ge:me.x,he===1?Ge:me.y),De];q.length>ae+1?re.push({polygons:Je,bounds:et,depth:ae+1}):k(Je,et)}}return P}(n,e,Math.ceil((u-a)/11.25),Math.ceil((d-m)/11.25),1,(y,x,T)=>{if(y===0)return .5*(x+T);{const S=z((i.y+x/ht)/o);return(b(.5*(z((i.y+T/ht)/o)+S))*o-i.y)*ht}})}function sL(n,e,i,o,a,u){const d=Math.pow(2,o.z-a.z);for(let m=0;m<i;m++){let y=n.int16[2*(m+e)+0],x=n.int16[2*(m+e)+1];y=(y+a.x*ht)*d-o.x*ht,x=(x+a.y*ht)*d-o.y*ht,u.push(new Ke(y,x))}}let xE,wE;At(Xy,"FillExtrusionBucket",{omit:["layers","features"]}),At(uE,"PartData"),At(cE,"FootprintSegment"),At(hE,"BorderCentroidData"),At(j1,"GroundEffect");class ch extends Ke{constructor(e,i,o){super(e,i),this.z=o}}class bE extends ch{constructor(e,i,o,a){super(e,i,o),this.w=a}}function TE(n,e,i,o){const a=i==="x"?"y":"x",u=(o-n[i])/(e[i]-n[i]);n[a]=Math.round(n[a]+(e[a]-n[a])*u),n[i]=o,n.hasOwnProperty("z")&&(n.z=Qt(n.z,e.z,u)),n.hasOwnProperty("w")&&(n.w=Qt(n.w,e.w,u))}function SE(n,e,i,o){const a=i,u=o;for(const d of["x","y"]){let m=n,y=e;m[d]>=y[d]&&(m=e,y=n),m[d]<a&&y[d]>a&&TE(m,y,d,a),m[d]<u&&y[d]>u&&TE(y,m,d,u)}}function Yy(n,e,i,o,a,u){const d=[];for(let m=0;m<n.length;m++){const y=n[m];let x;const T=d.length;let S=0;for(let I=0;I<y.length-1;I++){let M=y[I],P=y[I+1],k=0;const V=S;let N,$;u&&(k=Math.hypot(P.x-M.x,P.y-M.y),S+=k,N=M,$=P),M.x<e&&P.x<e||(M.x<e?M=new Ke(e,M.y+(e-M.x)/(P.x-M.x)*(P.y-M.y))._round():P.x<e&&(P=new Ke(e,M.y+(e-M.x)/(P.x-M.x)*(P.y-M.y))._round()),M.y<i&&P.y<i||(M.y<i?M=new Ke(M.x+(i-M.y)/(P.y-M.y)*(P.x-M.x),i)._round():P.y<i&&(P=new Ke(M.x+(i-M.y)/(P.y-M.y)*(P.x-M.x),i)._round()),M.x>=o&&P.x>=o||(M.x>=o?M=new Ke(o,M.y+(o-M.x)/(P.x-M.x)*(P.y-M.y))._round():P.x>=o&&(P=new Ke(o,M.y+(o-M.x)/(P.x-M.x)*(P.y-M.y))._round()),M.y>=a&&P.y>=a||(M.y>=a?M=new Ke(M.x+(a-M.y)/(P.y-M.y)*(P.x-M.x),a)._round():P.y>=a&&(P=new Ke(M.x+(a-M.y)/(P.y-M.y)*(P.x-M.x),a)._round()),x&&M.equals(x[x.length-1])||(x=[M],d.push(x),u&&u.push({progress:{min:V+EE(N,$,M)*k,max:1},parentIndex:m,prevPoint:N,nextPoint:$})),x.push(P),u&&(u[u.length-1].progress.max=V+EE(N,$,P)*k,u[u.length-1].nextPoint=$)))))}if(u&&S>0)for(let I=T;I<d.length;I++)u[I].progress.min/=S,u[I].progress.max/=S}return d}function aL(n,e,i,o,a){if(n.length<2)return void o.push(n);const u=[];for(;e.valid();){const[x,T]=e.get();for(let S=0;S<n.length-1;S++){const I=n[S],M=n[S+1],P=gi(I,M,x,T);if(P){const[k]=P,V=new Ke(Qt(I.x,M.x,k),Qt(I.y,M.y,k));u.push({t:S+k,distance:0,point:V})}}e.next()}if(u.length===0)return void o.push(n);u.sort((x,T)=>x.t-T.t);let d=0,m=0,y=[];for(o.push(y);d!==n.length;){if(m===u.length){for(;d!==n.length;)y.length!==0&&y[y.length-1].equals(n[d])||y.push(n[d]),d++;break}u[m].t<=d?(y.length!==0&&y[y.length-1].equals(u[m].point)||y.push(u[m].point),Math.trunc(u[m].t),m++):(y.length!==0&&y[y.length-1].equals(n[d])||y.push(n[d]),d++)}}function EE(n,e,i){return n.x!==e.x?(i.x-n.x)/(e.x-n.x):n.y!==e.y?(i.y-n.y)/(e.y-n.y):0}function Um(n,e){return n.x*e.x+n.y*e.y}function IE(n,e){if(n.length===1){let i=0;const o=e[i++];let a;for(;!a||o.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],d=n[0],m=a.sub(o),y=u.sub(o),x=d.sub(o),T=Um(m,m),S=Um(m,y),I=Um(y,y),M=Um(x,m),P=Um(x,y),k=T*I-S*S,V=(I*M-S*P)/k,N=(T*P-S*M)/k,$=o.z*(1-V-N)+a.z*V+u.z*N;if(isFinite($))return $}return 1/0}{let i=1/0;for(const o of e)i=Math.min(i,o.z);return i}}function AE(n,e,i){let o=1/0;Ji(i,e)&&(o=IE(i,e[0]));for(let a=0;a<e.length;a++){const u=e[a],d=n[a];for(let m=0;m<u.length-1;m++){const y=u[m],x=[y,u[m+1],d[m+1],d[m],y];Hi(i,x)&&(o=Math.min(o,IE(i,x)))}}return o!==1/0&&o}function CE(n,e,i,o,a,u,d,m,y,x,T){return n.projection.name==="globe"?function(S,I,M,P,k,V,N,$,q,Y,re){const ee=[],ae=[],he=S.projection.upVectorScale(re,S.center.lat,S.worldSize).metersToTile,me=[0,0,0,1],De=[0,0,0,1],xe=(Ge,$e,Je,et)=>{Ge[0]=$e,Ge[1]=Je,Ge[2]=et,Ge[3]=1},Be=yE();M>0&&(M+=Be),P+=Be;for(const Ge of I){const $e=[],Je=[];for(const et of Ge){const We=et.x+k.x,Xe=et.y+k.y,Fe=S.projection.projectTilePoint(We,Xe,re),ke=S.projection.upVector(re,et.x,et.y);let Ye=M,pt=P;if(N){const ot=ME(We,Xe,M,P,N,$,q,Y);Ye+=ot.base,pt+=ot.top}M!==0?xe(me,Fe.x+ke[0]*he*Ye,Fe.y+ke[1]*he*Ye,Fe.z+ke[2]*he*Ye):xe(me,Fe.x,Fe.y,Fe.z),xe(De,Fe.x+ke[0]*he*pt,Fe.y+ke[1]*he*pt,Fe.z+ke[2]*he*pt),qn(me,me,V),qn(De,De,V),$e.push(new ch(me[0],me[1],me[2])),Je.push(new ch(De[0],De[1],De[2]))}ee.push($e),ae.push(Je)}return[ee,ae]}(n,e,i,o,a,u,d,m,y,x,T):d?function(S,I,M,P,k,V,N,$,q){const Y=[],re=[],ee=[0,0,0,1];for(const ae of S){const he=[],me=[];for(const De of ae){const xe=De.x+P.x,Be=De.y+P.y,Ge=ME(xe,Be,I,M,V,N,$,q);ee[0]=xe,ee[1]=Be,ee[2]=Ge.base,ee[3]=1,Ur(ee,ee,k),ee[3]=Math.max(ee[3],1e-5);const $e=new ch(ee[0]/ee[3],ee[1]/ee[3],ee[2]/ee[3]);ee[0]=xe,ee[1]=Be,ee[2]=Ge.top,ee[3]=1,Ur(ee,ee,k),ee[3]=Math.max(ee[3],1e-5);const Je=new ch(ee[0]/ee[3],ee[1]/ee[3],ee[2]/ee[3]);he.push($e),me.push(Je)}Y.push(he),re.push(me)}return[Y,re]}(e,i,o,a,u,d,m,y,x):function(S,I,M,P,k){const V=[],N=[],$=k[8]*I,q=k[9]*I,Y=k[10]*I,re=k[11]*I,ee=k[8]*M,ae=k[9]*M,he=k[10]*M,me=k[11]*M;for(const De of S){const xe=[],Be=[];for(const Ge of De){const $e=Ge.x+P.x,Je=Ge.y+P.y,et=k[0]*$e+k[4]*Je+k[12],We=k[1]*$e+k[5]*Je+k[13],Xe=k[2]*$e+k[6]*Je+k[14],Fe=k[3]*$e+k[7]*Je+k[15],ke=et+$,Ye=We+q,pt=Xe+Y,ot=Math.max(Fe+re,1e-5),Ot=et+ee,wt=We+ae,Et=Xe+he,Pt=Math.max(Fe+me,1e-5);xe.push(new ch(ke/ot,Ye/ot,pt/ot)),Be.push(new ch(Ot/Pt,wt/Pt,Et/Pt))}V.push(xe),N.push(Be)}return[V,N]}(e,i,o,a,u)}function ME(n,e,i,o,a,u,d,m){const y=d*a.getElevationAt(n,e,!0,!0),x=u[0]!==0,T=x?u[1]===0?d*(u[0]/aE-lE):d*function(S,I,M){const P=Math.floor(I[0]/8),k=Math.floor(I[1]/8),V=10*(I[0]-8*P),N=10*(I[1]-8*k),$=S.getElevationAt(P,k,!0,!0),q=S.getMeterToDEM(M),Y=Math.floor(.5*(V*q-1)),re=Math.floor(.5*(N*q-1)),ee=S.tileCoordToPixel(P,k),ae=2*Y+1,he=2*re+1,me=function(Je,et,We,Xe,Fe){return[Je.getElevationAtPixel(et,We,!0),Je.getElevationAtPixel(et+Fe,We,!0),Je.getElevationAtPixel(et,We+Fe,!0),Je.getElevationAtPixel(et+Xe,We+Fe,!0)]}(S,ee.x-Y,ee.y-re,ae,he),De=Math.abs(me[0]-me[1]),xe=Math.abs(me[2]-me[3]),Be=Math.abs(me[0]-me[2])+Math.abs(me[1]-me[3]),Ge=Math.min(.25,.5*q*(De+xe)/ae),$e=Math.min(.25,.5*q*Be/he);return $+Math.max(Ge*V,$e*N)}(a,u,m):y;return{base:y+(i===0?-1:i),top:x?Math.max(T+o,y+i+2):y+o}}class lL{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class cL{constructor(){this.tasks={},this.taskQueue=[],we(["process"],this),this.invoker=new lL(this.process),this.nextId=0}add(e,i){const o=this.nextId++,a=function({type:u,isSymbolTile:d,zoom:m}){return m=m||0,u==="message"?0:u!=="maybePrepare"||d?u!=="parseTile"||d?u==="parseTile"&&d?300-m:u==="maybePrepare"&&d?400-m:500:200-m:100-m}(i);if(a===0){try{e()}finally{}return null}return this.tasks[o]={fn:e,metadata:i,priority:a,id:o},this.taskQueue.push(o),this.invoker.trigger(),{cancel:()=>{delete this.tasks[o]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(o=>!!this.tasks[o]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const o=this.taskQueue[e];return this.taskQueue.splice(e,1),o}remove(){this.invoker.remove()}}class PE{constructor(e,i,o){this.target=e,this.parent=i,this.mapId=o,this.callbacks={},this.cancelCallbacks={},we(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
53=new cL}send(e,i,o,a,u=!1,d){const m=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=d,this.callbacks[m]=o);const y=new Set;return this.target.postMessage({id:m,type:e,hasCallback:!!o,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:Ma(i,y)},y),{cancel:()=>{o&&delete this.callbacks[m],this.target.postMessage({id:m,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const o=i.id;if(o&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[o];delete this.cancelCallbacks[o],a&&a.cancel()}else if(i.mustQueue||Fi(self)){const a=this.callbacks[o],u=this.scheduler.add(()=>this.processTask(o,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[o]=u)}else this.processTask(o,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const o=this.callbacks[e];delete this.callbacks[e],o&&(i.error?o(pl(i.error)):o(null,pl(i.data)))}else{const o=new Set,a=i.hasCallback?(d,m)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:d?Ma(d):null,data:Ma(m,o)},o)}:()=>{},u=pl(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const d=i.type.split("."),{source:m,scope:y}=u;this.parent.getWorkerSource(i.sourceMapId,d[0],m,y)[d[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Gm={workerUrl:"",workerClass:null,workerParams:void 0};const G1="mapboxgl_preloaded_worker_pool";class uh{constructor(e){this.active={},this.name=e}acquire(e,i=uh.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const a=(o=`${this.name||""}WorkerPool: ${e}-${this.workers.length}`,Gm.workerClass!=null?new Gm.workerClass:new self.Worker(Gm.workerUrl,Object.assign({name:o},Gm.workerParams)));this.workers.push(a)}var o;return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[G1]}numActive(){return Object.keys(this.active).length}}uh.workerCount=2;class dp{constructor(e,i,o="Worker",a=uh.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ye();const u=this.workerPool.acquire(this.id,a);for(let d=0;d<u.length;d++){const m=new dp.Actor(u[d],i,this.id);m.name=`${o} ${d}`,this.actors.push(m)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,o){pe(this.actors,(a,u)=>{a.send(e,i,u)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let $m,$1;function Ky(){return $m||($m=new uh),$m}dp.Actor=PE;const H1=4096;class uL{constructor(e){this.module=e,this.memoryStack=this.module.malloc(H1),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>H1?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>H1?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,o){this.module.setFauxFacadeOptions(e?1:0,i?1:0,o)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const m of e){const y=this.createIntArray(m.ringIndices),x=this.createFloatArray(m.coordinates);if(y===-1||x===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(m.id,m.sourceId,m.minHeight,m.height,m.roofType,x,y,m.ringIndices.length-1)}for(const m of i){let y;y=m.entrances?JSON.parse(m.entrances):[];const x=this.createFloatArray(y),T=this.createFloatArray(m.coordinates);if(x===-1||T===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(m.sourceId,m.crossPerc,m.distanceToRoad,x,y.length,T,m.coordinates.length)}if(!this.module.generateMesh()){const m=this.module.getLastError();return this.readStringBuffer(m)}
53const o=this.module.getMeshCount(),a=new Array(o);for(let m=0;m<o;m++){const y=this.module.getPositionsPtr(m),x=this.module.getPositionsLength(m),T=new Float32Array(this.module.heapF32.buffer,y,x),S=this.module.getNormalsPtr(m),I=this.module.getNormalsLength(m),M=new Float32Array(this.module.heapF32.buffer,S,I),P=this.module.getAOPtr(m),k=this.module.getAOLength(m),V=new Float32Array(this.module.heapF32.buffer,P,k),N=this.module.getUVPtr(m),$=this.module.getUVLength(m),q=new Float32Array(this.module.heapF32.buffer,N,$),Y=this.module.getFauxFacadePtr(m),re=this.module.getFauxFacadeLength(m),ee=new Uint8Array(this.module.heapU8.buffer,Y,re),ae=this.module.getIndicesPtr(m),he=this.module.getIndicesLength(m),me=new Int16Array(this.module.heap16.buffer,ae,he),De=this.module.getBuildingPart(m);a[m]={positions:T,normals:M,ao:V,uv:q,isFauxFacade:ee,indices:me,buildingPart:De}}const u=this.module.getRingCount(),d=[];for(let m=0;m<u;m++){const y=this.module.getRingPtr(m),x=this.module.getRingLength(m),T=new Float32Array(this.module.heapF32.buffer,y,x);d.push(T)}return{meshes:a,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:d}}}let Hm,q1,ja,pp,Z1,fp=null,mp=null,RE=null,Jy=null;function LE(){return Fi(self)&&self.worker.dracoUrl?self.worker.dracoUrl:q1||Ri.DRACO_URL}function zE(){if(Fi(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(pp)return pp;const n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return pp=WebAssembly.validate(n)?Ri.MESHOPT_SIMD_URL:Ri.MESHOPT_URL,pp}function hL(){return Jy}const Qy={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},dL={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},qm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function DE(n,e,i){const o=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=o,i.json.bufferViews[o]={buffer:a,byteLength:n.byteLength},i.buffers[a]=n}const W1="KHR_draco_mesh_compression";function pL(n,e){const i=n.extensions&&n.extensions[W1];if(!i)return;const o=new ja.Decoder,a=BE(e,i.bufferView),u=new ja.Mesh;if(!o.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const d=e.json.accessors[n.indices],m=Qy[d.componentType],y=d.count*m.BYTES_PER_ELEMENT,x=ja._malloc(y);m===Uint16Array?o.GetTrianglesUInt16Array(u,y,x):o.GetTrianglesUInt32Array(u,y,x),DE(ja.memory.buffer.slice(x,x+y),d,e),ja._free(x);for(const T of Object.keys(i.attributes)){const S=o.GetAttributeByUniqueId(u,i.attributes[T]),I=e.json.accessors[n.attributes[T]],M=dL[I.componentType],P=I.count*qm[I.type]*Qy[I.componentType].BYTES_PER_ELEMENT,k=ja._malloc(P);o.GetAttributeDataArrayForAllPoints(u,S,ja[M],P,k),DE(ja.memory.buffer.slice(k,k+P),I,e),ja._free(k)}o.destroy(),u.destroy(),delete n.extensions[W1]}const e0="EXT_meshopt_compression";function fL(n,e){if(!n.extensions||!n.extensions[e0])return;const i=n.extensions[e0],o=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);Z1.decodeGltfBuffer(a,i.count,i.byteStride,o,i.mode,i.filter),n.buffer=e.buffers.length,n.byteOffset=0,e.buffers[n.buffer]=a.buffer,delete n.extensions[e0]}const kE=1179937895,OE=new TextDecoder("utf8");function FE(n,e){return new URL(n,e).href}function mL(n,e,i,o){return fetch(FE(n.uri,o)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function BE(n,e){const i=n.json.bufferViews[e];return new Uint8Array(n.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function _L(n,e,i,o){if(n.uri){const a=FE(n.uri,o);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(n.bufferView!==void 0){const a=BE(e,n.bufferView),u=new Blob([a],{type:n.mimeType});return createImageBitmap(u).then(d=>{e.images[i]=d})}}function NE(n,e=0,i){const o={json:null,images:[],buffers:[]};if(new Uint32Array(n,e,1)[0]===kE){const T=new Uint32Array(n,e);let S=2;const I=(T[S++]>>2)-3,M=T[S++]>>2;if(S++,o.json=JSON.parse(OE.decode(T.subarray(S,S+M))),S+=M,S<I){const P=T[S++];S++;const k=e+(S<<2);o.buffers[0]=n.slice(k,k+P)}}else o.json=JSON.parse(OE.decode(new Uint8Array(n,e)));const{buffers:a,images:u,meshes:d,extensionsUsed:m,bufferViews:y}=o.json;let x=Promise.resolve();if(a){const T=[];for(let S=0;S<a.length;S++){const I=a[S];I.uri?T.push(mL(I,o,S,i)):o.buffers[S]||(o.buffers[S]=null)}x=Promise.all(T)}return x.then(()=>{const T=[],S=m&&m.includes(W1),I=m&&m.includes(e0);if(S&&T.push(function(){if(!ja)return Hm??(Hm=function(M){let P,k=null;function V(){P=new Uint8Array(k.buffer)}function N(){throw new Error("Unexpected Draco error.")}const $={a:{a:N,d:function(q,Y,re){return P.copyWithin(q,Y,Y+re)},c:function(q){const Y=P.length,re=Math.max(q>>>0,Math.ceil(1.2*Y)),ee=Math.ceil((re-Y)/65536);try{return k.grow(ee),V(),!0}catch{return!1}},b:N}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(M,$):M.then(q=>q.arrayBuffer()).then(q=>WebAssembly.instantiate(q,$))).then(q=>{const{Rb:Y,Qb:re,P:ee,T:ae,X:he,Ja:me,La:De,Qa:xe,Va:Be,Wa:Ge,eb:$e,jb:Je,f:et,e:We,yb:Xe,zb:Fe,Ab:ke,Bb:Ye,Db:pt,Gb:ot}=q.instance.exports;k=We;const Ot=(()=>{let wt=0,Et=0,Pt=0,wi=0;return lt=>{Pt&&(Y(wi),Y(wt),Et+=Pt,Pt=wt=0),wt||(Et+=128,wt=re(Et));const Rt=lt.length+7&-8;let oi=wt;Rt>=Et&&(Pt=Rt,oi=wi=re(Rt));for(let zi=0;zi<lt.length;zi++)P[oi+zi]=lt[zi];return oi}})();return V(),et(),{memory:We,_free:Y,_malloc:re,Mesh:class{constructor(){this.ptr=ee()}destroy(){ae(this.ptr)}},Decoder:class{constructor(){this.ptr=me()}destroy(){Je(this.ptr)}DecodeArrayToMesh(wt,Et,Pt){const wi=Ot(wt),lt=De(this.ptr,wi,Et,Pt.ptr);return!!he(lt)}GetAttributeByUniqueId(wt,Et){return{ptr:xe(this.ptr,wt.ptr,Et)}
53}GetTrianglesUInt16Array(wt,Et,Pt){Be(this.ptr,wt.ptr,Et,Pt)}GetTrianglesUInt32Array(wt,Et,Pt){Ge(this.ptr,wt.ptr,Et,Pt)}GetAttributeDataArrayForAllPoints(wt,Et,Pt,wi,lt){$e(this.ptr,wt.ptr,Et.ptr,Pt,wi,lt)}},DT_INT8:Xe(),DT_UINT8:Fe(),DT_INT16:ke(),DT_UINT16:Ye(),DT_UINT32:pt(),DT_FLOAT32:ot()}})}(fetch(LE())),Hm.then(M=>{ja=M,Hm=void 0}))}()),I&&T.push(function(){if(Z1)return;const M=function(P){let k;const V=WebAssembly.instantiateStreaming(P,{}).then(q=>{k=q.instance,k.exports.__wasm_call_ctors()}),N={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},$={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:V,supported:!0,decodeGltfBuffer(q,Y,re,ee,ae,he){(function(me,De,xe,Be,Ge,$e,Je){const et=me.exports.sbrk,We=Be+3&-4,Xe=et(We*Ge),Fe=et($e.length),ke=new Uint8Array(me.exports.memory.buffer);ke.set($e,Fe);const Ye=De(Xe,Be,Ge,Fe,$e.length);if(Ye===0&&Je&&Je(Xe,We,Ge),xe.set(ke.subarray(Xe,Xe+Be*Ge)),et(Xe-et(0)),Ye!==0)throw new Error(`Malformed buffer data: ${Ye}`)})(k,k.exports[$[ae]],q,Y,re,ee,k.exports[N[he]])}}}(fetch(zE()));return M.ready.then(()=>{Z1=M})}()),u)for(let M=0;M<u.length;M++)T.push(_L(u[M],o,M,i));return(T.length?Promise.all(T):Promise.resolve()).then(()=>{if(S&&d)for(const{primitives:M}of d)for(const P of M)pL(P,o);if(I&&d&&y)for(const M of y)fL(M,o);return o}
vendor: 5,200 bytes, line 53
53)})}function VE(n){return fetch(n).then(e=>e.arrayBuffer()).then(e=>NE(e,0,n))}function X1(n){switch(n){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Y1(n){switch(n){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class K1{constructor(e,i,o,a){this.context=e,this.format=o,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const o=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:d}=u,{x:m,y}=i&&i.position?i.position:{x:0,y:0},x=m+o,T=y+a;!this.size||this.size[0]===x&&this.size[1]===T||(d.bindTexture(d.TEXTURE_2D,null),d.deleteTexture(this.texture),this.texture=d.createTexture(),this.size=null),d.bindTexture(d.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===d.RGBA8&&(!i||i.premultiply!==!1));const S=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&x>0&&T>0){const I=this.useMipmap?Math.floor(Math.log2(Math.max(x,T)))+1:1;d.texStorage2D(d.TEXTURE_2D,I,this.format,x,T),this.size=[x,T]}this.size&&(S?d.texSubImage2D(d.TEXTURE_2D,0,m,y,X1(this.format),Y1(this.format),e):"data"in e&&e.data&&d.texSubImage2D(d.TEXTURE_2D,0,m,y,o,a,X1(this.format),Y1(this.format),e.data)),this.useMipmap&&d.generateMipmap(d.TEXTURE_2D)}bind(e,i,o=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!o?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,o,a,u){const{context:d}=this,{gl:m}=d;m.bindTexture(m.TEXTURE_2D,this.texture),i!==this.magFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,this.useMipmap?e===m.NEAREST?m.NEAREST_MIPMAP_NEAREST:m.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),o!==this.wrapS&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,o),this.wrapS=o),a!==this.wrapT&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,a),this.wrapT=a),u!==this.compareMode&&(u?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_MODE,m.COMPARE_REF_TO_TEXTURE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_FUNC,u)):m.texParameteri(m.TEXTURE_2D,m.TEXTURE_COMPARE_MODE,m.NONE),this.compareMode=u)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Zm{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:o}=this,{gl:a}=o;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}const gL=Ai([{name:"a_pos_3f",components:3,type:"Float32"}]),yL=Ai([{name:"a_color_3f",components:3,type:"Float32"}]),vL=Ai([{name:"a_color_4f",components:4,type:"Float32"}]),xL=Ai([{name:"a_uv_2f",components:2,type:"Float32"}]),wL=Ai([{name:"a_normal_3f",components:3,type:"Float32"}]),bL=Ai([{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"}]),TL=Ai([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function jE(n,e){const i=t0(n.projection,n.zoom,n.width,n.height),o=function(u,d,m,y,x){const T=new r(m.lng-180*iu,m.lat),S=new r(m.lng+180*iu,m.lat),I=u.project(T.lng,T.lat),M=u.project(S.lng,S.lat),P=-Math.atan2(M.y-I.y,M.x-I.x),k=Z.fromLngLat(m);k.y=j(k.y,-1+iu,1-iu);const V=k.toLngLat(),N=u.project(V.lng,V.lat),$=Z.fromLngLat(V);$.x+=iu;const q=$.toLngLat(),Y=u.project(q.lng,q.lat),re=GE(Y.x-N.x,Y.y-N.y,P),ee=Z.fromLngLat(V);ee.y+=iu;const ae=ee.toLngLat(),he=u.project(ae.lng,ae.lat),me=GE(he.x-N.x,he.y-N.y,P),De=Math.abs(re.x)/Math.abs(me.y),xe=Ft([]);qt(xe,xe,-P*(1-(x?0:y)));const Be=Ft([]);return dt(Be,Be,[1,1-(1-De)*y,1]),Be[4]=-me.x/me.y*y,qt(Be,Be,P),Se(Be,xe,Be),Be}
vendor: 16,057 bytes, line 53
53(n.projection,0,n.center,i,e),a=UE(n);return dt(o,o,[a,a,1]),o}function UE(n){const e=n.projection,i=t0(n.projection,n.zoom,n.width,n.height),o=J1(e,n.center),a=J1(e,r.convert(e.center));return Math.pow(2,o*i+(1-i)*a)}function t0(n,e,i,o,a=1/0){const u=n.range;if(!u)return 0;const d=Math.min(a,Math.max(i,o)),m=Math.log2(d/1024);return H(u[0]+m,u[1]+m,e)}const iu=1/4e4;function J1(n,e){const i=j(e.lat,-D,D),o=new r(e.lng-180*iu,i),a=new r(e.lng+180*iu,i),u=n.project(o.lng,i),d=n.project(a.lng,i),m=Z.fromLngLat(o),y=Z.fromLngLat(a),x=d.x-u.x,T=d.y-u.y,S=y.x-m.x,I=y.y-m.y,M=Math.sqrt((S*S+I*I)/(x*x+T*T));return Math.log2(M)}function GE(n,e,i){const o=Math.cos(i),a=Math.sin(i);return{x:n*o-e*a,y:n*a+e*o}}function $E(n,e,i){Ft(n),qt(n,n,qi(e[2])),Vt(n,n,qi(e[0])),jt(n,n,qi(e[1])),dt(n,n,i),Se(n,n,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function i0(n,e,i,o,a,u,d,m){const y=[i[0]-e[0],i[1]-e[1],0],x=[o[0]-e[0],o[1]-e[1],0];if(Hn(y)<1e-12||Hn(x)<1e-12)return Qa(n);const T=nr([],y,x);un(T,T),Ti(x,o,e),y[2]=(u-a)*m,x[2]=(d-a)*m;const S=y;return nr(S,y,x),un(S,S),Zs(n,T,S)}function n0(n,e,i=!1){const o=eu(e.zoom),a=function(u,d,m){const y=d.worldSize,x=[u[12],u[13],u[14]],T=z(x[1]/y),S=C(x[0]/y),I=Ft([]),M=E(1,T)*y,P=E(1,0)*y*O(T,d.zoom),k=1/A1(y);let V=P*k;if(m){const Y=t0(d.projection,d.zoom,d.width,d.height,1024);V=k*d.projection.pixelSpaceConversion(d.center.lat,y,Y)}const N=Kc(T,S);Gt(N,N,ai([],un([],N),M*V*x[2]));const $=function(Y){const re=[Y[0],Y[1],Y[2]];let ee=[0,1,0];const ae=nr([],ee,re);return nr(ee,re,ae),br(ee)===0&&(ee=[0,1,0],nr(ae,re,ee)),un(ae,ae),un(ee,ee),un(re,re),[ae[0],ae[1],ae[2],0,ee[0],ee[1],ee[2],0,re[0],re[1],re[2],0,Y[0],Y[1],Y[2],1]}(N);dt(I,I,[V,V,V*M]),Ce(I,I,[-x[0],-x[1],-x[2]]);const q=Se([],d.globeMatrix,$);return Se(q,q,I),Se(q,q,u),q}(n,e,i);if(o>0){const u=function(d,m){const y=m.worldSize,x=E(1,0)*y*O(m.center.lat,m.zoom)/A1(y),T=E(1,m.center.lat)*y,S=Ft([]);jt(S,S,qi(m.center.lng)),Vt(S,S,qi(m.center.lat)),Ce(S,S,[0,0,Qr]),dt(S,S,[x,x,x*T]);const I=m.point;return Ce(S,S,[-I.x,-I.y,0]),Se(S,S,d),Se(S,m.globeMatrix,S)}(n,e);return function(d,m,y){const x=(P,k,V)=>{const N=Hn(P),$=Hn(k),q=Va(P,k,V);return ai(q,q,1/Hn(q)*Qt(N,$,V))},T=x([d[0],d[1],d[2]],[m[0],m[1],m[2]],y),S=x([d[4],d[5],d[6]],[m[4],m[5],m[6]],y),I=x([d[8],d[9],d[10]],[m[8],m[9],m[10]],y),M=Va([d[12],d[13],d[14]],[m[12],m[13],m[14]],y);return[T[0],T[1],T[2],0,S[0],S[1],S[2],0,I[0],I[1],I[2],0,M[0],M[1],M[2],1]}(a,u,o)}return a}function Q1(n,e,i,o){const a=zt.projectAabbCorners(o,i);let u=Number.MAX_VALUE;for(let m=0;m<a.length;++m){const y=a[m];y[0]=(.5*y[0]+.5)*e.width,y[1]=(.5-.5*y[1])*e.height,y[2]<u&&(u=y[2])}const d=function(m){const y=[];let x=0;for(let M=1;M<m.length;M++)(m[M][0]<m[x][0]||m[M][0]===m[x][0]&&m[M][1]<m[x][1])&&(x=M);let T,S=x;const I=new Uint8Array(m.length);do{if(I[S])break;y.push(new Ke(m[S][0],m[S][1])),I[S]=1,T=(S+1)%m.length;for(let M=0;M<m.length;M++){if(m[M][0]===m[T][0]&&m[M][1]===m[T][1]||m[M][0]===m[S][0]&&m[M][1]===m[S][1])continue;const P=[m[M][0]-m[S][0],m[M][1]-m[S][1]],k=[m[T][0]-m[S][0],m[T][1]-m[S][1]],V=P[0]*k[1]-P[1]*k[0];(V>0||V===0&&P[0]*k[0]+P[1]*k[1]>=0&&P[0]*P[0]+P[1]*P[1]>k[0]*k[0]+k[1]*k[1])&&(T=M)}S=T}while(S!==x);return y.length>0&&y.push(y[0]),y}(a);if(Hi(n,d))return u}const hh=64,_p={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function r0(n,e,i,o,a,u,d,m,y,x=!1){const T=i.zoom,S=i.project(o),I=O(o.lat,T),M=1/I;Ft(n),Ce(n,n,[S.x+d[0]*M,S.y+d[1]*M,d[2]]);let P=1,k=1;const V=i.worldSize;if(x){if(i.projection.name==="mercator"){let Y=0;i.elevation&&(Y=i.elevation.getAtPointOrZero(new Z(S.x/V,S.y/V),0));const re=Ur([],[S.x,S.y,Y,1],i.projMatrix)[3]/i.cameraToCenterDistance;P=re,k=re*O(i.center.lat,T)}else if(i.projection.name==="globe"){const Y=n0(n,i),re=[0,0,0,1];Ur(re,re,Se([],i.projMatrix,Y));const ee=re[3]/i.cameraToCenterDistance,ae=eu(T),he=i.projection.pixelsPerMeter(o.lat,V)*O(o.lat,T),me=i.projection.pixelsPerMeter(i.center.lat,V)*O(i.center.lat,T);P=ee/Qt(he,B(i.center.lat),ae),k=ee*I/he,P*=me,k*=me}}else P=M;dt(n,n,[P,P,k]);const N=[...n],$=e.orientation,q=[];if($E(q,[$[0]+(a?a[0]:0),$[1]+(a?a[1]:0),$[2]+(a?a[2]:0)],u),Se(n,N,q),m&&i.elevation){let Y=0;const re=[];if(y&&i.elevation){Y=function(ae,he,me,De,xe){const Be=he.elevation;if(!Be)return 0;const Ge=zt.projectAabbCorners(me,De),$e=E(1,xe.lat)*he.worldSize,Je=function(Et,Pt){const wi=[0,0,1],lt=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const Rt of lt){const oi=Et[Rt.corners[0]],zi=Et[Rt.corners[1]],ki=Et[Rt.corners[2]],di=[zi[0]-oi[0],zi[1]-oi[1],Pt*(zi[2]-oi[2])],hn=nr(di,di,[ki[0]-oi[0],ki[1]-oi[1],Pt*(ki[2]-oi[2])]);un(hn,hn),Rt.dotProductWithUp=vn(hn,wi)}return lt.sort((Rt,oi)=>Rt.dotProductWithUp-oi.dotProductWithUp),lt[0].corners}(Ge,$e),et=Ge[Je[0]],We=Ge[Je[1]],Xe=Ge[Je[2]],Fe=Ge[Je[3]],ke=Be.getAtPointOrZero(new Z(et[0]/he.worldSize,et[1]/he.worldSize),0),Ye=Be.getAtPointOrZero(new Z(We[0]/he.worldSize,We[1]/he.worldSize),0),pt=Be.getAtPointOrZero(new Z(Xe[0]/he.worldSize,Xe[1]/he.worldSize),0),ot=Be.getAtPointOrZero(new Z(Fe[0]/he.worldSize,Fe[1]/he.worldSize),0),Ot=(ke+ot)/2,wt=(Ye+pt)/2;return Ot>wt?Ye<pt?i0(ae,We,Fe,et,Ye,ot,ke,$e):i0(ae,Xe,et,Fe,pt,ke,ot,$e):ke<ot?i0(ae,et,We,Xe,ke,Ye,pt,$e):i0(ae,Fe,Xe,We,ot,pt,Ye,$e),Math.max(Ot,wt)}(re,i,e.aabb,n,o);const ee=Se([],ar([],re),q);Se(n,N,ee)}else Y=i.elevation.getAtPointOrZero(new Z(S.x/V,S.y/V),0);Y!==0&&(n[14]+=Y)}}class HE{constructor(e,i,o,a,u){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=o!=null?new r(o[0],o[1]):new r(0,0),this.orientation=a??[0,0,0],this.nodes=u,this.uploaded=!1,this.aabb=new zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){Se(e.globalMatrix,i,e.localMatrix);const o=this.nodeOverrides.get(e.name);if(o!==void 0){const d=[];u=o.orientation,Ft(a=d),jt(a,a,qi(u[1])),qt(a,a,qi(u[2])),Vt(a,a,qi(u[0])),Se(e.globalMatrix,e.globalMatrix,d)}var a,u;if(e.meshes)for(const d of e.meshes){const m=zt.applyTransformFast(d.aabb,e.globalMatrix);this.aabb.encapsulate(m)}if(e.children)for(const d of e.children)this._applyTransformations(d,e.globalMatrix)}computeBoundsAndApplyParent(){const e=Ft([]);this.aabb=new zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,o,a,u,d,m=!1){r0(this.matrix,this,e.transform,this.position,i,o,a,u,d,m)}upload(e){if(!this.uploaded){for(const i of this.nodes)ew(i,e);for(const i of this.nodes)o0(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)tw(e)}}function Wm(n,e,i=!1){n.uploaded||(n.gfxTexture=new K1(e,n.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:n.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),n.uploaded=!0,n.image=null)}function SL(n,e,i){n.indexBuffer=e.createIndexBuffer(n.indexArray,!1,!0),n.vertexBuffer=e.createVertexBuffer(n.vertexArray,gL.members,!1,!0),n.normalArray&&(n.normalBuffer=e.createVertexBuffer(n.normalArray,wL.members,!1,!0)),n.texcoordArray&&(n.texcoordBuffer=e.createVertexBuffer(n.texcoordArray,xL.members,!1,!0)),n.colorArray&&(n.colorBuffer=e.createVertexBuffer(n.colorArray,(n.colorArray.bytesPerElement===12?yL:vL).members,!1,!0)),n.featureArray&&(n.pbrBuffer=e.createVertexBuffer(n.featureArray,TL.members,!0)),n.segments=zn.simpleSegment(0,0,n.vertexArray.length,n.indexArray.length);const o=n.material;o.pbrMetallicRoughness.baseColorTexture&&Wm(o.pbrMetallicRoughness.baseColorTexture,e),o.pbrMetallicRoughness.metallicRoughnessTexture&&Wm(o.pbrMetallicRoughness.metallicRoughnessTexture,e),o.normalTexture&&Wm(o.normalTexture,e),o.occlusionTexture&&Wm(o.occlusionTexture,e,i),o.emissionTexture&&Wm(o.emissionTexture,e)}function ew(n,e,i){if(n.meshes)for(const o of n.meshes)SL(o,e,i);if(n.children)for(const o of n.children)ew(o,e,i)}function o0(n){if(n.meshes)for(const e of n.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(n.children)for(const e of n.children)o0(e)}function tw(n){if(n.meshes)for(const i of n.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(n.children)for(const i of n.children)tw(i)}function dh(n,e){const i=n.json.bufferViews[e.bufferView],o=Qy[e.componentType];return new o(n.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==qm[e.type]*o.BYTES_PER_ELEMENT?i.byteStride/o.BYTES_PER_ELEMENT:qm[e.type]))}function iw(n,e,i,o){const a=Qy[e.componentType],u=function(T){switch(T){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),d=n.json.bufferViews[e.bufferView],m=d.byteStride?d.byteStride/a.BYTES_PER_ELEMENT:qm[e.type],y=i.float32,x=y.length/i.capacity;for(let T=0,S=0;T<e.count*m;T+=m,S+=x)for(let I=0;I<x;I++)y[S+I]=o[T+I]*u;i._trim()}function EL(n,e,i){const o=n.indices,a=n.attributes,u={};u.indexArray=new mr;const d=e.json.accessors[o],m=d.count/3;u.indexArray.reserve(m);const y=dh(e,d);for(let I=0;I<m;I++)u.indexArray.emplaceBack(y[3*I],y[3*I+1],y[3*I+2]);u.indexArray._trim(),u.vertexArray=new Xo;const x=e.json.accessors[a.POSITION];u.vertexArray.reserve(x.count);const T=dh(e,x);for(let I=0;I<x.count;I++)u.vertexArray.emplaceBack(T[3*I],T[3*I+1],T[3*I+2]);if(u.vertexArray._trim(),u.aabb=new zt(x.min,x.max),u.centroid=function(I,M){const P=[0,0,0],k=I.length;if(k>0){for(let V=0;V<k;V++){const N=3*I[V];P[0]+=M[N],P[1]+=M[N+1],P[2]+=M[N+2]}P[0]/=k,P[1]/=k,P[2]/=k}return P}(y,T),a.COLOR_0!==void 0){const I=e.json.accessors[a.COLOR_0],M=qm[I.type],P=dh(e,I);u.colorArray=M===3?new Xo:new ml,u.colorArray.resize(I.count),iw(e,I,u.colorArray,P)}if(a.NORMAL!==void 0){u.normalArray=new Xo;const I=e.json.accessors[a.NORMAL];u.normalArray.resize(I.count);const M=dh(e,I);iw(e,I,u.normalArray,M)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new aa;const I=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(I.count);const M=dh(e,I);iw(e,I,u.texcoordArray,M)}if(a._FEATURE_ID_RGBA4444!==void 0){const I=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=dh(e,I))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(dh(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const S=n.material;return u.material=function(I,M){const{emissiveFactor:P=[0,0,0],alphaMode:k="OPAQUE",alphaCutoff:V=.5,normalTexture:N,occlusionTexture:$,emissiveTexture:q,doubleSided:Y,name:re}=I,{baseColorFactor:ee=[1,1,1,1],metallicFactor:ae=1,roughnessFactor:he=1,baseColorTexture:me,metallicRoughnessTexture:De}=I.pbrMetallicRoughness||{},xe=$?M[$.index]:void 0;if($&&$.extensions&&$.extensions.KHR_texture_transform&&xe){const Be=$.extensions.KHR_texture_transform;xe.offsetScale=[Be.offset[0],Be.offset[1],Be.scale[0],Be.scale[1]]}return{name:re,pbrMetallicRoughness:{baseColorFactor:new rn(...ee),metallicFactor:ae,roughnessFactor:he,baseColorTexture:me?M[me.index]:void 0,metallicRoughnessTexture:De?M[De.index]:void 0},doubleSided:Y,emissiveFactor:new rn(...P),alphaMode:k,alphaCutoff:V,normalTexture:N?M[N.index]:void 0,occlusionTexture:xe,emissionTexture:q?M[q.index]:void 0,defined:I.defined===void 0}}(S!==void 0?e.json.materials[S]:{defined:!1},i),u}function qE(n,e,i){const{matrix:o,rotation:a,translation:u,scale:d,mesh:m,extras:y,children:x,name:T}=n,S={};if(S.name=T,S.localMatrix=o||function(I,M,P,k){var V=M[0],N=M[1],$=M[2],q=M[3],Y=V+V,re=N+N,ee=$+$,ae=V*Y,he=V*re,me=V*ee,De=N*re,xe=N*ee,Be=$*ee,Ge=q*Y,$e=q*re,Je=q*ee,et=k[0],We=k[1],Xe=k[2];return I[0]=(1-(De+Be))*et,I[1]=(he+Je)*et,I[2]=(me-$e)*et,I[3]=0,I[4]=(he-Je)*We,I[5]=(1-(ae+Be))*We,I[6]=(xe+Ge)*We,I[7]=0,I[8]=(me+$e)*Xe,I[9]=(xe-Ge)*Xe,I[10]=(1-(ae+De))*Xe,I[11]=0,I[12]=P[0],I[13]=P[1],I[14]=P[2],I[15]=1,I}([],a||[0,0,0,1],u||[0,0,0],d||[1,1,1]),S.globalMatrix=at(S.localMatrix),m!==void 0){S.meshes=i[m];const I=S.anchor=[0,0];for(const M of S.meshes){const{min:P,max:k}=M.aabb;I[0]+=P[0]+k[0],I[1]+=P[1]+k[1]}I[0]=Math.floor(I[0]/S.meshes.length/2),I[1]=Math.floor(I[1]/S.meshes.length/2)}if(y&&(y.id&&(S.id=y.id),y.lights&&(S.lights=function(I){if(!I.length)return[];const M=function($){const q=atob($),Y=new Uint8Array(q.length);for(let re=0;re<q.length;re++)Y[re]=q.codePointAt(re);return Y}(I),P=[],k=M.length/24,V=new Uint16Array(M.buffer),N=new Float32Array(M.buffer);for(let $=0;$<k;$++){const q=V[2*$*6]/30,Y=V[2*$*6+1]/30,re=V[2*$*6+10]/100,ee=N[6*$+1],ae=N[6*$+2],he=N[6*$+3],me=N[6*$+4],De=he-ee,xe=me-ae,Be=Math.hypot(De,xe);P.push({pos:[ee+.5*De,ae+.5*xe,Y],normal:[xe/Be,-De/Be,0],width:Be,height:q,depth:re,points:[ee,ae,he,me]})}return P}(y.lights)),y.MAPBOX_geometry_bloom&&(S.isGeometryBloom=y.MAPBOX_geometry_bloom)),x){const I=[];for(const M of x)I.push(qE(e.json.nodes[M],e,i));S.children=I}return S}function IL(n){if(n.vertices.length===0||n.indices.length===0)return null;const e=new Hy(n.vertices,n.indices,8,256),[i,o]=[e.min.clone(),e.max.clone()];return{vertices:n.vertices,indices:n.indices,grid:e,min:i,max:o}}function AL(n){if(!n.extras||!n.extras.ground)return null;const e=n.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const o=[];for(const d of i){if(!Array.isArray(d)||d.length!==2)continue;const m=d[0],y=d[1];typeof m=="number"&&typeof y=="number"&&o.push(new Ke(m,y))}if(o.length<3)return null;o.length>1&&o[o.length-1].equals(o[0])&&o.pop();let a=0;for(let d=0;d<o.length;d++){const m=o[d],y=o[(d+1)%o.length],x=o[(d+2)%o.length];a+=(m.x-y.x)*(x.y-y.y)-(x.x-y.x)*(m.y-y.y)}a>0&&o.reverse();const u=up(o.flatMap(d=>[d.x,d.y]),[]);return u.length===0?null:{vertices:o,indices:u}}function CL(n,e){const i=[],o=[];let a=0;const u=[];for(const d of n){a=i.length;const m=d.vertexArray.float32,y=d.indexArray.uint16;for(let x=0;x<d.vertexArray.length;x++)u[0]=m[3*x+0],u[1]=m[3*x+1],u[2]=m[3*x+2],qn(u,u,e),i.push(new Ke(u[0],u[1]));for(let x=0;x<3*d.indexArray.length;x++)o.push(y[x]+a)}if(o.length%3!=0)return null;for(let d=0;d<o.length;d+=3){const m=i[o[d+0]],y=i[o[d+1]],x=i[o[d+2]];(m.x-y.x)*(x.y-y.y)-(x.x-y.x)*(m.y-y.y)>0&&([o[d+1],o[d+2]]=[o[d+2],o[d+1]])}return{vertices:i,indices:o}}function nw(n){const e=function(y,x){const T=[],S=WebGL2RenderingContext;if(y.json.textures)for(const I of y.json.textures){const M={magFilter:S.LINEAR,minFilter:S.NEAREST,wrapS:S.REPEAT,wrapT:S.REPEAT};I.sampler!==void 0&&Object.assign(M,y.json.samplers[I.sampler]),T.push({image:x[I.source],sampler:M,uploaded:!1})}return T}(n,n.images),i=function(y,x){const T=[];for(const S of y.json.meshes){const I=[];for(const M of S.primitives)I.push(EL(M,y,x));T.push(I)}return T}(n,e),{scenes:o,scene:a,nodes:u}=n.json,d=o?o[a||0].nodes:[...u.keys()],m=[];for(const y of d)m.push(qE(u[y],n,i));return function(y,x,T){const S={},I=new Set;for(let M=0;M<y.length;M++){const P=T[x[M]];if(!P.extras)continue;
vendor: 11,468 bytes, line 53
53const k=P.extras["mapbox:footprint:version"],V=P.extras["mapbox:footprint:id"];(k||V)&&I.add(M),k==="1.0.0"&&V&&(S[V]=M)}for(let M=0;M<y.length;M++){if(I.has(M))continue;const P=y[M],k=T[x[M]];if(!k.extras)continue;let V=null;P.id in S&&(V=CL(y[S[P.id]].meshes,P.localMatrix)),V||(V=AL(k)),V&&(P.footprint=IL(V))}if(I.size>0){const M=Array.from(I.values()).sort((P,k)=>P-k);for(let P=M.length-1;P>=0;P--)y.splice(M[P],1)}}(m,d,n.json.nodes),m}function ML(n){n.heightmap=new Float32Array(4096),n.heightmap.fill(-1);const e=n.vertexArray.float32,i=n.aabb.min[0]-1,o=n.aabb.min[1]-1,a=hh/(n.aabb.max[0]-i+2),u=hh/(n.aabb.max[1]-o+2);for(let d=0;d<e.length;d+=3){const m=e[d+2],y=(e[d+0]-i)*a|0,x=(e[d+1]-o)*u|0;m>n.heightmap[x*hh+y]&&(n.heightmap[x*hh+y]=m)}}function ZE(n,e,i,o,a){i.reserve(i.length+4*n.length),o.reserve(o.length+10*n.length),a.reserve(a.length+10*n.length);let u=o.length;for(const d of n){const m=Math.min(10,Math.max(4,1.3*d.height))*e,y=[-d.normal[1],d.normal[0],0],x=Math.min(.29,.1*d.width/d.depth),T=d.width-2*d.depth*e*(x+.01),S=Si([],d.pos,y,T/2),I=Si([],d.pos,y,-T/2),M=[S[0],S[1],S[2]+d.height],P=[I[0],I[1],I[2]+d.height],k=Si([],d.normal,y,x);ai(k,k,m);const V=Si([],d.normal,y,-x);ai(V,V,m),Gt(k,S,k),Gt(V,I,V),S[2]+=.1,I[2]+=.1,o.emplaceBack(k[0],k[1],k[2]),o.emplaceBack(V[0],V[1],V[2]),o.emplaceBack(S[0],S[1],S[2]),o.emplaceBack(I[0],I[1],I[2]),o.emplaceBack(M[0],M[1],M[2]),o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(S[0],S[1],S[2]),o.emplaceBack(I[0],I[1],I[2]),o.emplaceBack(k[0],k[1],k[2]),o.emplaceBack(V[0],V[1],V[2]);const N=T/m/2;a.emplaceBack(-N-x,-1,N,.8),a.emplaceBack(N+x,-1,N,.8),a.emplaceBack(-N,0,N,1.3),a.emplaceBack(N,0,N,1.3),a.emplaceBack(N+x,-.8,N,.7),a.emplaceBack(N+x,-.8,N,.7),a.emplaceBack(0,0,N,1.3),a.emplaceBack(0,0,N,1.3),a.emplaceBack(N+x,-1.2,N,.8),a.emplaceBack(N+x,-1.2,N,.8),i.emplaceBack(6+u,4+u,8+u),i.emplaceBack(7+u,9+u,5+u),i.emplaceBack(0+u,1+u,2+u),i.emplaceBack(1+u,3+u,2+u),u+=10}}function PL(n,e){const i={};i.indexArray=new mr,i.vertexArray=new Xo,i.colorArray=new ml,ZE(n,e,i.indexArray,i.vertexArray,i.colorArray);const o={defined:!0};o.emissiveFactor=rn.black;const a={};return a.baseColorFactor=rn.white,o.pbrMetallicRoughness=a,i.material=o,i.aabb=new zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const WE=Ai([{name:"a_pos_3f",components:3,type:"Float32"}]),RL=Ai([{name:"a_normal_3",components:3,type:"Int16"}]),LL=Ai([{name:"a_centroid_3",components:3,type:"Int16"}]),XE=Ai([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),zL=Ai([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),DL=Ai([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),kL=Ai([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),OL=Ai([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),FL=Ai([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),YE=ge.types,s0=32767;function BL(n,e){const i=ht+e;for(const o of n)for(const a of o)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}function NL(n){switch(n){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 new Error(`Unknown roof shape: ${n}`)}}class rw{constructor(){this.layoutVertexArray=new Xo,this.layoutAttenuationArray=new ml,this.layoutColorArray=new Yo,this.indexArray=new mr,this.indexArrayForConflation=new mr,this.segmentsBucket=new zn}}class ow{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new zn,this.entranceBloom=new rw;const i=66560;this.layoutVertexArray=new Xo,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Hc,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Hc,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new Yo,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new _l,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new Jd,this.layoutAOArray.reserve(i),this.indexArray=new mr,this.indexArray.reserve(66560),this.indexArrayForConflation=new mr,this.segmentsBucket=new zn,this.entranceBloom=new rw,e&&(this.layoutFacadePaintArray=new Yo,this.layoutFacadeDataArray=new Ql,this.layoutFacadeVerticalRangeArray=new Yo)}reserve(e,i,o){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),o&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class KE{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new aa,this.footprintsIndices=new _l,this.footprintsMin=new Ke(1/0,1/0),this.footprintsMax=new Ke(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new ow(!1),this.buildingWithFacade=new ow(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new j1(e),this.groundEffect.groundRadiusArray=new za,this.hasAppearances=null}updateFootprints(e,i){const o=new Hy([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:o,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,o,a){}prepare(){return function(){if(Jy!=null||RE!=null)return null;if(mp!=null)return mp;const e=fetch(Ri.BUILDING_GEN_URL);return mp=function(i){let o,a,u,d,m;function y(){o=new Uint8Array(m.buffer),a=new Int16Array(m.buffer),u=new Int32Array(m.buffer),d=new Float32Array(m.buffer)}function x(){throw new Error("Unexpected BuildingGen error.")}const T=()=>{},S={a:{a:x,f:function(I){const M=o.length,P=Math.max(I>>>0,Math.ceil(1.2*M)),k=Math.ceil((P-M)/65536);try{return m.grow(k),y(),!0}catch{return!1}},g:x,b:T,c:T,d:T,e:T}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,S):i.then(I=>I.arrayBuffer()).then(I=>WebAssembly.instantiate(I,S))).then(I=>{const M=I.instance.exports;return(0,M.g)(),m=M.f,y(),new uL({setStyle:M.h,setAOOptions:M.i,setMetricOptions:M.j,setStructuralOptions:M.k,setFacadeOptions:M.l,setFauxFacadeOptions:M.m,setFacadeClassifierOptions:M.n,addFeature:M.o,addFacade:M.p,generateMesh:M.q,getLastError:M.r,getOuterRingLength:M.s,getMeshCount:M.t,getPositionsPtr:M.u,getPositionsLength:M.v,getNormalsPtr:M.w,getNormalsLength:M.x,getAOPtr:M.y,getAOLength:M.z,getUVPtr:M.A,getUVLength:M.B,getFauxFacadePtr:M.C,getFauxFacadeLength:M.D,getIndicesPtr:M.E,getIndicesLength:M.F,getBuildingPart:M.G,getRingCount:M.H,getRingPtr:M.I,getRingLength:M.J,malloc:M.K,free:M.L,heapU8:o,heap16:a,heap32:u,heapF32:d})})}(e).then(i=>(mp=null,Jy=i,Jy)).catch(i=>{Tt("Could not load building-gen"),mp=null,RE=i}),mp}()}populate(e,i,o,a){const u=hL();if(!u)return;const d=U(o);this.tileToMeter=d,this.brightness=i.brightness,u.setStyle({normalScale:[1,-1,d],tileToMeters:d}),u.setAOOptions(!1,.3),u.setMetricOptions(!1,16),u.setStructuralOptions(!0),u.setFacadeClassifierOptions(3);const m=new Map,y=new Map;let x=0;for(const{feature:N}of e){if(YE[N.type]!=="LineString"){m.set(N.id,N.properties.source_id);continue}const $=this.layers[0]._featureFilter.needGeometry;if($&&!this.layers[0]._featureFilter.filter(new bn(this.zoom),N,o))continue;const q=ve(N,$);if(!$&&!this.layers[0]._featureFilter.filter(new bn(this.zoom),q,o))continue;const Y=$?q.geometry:ce(N,o,a),re=[];for(const me of Y)for(const De of me)re.push(De.x),re.push(De.y);const ee={coordinates:re,crossPerc:N.properties.cross_perc,distanceToRoad:N.properties.distance_to_road,entrances:N.properties.entrances,sourceId:0},ae=N.properties.source_id;let he=y.get(ae);he||(he=[],y.set(ae,he)),he.push(ee),++x}this.maxHeight=0;const T=new Array,S=new Set,I=N=>{N!=null&&S.add(N)},M=(N,$)=>{N!=null&&T.push({buildingId:N,footprintIndex:$})},P=64*(e.length-x),k=P/2;this.buildingWithFacade.reserve(P,k,!0),this.buildingWithoutFacade.reserve(2*P,2*k,!1),this.footprintsIndices.reserve(16*(e.length-x)),this.footprintsVertices.reserve(8*(e.length-x));for(const{feature:N,id:$,index:q,sourceLayerIndex:Y}of e){if(YE[N.type]==="LineString")continue;const re=this.layers[0]._featureFilter.needGeometry;if(re&&!this.layers[0]._featureFilter.filter(new bn(this.zoom),N,o))continue;let ee=null;if(N.properties&&N.properties.hasOwnProperty("building_id")&&(ee=N.properties.building_id,S.has(ee)))continue;const ae=ve(N,re);if(!re&&!this.layers[0]._featureFilter.filter(new bn(this.zoom),ae,o))continue;const he=re?ae.geometry:ce(N,o,a),me=Fm(he,500);let De=!1;for(const Kt of me)if(Kt.length!==1){De=!0;break}if(De){I(ee);continue}if(!BL(he,163)){I(ee);continue}const xe=this.layers[0],Be=NL(xe.layout.get("building-roof-shape").evaluate(N,{},o)),Ge=xe.layout.get("building-base").evaluate(N,{},o),$e=xe.layout.get("building-height").evaluate(N,{},o),Je=xe.layout.get("building-flood-light-ground-radius").evaluate(N,{},o),et=xe.paint.get("building-ambient-occlusion-intensity"),We=Je/this.tileToMeter;N.properties["building-part"]="roof";const Xe=xe.paint.get("building-color").evaluate(N,{},this.canonical).toPremultipliedRenderColor(this.lut),Fe=xe.paint.get("building-emissive-strength").evaluate(N,{},this.canonical);N.properties["building-part"]="wall";const ke=xe.paint.get("building-color").evaluate(N,{},this.canonical).toPremultipliedRenderColor(this.lut),Ye=xe.paint.get("building-emissive-strength").evaluate(N,{},this.canonical);N.properties["building-part"]="window";const pt=xe.paint.get("building-color").evaluate(N,{},this.canonical).toPremultipliedRenderColor(this.lut),ot=xe.paint.get("building-emissive-strength").evaluate(N,{},this.canonical);N.properties["building-part"]="door";const Ot=xe.paint.get("building-color").evaluate(N,{},this.canonical).toPremultipliedRenderColor(this.lut),wt=xe.paint.get("building-emissive-strength").evaluate(N,{},this.canonical);let Et=xe.layout.get("building-flood-light-wall-radius").evaluate(N,{},o);Et=j(Et,0,2048);const Pt=Et/2048*s0,wi=m.get($),lt=y.get(wi)||[],Rt=lt.length!==0&&xe.layout.get("building-facade").evaluate(N,{},o);u.setFacadeOptions(4,!0),u.setFauxFacadeOptions(Rt,!1,1);let oi=0,zi=0,ki=0,di=0,hn=0,te=0,oe=0,Ne=0,Qe=0,gt=0,yt=0;if(Rt){let Kt=Math.round(xe.layout.get("building-facade-floors").evaluate(N,{},o));if(Ge===0){Kt=Math.max(1,Kt-(lt.length>0?1:0));let an=4;if($e>100){const Mn=[10,13,15];an=Mn[N.id?N.id%Mn.length:0]}else $e<=10&&(an=3);u.setFacadeOptions(an,!0),hn=($e<15?1.3:1.61803)*an/d}else hn=Ge/d;te=$e/d,hn=Math.min(hn,te),ki=xe.layout.get("building-facade-unit-width").evaluate(N,{},o)/d,di=(te-hn)/Kt,u.setFauxFacadeOptions(!0,!0,ki);const On=xe.layout.get("building-facade-window").evaluate(N,{},o);oi=On[0],zi=On[1],oe=Math.floor(65535*Math.min(1,hn/ht)),Ne=Math.floor(65535*Math.min(1,te/ht)),Qe=M
vendor: 4,170 bytes, line 53
53ath.floor(255*oi)<<8|Math.floor(255*zi),gt=Math.floor(65535*Math.min(1,ki/ht)),yt=Math.floor(65535*Math.min(1,di/ht))}const Bt=Array(me.length),Ut={x:1/0,y:1/0},ui={x:-1/0,y:-1/0},yi={x:0,y:0};let xi=0;for(let Kt=0;Kt<me.length;Kt++){const On=me[Kt];if(On.length>0){const an=[],Mn=Array(On.length+1);Mn[0]=0;for(let yr=0;yr<On.length;yr++){const Lr=On[yr];for(let ur=0;ur<Lr.length;ur++){const hr=Lr[Lr.length-ur-1];Ut.x=Math.min(Ut.x,hr.x),Ut.y=Math.min(Ut.y,hr.y),ui.x=Math.max(ui.x,hr.x),ui.y=Math.max(ui.y,hr.y),yi.x+=hr.x,yi.y+=hr.y,xi++,an.push(hr.x),an.push(hr.y)}Mn[yr+1]=an.length}Bt[Kt]={id:N.id?N.id:0,height:$e,minHeight:Ge,sourceId:0,roofType:Be,coordinates:an,ringIndices:Mn}}}yi.x/=xi||1,yi.y/=xi||1;const Ci=u.generateMesh(Bt,lt);if(typeof Ci=="string"){Tt(`Unable to generate building ${N.id}: ${Ci}`),I(ee);continue}if(Ci.meshes.length===0||Ci.modifiedPolygonRings.length===0){I(ee);continue}const Jt=Rt?this.buildingWithFacade:this.buildingWithoutFacade;let ni=0;for(const Kt of Ci.meshes)ni+=Kt.positions.length/3;const Vi=Jt.segmentsBucket.prepareSegment(ni,Jt.layoutVertexArray,Jt.indexArray),Wi=[];let Xi=null,sn=0,_n=-1;const dn=Jt.layoutVertexArray.length,Ki=dn+ni;Jt.layoutVertexArray.resize(Ki),Jt.layoutCentroidArray.resize(Ki),Jt.layoutNormalArray.resize(Ki),Jt.layoutAOArray.resize(Ki),Jt.layoutColorArray.resize(Ki),Jt.layoutFloodLightDataArray.resize(Ki),Rt&&(Jt.layoutFacadePaintArray.resize(Ki),Jt.layoutFacadeDataArray.resize(Ki),Jt.layoutFacadeVerticalRangeArray.resize(Ki));const tn=Jt.indexArray.length;let vi=0,Di=dn;for(const Kt of Ci.meshes){let On,an;if(Kt.buildingPart===1)On=Xe,an=Fe;else if(Kt.buildingPart===0)On=ke,an=Ye;else if(Kt.buildingPart===2)On=pt,an=ot;else{if(Kt.buildingPart!==3)continue;On=Ot,an=wt}if(an=j(an,0,1),Kt.buildingPart===3){const wn=new Array;for(let vr=0;vr<Kt.positions.length;vr+=12){const ha=Kt.positions[vr+0],wl=Kt.positions[vr+1],Wr=Kt.positions[vr+3],vo=Kt.positions[vr+4],es=Kt.positions[vr+2],su=Kt.positions[vr+8]-es,Mp=1,qa=Wr-ha,Za=vo-wl,y_=Math.hypot(qa,Za);wn.push({pos:[ha+.5*qa,wl+.5*Za,es],normal:[Za/y_,-qa/y_,0],width:y_,height:su,depth:Mp,points:[ha,wl,Wr,vo]})}const Yn=Jt.entranceBloom.segmentsBucket.prepareSegment(10*wn.length,Jt.entranceBloom.layoutVertexArray,Jt.entranceBloom.indexArray),ir=Jt.entranceBloom.layoutVertexArray.length;sn=Jt.entranceBloom.indexArray.length,ZE(wn,.5/this.tileToMeter,Jt.entranceBloom.indexArray,Jt.entranceBloom.layoutVertexArray,Jt.entranceBloom.layoutAttenuationArray);const Bo=Jt.entranceBloom.layoutVertexArray.length-ir;_n=Jt.entranceBloom.indexArray.length-sn;for(let vr=0;vr<Bo;vr++)Jt.entranceBloom.layoutColorArray.emplaceBack(255*Ot.r<<8|255*Ot.g,255*Ot.b<<8|51*wt);Yn.vertexLength+=Bo,Yn.primitiveLength+=_n,Xi={part:Kt.buildingPart,vertexOffset:ir,vertexLength:Bo}}Jt.layoutVertexArray.float32.set(Kt.positions,3*Di);const Mn=Kt.positions.length/3;for(let wn=0;wn<Mn;++wn){const Yn=3*wn;vi=Math.max(vi,Kt.positions[Yn+2]);const ir=Kt.normals[Yn+1]*s0,Bo=Kt.normals[Yn+2]*s0,vr=3*(Di+wn);Jt.layoutNormalArray.int16[vr]=Kt.normals[Yn]*s0,Jt.layoutNormalArray.int16[vr+1]=ir,Jt.layoutNormalArray.int16[vr+2]=Bo;const ha=Kt.ao[wn];Jt.layoutAOArray.uint8[Di+wn]=255*ha;const wl=1+(ha-1)*et,Wr=255*On.b*wl<<8|255*an;Jt.layoutColorArray.uint16[2*(Di+wn)]=255*On.r*wl<<8|255*On.g*wl,Jt.layoutColorArray.uint16[2*(Di+wn)+1]=Wr}const yr=Math.floor(yi.x),Lr=Math.floor(yi.y),ur=Math.floor($e);for(let wn=0;wn<Mn;++wn){const Yn=3*(Di+wn);Jt.layoutCentroidArray.int16[Yn]=yr,Jt.layoutCentroidArray.int16[Yn+1]=Lr,Jt.layoutCentroidArray.int16[Yn+2]=ur}if(Jt.layoutFloodLightDataArray.uint16.fill(Kt.buildingPart===0?Pt:0,Di,Di+Mn),Rt){const wn=255*pt.r<<8|255*pt.g,Yn=255*pt.b<<8|255*ot;for(let ir=0;ir<Mn;++ir){const Bo=2*(Di+ir);Jt.layoutFacadePaintArray.uint16[Bo]=wn,Jt.layoutFacadePaintArray.uint16[Bo+1]=Yn}for(let ir=0;ir<Mn;++ir)if(Kt.isFauxFacade[ir]){const Bo=Math.min(65535,Math.floor(Kt.uv[2*ir]*Ci.outerRingLength));Jt.layoutFacadeDataArray.emplace(Di+ir,1|Bo,Qe,gt,yt),Jt.layoutFacadeVerticalRangeArray.emplace(Di+ir,oe,Ne)}else Jt.layoutFacadeDataArray.emplace(Di+ir,0,0,0,0),Jt.layoutFacadeVerticalRangeArray.emplace(Di+ir,0,0)}
vendor: 11,802 bytes, line 53
53const hr=Vi.vertexLength,Ir=Kt.indices.length/3,Mo=Jt.indexArray.length;Jt.indexArray.resize(Mo+Ir);for(let wn=0;wn<Ir;++wn){const Yn=3*wn,ir=3*Mo+Yn;Jt.indexArray.uint16[ir]=hr+Kt.indices[Yn],Jt.indexArray.uint16[ir+1]=hr+Kt.indices[Yn+1],Jt.indexArray.uint16[ir+2]=hr+Kt.indices[Yn+2]}Kt.buildingPart!==1&&Kt.buildingPart!==0&&Kt.buildingPart!==2&&Kt.buildingPart!==3||Wi.push({part:Kt.buildingPart,vertexOffset:Di,vertexLength:Kt.positions.length/3}),Di+=Mn,Vi.vertexLength+=Mn,Vi.primitiveLength+=Kt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,vi);const Ln=Jt.indexArray.length-tn,Yt=this.footprintsIndices.length,Mi=this.footprintsVertices.length,pn=[],yn=new Ke(1/0,1/0),Tn=new Ke(-1/0,-1/0),tr=this.groundEffect.vertexArray.length;for(const Kt of Ci.modifiedPolygonRings){const On=[],an=new Ke(1/0,1/0),Mn=new Ke(-1/0,-1/0);for(let yr=0;yr<Kt.length;yr+=2){const Lr=Kt.length-yr-2;an.x=Math.min(an.x,Kt[Lr]),an.y=Math.min(an.y,Kt[Lr+1]),Mn.x=Math.max(Mn.x,Kt[Lr]),Mn.y=Math.max(Mn.y,Kt[Lr+1]);const ur=new Ke(Kt[Lr],Kt[Lr+1]);On.push(ur),pn.push(ur.x,ur.y),this.footprintsVertices.emplaceBack(ur.x,ur.y)}yn.x=Math.min(yn.x,an.x),yn.y=Math.min(yn.y,an.y),Tn.x=Math.max(Tn.x,Mn.x),Tn.y=Math.max(Tn.y,Mn.y),this.groundEffect.addData(On,[an,Mn],We)}const xn=this.groundEffect.vertexArray.length-tr;this.groundEffect.groundRadiusArray.reserveForAdditional(xn);for(let Kt=0;Kt<xn;Kt++)this.groundEffect.groundRadiusArray.emplaceBack(Je);(Ut.x<0||ui.x>ht||Ut.y<0||ui.y>ht)&&this.featuresOnBorder.push({featureId:N.id,footprintIndex:this.footprints.length});{const Kt=up(pn,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Kt.length),this.footprintsIndices.uint16.set(Kt,Yt),this.buildingIds.add(ee??N.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,yn.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,yn.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Tn.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Tn.y);const On={footprintVertexOffset:Mi,footprintVertexLength:this.footprintsVertices.length-Mi,footprintIndexOffset:Yt,footprintIndexLength:this.footprintsIndices.length-Yt,min:yn,max:Tn,hiddenFlags:0,indicesOffset:tn,indicesLength:Ln,bloomIndicesOffset:sn,bloomIndicesLength:_n,groundEffectVertexOffset:tr,groundEffectVertexLength:xn,hasFauxFacade:Rt,height:vi,promoteId:$,feature:ae,parts:Wi,buildingBloom:Xi},an=this.footprints.length;N.id!==void 0&&this.featureFootprintLookup.set(N.id,an),M(ee,an),this.footprints.push(On)}this.programConfigurations.populatePaintArrays(Jt.layoutVertexArray.length,N,q,{},i.availableImages,o,i.brightness),this.groundEffect.addPaintPropertiesData(N,q,{},i.availableImages,o,i.brightness),i.featureIndex.insert(N,he,q,Y,this.index,dn)}T.forEach(({buildingId:N,footprintIndex:$})=>{S.has(N)&&(this.footprints[$].hiddenFlags|=4)});const V=new Set;this.buildingIds.forEach((N,$,q)=>{S.has(N)||V.add(N)}),this.buildingIds=V,this.groundEffect.prepareBorderSegments()}update(e,i,o,a,u,d,m){this.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m),this.groundEffect.update(e,i,u,o,a,d,m),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=o=>{o.layoutVertexBuffer=e.createVertexBuffer(o.layoutVertexArray,WE.members),o.layoutNormalBuffer=e.createVertexBuffer(o.layoutNormalArray,RL.members),o.layoutCentroidBuffer=e.createVertexBuffer(o.layoutCentroidArray,LL.members),o.layoutFloodLightDataBuffer=e.createVertexBuffer(o.layoutFloodLightDataArray,FL.members),o.layoutFacadeDataArray&&o.layoutFacadeDataArray.length&&(o.layoutFacadeDataBuffer=e.createVertexBuffer(o.layoutFacadeDataArray,DL.members)),o.layoutFacadeVerticalRangeArray&&o.layoutFacadeVerticalRangeArray.length&&(o.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(o.layoutFacadeVerticalRangeArray,kL.members)),o.entranceBloom.layoutVertexArray.length&&(o.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(o.entranceBloom.layoutVertexArray,WE.members),o.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(o.entranceBloom.layoutAttenuationArray,OL.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=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()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,o=!0){let a=!1;const u=o?i:0,d=0|(o?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const m of e){const y=this.footprints[m],x=y.hiddenFlags&d|u;y.hiddenFlags!==x&&(y.hiddenFlags=x,a=!0,this.groundEffect.updateHiddenByLandmarkRange(y.groundEffectVertexOffset,y.groundEffectVertexLength,y.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=a=>{a.indexArray.length!==0&&(a.indexArrayForConflation.resize(a.indexArray.length),a.indexArrayForConflation.uint16.set(a.indexArray.uint16),a.entranceBloom.indexArrayForConflation.resize(a.entranceBloom.indexArray.length),a.entranceBloom.indexArrayForConflation.uint16.set(a.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const a of this.footprints){const u=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,d=a.indicesOffset+a.indicesLength;if(a.hiddenFlags!==0){for(let y=a.indicesOffset;y<d;y++)u.indexArrayForConflation.uint16[3*y+0]=0,u.indexArrayForConflation.uint16[3*y+1]=0,u.indexArrayForConflation.uint16[3*y+2]=0;const m=a.bloomIndicesOffset+a.bloomIndicesLength;for(let y=a.bloomIndicesOffset;y<m;y++)u.entranceBloom.indexArrayForConflation.uint16[3*y+0]=0,u.entranceBloom.indexArrayForConflation.uint16[3*y+1]=0,u.entranceBloom.indexArrayForConflation.uint16[3*y+2]=0}}const o=a=>{a.indexArray.length!==0&&(a.indexBuffer?a.indexBuffer.updateData(a.indexArrayForConflation):a.indexBuffer=e.createIndexBuffer(a.indexArrayForConflation,!0),a.entranceBloom.indexBuffer?a.entranceBloom.indexBuffer.updateData(a.entranceBloom.indexArrayForConflation):a.entranceBloom.indexBuffer=e.createIndexBuffer(a.entranceBloom.indexArrayForConflation,!0))};o(this.buildingWithoutFacade),o(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=o=>{o.layoutColorBuffer?o.layoutColorBuffer.updateData(o.layoutColorArray):o.layoutColorBuffer=e.createVertexBuffer(o.layoutColorArray,XE.members,!0),o.layoutFacadePaintArray&&(o.layoutFacadePaintBuffer?o.layoutFacadePaintBuffer.updateData(o.layoutFacadePaintArray):o.layoutFacadePaintBuffer=e.createVertexBuffer(o.layoutFacadePaintArray,zL.members,!0)),o.entranceBloom.layoutColorBuffer?o.entranceBloom.layoutColorBuffer.updateData(o.entranceBloom.layoutColorArray):o.entranceBloom.layoutColorBuffer=e.createVertexBuffer(o.entranceBloom.layoutColorArray,XE.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const o=e.paint.get("building-ambient-occlusion-intensity");for(const a of this.footprints){if(4&a.hiddenFlags)continue;const u=i[a.promoteId],d=a.feature;d.properties["building-part"]="roof";const m=e.paint.get("building-color").evaluate(d,u,this.canonical).toPremultipliedRenderColor(this.lut),y=e.paint.get("building-emissive-strength").evaluate(d,u,this.canonical);d.properties["building-part"]="wall";const x=e.paint.get("building-color").evaluate(d,u,this.canonical).toPremultipliedRenderColor(this.lut),T=e.paint.get("building-emissive-strength").evaluate(d,u,this.canonical);d.properties["building-part"]="window";const S=e.paint.get("building-color").evaluate(d,u,this.canonical).toPremultipliedRenderColor(this.lut),I=e.paint.get("building-emissive-strength").evaluate(d,u,this.canonical);d.properties["building-part"]="door";const M=e.paint.get("building-color").evaluate(d,u,this.canonical).toPremultipliedRenderColor(this.lut),P=e.paint.get("building-emissive-strength").evaluate(d,u,this.canonical),k=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const N of a.parts){let $,q=m;N.part===1?(q=m,$=y):N.part===0?(q=x,$=T):N.part===2?(q=S,$=I):N.part===3&&(q=M,$=P),$=j($,0,1);for(let Y=0;Y<N.vertexLength;Y++){const re=N.vertexOffset+Y,ee=1+(k.layoutAOArray.uint8[re]/255-1)*o;k.layoutColorArray.emplace(re,q.r*ee*255<<8|q.g*ee*255,q.b*ee*255<<8|255*$),a.hasFauxFacade&&k.layoutFacadePaintArray.emplace(re,255*S.r<<8|255*S.g,255*S.b<<8|255*I)}}const V=a.buildingBloom;if(V)for(let N=0;N<V.vertexLength;N++)k.entranceBloom.layoutColorArray.emplace(V.vertexOffset+N,255*M.r<<8|255*M.g,255*M.b<<8|51*P)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Zy(this.activeReplacements,a))return;this.activeReplacements=a;for(const d of this.footprints)d.hiddenFlags&=-2;const u=[];for(const d of this.activeReplacements){if(d.order<=JS)continue;const m=Math.max(1,Math.pow(2,d.footprintTileId.canonical.z-e.canonical.z));for(const y of this.footprints)y.min.x>d.max.x||y.max.x<d.min.x||y.min.y>d.max.y||y.max.y<d.min.y||(u.length=0,jL(this.footprintsVertices,y.footprintVertexOffset,y.footprintVertexLength,d.footprintTileId.canonical,e.canonical,u),B1(d.footprint,u,this.footprintsIndices.uint16,y.footprintIndexOffset,y.footprintIndexLength,0,-m)&&(y.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const d of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(d.groundEffectVertexOffset,d.groundEffectVertexLength,d.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+ht)*ht+(i+ht);if(this.footprintLookup.hasOwnProperty(u)){const m=this.footprintLookup[u];return m?{height:m.height,hidden:m.hiddenFlags!==0}:void 0}const d=new Ke(e,i);for(const m of this.footprints)e>m.max.x||m.min.x>e||i>m.max.y||m.min.y>i||m.height<=o||VL(d,this.footprintsVertices.float32.subarray(2*m.footprintVertexOffset,2*(m.footprintVertexOffset+m.footprintVertexLength)),this.footprintsIndices.uint16.subarray(m.footprintIndexOffset,m.footprintIndexOffset+m.footprintIndexLength))&&(o=m.height,this.footprintLookup[u]=m,a=m.hiddenFlags!==0);if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.footprintLookup[u]=void 0}}function VL(n,e,i){for(let o=0;o<i.length;o+=3){const a=i[o],u=i[o+1],d=i[o+2],m=e[2*a+0],y=e[2*a+1],x=e[2*u+0],T=e[2*u+1],S=e[2*d+0],I=e[2*d+1],M=(m-S)*(n.y-I)-(y-I)*(n.x-S),P=(x-m)*(n.y-y)-(T-y)*(n.x-m);if(M<0!=P<0&&M!==0&&P!==0)continue;
53const k=(S-x)*(n.y-T)-(I-T)*(n.x-x);if(k===0||k<0==M+P<=0)return!0}return!1}function jL(n,e,i,o,a,u){const d=Math.pow(2,o.z-a.z);for(let m=0;m<i;m++){let y=n.float32[2*(m+e)+0],x=n.float32[2*(m+e)+1];y=(y+a.x*ht)*d-o.x*ht,x=(x+a.y*ht)*d-o.y*ht,u.push(new Ke(y,x))}}let JE,QE;At(KE,"BuildingBucket",{omit:["layers"]}),At(ow,"BuildingGeometry"),At(rw,"BuildingBloomGeometry");const UL=Ai([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),GL=Ai([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:$L}=UL,HL=Ai([{name:"a_packed",components:3,type:"Float32"}]),{members:qL}=HL,ZL=Ai([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:WL}=ZL;class eI{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new tu({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const o=this.getKey(e,i);return this.positions[o]}trim(){const e=this.width,i=this.height=Re(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,o){const a=[];let u=e.length%2==1?-e[e.length-1]*o:0,d=e[0]*o,m=!0;a.push({left:u,right:d,isDash:m,zeroLength:e[0]===0});let y=e[0];for(let x=1;x<e.length;x++){m=!m;const T=e[x];u=y*o,y+=T,d=y*o,a.push({left:u,right:d,isDash:m,zeroLength:T===0})}return a}addRoundDash(e,i,o){const a=i/2;for(let u=-o;u<=o;u++){const d=this.width*(this.nextRow+o+u);let m=0,y=e[m];for(let x=0;x<this.width;x++){x/y.right>1&&(y=e[++m]);const T=Math.abs(x-y.left),S=Math.abs(x-y.right),I=Math.min(T,S);let M;const P=u/o*(a+1);if(y.isDash){const k=a-Math.abs(P);M=Math.sqrt(I*I+k*k)}else M=a-Math.sqrt(I*I+P*P);this.image.data[d+x]=Math.max(0,Math.min(255,M+128))}}}addRegularDash(e,i){for(let y=e.length-1;y>=0;--y){const x=e[y],T=e[y+1];x.zeroLength?e.splice(y,1):T&&T.isDash===x.isDash&&(T.left=x.left,e.splice(y,1))}const o=e[0],a=e[e.length-1];o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);const u=this.width*this.nextRow;let d=0,m=e[d];for(let y=0;y<this.width;y++){y/m.right>1&&(m=e[++d]);const x=Math.abs(y-m.left),T=Math.abs(y-m.right),S=Math.min(x,T);this.image.data[u+y]=Math.max(0,Math.min(255,(m.isDash?S:-S)+i+128))}}addDash(e,i){const o=this.getKey(e,i);if(this.positions[o])return this.positions[o];const a=i==="round",u=a?7:0,d=2*u+1;if(this.nextRow+d>this.height)return Tt("LineAtlas out of space"),null;e.length===0&&e.push(1);let m=0;for(let T=0;T<e.length;T++)e[T]<0&&(Tt("Negative value is found in line dasharray, replacing values with 0"),e[T]=0),m+=e[T];if(m!==0){const T=this.width/m,S=this.getDashRanges(e,this.width,T);a?this.addRoundDash(S,T,u):this.addRegularDash(S,i==="square"?.5*T:0)}const y=this.nextRow+u;this.nextRow+=d;const x={tl:[y,u],br:[m,0]};return this.positions[o]=x,x}}At(eI,"LineAtlas");const XL=ge.types,YL=Math.cos(Math.PI/180*37.5),KL=Math.cos(Math.PI/180*5);class sw{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Hd,this.layoutVertexArray2=new Xo,this.patternVertexArray=new Xo,this.indexArray=new mr,this.programConfigurations=new Ds(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new zn,this.maxLineLength=0,this.zOffsetVertexArray=new Xo,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:ht/64,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.hasPattern=L1("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=U(o);const d=this.layers[0].layout.get("line-elevation-reference");if(d==="hd-road-markup")this.elevationType="road";else{const I=this.layers[0].layout.get("line-z-offset"),M=I.isConstant()&&!I.constantOr(0);this.elevationType=d!=="sea"&&d!=="ground"&&M?"none":"offset",this.elevationType==="offset"&&d==="none"&&Tt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const m=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&m!==void 0;const y=[];for(const{feature:I,id:M,index:P,sourceLayerIndex:k}of e){const V=this.layers[0]._featureFilter.needGeometry,N=ve(I,V);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),N,o))continue;const $=u?u.evaluate(N,{},o):void 0,q={id:M,properties:I.properties,type:I.type,sourceLayerIndex:k,index:P,geometry:V?N.geometry:ce(I,o,a),patterns:{},sortKey:$};y.push(q)}u&&y.sort((I,M)=>I.sortKey-M.sortKey);const{lineAtlas:x,featureIndex:T}=i,S=this.addConstantDashes(x);for(const I of y){const{geometry:M,index:P,sourceLayerIndex:k}=I;if(S&&this.addFeatureDashes(I,x),this.hasPattern){const V=z1("line",this.layers,I,this.zoom,this.pixelRatio,i);this.patternFeatures.push(V)}else this.addFeature(I,M,P,o,x.positions,i.availableImages,i.brightness,i.elevationFeatures);T.insert(e[P].feature,M,P,k,this.index)}}addConstantDashes(e){let i=!1;for(const o of this.layers){const a=o.paint.get("line-dasharray").value,u=o.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const d=u.value,m=a.value;if(!m)continue;e.addDash(m,d)}}return i}addFeatureDashes(e,i){const o=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,d=a.layout.get("line-cap").value;if(u.kind==="constant"&&d.kind==="constant")continue;let m,y;if(u.kind==="constant"){if(m=u.value,!m)continue}else m=u.evaluate({zoom:o},e);y=d.kind==="constant"?d.value:d.evaluate({zoom:o},e),i.addDash(m,y),e.patterns[a.id]=[i.getKey(m,y)]}}update(e,i,o,a,u,d,m,y){this.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,y)}addFeatures(e,i,o,a,u,d){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,i,o,a,d,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,qL)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,WL)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,GL.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$L),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let o,a;if(i&&i>0?(o=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(o="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(o)&&e.properties.hasOwnProperty(a))return{start:+e.properties[o],end:+e.properties[a]}}addFeature(e,i,o,a,u,d,m,y){const x=this.layers[0].layout,T=x.get("line-join").evaluate(e,{}),S=x.get("line-cap").evaluate(e,{}),I=x.get("line-miter-limit"),M=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const P=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=x.get("line-z-offset").value;
53const k=this.layers[0].paint.get("line-width").value;if(k.kind!=="constant"&&k.isLineProgressConstant===!1&&(this.variableWidthValue=k),this.elevationType==="road"){const V=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,y,T,S,I,M)){const[N,$]=this.clipRuntimeLinesToTile(i,1);for(let q=0;q<N.length;q++){const Y=N[q],re=$[q],ee={progress:{min:re.progress.min,max:re.progress.max},nextDir:this.computeSegNextDir(re,Y),prevDir:this.computeSegPrevDir(re,Y)};this.addLine(Y,e,a,T,S,I,M,ee,P&&re.parentIndex>0?re.parentIndex:null)}this.fillNonElevatedRoadSegment(V)}}else for(let V=0;V<i.length;V++)this.addLine(i[V],e,a,T,S,I,M,void 0,P&&V>0?V:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,u,d,a,m,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return Yy(e,-i,-i,ht+i,ht+i)}clipRuntimeLinesToTile(e,i){const o=[];return[Yy(e,-i,-i,ht+i,ht+i,o),o]}addElevatedRoadFeature(e,i,o,a,u,d,m,y){const x=[],T=Qi.getElevationFeature(e,a);if(T){const S=this.clipLinesToTile(i,1),I=this.prepareElevatedLines(S,T,o);for(const M of I)x.push({geometry:M,elevation:T,elevationTileID:o,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(x.length===0)return!1;for(const S of x){const I=this.layoutVertexArray.length;this.addLine(S.geometry,e,o,u,d,m,y);const M=new cn(o,S.elevationTileID);if(S.elevation)for(let P=I;P<this.layoutVertexArray.length;P++){const k=new Ke(this.layoutVertexArray.int16[6*P]>>1,this.layoutVertexArray.int16[6*P+1]>>1),V=M.pointElevation(k,S.elevation,.05);this.updateHeightRange(V),this.zOffsetVertexArray.emplaceBack(V,0,0)}else this.fillNonElevatedRoadSegment(I)}return!0}prepareElevatedLines(e,i,o){if(i.constantHeight!=null)return e;const a=[],u=1/U(o);for(const d of e)aL(d,new Zi(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,o,a,u,d,m,y,x){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=x?this.lineFeatureClips(i,x):this.lineClips;const T=a==="none";this.patternJoinNone=this.hasPattern&&T,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const S=y&&y.progress.min>0,I=y&&y.progress.max<1;if(this.lineClips){let me={min:this.lineClips.start,max:this.lineClips.end},De=1;if(y){const Ge=this.lineClips.end-this.lineClips.start;me=function($e,Je,et){return{min:gn($e.min,Je,et),max:gn($e.max,Je,et)}}(y.progress,{min:0,max:1},me),Ge>0&&(De=(me.max-me.min)/Ge)}const xe=+i.properties.mapbox_clip_feature_len,Be=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(xe)||Number.isNaN(Be)){for(let $e=0;$e<e.length-1;$e++)this.totalDistance+=e[$e].dist(e[$e+1]);const Ge=this.totalDistance/(me.max-me.min);this.totalFeatureLength=Number.isFinite(Ge)?Ge:0,this.lineClips.start=me.min,this.lineClips.end=me.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=xe,this.distance=Be*De,this.lineClips.start=me.min,this.lineClips.end=me.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const M=XL[i.type]==="Polygon";let P=e.length;for(;P>=2&&e[P-1].equals(e[P-2]);)P--;let k=0;for(;k<P-1&&e[k].equals(e[k+1]);)k++;if(P<(M?3:2))return;a==="bevel"&&(d=1.05);const V=this.segments.prepareSegment(10*P,this.layoutVertexArray,this.indexArray);let N,$,q,Y,re,ee,ae,he;y&&y.prevDir&&(ee=y.prevDir.perp()),y&&y.nextDir&&(ae=y.nextDir.perp()),this.e1=this.e2=-1,M&&(N=e[P-2],re=e[k].sub(N)._unit()._perp());for(let me=k;me<P;me++){if(q=me===P-1?M?e[k+1]:void 0:e[me+1],q&&e[me].equals(q))continue;re&&(Y=re),N&&($=N),N=e[me],he=this.evaluateLineProgressFeatures($?$.dist(N):0),re=q?q.sub(N)._unit()._perp():Y,Y=Y||re;const De=$&&q;let xe=De?a:M||T?"butt":u;const Be=Y.x*re.x+Y.y*re.y;if(T){const ke=function(Ye){if(Ye.patternJoinNone){const pt=Ye.segmentPoints.length/2,ot=Ye.lineSoFar-Ye.segmentStart;for(let Ot=0;Ot<pt;++Ot){const wt=Ye.segmentPoints[2*Ot+1],Et=Math.round(Ye.segmentPoints[2*Ot])+.5+.25*wt;Ye.patternVertexArray.emplaceBack(Et,ot,Ye.segmentStart),Ye.patternVertexArray.emplaceBack(Et,ot,Ye.segmentStart)}Ye.segmentPoints.length=0}Ye.e1=Ye.e2=-1};if(De&&Be<KL){this.updateDistance($,N),this.addCurrentVertex(N,Y,1,1,V,he),ke(this),this.addCurrentVertex(N,re,-1,-1,V,he);continue}if($){if(!q){this.updateDistance($,N),this.addCurrentVertex(N,Y,1,1,V,he),ke(this);continue}xe="miter"}}let Ge=Y.add(re);Ge.x===0&&Ge.y===0||Ge._unit();const $e=Ge.x*re.x+Ge.y*re.y,Je=$e!==0?1/$e:1/0,et=2*Math.sqrt(2-2*$e),We=$e<YL&&$&&q,Xe=Y.x*re.y-Y.y*re.x>0,Fe=this.overscaling<=16?15*ht/(512*this.overscaling):0;if(De&&xe==="round"){if(Je<m)xe="miter";else if(Je<=2){const ke=aw(N,-10,ht+10);xe=this.elevationType==="offset"&&(ke||this.hasCrossSlope)?"miter":"fakeround"}}if(xe==="miter"&&Je>d&&(xe="bevel"),xe==="bevel"&&(Je>
532&&(xe="flipbevel"),Je<d&&(xe="miter")),$&&!(xe==="miter"&&We)&&this.updateDistance($,N),xe==="miter")if(We){const ke=N.dist($);if(ke>2*Fe){const pt=N.sub(N.sub($)._mult(Fe/ke)._round());this.updateDistance($,pt),this.addCurrentVertex(pt,Y,0,0,V,he),$=pt}this.updateDistance($,N),Ge._mult(Je),this.addCurrentVertex(N,Ge,0,0,V,he);const Ye=N.dist(q);if(Ye>2*Fe){const pt=N.add(q.sub(N)._mult(Fe/Ye)._round());this.updateDistance(N,pt),this.addCurrentVertex(pt,re,0,0,V,he),N=pt}}else Ge._mult(Je),this.addCurrentVertex(N,Ge,0,0,V,he);else if(xe==="flipbevel"){if(Je>100)Ge=re.mult(-1);else{const ke=Je*Y.add(re).mag()/Y.sub(re).mag();Ge._perp()._mult(ke*(Xe?-1:1))}this.addCurrentVertex(N,Ge,0,0,V,he),this.addCurrentVertex(N,Ge.mult(-1),0,0,V,he)}else if(xe==="bevel"||xe==="fakeround"){he!=null&&$&&this.addCurrentVertex(N,ae||Y,-1,-1,V,he);const ke=N.dist($)<=2*Fe&&xe!=="bevel",Ye=Ge.mult(Xe?1:-1);Ye._mult(Je);const pt=re.mult(Xe?-1:1),ot=Y.mult(Xe?-1:1),Ot=this.evaluateLineProgressFeatures(this.distance);if(he==null&&(this.addHalfVertex(N,Ye.x,Ye.y,!1,!Xe,0,V,Ot),ke||this.addHalfVertex(N,Ye.x+2*ot.x,Ye.y+2*ot.y,!1,Xe,0,V,Ot)),xe==="fakeround"){const wt=Math.round(180*et/Math.PI/20);this.addHalfVertex(N,ot.x,ot.y,!1,Xe,0,V,Ot);for(let Et=0;Et<wt;Et++){let Pt=Et/wt;if(Pt!==.5){const lt=Pt-.5;Pt+=Pt*lt*(Pt-1)*((1.0904+Be*(Be*(3.55645-1.43519*Be)-3.2452))*lt*lt+(.848013+Be*(.215638*Be-1.06021)))}const wi=pt.sub(ot)._mult(Pt)._add(ot)._unit();this.addHalfVertex(N,wi.x,wi.y,!1,Xe,0,V,Ot)}this.addHalfVertex(N,pt.x,pt.y,!1,Xe,0,V,Ot)}ke||he!=null||this.addHalfVertex(N,Ye.x+2*pt.x,Ye.y+2*pt.y,!1,Xe,0,V,Ot),he!=null&&q&&this.addCurrentVertex(N,ee||re,1,1,V,he)}else if(xe==="butt")this.addCurrentVertex(N,Ge,0,0,V,he);else if(xe==="square"){if(!$){const ke=S?0:-1;this.addCurrentVertex(N,Ge,ke,ke,V,he)}if(this.addCurrentVertex(N,Ge,0,0,V,he),$){const ke=I?0:1;this.addCurrentVertex(N,Ge,ke,ke,V,he)}}else if(xe==="round"){if($){const ke=!De&&ae?ae:Y;this.addCurrentVertex(N,ke,0,0,V,he),!De&&I||this.addCurrentVertex(N,ke,1,1,V,he,!0)}if(q){const ke=!De&&ee?ee:re;!De&&S||this.addCurrentVertex(N,ke,-1,-1,V,he,!0),this.addCurrentVertex(N,ke,0,0,V,he)}}}}addVerticesTo(e,i,o,a,u,d,m,y,x,T){const S=(i.w-e.w)/this.tessellationStep|0;let I=0;const M=this.scaledDistance;if(S>1){this.lineSoFar=e.w;const k=(i.x-e.x)/S,V=(i.y-e.y)/S,N=(i.z-e.z)/S,$=(i.w-e.w)/S;for(let q=1;q<S;++q){e.x+=k,e.y+=V,e.z+=N,this.lineSoFar+=$,I+=$;const Y=this.evaluateLineProgressFeatures(this.prevDistance+I);this.scaledDistance=(this.prevDistance+I)/this.totalDistance,this.addHalfVertex(e,o,a,T,!1,m,x,Y),this.addHalfVertex(e,u,d,T,!0,-y,x,Y)}}this.lineSoFar=i.w,this.scaledDistance=M;const P=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,o,a,T,!1,m,x,P),this.addHalfVertex(i,u,d,T,!0,-y,x,P)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Tt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,o,a,u,d,m=!1){const y=i.x+i.y*o,x=i.y-i.x*o,T=i.y*a-i.x,S=-i.y-i.x*a;if(d!=null){const I=this.elevationType==="offset",M=-10,P=ht+10,k=d.zOffset,V=new bE(e.x,e.y,k,this.lineSoFar),N=!!I&&aw(e,M,P),$=this.lineSoFar,q=this.distance;if(this.currentVertex)if(N){const Y=this.currentVertexIsOutside,re=this.currentVertex,ee=new bE(e.x,e.y,k,this.lineSoFar);if(SE(re,ee,M,P),!aw(ee,M,P)){if(Y){this.e1=this.e2=-1,this.distance-=re.dist(V),this.lineSoFar=re.w;const ae=this.evaluateLineProgressFeatures(re.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(re,y,x,m,!1,o,u,ae),this.addHalfVertex(re,T,S,m,!0,-a,u,ae),this.prevDistance=this.distance}this.distance=this.prevDistance+re.dist(ee),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(re,ee,y,x,T,S,o,a,u,m),this.distance=q,this.scaledDistance=this.distance/this.totalDistance}}else{const Y=this.currentVertex;if(this.currentVertexIsOutside){SE(Y,V,M,P),this.e1=this.e2=-1,this.distance-=Y.dist(V),this.scaledDistance=this.distance/this.totalDistance,this.lineS
53oFar=Y.w;const re=this.evaluateLineProgressFeatures(Y.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(Y,y,x,m,!1,o,u,re),this.addHalfVertex(Y,T,S,m,!0,-a,u,re),this.prevDistance=this.distance,this.distance=q,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(Y,V,y,x,T,S,o,a,u,m)}else N||(this.addHalfVertex(e,y,x,m,!1,o,u,d),this.addHalfVertex(e,T,S,m,!0,-a,u,d));this.currentVertex=V,this.currentVertexIsOutside=N,this.lineSoFar=$}else this.addHalfVertex(e,y,x,m,!1,o,u,d),this.addHalfVertex(e,T,S,m,!0,-a,u,d)}addHalfVertex({x:e,y:i},o,a,u,d,m,y,x){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),d||this.segmentPoints.push(this.lineSoFar-this.segmentStart,m)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*a)+128,1+(m===0?0:m<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const S=Qt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,S)}const T=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),y.primitiveLength++),d?this.e2=T:this.e1=T,x!=null&&this.zOffsetVertexArray.emplaceBack(x.zOffset,x.variableWidth,x.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function aw(n,e,i){return n.x<e||n.x>i||n.y<e||n.y>i}let tI,iI;function nI(n,e,i){return e*(ht/(n.tileSize*Math.pow(2,i-n.tileID.overscaledZ)))}At(sw,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const rI=(n,e,i)=>(1-i)*n+i*e;function oI(n,e){return 1/nI(n,1,e.tileZoom)}function sI(n,e,i,o){return n.translatePosMatrix(o||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const aI=n=>{const e=[];lI(n)&&e.push("RENDER_LINE_DASH"),n.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=n.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),n.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const o=n.layout.get("line-join").constantOr("miter")==="none",a=!!n.paint.get("line-pattern").constantOr(1);return o&&a&&e.push("LINE_JOIN_NONE"),e};function lI(n){const e=n.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let lw;const cI=()=>lw||(lw={layout:tI||(tI=new Un({"line-cap":new _t(be.layout_line["line-cap"]),"line-join":new _t(be.layout_line["line-join"]),"line-miter-limit":new ct(be.layout_line["line-miter-limit"]),"line-round-limit":new ct(be.layout_line["line-round-limit"]),"line-sort-key":new _t(be.layout_line["line-sort-key"]),"line-z-offset":new _t(be.layout_line["line-z-offset"]),"line-elevation-reference":new ct(be.layout_line["line-elevation-reference"]),"line-cross-slope":new ct(be.layout_line["line-cross-slope"]),visibility:new ct(be.layout_line.visibility),"line-width-unit":new ct(be.layout_line["line-width-unit"])})),paint:iI||(iI=new Un({"line-opacity":new _t(be.paint_line["line-opacity"]),"line-color":new _t(be.paint_line["line-color"]),"line-translate":new ct(be.paint_line["line-translate"]),"line-translate-anchor":new ct(be.paint_line["line-translate-anchor"]),"line-width":new _t(be.paint_line["line-width"]),"line-gap-width":new _t(be.paint_line["line-gap-width"]),"line-offset":new _t(be.paint_line["line-offset"]),"line-blur":new _t(be.paint_line["line-blur"]),"line-dasharray":new _t(be.paint_line["line-dasharray"]),"line-pattern":new _t(be.paint_line["line-pattern"]),"line-pattern-cross-fade":new ct(be.paint_line["line-pattern-cross-fade"]),"line-gradient":new Yl(be.paint_line["line-gradient"]),"line-trim-offset":new ct(be.paint_line["line-trim-offset"]),"line-trim-fade-range":new ct(be.paint_line["line-trim-fade-range"]),"line-trim-color":new ct(be.paint_line["line-trim-color"]),"line-emissive-strength":new _t(be.paint_line["line-emissive-strength"]),"line-border-width":new _t(be.paint_line["line-border-width"]),"line-border-color":new _t(be.paint_line["line-border-color"]),"line-occlusion-opacity":new ct(be.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}
vendor: 4,516 bytes, line 53
53),"line-gradient-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},lw);class JL extends _t{possiblyEvaluate(e,i){return i=new bn(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,o,a){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,o,a)}}let Xm;function uI(n,e){return e>0?e+2*n:n}const QL=Ai([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ez=Ai([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),tz=Ai([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ai([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const iz=Ai([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),nz=Ai([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),rz=Ai([{name:"a_texb",components:2,type:"Uint16"}]),oz=Ai([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),sz=Ai([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ai([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const hI=Ai([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),az=Ai([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ai([{name:"triangle",components:3,type:"Uint16"}]),Ai([{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"}]),Ai([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
vendor: 10,451 bytes, line 53
53]),Ai([{type:"Float32",name:"offsetX"}]),Ai([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Rr=24;function lz(n,e,i){return n.sections.forEach(o=>{o.text=function(a,u,d){const m=u.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?a=a.toLocaleUpperCase():m==="lowercase"&&(a=a.toLocaleLowerCase()),La.applyArabicShaping&&(a=La.applyArabicShaping(a)),a}(o.text,e,i)}),n}const Ym={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function cz(n){return n==="︶"||n==="﹈"||n==="︸"||n==="﹄"||n==="﹂"||n==="︾"||n==="︼"||n==="︺"||n==="︘"||n==="﹀"||n==="︐"||n==="︓"||n==="︔"||n==="`"||n===" ̄"||n==="︑"||n==="︒"}function uz(n){return n==="︵"||n==="﹇"||n==="︷"||n==="﹃"||n==="﹁"||n==="︽"||n==="︻"||n==="︹"||n==="︗"||n==="︿"}const cw=4294967296,dI=1/cw,pI=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let a0=class{constructor(n=new Uint8Array(16)){this.buf=ArrayBuffer.isView(n)?n:new Uint8Array(n),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(n,e,i=this.length){for(;this.pos<i;){const o=this.readVarint(),a=o>>3,u=this.pos;this.type=7&o,n(a,e,this),this.pos===u&&this.skip(o)}return e}readMessage(n,e){return this.readFields(n,e,this.readVarint()+this.pos)}readFixed32(){const n=this.dataView.getUint32(this.pos,!0);return this.pos+=4,n}readSFixed32(){const n=this.dataView.getInt32(this.pos,!0);return this.pos+=4,n}readFixed64(){const n=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*cw;return this.pos+=8,n}readSFixed64(){const n=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*cw;return this.pos+=8,n}readFloat(){const n=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,n}readDouble(){const n=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,n}readVarint(n){const e=this.buf;let i,o;return o=e[this.pos++],i=127&o,o<128?i:(o=e[this.pos++],i|=(127&o)<<7,o<128?i:(o=e[this.pos++],i|=(127&o)<<14,o<128?i:(o=e[this.pos++],i|=(127&o)<<21,o<128?i:(o=e[this.pos],i|=(15&o)<<28,function(a,u,d){const m=d.buf;let y,x;if(x=m[d.pos++],y=(112&x)>>4,x<128||(x=m[d.pos++],y|=(127&x)<<3,x<128)||(x=m[d.pos++],y|=(127&x)<<10,x<128)||(x=m[d.pos++],y|=(127&x)<<17,x<128)||(x=m[d.pos++],y|=(127&x)<<24,x<128)||(x=m[d.pos++],y|=(1&x)<<31,x<128))return gp(a,y,u);throw new Error("Expected varint not more than 10 bytes")}(i,n,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const n=this.readVarint();return n%2==1?(n+1)/-2:n/2}readBoolean(){return!!this.readVarint()}readString(){const n=this.readVarint()+this.pos,e=this.pos;return this.pos=n,n-e>=12&&pI?pI.decode(this.buf.subarray(e,n)):function(i,o,a){let u="",d=o;for(;d<a;){const m=i[d];let y,x,T,S=null,I=m>239?4:m>223?3:m>191?2:1;if(d+I>a)break;I===1?m<128&&(S=m):I===2?(y=i[d+1],(192&y)==128&&(S=(31&m)<<6|63&y,S<=127&&(S=null))):I===3?(y=i[d+1],x=i[d+2],(192&y)==128&&(192&x)==128&&(S=(15&m)<<12|(63&y)<<6|63&x,(S<=2047||S>=55296&&S<=57343)&&(S=null))):I===4&&(y=i[d+1],x=i[d+2],T=i[d+3],(192&y)==128&&(192&x)==128&&(192&T)==128&&(S=(15&m)<<18|(63&y)<<12|(63&x)<<6|63&T,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,I=1):S>65535&&(S-=65536,u+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),u+=String.fromCharCode(S),d+=I}return u}(this.buf,e,n)}readBytes(){const n=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,n);return this.pos=n,e}readPackedVarint(n=[],e){const i=this.readPackedEnd();for(;this.pos<i;)n.push(this.readVarint(e));return n}readPackedSVarint(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSVarint());return n}readPackedBoolean(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readBoolean());return n}readPackedFloat(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFloat());return n}readPackedDouble(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readDouble());return n}readPackedFixed32(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFixed32());return n}readPackedSFixed32(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSFixed32());return n}readPackedFixed64(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readFixed64());return n}readPackedSFixed64(n=[]){const e=this.readPackedEnd();for(;this.pos<e;)n.push(this.readSFixed64());return n}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(n){const e=7&n;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(n,e){this.writeVarint(n<<3|e)}realloc(n){let e=this.length||16;for(;e<this.pos+n;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(n){this.realloc(4),this.dataView.setInt32(this.pos,n,!0),this.pos+=4}writeSFixed32(n){this.realloc(4),this.dataView.setInt32(this.pos,n,!0),this.pos+=4}writeFixed64(n){this.realloc(8),this.dataView.setInt32(this.pos,-1&n,!0),this.dataView.setInt32(this.pos+4,Math.floor(n*dI),!0),this.pos+=8}writeSFixed64(n){this.realloc(8),this.dataView.setInt32(this.pos,-1&n,!0),this.dataView.setInt32(this.pos+4,Math.floor(n*dI),!0),this.pos+=8}writeVarint(n){(n=+n||0)>268435455||n<0?function(e,i){let o,a;if(e>=0?(o=e%4294967296|0,a=e/4294967296|0):(o=~(-e%4294967296),a=~(-e/4294967296),4294967295^o?o=o+1|0:(o=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(u,d,m){m.buf[m.pos++]=127&u|128,u>>>=7,m.buf[m.pos++]=127&u|128,u>>>=7,m.buf[m.pos++]=127&u|128,u>>>=7,m.buf[m.pos++]=127&u|128,m.buf[m.pos]=127&(u>>>=7)}(o,0,i),function(u,d){const m=(7&u)<<4;d.buf[d.pos++]|=m|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(a,i)}(n,this):(this.realloc(4),this.buf[this.pos++]=127&n|(n>127?128:0),n<=127||(this.buf[this.pos++]=127&(n>>>=7)|(n>127?128:0),n<=127||(this.buf[this.pos++]=127&(n>>>=7)|(n>127?128:0),n<=127||(this.buf[this.pos++]=n>>>7&127))))}writeSVarint(n){this.writeVarint(n<0?2*-n-1:2*n)}writeBoolean(n){this.writeVarint(+n)}writeString(n){n=String(n),this.realloc(4*n.length),this.pos++;const e=this.pos;this.pos=function(o,a,u){for(let d,m,y=0;y<a.length;y++){if(d=a.charCodeAt(y),d>55295&&d<57344){if(!m){d>56319||y+1===a.length?(o[u++]=239,o[u++]=191,o[u++]=189):m=d;continue}if(d<56320){o[u++]=239,o[u++]=191,o[u++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[u++]=239,o[u++]=191,o[u++]=189,m=null);d<128?o[u++]=d:(d<2048?o[u++]=d>>6|192:(d<65536?o[u++]=d>>12|224:(o[u++]=d>>18|240,o[u++]=d>>12&63|128),o[u++]=d>>6&63|128),o[u++]=63&d|128)}return u}(this.buf,n,this.pos);const i=this.pos-e;i>=128&&fI(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(n){this.realloc(4),this.dataView.setFloat32(this.pos,n,!0),this.pos+=4}writeDouble(n){this.realloc(8),this.dataView.setFloat64(this.pos,n,!0),this.pos+=8}writeBytes(n){const e=n.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=n[i]}writeRawMessage(n,e){this.pos++;const i=this.pos;n(e,this);const o=this.pos-i;o>=128&&fI(i,o,this),this.pos=i-1,this.writeVarint(o),this.pos+=o}writeMessage(n,e,i){this.writeTag(n,2),this.writeRawMessage(e,i)}writePackedVarint(n,e){e.length&&this.writeMessage(n,hz,e)}writePackedSVarint(n,e){e.length&&this.writeMessage(n,dz,e)}writePackedBoolean(n,e){e.length&&this.writeMessage(n,mz,e)}writePackedFloat(n,e){e.length&&this.writeMessage(n,pz,e)}writePackedDouble(n,e){e.length&&this.writeMessage(n,fz,e)}writePackedFixed32(n,e){e.length&&this.writeMessage(n,_z,e)}writePackedSFixed32(n,e){e.length&&this.writeMessage(n,gz,e)}writePackedFixed64(n,e){e.length&&this.writeMessage(n,yz,e)}writePackedSFixed64(n,e){e.length&&this.writeMessage(n,vz,e)}writeBytesField(n,e){this.writeTag(n,2),this.writeBytes(e)}writeFixed32Field(n,e){this.writeTag(n,5),this.writeFixed32(e)}writeSFixed32Field(n,e){this.writeTag(n,5),this.writeSFixed32(e)}writeFixed64Field(n,e){this.writeTag(n,1),this.writeFixed64(e)}writeSFixed64Field(n,e){this.writeTag(n,1),this.writeSFixed64(e)}writeVarintField(n,e){this.writeTag(n,0),this.writeVarint(e)}writeSVarintField(n,e){this.writeTag(n,0),this.writeSVarint(e)}writeStringField(n,e){this.writeTag(n,2),this.writeString(e)}writeFloatField(n,e){this.writeTag(n,5),this.writeFloat(e)}writeDoubleField(n,e){this.writeTag(n,1),this.writeDouble(e)}writeBooleanField(n,e){this.writeVarintField(n,+e)}};function gp(n,e,i){return i?4294967296*e+(n>>>0):4294967296*(e>>>0)+(n>>>0)}function fI(n,e,i){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(o);for(let a=i.pos-1;a>=n;a--)i.buf[a+o]=i.buf[a]}function hz(n,e){for(let i=0;i<n.length;i++)e.writeVarint(n[i])}function dz(n,e){for(let i=0;i<n.length;i++)e.writeSVarint(n[i])}function pz(n,e){for(let i=0;i<n.length;i++)e.writeFloat(n[i])}function fz(n,e){for(let i=0;i<n.length;i++)e.writeDouble(n[i])}function mz(n,e){for(let i=0;i<n.length;i++)e.writeBoolean(n[i])}function _z(n,e){for(let i=0;i<n.length;i++)e.writeFixed32(n[i])}function gz(n,e){for(let i=0;i<n.length;i++)e.writeSFixed32(n[i])}function yz(n,e){for(let i=0;i<n.length;
53i++)e.writeFixed64(n[i])}function vz(n,e){for(let i=0;i<n.length;i++)e.writeSFixed64(n[i])}const uw=3;function xz(n,e,i){e.glyphs=[],n===1&&i.readMessage(wz,e)}function wz(n,e,i){if(n===3){const{id:o,bitmap:a,width:u,height:d,left:m,top:y,advance:x}=i.readMessage(bz,{});e.glyphs.push({id:o,bitmap:new tu({width:u+2*uw,height:d+2*uw},a),metrics:{width:u,height:d,left:m,top:y,advance:x}})}else n===4?e.ascender=i.readSVarint():n===5&&(e.descender=i.readSVarint())}function bz(n,e,i){n===1?e.id=i.readVarint():n===2?e.bitmap=i.readBytes():n===3?e.width=i.readVarint():n===4?e.height=i.readVarint():n===5?e.left=i.readSVarint():n===6?e.top=i.readSVarint():n===7&&(e.advance=i.readVarint())}const mI=uw,Qo={horizontal:1,vertical:2,horizontalOnly:3};class Km{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const o=new Km;return o.scale=e||1,o.fontStack=i,o}static forImage(e){const i=new Km;return i.image=e,i}}class yp{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,o){const a=new yp;for(let u=0;u<e.sections.length;u++){const d=e.sections[u];d.image?a.addImageSection(d,o):a.addTextSection(d,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,o){let a="";for(let u=0;u<i.length;u++){const d=i.charCodeAt(u+1)||null,m=i.charCodeAt(u-1)||null;a+=!o&&(d&&Dd(d)&&!Ym[i[u+1]]||m&&Dd(m)&&!Ym[i[u-1]])||!Ym[i[u]]?i[u]:Ym[i[u]]}return a}(this.text,e)}trim(){let e=0;for(let o=0;o<this.text.length&&l0[this.text.charCodeAt(o)];o++)e++;let i=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&l0[this.text.charCodeAt(o)];o--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const o=new yp;return o.text=this.text.substring(e,i),o.sectionIndex=this.sectionIndex.slice(e,i),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Km.forText(e.scale,e.fontStack||i));const o=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(o)}addImageSection(e,i){const o=e.image?e.image.getPrimary():null;if(!o)return void Tt("Can't add FormattedSection with an empty image.");o.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Km.forImage(o)),this.sectionIndex.push(this.sections.length-1)):Tt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hw(n,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k=1){const V=yp.fromFeature(n,a,k);S===Qo.vertical&&V.verticalizePunctuation(I);let N=[];const $=function(ae,he,me,De,xe,Be){if(!ae)return[];const Ge=[],$e=function(Xe,Fe,ke,Ye,pt,ot){let Ot=0;for(let wt=0;wt<Xe.length();wt++){const Et=Xe.getSection(wt);Ot+=_I(Xe.getCodePoint(wt),Et,Ye,pt,Fe,ot)}return Ot/Math.max(1,Math.ceil(Ot/ke))}(ae,he,me,De,xe,Be),Je=ae.text.indexOf("​")>=0;let et=0;for(let Xe=0;Xe<ae.length();Xe++){const Fe=ae.getSection(Xe),ke=ae.getCodePoint(Xe);if(l0[ke]||(et+=_I(ke,Fe,De,xe,he,Be)),Xe<ae.length()-1){const Ye=!((We=ke)<11904||!(Xt["Bopomofo Extended"](We)||Xt.Bopomofo(We)||Xt["CJK Compatibility Forms"](We)||Xt["CJK Compatibility Ideographs"](We)||Xt["CJK Compatibility"](We)||Xt["CJK Radicals Supplement"](We)||Xt["CJK Strokes"](We)||Xt["CJK Symbols and Punctuation"](We)||Xt["CJK Unified Ideographs Extension A"](We)||Xt["CJK Unified Ideographs"](We)||Xt["Enclosed CJK Letters and Months"](We)||Xt["Halfwidth and Fullwidth Forms"](We)||Xt.Hiragana(We)||Xt["Ideographic Description Characters"](We)||Xt["Kangxi Radicals"](We)||Xt["Katakana Phonetic Extensions"](We)||Xt.Katakana(We)||Xt["Vertical Forms"](We)||Xt["Yi Radicals"](We)||Xt["Yi Syllables"](We)));(Tz[ke]||Ye||Fe.image)&&Ge.push(yI(Xe+1,et,$e,Ge,Sz(ke,ae.getCodePoint(Xe+1),Ye&&Je),!1))}}var We;return vI(yI(ae.length(),et,$e,Ge,0,!0))}(V,x,u,e,o,M),{processBidirectionalText:q,processStyledBidirectionalText:Y}=La;if(q&&V.sections.length===1){const ae=q(V.toString(),$);for(const he of ae){const me=new yp;me.text=he,me.sections=V.sections;for(let De=0;De<he.length;De++)me.sectionIndex.push(0);N.push(me)}}else if(Y){const ae=Y(V.text,V.sectionIndex,$);for(const he of ae){const me=new yp;me.text=he[0],me.sectionIndex=he[1],me.sections=V.sections,N.push(me)}}else N=function(ae,he){const me=[],De=ae.text;let xe=0;for(const Be of he)me.push(ae.substring(xe,Be)),xe=Be;return xe<De.length&&me.push(ae.substring(xe,De.length)),me}(V,$);const re=[],ee={positionedLines:re,text:V.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:S,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(ae,he,me,De,xe,Be,Ge,$e,Je,et,We,Xe){let Fe=0,ke=0,Ye=0;const pt=$e==="right"?1:$e==="left"?0:.5;let ot=!1;for(const lt of xe){const Rt=lt.getSections();for(const oi of Rt){if(oi.image)continue;const zi=he[oi.fontStack];if(zi&&(ot=zi.ascender!==void 0&&zi.descender!==void 0,!ot))break}if(!ot)break}let Ot=0;for(const lt of xe){lt.trim();const Rt=lt.getMaxScale(),oi=(Rt-1)*Rr,zi={positionedGlyphs:[],lineOffset:0};ae.positionedLines[Ot]=zi;const ki=zi.positionedGlyphs;let di=0;if(!lt.length()){ke+=Be,++Ot;continue}let hn=0,te=0;for(let Ne=0;Ne<lt.length();Ne++){const Qe=lt.getSection(Ne),gt=lt.getSectionIndex(Ne),yt=lt.getCodePoint(Ne);let Bt=Qe.scale,Ut=null,ui=null,yi=null,xi=Rr,Ci=0,Jt=Je;Jt===Qo.vertical&&((wt=yt)===12312||wt===12313||wt===12316||wt===12540||wt===12448)&&(Jt=Qo.horizontal);const ni=!(Jt===Qo.horizontal||!We&&!zd(yt)||We&&(l0[yt]||kd(yt)));if(Qe.image){const Vi=De.get(Qe.image.toString());if(!Vi)continue;yi=Qe.image,ae.iconsInText=ae.iconsInText||!0,ui=Vi.paddedRect;const Wi=Vi.displaySize;Bt=Bt*Rr/Xe,Ut={width:Wi[0],height:Wi[1],left:0,top:-mI,advance:ni?Wi[1]:Wi[0],localGlyph:!1},Ci=ot?-Ut.height*Bt:Rt*Rr-17-Wi[1]*Bt,xi=Ut.advance;const Xi=(ni?Wi[0]:Wi[1])*Bt-Rr*Rt;Xi>0&&Xi>di&&(di=Xi)}else{const Vi=me[Qe.fontStack];if(!Vi)continue;Vi[yt]&&(ui=Vi[yt]);const Wi=he[Qe.fontStack];if(!Wi)continue;const Xi=Wi.glyphs[yt];
53if(!Xi)continue;if(Ut=Xi.metrics,xi=yt!==8203?Rr:0,ot){const sn=Wi.ascender!==void 0?Math.abs(Wi.ascender):0,_n=Wi.descender!==void 0?Math.abs(Wi.descender):0,dn=(sn+_n)*Bt;hn<dn&&(hn=dn,te=(sn-_n)/2*Bt),Ci=-sn*Bt}else Ci=(Rt-Bt)*Rr-17}ni?(ae.verticalizable=!0,ki.push({glyph:yt,image:yi,x:Fe,y:ke+Ci,vertical:ni,scale:Bt,localGlyph:Ut.localGlyph,fontStack:Qe.fontStack,sectionIndex:gt,metrics:Ut,rect:ui}),Fe+=xi*Bt+et):(ki.push({glyph:yt,image:yi,x:Fe,y:ke+Ci,vertical:ni,scale:Bt,localGlyph:Ut.localGlyph,fontStack:Qe.fontStack,sectionIndex:gt,metrics:Ut,rect:ui}),Fe+=Ut.advance*Bt+et)}ki.length!==0&&(Ye=Math.max(Fe-et,Ye),ot?xI(ki,pt,di,te,Be*Rt/2):xI(ki,pt,di,0,Be/2)),Fe=0;const oe=Be*Rt+di;zi.lineOffset=Math.max(di,oi),ke+=oe,++Ot}var wt;const Et=ke,{horizontalAlign:Pt,verticalAlign:wi}=dw(Ge);(function(lt,Rt,oi,zi,ki,di){const hn=(Rt-oi)*ki,te=-di*zi;for(const oe of lt)for(const Ne of oe.positionedGlyphs)Ne.x+=hn,Ne.y+=te})(ae.positionedLines,pt,Pt,wi,Ye,Et),ae.top+=-wi*Et,ae.bottom=ae.top+Et,ae.left+=-Pt*Ye,ae.right=ae.left+Ye,ae.hasBaseline=ot}(ee,e,i,o,N,d,m,y,S,x,I,P),!function(ae){for(const he of ae)if(he.positionedGlyphs.length!==0)return!1;return!0}(re))return ee}const l0={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Tz={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 _I(n,e,i,o,a,u){if(e.image){const d=o.get(e.image.toString());return d?d.displaySize[0]*e.scale*Rr/u+a:0}{const d=i[e.fontStack],m=d&&d.glyphs[n];return m?m.metrics.advance*e.scale+a:0}}function gI(n,e,i,o){const a=Math.pow(n-e,2);return o?n<e?a/2:2*a:a+Math.abs(i)*i}function Sz(n,e,i){let o=0;return n===10&&(o-=1e4),i&&(o+=150),n!==40&&n!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function yI(n,e,i,o,a,u){let d=null,m=gI(e,i,a,u);for(const y of o){const x=gI(e-y.x,i,a,u)+y.badness;x<=m&&(d=y,m=x)}return{index:n,x:e,priorBreak:d,badness:m}}function vI(n){return n?vI(n.priorBreak).concat(n.index):[]}function dw(n){let e=.5,i=.5;switch(n){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function xI(n,e,i,o,a){if(!(e||i||o||a))return;const u=n.length-1,d=n[u],m=(d.x+d.metrics.advance*d.scale)*e;for(let y=0;y<=u;y++)n[y].x-=m,n[y].y+=i+o+a}function pw(n){return n.imagePrimary!==void 0&&n.top!==void 0&&n.bottom!==void 0&&n.left!==void 0&&n.right!==void 0}function c0(n,e,i,o){const{horizontalAlign:a,verticalAlign:u}=dw(o),d=i[0]-n.displaySize[0]*a,m=i[1]-n.displaySize[1]*u;return{imagePrimary:n,imageSecondary:e,top:m,bottom:m+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function fw(n,e,i,o,a,u){const d=n.imagePrimary;let m;if(d.content){const V=d.content,N=d.pixelRatio||1;m=[V[0]/N,V[1]/N,d.displaySize[0]-V[2]/N,d.displaySize[1]-V[3]/N]}const y=e.left*u,x=e.right*u;let T,S,I,M;i==="width"||i==="both"?(M=a[0]+y-o[3],S=a[0]+x+o[1]):(M=a[0]+(y+x-d.displaySize[0])/2,S=M+d.displaySize[0]);const P=e.top*u,k=e.bottom*u;return i==="height"||i==="both"?(T=a[1]+P-o[0],I=a[1]+k+o[2]):(T=a[1]+(P+k-d.displaySize[1])/2,I=T+d.displaySize[1]),{imagePrimary:d,imageSecondary:void 0,top:T,right:S,bottom:I,left:M,collisionPadding:m}}function wI(n){return!n.imagePrimary.stretchX}function bI(n){return!n.imagePrimary.stretchY}function TI(n){return{width:n.right-n.left,height:n.bottom-n.top}}const Ua=128;function vp(n,e,i){const{expression:o}=e;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new bn(n+1,{worldview:i}))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:u}=o;let d=0;for(;d<a.length&&a[d]<=n;)d++;d=Math.max(0,d-1);let m=d;for(;m<a.length&&a[m]<n+1;)m++;m=Math.min(a.length-1,m);const y=a[d],x=a[m];return o.kind==="composite"?{kind:"composite",minZoom:y,maxZoom:x,interpolationType:u}:{kind:"camera",minZoom:y,maxZoom:x,minSize:o.evaluate(new bn(y,{worldview:i})),maxSize:o.evaluate(new bn(x,{worldview:i})),interpolationType:u}}}function mw(n,{uSize:e,uSizeT:i},{lowerSize:o,upperSize:a}){return n.kind==="source"?o/Ua:n.kind==="composite"?Qt(o/Ua,a/Ua,i):e}function xp(n,e,i=1){let o=0,a=0;if(n.kind==="constant")a=n.layoutSize*i;else if(n.kind!=="source"){const{interpolationType:u,minZoom:d,maxZoom:m}=n,y=u?j(Wo.interpolationFactor(u,e,d,m),0,1):0;n.kind==="camera"?a=Qt(n.minSize,n.maxSize,y)*i:o=y*i}return{uSizeT:o,uSize:a}}class rc extends Ke{constructor(e,i,o,a,u){super(e,i),this.angle=a,this.z=o,u!==void 0&&(this.segment=u)}clone(){return new rc(this.x,this.y,this.z,this.angle,this.segment)}}function SI(n,e,i,o,a){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,m=0;for(;m>-i/2;){if(d--,d<0)return!1;m-=n[d].dist(u),u=n[d]}m+=n[d].dist(n[d+1]),d++;const y=[];let x=0;for(;m<i/2;){const T=n[d],S=n[d+1];if(!S)return!1;let I=n[d-1].angleTo(T)-T.angleTo(S);for(I=Math.abs((I+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:I}),x+=I;m-y[0].distance>o;)x-=y.shift().angleDelta;if(x>a)return!1;d++,m+=T.dist(S)}return!0}function EI(n){let e=0;for(let i=0;i<n.length-1;
vendor: 4,989 bytes, line 53
53i++)e+=n[i].dist(n[i+1]);return e}function II(n,e,i){return n?.6*e*i:0}function AI(n,e){return Math.max(n?n.right-n.left:0,e?e.right-e.left:0)}function Ez(n,e,i,o,a,u){const d=II(i,a,u),m=AI(i,o)*u;let y=0;const x=EI(n)/2;for(let T=0;T<n.length-1;T++){const S=n[T],I=n[T+1],M=S.dist(I);if(y+M>x){const P=(x-y)/M,k=Qt(S.x,I.x,P),V=Qt(S.y,I.y,P),N=new rc(k,V,0,I.angleTo(S),T);return!d||SI(n,N,m,d,e)?N:void 0}y+=M}}function Iz(n,e,i,o,a,u,d,m,y){const x=II(o,u,d),T=AI(o,a),S=T*d,I=n[0].x===0||n[0].x===y||n[0].y===0||n[0].y===y;return e-S<e/4&&(e=S+e/4),CI(n,I?e/2*m%e:(T/2+2*u)*d*m%e,e,x,i,S,I,!1,y)}function CI(n,e,i,o,a,u,d,m,y){const x=u/2,T=EI(n);let S=0,I=e-i,M=[];for(let P=0;P<n.length-1;P++){const k=n[P],V=n[P+1],N=k.dist(V),$=V.angleTo(k);for(;I+i<S+N;){I+=i;const q=(I-S)/N,Y=Qt(k.x,V.x,q),re=Qt(k.y,V.y,q);if(Y>=0&&Y<y&&re>=0&&re<y&&I-x>=0&&I+x<=T){const ee=new rc(Y,re,0,$,P);o&&!SI(n,ee,u,o,a)||M.push(ee)}}S+=N}return m||M.length||d||(M=CI(n,S/2,i,o,a,u,d,!0,y)),M}function MI(n){let e=0,i=0;for(const d of n)e+=d.w*d.h,i=Math.max(i,d.w);n.sort((d,m)=>m.h-d.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const d of n)for(let m=o.length-1;m>=0;m--){const y=o[m];if(!(d.w>y.w||d.h>y.h)){if(d.x=y.x,d.y=y.y,u=Math.max(u,d.y+d.h),a=Math.max(a,d.x+d.w),d.w===y.w&&d.h===y.h){const x=o.pop();x&&m<o.length&&(o[m]=x)}else d.h===y.h?(y.x+=d.w,y.w-=d.w):d.w===y.w?(y.y+=d.h,y.h-=d.h):(o.push({x:y.x+d.w,y:y.y,w:y.w-d.w,h:d.h}),y.y+=d.h,y.h-=d.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}At(rc,"Anchor");const ph=1;class Jm{static getImagePositionScale(e,i,o){if(i&&e){const{sx:a,sy:u}=e;return{x:a,y:u}}return{x:o,y:o}}constructor(e,i,o,a){this.paddedRect=e;const{pixelRatio:u,version:d,stretchX:m,stretchY:y,content:x,sdf:T,usvg:S}=i;this.pixelRatio=u,this.stretchX=m,this.stretchY=y,this.content=x,this.version=d,this.padding=o,this.sdf=T,this.usvg=S,this.scale=Jm.getImagePositionScale(a,S,u)}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 _w(n,e,i){const o=Ea.parse(n),a=function(u,d,m=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*m[0])+2*d,h:(u.data?u.data.height:u.height*m[1])+2*d}}(e,i,[o.sx,o.sy]);return{bin:a,imagePosition:new Jm(a,e,i,o),imageVariant:o}}class PI{constructor(e,i,o){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const d=[];this.addImages(e,a,ph,d),this.addImages(i,u,2,d);const{w:m,h:y}=MI(d),x=new io({width:m||1,height:y||1});for(const[T,S]of e.entries()){const I=a.get(T).paddedRect;io.copy(S.data,x,{x:0,y:0},{x:I.x+ph,y:I.y+ph},S.data,null,S.sdf)}for(const[T,S]of i.entries()){const I=u.get(T),M=I.paddedRect;let P=I.padding;const k=M.x+P,V=M.y+P,N=S.data.width,$=S.data.height;P=P>1?P-1:P,io.copy(S.data,x,{x:0,y:0},{x:k,y:V},S.data,o),io.copy(S.data,x,{x:0,y:$-P},{x:k,y:V-P},{width:N,height:P},o),io.copy(S.data,x,{x:0,y:0},{x:k,y:V+$},{width:N,height:P},o),io.copy(S.data,x,{x:N-P,y:0},{x:k-P,y:V},{width:P,height:$},o),io.copy(S.data,x,{x:0,y:0},{x:k+N,y:V},{width:P,height:$},o),io.copy(S.data,x,{x:N-P,y:$-P},{x:k-P,y:V-P},{width:P,height:P},o),io.copy(S.data,x,{x:0,y:$-P},{x:k+N,y:V-P},{width:P,height:P},o),io.copy(S.data,x,{x:0,y:0},{x:k+N,y:V+$},{width:P,height:P},o),io.copy(S.data,x,{x:N-P,y:0},{x:k-P,y:V+$},{width:P,height:P},o)}this.lut=o,this.image=x,this.iconPositions=a,this.patternPositions=u}addImages(e,i,o,a){for(const[u,d]of e.entries()){const{bin:m,imagePosition:y,imageVariant:x}=_w(u,d,o);i.set(u,y),a.push(m),d.hasRenderCallback&&this.haveRenderCallbacks.push(x.id)}}patchUpdatedImages(e,i,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,o)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,o);for(const a of e.getUpdatedImages(o)){for(const u of this.iconPositions.keys()){const d=Ea.parse(u);if(co.isEqual(d.id,a)){const m=e.getImage(a,o);this.patchUpdatedImage(this.iconPositions.get(u),m,i,null)}}for(const u of this.patternPositions.keys()){const d=Ea.parse(u);if(co.isEqual(d.id,a)){const m=e.getImage(a,o);this.patchUpdatedImage(this.patternPositions.get(u),m,i,this.lut)}}}}patchUpdatedImage(e,i,o,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[u,d]=e.tl,m=e.sdf;if(this.lut||m){const y={width:i.data.width,height:i.data.height},x=new io(y);io.copy(i.data,x,{x:0,y:0},{x:0,y:0},y,a,m),o.update(x,{position:{x:u,y:d}})}else o.update(i.data,{position:{x:u,y:d}})}}At(Jm,"ImagePosition"),At(PI,"ImageAtlas");const Qm=1e20;function RI(n,e,i,o,a,u,d,m,y){for(let x=e;x<e+o;x++)LI(n,i*u+x,u,a,d,m,y);for(let x=i;x<i+a;x++)LI(n,x*u+e,1,o,d,m,y)}function LI(n,e,i,o,a,u,d){u[0]=0,d[0]=-Qm,d[1]=Qm,a[0]=n[e];for(let m=1,y=0,x=0;m<o;m++){a[m]=n[e+m*i];const T=m*m;do{const S=u[y];x=(a[m]-a[S]+T-S*S)/(m-S)/2}while(x<=d[y]&&--y>-1);
53y++,u[y]=m,d[y]=x,d[y+1]=Qm}for(let m=0,y=0;m<o;m++){for(;d[y+1]<m;)y++;const x=u[y],T=m-x;n[e+m*i]=a[x]+T*T}}const Ga=2,gw={none:0,ideographs:1,all:2};class wp{constructor(e,i,o){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=o,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const o=[],a=this.url||Ri.GLYPHS_URL;for(const u in e)for(const d of e[u])o.push({stack:u,id:d});pe(o,({stack:u,id:d},m)=>{let y=this.entries[u];y||(y=this.entries[u]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let x=y.glyphs[d];if(x!==void 0)return void m(null,{stack:u,id:d,glyph:x});if(x=this._tinySDF(y,u,d),x)return y.glyphs[d]=x,void m(null,{stack:u,id:d,glyph:x});const T=Math.floor(d/256);if(256*T>65535)return Tt("glyphs > 65535 not supported"),void m(null,{stack:u,id:d,glyph:x});if(y.ranges[T])return void m(null,{stack:u,id:d,glyph:x});let S=y.requests[T];S||(S=y.requests[T]=[],wp.loadGlyphRange(u,T,a,this.requestManager,(I,M)=>{if(M){y.ascender=M.ascender,y.descender=M.descender;for(const P in M.glyphs)this._doesCharSupportLocalGlyph(+P)||(y.glyphs[+P]=M.glyphs[+P]);y.ranges[T]=!0}for(const P of S)P(I,M);delete y.requests[T]})),S.push((I,M)=>{I?m(I):M&&m(null,{stack:u,id:d,glyph:M.glyphs[d]||null})})},(u,d)=>{if(u)i(u);else if(d){const m={};for(const{stack:y,id:x,glyph:T}of d)m[y]===void 0&&(m[y]={}),m[y].glyphs===void 0&&(m[y].glyphs={}),m[y].glyphs[x]=T&&{id:T.id,bitmap:T.bitmap.clone(),metrics:T.metrics},m[y].ascender=this.entries[y].ascender,m[y].descender=this.entries[y].descender;i(null,m)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==gw.none&&(this.localGlyphMode===gw.all?!!this.localFontFamily:!!this.localFontFamily&&(Xt["CJK Unified Ideographs"](e)||Xt["Hangul Syllables"](e)||Xt.Hiragana(e)||Xt.Katakana(e)||Xt["CJK Symbols and Punctuation"](e)||Xt["CJK Unified Ideographs Extension A"](e)||Xt["CJK Unified Ideographs Extension B"](e)||Xt.Osage(e)))}_tinySDF(e,i,o){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let u=e.tinySDF;if(!u){let k="400";/bold/i.test(i)?k="900":/medium/i.test(i)?k="500":/light/i.test(i)&&(k="200"),u=e.tinySDF=new wp.TinySDF({fontFamily:a,fontWeight:k,fontSize:24*Ga,buffer:3*Ga,radius:8*Ga}),u.fontWeight=k}if(this.localGlyphs[u.fontWeight][o])return this.localGlyphs[u.fontWeight][o];const d=String.fromCodePoint(o),{data:m,width:y,height:x,glyphWidth:T,glyphHeight:S,glyphLeft:I,glyphTop:M,glyphAdvance:P}=u.draw(d);return this.localGlyphs[u.fontWeight][o]={id:o,bitmap:new tu({width:y,height:x},m),metrics:{width:T/Ga,height:S/Ga,left:I/Ga,top:M/Ga-27,advance:P/Ga,localGlyph:!0}}}}wp.loadGlyphRange=function(n,e,i,o,a){const u=256*e,d=u+255,m=o.transformRequest(o.normalizeGlyphsURL(i).replace("{fontstack}",n).replace("{range}",`${u}-${d}`),Su.Glyphs);Sa(m,(y,x)=>{if(y)a(y);else if(x){const T={},S=function(I){return new a0(I).readFields(xz,{})}(x);for(const I of S.glyphs)T[I.id]=I;a(null,{glyphs:T,ascender:S.ascender,descender:S.descender})}})},wp.TinySDF=class{constructor({fontSize:n=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:d="normal",lang:m=null}={}){this.buffer=e,this.cutoff=o,this.radius=i,this.lang=m;const y=this.size=n+4*e,x=this._createCanvas(y),T=this.ctx=x.getContext("2d",{willReadFrequently:!0});T.font=`${d} ${u} ${n}px ${a}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(n){const e=document.createElement("canvas");return e.width=e.height=n,e}draw(n){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(n),d=Math.ceil(i),m=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),y=Math.min(this.size-this.buffer,d+Math.ceil(o)),x=m+2*this.buffer,T=y+2*this.buffer,S=Math.max(x*T,0),I=new Uint8ClampedArray(S),M={data:I,width:x,height:T,glyphWidth:m,glyphHeight:y,glyphTop:d,glyphLeft:0,glyphAdvance:e};if(m===0||y===0)return M;const{ctx:P,buffer:k,gridInner:V,gridOuter:N}=this;this.lang&&(P.lang=this.lang),P.clearRect(k,k,m,y),P.fillText(n,k,k+d);const $=P.getImageData(k,k,m,y);N.fill(Qm,0,S),V.fill(0,0,S);for(let q=0;q<y;q++)for(let Y=0;Y<m;Y++){const re=$.data[4*(q*m+Y)+3]/255;if(re===0)continue;const ee=(q+k)*x+Y+k;if(re===1)N[ee]=0,V[ee]=Qm;else{const ae=.5-re;N[ee]=ae>0?ae*ae:0,V[ee]=ae<0?ae*ae:0}}RI(N,0,0,x,T,x,this.f,this.v,this.z),RI(V,k,k,m,y,x,this.f,this.v,this.z);for(let q=0;q<S;q++){const Y=Math.sqrt(N[q])-Math.sqrt(V[q]);I[q]=Math.round(255-255*(Y/this.radius+this.cutoff))}return M}};const xl=ph;function zI(n,e){return n+e[1]-e[0]}function yw(n,e,i,o,a=1){const u=[],d=n.imagePrimary,m=d.pixelRatio,y=d.paddedRect.w-2*xl,x=d.paddedRect.h-2*xl,T=(n.right-n.left)*a,S=(n.bottom-n.top)*a,I=d.stretchX||[[0,y]],M=d.stretchY||[[0,x]],P=I.reduce(zI,0),k=M.reduce(zI,0),V=y-P,N=x-k;let $=0,q=P,Y=0,re=k,ee=0,ae=V,he=0,me=N;if(d.content&&o){const xe=d.content;$=u0(I,0,xe[0]),Y=u0(M,0,xe[1]),q=u0(I,xe[0],xe[2]),re=u0(M,xe[1],xe[3]),ee=xe[0]-$,he=xe[1]-Y,ae=xe[2]-xe[0]-q,me=xe[3]-xe[1]-re}const De=(xe,Be,Ge,$e)=>{const Je=h0(xe.stretch-$,q,T,n.left*a),et=d0(xe.fixed-ee,ae,xe.stretch,P),We=h0(Be.stretch-Y,re,S,n.top*a),Xe=d0(Be.fixed-he,me,Be.stretch,k),Fe=h0(Ge.stretch-$,q,T,n.left*a),ke=d0(Ge.fixed-ee,ae,Ge.stretch,P),Ye=h0($e.stretch-Y,re,S,n.top*a),pt=d0($e.fixed-he,me,$e.stretch,k),ot=new Ke(Je,We),Ot=new Ke(Fe,We),wt=new Ke(Fe,Ye),Et=new Ke(Je,Ye),Pt=new Ke(et/m,Xe/m),wi=new Ke(ke/m,pt/m),lt=e*Math.PI/180;if(lt){const hn=Math.sin(lt),te=Math.cos(lt),oe=[te,-hn,hn,te];ot._matMult(oe),Ot._matMult(oe),Et._matMult(oe),wt._matMult(oe)}const Rt=xe.stretch+xe.fixed,oi=Ge.stretch+Ge.fixed,zi=Be.stretch+Be.fixed,ki=$e.stretch+$e.fixed,di=n.imageSecondary;return{tl:ot,tr:Ot,bl:Et,br:wt,texPrimary:{x:d.paddedRect.x+xl+Rt,y:d.paddedRect.y+xl+zi,w:oi-Rt,h:ki-zi},texSecondary:di?{x:di.paddedRect.x+xl+Rt,y:di.paddedRect.y+xl+zi,w:oi-Rt,h:ki-zi}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pt,pixelOffsetBR:wi,minFontScaleX:ae/m/T,minFontScaleY:me/m/S,isSDF:i}};if(o&&(d.stretchX||d.stretchY)){const xe=DI(I,V,P),Be=DI(M,N,k);for(let Ge=0;Ge<xe.length-1;Ge++){const $e=xe[Ge],Je=xe[Ge+1];for(let et=0;et<Be.length-1;et++)u.push(De($e,Be[et],Je,Be[et+1]))}}else u.push(De({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:y+1},{fixed:0,stretch:x+1}));return u}function Az(n,e){const i=n.stretchY||[[0,n.paddedRect.h-2*xl]];return e&&(n.stretchX||n.stretchY)?kI(n.stretchX||[[0,n.paddedRect.w-2*xl]])*kI(i):1}function u0(n,e,i){let o=0;for(const a of n)o+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return o}function DI(n,e,i){const o=[{fixed:-xl,stretch:0}];for(const[a,u]of n){const d=o[o.length-1];
vendor: 4,939 bytes, line 53
53o.push({fixed:a-d.stretch,stretch:d.stretch}),o.push({fixed:a-d.stretch,stretch:d.stretch+(u-a)})}return o.push({fixed:e+xl,stretch:i}),o}function kI(n){return 2*n.length+1}function h0(n,e,i,o){return n/e*i+o}function d0(n,e,i,o){return n-e*i/o}function Cz(n,e,i,o){const a=e+n.positionedLines[o].lineOffset;return o===0?i+a/2:i+(a+(e+n.positionedLines[o-1].lineOffset))/2}function Mz(n,e=1,i=!1){let o=1/0,a=1/0,u=-1/0,d=-1/0;const m=n[0];for(let M=0;M<m.length;M++){const P=m[M];(!M||P.x<o)&&(o=P.x),(!M||P.y<a)&&(a=P.y),(!M||P.x>u)&&(u=P.x),(!M||P.y>d)&&(d=P.y)}const y=Math.min(u-o,d-a);let x=y/2;const T=new hd([],Pz);if(y===0)return new Ke(o,a);for(let M=o;M<u;M+=y)for(let P=a;P<d;P+=y)T.push(new bp(M+x,P+x,x,n));let S=function(M){let P=0,k=0,V=0;const N=M[0];for(let $=0,q=N.length,Y=q-1;$<q;Y=$++){const re=N[$],ee=N[Y],ae=re.x*ee.y-ee.x*re.y;k+=(re.x+ee.x)*ae,V+=(re.y+ee.y)*ae,P+=3*ae}return new bp(k/P,V/P,0,M)}(n),I=T.length;for(;T.length;){const M=T.pop();(M.d>S.d||!S.d)&&(S=M,i&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,I)),M.max-S.d<=e||(x=M.h/2,T.push(new bp(M.p.x-x,M.p.y-x,x,n)),T.push(new bp(M.p.x+x,M.p.y-x,x,n)),T.push(new bp(M.p.x-x,M.p.y+x,x,n)),T.push(new bp(M.p.x+x,M.p.y+x,x,n)),I+=4)}return i&&(console.log(`num probes: ${I}`),console.log(`best distance: ${S.d}`)),S.p}function Pz(n,e){return e.max-n.max}class bp{constructor(e,i,o,a){this.p=new Ke(e,i),this.h=o,this.d=function(u,d){let m=!1,y=1/0;for(let x=0;x<d.length;x++){const T=d[x];for(let S=0,I=T.length,M=I-1;S<I;M=S++){const P=T[S],k=T[M];P.y>u.y!=k.y>u.y&&u.x<(k.x-P.x)*(u.y-P.y)/(k.y-P.y)+P.x&&(m=!m),y=Math.min(y,Xn(u,P,k))}}return(m?1:-1)*Math.sqrt(y)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const Rz=Object.keys,vw=Number.POSITIVE_INFINITY,Lz=Math.sqrt(2);function nu(n,e,i,o,a){const u=pw(n)&&n.collisionPadding?n.collisionPadding:[0,0,0,0],d={top:n.top-u[1],bottom:n.bottom+u[3],left:n.left-u[0],right:n.right+u[2],scaled:!1};return o!==void 0&&function(m,y){m.top*=y,m.bottom*=y,m.left*=y,m.right*=y,m.scaled=!0}(d,o),i&&function(m,y){if(!y)return;const x=qi(y),T=new Ke(m.left,m.top),S=new Ke(m.right,m.top),I=new Ke(m.left,m.bottom),M=new Ke(m.right,m.bottom),P=new Ke(0,0);T._rotateAround(x,P),S._rotateAround(x,P),I._rotateAround(x,P),M._rotateAround(x,P),m.left=Math.min(T.x,S.x,I.x,M.x),m.right=Math.max(T.x,S.x,I.x,M.x),m.top=Math.min(T.y,S.y,I.y,M.y),m.bottom=Math.max(T.y,S.y,I.y,M.y)}(d,i),a&&(d.left+=a[0],d.right+=a[0],d.top+=a[1],d.bottom+=a[1]),e?{top:Math.min(e.top,d.top),bottom:Math.max(e.bottom,d.bottom),left:Math.min(e.left,d.left),right:Math.max(e.right,d.right),scaled:e.scaled||d.scaled}:d}function OI(n,[e,i]){let o=0,a=0;if(i===vw){e<0&&(e=0);const u=e/Lz;switch(n){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(n){case"top-right":case"bottom-right":o=-u;break;case"top-left":case"bottom-left":o=u;break;case"left":o=e;break;case"right":o=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),n){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(n){case"top-right":case"bottom-right":case"right":o=-e;break;case"top-left":case"bottom-left":case"left":o=e}}return[o,a]}function zz(n,e,i,o,a,u,d,m,y,x,T,S,I,M){const P=n.layers[0],k=P.appearances;if(k.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const V={iconBBox:null,iconVerticalBBox:null},N={textBBox:null,textVerticalBBox:null},{baseIconRotate:$,baseTextRotate:q,iconScaleFactor:Y}=function(ee,ae,he){const me=ee.get("icon-rotate").evaluate(ae,{},he),De=ee.get("text-rotate").evaluate(ae,{},he),[xe,Be]=ee.get("icon-size-scale-range");return{baseIconRotate:me,baseTextRotate:De,iconScaleFactor:j(1,xe,Be)}}(o,a,u);e&&(V.iconBBox=nu(e,V.iconBBox,$,d),i)&&(V.iconVerticalBBox=nu(i,V.iconVerticalBBox,$+90,d));const re=f0(S.horizontal);re&&(N.textBBox=nu(re,N.textBBox,q,1,M)),S.vertical&&(N.textVerticalBBox=nu(S.vertical,N.textVerticalBBox,q+90,1,M));for(const ee of k)ee.hasIconProperties()&&Dz(V,n,P,ee,a,u,m,$,d,y,e,x,Y,T),ee.hasTextProperties()&&kz(N,P,ee,a,u,M,q,I,re,S.vertical);return{iconBBox:V.iconBBox,iconVerticalBBox:V.iconVerticalBBox,textBBox:N.textBBox,textVerticalBBox:N.textVerticalBBox}}function Dz(n,e,i,o,a,u,d,m,y,x,T,S,I,M){const{appearanceIconOffset:P,appearanceIconRotate:k,appearanceIconSize:V}=function(Y,re,ee,ae,he,me,De,xe){const Be=Y.hasProperty("icon-offset")?re.getAppearanceValueAndResolveTokens(Y,"icon-offset",ee,ae,[]):null,Ge=Be&&Array.isArray(Be)?Be:he,$e=Y.hasProperty("icon-rotate")?re.getAppearanceValueAndResolveTokens(Y,"icon-rotate",ee,ae,[]):null,Je=typeof $e=="number"?$e:me,et=Y.hasProperty("icon-size")?re.getAppearanceValueAndResolveTokens(Y,"icon-size",ee,ae,[]):null;return{appearanceIconOffset:Ge,appearanceIconRotate:Je,appearanceIconSize:typeof et=="number"?et*xe.iconScaleFactor:
53De}}(o,i,a,u,d,m,y,x);let N=null,$=null,q=null;o.hasProperty("icon-image")?q=function(Y,re,ee,ae,he,me,De){let xe=null;const Be=re.getAppearanceValueAndResolveTokens(ee,"icon-image",ae,he,[]);if(Be){const Ge=Y.getResolvedImageFromTokens(Be),$e=ee.getUnevaluatedProperty("icon-size"),Je=e_(Ge,vp(Y.zoom,$e,Y.worldview),$e,he,Y.zoom,ae,Y.pixelRatio,De,Y.worldview);xe=me.get(Je.iconPrimary.toString())}return xe}(e,i,o,a,u,S,I):T&&(q=T.imagePrimary),q&&(N=c0(q,null,P,M),e.allowVerticalPlacement&&($=c0(q,null,P,M))),N&&(n.iconBBox=nu(N,n.iconBBox,k,V)),$&&(n.iconVerticalBBox=nu($,n.iconVerticalBBox,k+90,V))}function kz(n,e,i,o,a,u,d,m,y,x){const{appearanceTextOffset:T,appearanceTextRotate:S,appearanceTextSize:I}=function(P,k,V,N,$,q,Y){const re=P.hasProperty("text-offset")?k.getAppearanceValueAndResolveTokens(P,"text-offset",V,N,[]):null,ee=re&&Array.isArray(re)?[re[0]*Rr,re[1]*Rr]:$,ae=P.hasProperty("text-rotate")?k.getAppearanceValueAndResolveTokens(P,"text-rotate",V,N,[]):null,he=typeof ae=="number"?ae:q,me=P.hasProperty("text-size")?k.getAppearanceValueAndResolveTokens(P,"text-size",V,N,[]):null;return{appearanceTextOffset:ee,appearanceTextRotate:he,appearanceTextSize:typeof me=="number"?me:Y}}(i,e,o,a,u,d,m),M=I/m;y&&(n.textBBox=nu(y,n.textBBox,S,M,T)),x&&(n.textVerticalBBox=nu(x,n.textVerticalBBox,S+90,M,T))}function p0(n,e,i,o,a,u,d,m,y){if(!e||!e.usvg)return;const x=TI(o),T=TI(a),S=u!=="both"&&u!=="width"||!wI(o)?1:T.width/x.width,I=u!=="both"&&u!=="height"||!bI(o)?1:T.height/x.height;i.scaleSelf(S,I);const M=i.toString();d.set(M,i),m.set(M,e);const{imagePosition:P}=_w(M,e,ph);y.set(M,P)}function FI(n,e,i,o,a,u,d,m,y){if(!n)return;const x=function(T,S,I,M,P,k){if(T.kind==="camera")return T.maxSize;if(T.kind==="composite"){const V=S.possiblyEvaluate(new bn(T.maxZoom,{worldview:k}),I).evaluate(P,{},I),N=S.possiblyEvaluate(new bn(T.minZoom,{worldview:k}),I).evaluate(P,{},I);return Math.max(V,N)}return S.possiblyEvaluate(new bn(M,{worldview:k})).evaluate(P,{},I)}(e,i,o,a,u,y);return n.scaleSelf(x*m*d)}function e_(n,e,i,o,a,u,d,m,y){return{iconPrimary:FI(n.getPrimary(),e,i,o,a,u,d,m,y),iconSecondary:FI(n.getSecondary(),e,i,o,a,u,d,m,y)}}function Oz(n,e,i){if(!e)return;const o=i.get(n.toString()),a=i.get(e.toString());o&&a&&(o.paddedRect.w===a.paddedRect.w&&o.paddedRect.h===a.paddedRect.h||Tt(`Mismatch in icon variant sizes: ${n.toString()} and ${e.toString()}`),o.usvg!==a.usvg&&Tt(`Mismatch in icon variant image types: ${n.id} and ${e.id}`))}function BI(n,e,i,o){if(!n)return;const a=e.get(i.toString());if(n.imagePrimary=a,o){const u=e.get(o.toString());n.imageSecondary=u}}function Fz(n,e){for(const i in n.horizontal)NI(n.horizontal[i],e);NI(n.vertical,e)}function NI(n,e){if(n){for(const i of n.positionedLines)for(const o of i.positionedGlyphs)if(o.image!==null){const a=o.image.toString();o.rect=e.get(a).paddedRect}}}function xw(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bz(n,e,i,o,a,u,d,m,y){const x=f0(u.horizontal)||u.vertical,T=i.get("icon-text-fit-padding").evaluate(o,{},a);let S,I=e;return e&&y!=="none"&&(n.allowVerticalPlacement&&u.vertical&&(S=fw(e,u.vertical,y,T,m,d)),x&&(I=fw(e,x,y,T,m,d))),{defaultShapedIcon:I,verticallyShapedIcon:S}}function Nz(n,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$,q,Y,re,ee,ae){let he=d.textMaxSize.evaluate(e,{},I);he===void 0?he=m*d.textScaleFactor:he*=d.textScaleFactor;const me=n.layers[0].layout,De=Rr,xe=m*d.textScaleFactor/De,Be=f0(i.horizontal)||i.vertical;if(V!=="none"&&n.appearanceFeatureData&&e.index<n.appearanceFeatureData.length){const wt=n.appearanceFeatureData[e.index];wt&&(wt.textShaping=Be,wt.iconTextFitPadding=me.get("icon-text-fit-padding").evaluate(e,{},I),wt.fontScale=xe)}const Ge=M.name==="globe",$e=n.tilePixelRatio*he/De,Je=(Ye=n.overscaling,n.zoom>18&&Ye>2&&(Ye>>=1),Math.max(ht/(512*Ye),1)*me.get("symbol-spacing")),et=me.get("text-padding")*n.tilePixelRatio,We=me.get("icon-padding")*n.tilePixelRatio,Xe=qi(me.get("text-max-angle")),Fe=me.get("icon-rotation-alignment")==="map"&&q!=="point",ke=Je/2;var Ye;
53n.hasAnyIconTextFit===!1&&V!=="none"&&(n.hasAnyIconTextFit=!0);const pt=e.properties?+e.properties[Oe]:null,ot=pt&&n.elevationFeatureIdToIndex?n.elevationFeatureIdToIndex.get(pt):65535,Ot=(wt,Et,Pt)=>{if(Et.x<0||Et.x>=ht||Et.y<0||Et.y>=ht)return;let wi=null;if(Ge){const{x:lt,y:Rt,z:oi}=M.projectTilePoint(Et.x,Et.y,Pt);wi={anchor:new rc(lt,Rt,oi,0,void 0),up:M.upVector(Pt,Et.x,Et.y)}}(function(lt,Rt,oi,zi,ki,di,hn,te,oe,Ne,Qe,gt,yt,Bt,Ut,ui,yi,xi,Ci,Jt,ni,Vi,Wi,Xi,sn,_n,dn,Ki,tn,vi,Di,Ln,Yt){const Mi=lt.addToLineVertexArray(Rt,zi);let pn,yn,Tn,tr,xn,Kt,On,an=0,Mn=0,yr=0,Lr=0,ur=-1,hr=-1;const Ir={};let Mo=Qh("");const wn=oi?oi.anchor:Rt,Yn=Ki!=="none";let ir=0,Bo=0;if(oe._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Wr=oe.layout.get("text-offset").evaluate(ni,{},sn);ir=Wr[0]*Rr,Bo=Wr[1]*Rr}else ir=oe.layout.get("text-radial-offset").evaluate(ni,{},sn)*Rr,Bo=vw;if(lt.allowVerticalPlacement&&ki.vertical){const Wr=ki.vertical;if(Ut)Kt=ww(Wr),te&&(On=ww(te));else{const vo=oe.layout.get("text-rotate").evaluate(ni,{},sn)+90;Tn=m0(Ne,wn,Rt,Qe,gt,yt,Wr,Bt,vo,ui,Ln),te&&(tr=m0(Ne,wn,Rt,Qe,gt,yt,te,xi,vo,null,Di))}}if(di){const Wr=lt.iconSizeData,vo=oe.layout.get("icon-rotate").evaluate(ni,{},sn),es=yw(di,vo,Wi,Yn,Vi.iconScaleFactor),su=te?yw(te,vo,Wi,Yn,Vi.iconScaleFactor):void 0;yn=m0(Ne,wn,Rt,Qe,gt,yt,di,xi,vo,null,vi);const Mp=function(Za,y_,rC,KD,oC,sC,JD,QD){const aC=Za.layers[0],lC=aC.appearances;let Pp=y_.length;if(rC&&(Pp=Math.max(Pp,rC.length)),lC.length===0)return Pp;const[ek,tk]=KD.get("icon-size-scale-range"),ik=j(1,ek,tk);for(const cC of lC){const uC=cC.getUnevaluatedProperties();if(uC._values["icon-image"].value!==void 0){const hC=aC.getAppearanceValueAndResolveTokens(cC,"icon-image",oC,sC,[]);if(hC){const dC=Za.getResolvedImageFromTokens(hC);if(dC){const pC=uC._values["icon-size"],nk=e_(dC,vp(Za.zoom,pC,Za.worldview),pC,sC,Za.zoom,oC,Za.pixelRatio,ik,Za.worldview),rk=JD.get(nk.iconPrimary.toString());Pp=Math.max(Pp,Az(rk,QD))}}}}return Pp}(lt,es,su,oe.layout,ni,sn,lt.iconAtlasPositions,Yn);an=4*Mp;let qa=null;Wr.kind==="source"?(qa=[Ua*oe.layout.get("icon-size").evaluate(ni,{},sn)*Vi.iconScaleFactor],qa[0]>oc&&Tt(`${lt.layerIds[0]}: Value for "icon-size" is >= ${t_}. Reduce your "icon-size".`)):Wr.kind==="composite"&&(qa=[Ua*Vi.compositeIconSizes[0].evaluate(ni,{},sn)*Vi.iconScaleFactor,Ua*Vi.compositeIconSizes[1].evaluate(ni,{},sn)*Vi.iconScaleFactor],(qa[0]>oc||qa[1]>oc)&&Tt(`${lt.layerIds[0]}: Value for "icon-size" is >= ${t_}. Reduce your "icon-size".`)),lt.addSymbols(lt.icon,es,qa,Jt,Ci,ni,void 0,oi,Rt,Mi.lineStartIndex,Mi.lineLength,-1,Xi,sn,_n,dn,lt.symbolInstances.length,Mp),ur=lt.icon.placedSymbolArray.length-1,su&&(Mn=4*Mp,lt.addSymbols(lt.icon,su,qa,Jt,Ci,ni,Qo.vertical,oi,Rt,Mi.lineStartIndex,Mi.lineLength,-1,Xi,sn,_n,dn,lt.symbolInstances.length,Mp),hr=lt.icon.placedSymbolArray.length-1)}for(const Wr in ki.horizontal){const vo=Wr,es=ki.horizontal[vo];pn||(Mo=Qh(es.text),Ut?xn=ww(es):pn=m0(Ne,wn,Rt,Qe,gt,yt,es,Bt,oe.layout.get("text-rotate").evaluate(ni,{},sn),ui,Ln));const su=es.positionedLines.length===1;if(yr+=VI(lt,oi,Rt,es,hn,oe,Ut,ni,ui,Mi,ki.vertical?Qo.horizontal:Qo.horizontalOnly,su?Rz(ki.horizontal):[vo],Ir,ur,Vi,Xi,sn,lt.symbolInstances.length,_n),su)break}ki.vertical&&(Lr+=VI(lt,oi,Rt,ki.vertical,hn,oe,Ut,ni,ui,Mi,Qo.vertical,["vertical"],Ir,hr,Vi,Xi,sn,lt.symbolInstances.length,_n));let vr=-1;const ha=(Wr,vo)=>Wr?Math.max(Wr,vo):vo;vr=ha(xn,vr),vr=ha(Kt,vr),vr=ha(On,vr);const wl=vr>-1?1:0;lt.glyphOffsetArray.length>=65535&&Tt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ni.sortKey!==void 0&&lt.addToSortKeyRanges(lt.symbolInstances.length,ni.sortKey),lt.symbolInstances.emplaceBack(Rt.x,Rt.y,wn.x,wn.y,wn.z,Ir.right>=0?Ir.right:-1,Ir.center>=0?Ir.center:-1,Ir.left>=0?Ir.left:-1,Ir.vertical>=0?Ir.vertical:-1,ur,hr,Mo,pn!==void 0?pn:lt.collisionBoxArray.length,pn!==void 0?pn+1:lt.collisionBoxArray.length,Tn!==void 0?Tn:lt.collisionBoxArray.length,Tn!==void 0?Tn+1:lt.collisionBoxArray.length,yn!==void 0?yn:lt.collisionBoxArray.length,yn!==void 0?yn+1:lt.collisionBoxArray.length,tr||lt.collisionBoxArray.length,tr?tr+1:lt.collisionBoxArray.length,Qe,yr,Lr,an,Mn,wl,0,ir,Bo,vr,0,Yn?1:0,tn)})(n,Et,wi,wt,i,o,u,a,n.layers[0],n.collisionBoxArray,e.index,e.sourceLayerIndex,n.index,et,$,x,0,We,Fe,N,e,d,T,S,I,P,k,V,ot,Y,re,ee)};if(q==="line")for(const wt of Yy(e.geometry,0,0,ht,ht)){const Et=Iz
53(wt,Je,Xe,i.vertical||Be,o,De,$e,n.overscaling,ht);for(const Pt of Et)Be&&Vz(n,Be.text,ke,Pt)||Ot(wt,Pt,I)}else if(q==="line-center"){for(const wt of e.geometry)if(wt.length>1){const Et=Ez(wt,Xe,i.vertical||Be,o,De,$e);Et&&Ot(wt,Et,I)}}else if(e.type==="Polygon")for(const wt of Fm(e.geometry,0)){const Et=Mz(wt,16);Ot(wt[0],new rc(Et.x,Et.y,0,0,void 0),I)}else if(e.type==="LineString")for(const wt of e.geometry)Ot(wt,new rc(wt[0].x,wt[0].y,0,0,void 0),I);else if(e.type==="Point")for(const wt of e.geometry)for(const Et of wt)Ot([Et],new rc(Et.x,Et.y,0,0,void 0),I)}const t_=255,oc=t_*Ua;function VI(n,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$){const q=function(ee,ae,he,me,De,xe,Be,Ge){const $e=[];if(ae.positionedLines.length===0)return $e;const Je=me.layout.get("text-rotate").evaluate(xe,{})*Math.PI/180,et=function(Ye){const pt=Ye[0],ot=Ye[1],Ot=pt*ot;return Ot>0?[pt,-ot]:Ot<0?[-pt,ot]:pt===0?[ot,pt]:[ot,-pt]}(he);let We=Math.abs(ae.top-ae.bottom);for(const Ye of ae.positionedLines)We-=Ye.lineOffset;const Xe=ae.positionedLines.length,Fe=We/Xe;let ke=ae.top-he[1];for(let Ye=0;Ye<Xe;++Ye){const pt=ae.positionedLines[Ye];ke=Cz(ae,Fe,ke,Ye);for(const ot of pt.positionedGlyphs){if(!ot.rect)continue;const Ot=ot.rect||{};let wt=mI+1,Et=!0,Pt=1,wi=0;if(ot.image){const yi=Be.get(ot.image.toString());if(!yi)continue;if(yi.sdf){Tt("SDF images are not supported in formatted text and will be ignored.");continue}Et=!1,Pt=yi.pixelRatio,wt=ph/Pt}const lt=(De||Ge)&&ot.vertical,Rt=ot.metrics.advance*ot.scale/2,oi=ot.metrics,zi=ot.rect;if(zi===null)continue;Ge&&ae.verticalizable&&(wi=ot.image?Rt-ot.metrics.width*ot.scale/2:0);const ki=De?[ot.x+Rt,ot.y]:[0,0];let di=[0,0],hn=[0,0],te=!1;De||(lt?(hn=[ot.x+Rt+et[0],ot.y+et[1]-wi],te=!0):di=[ot.x+Rt+he[0],ot.y+he[1]-wi]);const oe=zi.w*ot.scale/(Pt*(ot.localGlyph?Ga:1)),Ne=zi.h*ot.scale/(Pt*(ot.localGlyph?Ga:1));let Qe,gt,yt,Bt;if(lt){const yi=ot.y-ke,xi=new Ke(-Rt,Rt-yi),Ci=-Math.PI/2,Jt=new Ke(...hn);Qe=new Ke(-Rt+di[0],di[1]),Qe._rotateAround(Ci,xi)._add(Jt),Qe.x+=-yi+Rt,Qe.y-=(oi.left-wt)*ot.scale;const ni=ot.image?oi.advance*ot.scale:Rr*ot.scale,Vi=String.fromCodePoint(ot.glyph);cz(Vi)?Qe.x+=(1-wt)*ot.scale:uz(Vi)?Qe.x+=ni-oi.height*ot.scale+(-wt-1)*ot.scale:Qe.x+=ot.image||oi.width+2*wt===zi.w&&oi.height+2*wt===zi.h?(ni-Ne)/2:(ni-(oi.height+2*wt)*ot.scale)/2,gt=new Ke(Qe.x,Qe.y-oe),yt=new Ke(Qe.x+Ne,Qe.y),Bt=new Ke(Qe.x+Ne,Qe.y-oe)}else{const yi=(oi.left-wt)*ot.scale-Rt+di[0],xi=(-oi.top-wt)*ot.scale+di[1],Ci=yi+oe,Jt=xi+Ne;Qe=new Ke(yi,xi),gt=new Ke(Ci,xi),yt=new Ke(yi,Jt),Bt=new Ke(Ci,Jt)}if(Je){let yi;yi=De?new Ke(0,0):te?new Ke(et[0],et[1]):new Ke(he[0],he[1]),Qe._rotateAround(Je,yi),gt._rotateAround(Je,yi),yt._rotateAround(Je,yi),Bt._rotateAround(Je,yi)}const Ut=new Ke(0,0),ui=new Ke(0,0);$e.push({tl:Qe,tr:gt,bl:yt,br:Bt,texPrimary:Ot,texSecondary:void 0,writingMode:ae.writingMode,glyphOffset:ki,sectionIndex:ot.sectionIndex,isSDF:Et,pixelOffsetTL:Ut,pixelOffsetBR:ui,minFontScaleX:0,minFontScaleY:0})}}return $e}(0,o,y,u,d,m,a,n.allowVerticalPlacement),Y=n.textSizeData;let re=null;Y.kind==="source"?(re=[Ua*u.layout.get("text-size").evaluate(m,{},V)*P.textScaleFactor],re[0]>oc&&Tt(`${n.layerIds[0]}: Value for "text-size" is >= ${t_}. Reduce your "text-size".`)):Y.kind==="composite"&&(re=[Ua*P.compositeTextSizes[0].evaluate(m,{},V)*P.textScaleFactor,Ua*P.compositeTextSizes[1].evaluate(m,{},V)*P.textScaleFactor],(re[0]>oc||re[1]>oc)&&Tt(`${n.layerIds[0]}: Value for "text-size" is >= ${t_}. Reduce your "text-size".`)),n.addSymbols(n.text,q,re,y,d,m,T,e,i,x.lineStartIndex,x.lineLength,M,k,V,$,!1,N,q.length);for(const ee of S)I[ee]=n.text.placedSymbolArray.length-1;return 4*q.length}function f0(n){for(const e in n)return n[e];return null}function m0(n,e,i,o,a,u,d,m,y,x,T){let S,I,M,P;if(S=T?T.top:d.top,I=T?T.bottom:d.bottom,M=T?T.left:d.left,P=T?T.right:d.right,pw(d)&&d.collisionPadding){const k=d.collisionPadding;M-=k[0],S-=k[1],P+=k[2],I+=k[3]}if(y){const k=new Ke(M,S),V=new Ke(P,S),N=new Ke(M,I),$=new Ke(P,I),q=qi(y);let Y=new Ke(0,0);x&&(Y=new Ke(x[0],x[1])),k._rotateAround(q,Y),V._rotateAround(q,Y),N._rotateAroun
vendor: 4,101 bytes, line 53
53d(q,Y),$._rotateAround(q,Y),M=Math.min(k.x,V.x,N.x,$.x),P=Math.max(k.x,V.x,N.x,$.x),S=Math.min(k.y,V.y,N.y,$.y),I=Math.max(k.y,V.y,N.y,$.y)}return n.emplaceBack(e.x,e.y,e.z,i.x,i.y,M,S,P,I,m,o,a,u),n.length-1}function ww(n){pw(n)&&n.collisionPadding&&(n.top-=n.collisionPadding[1],n.bottom+=n.collisionPadding[3]);const e=n.bottom-n.top;return e>0?Math.max(10,e):null}function Vz(n,e,i,o){const a=n.compareText;if(e in a){const u=a[e];for(let d=u.length-1;d>=0;d--)if(o.dist(u[d])<i)return!0}else a[e]=[];return a[e].push(o),!1}function jI(n,e){const i=n.fovAboveCenter,o=n.elevation?n.elevation.getMinElevationBelowMSL()*e:0,a=(n._camera.position[2]*n.worldSize-o)/Math.cos(n._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-n._pitch-i,.01));let d=Math.sin(n._pitch)*u+a;const m=a*(1/n._horizonShift);if(!n.elevation||n.elevation.exaggeration()===0){let y=Math.max(n.zoom-17,0);n.isOrthographic&&(y/=10),d*=1+y}return Math.min(1.01*d,m)}function i_(n,e){if(!e.isReprojectedInTileSpace)return{scale:1<<n.z,x:n.x,y:n.y,x2:n.x+1,y2:n.y+1,projection:e};const i=Math.pow(2,-n.z),o=n.x*i,a=(n.x+1)*i,u=n.y*i,d=(n.y+1)*i,m=C(o),y=C(a),x=z(u),T=z(d),S=e.project(m,x),I=e.project(y,x),M=e.project(y,T),P=e.project(m,T);let k=Math.min(S.x,I.x,M.x,P.x),V=Math.min(S.y,I.y,M.y,P.y),N=Math.max(S.x,I.x,M.x,P.x),$=Math.max(S.y,I.y,M.y,P.y);const q=i/16;function Y(ee,ae,he,me,De,xe){const Be=(he+De)/2,Ge=(me+xe)/2,$e=e.project(C(Be),z(Ge)),Je=Math.max(0,k-$e.x,V-$e.y,$e.x-N,$e.y-$);k=Math.min(k,$e.x),N=Math.max(N,$e.x),V=Math.min(V,$e.y),$=Math.max($,$e.y),Je>q&&(Y(ee,$e,he,me,Be,Ge),Y($e,ae,Be,Ge,De,xe))}Y(S,I,o,u,a,u),Y(I,M,a,u,a,d),Y(M,P,a,d,o,d),Y(P,S,o,d,o,u),k-=q,V-=q,N+=q,$+=q;const re=1/Math.max(N-k,$-V);return{scale:re,x:k*re,y:V*re,x2:N*re,y2:$*re,projection:e}}function UI(n,{x:e,y:i},o=0){return new Ke(((e-o)*n.scale-n.x)*ht,(i*n.scale-n.y)*ht)}const jz=Ft(new Float32Array(16));class ru{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new r(0,0)}projectTilePoint(e,i,o){return{x:e,y:i,z:0}}locationPoint(e,i,o,a=!0){return e._coordinatePoint(e.locationCoordinate(i,o),a)}pixelsPerMeter(e,i){return E(1,e)*i}pixelSpaceConversion(e,i,o){return 1}farthestPixelDistance(e){return jI(e,e.pixelsPerMeter)}pointCoordinate(e,i,o,a){const u=e.horizonLineFromTop(!1),d=new Ke(i,Math.max(u,o));return e.rayIntersectionCoordinate(e.pointRayIntersection(d,a))}pointCoordinate3D(e,i,o){const a=new Ke(i,o);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const o=e.horizonLineFromTop();return i.y<o}createInversionMatrix(e,i){return jz}createTileMatrix(e,i,o){let a,u,d;const m=o.canonical,y=Ft(new Float64Array(16));if(this.isReprojectedInTileSpace){const x=i_(m,this);a=1,u=x.x+o.wrap*x.scale,d=x.y,dt(y,y,[a/x.scale,a/x.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(m.z),u=(m.x+Math.pow(2,m.z)*o.wrap)*a,d=m.y*a;return Ce(y,y,[u,d,0]),dt(y,y,[a/ht,a/ht,1]),y}upVector(e,i,o){return[0,0,1]}upVectorScale(e,i,o){return{metersToTile:1}}}class Uz extends ru{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,o]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(qi(i));this.n=(a+Math.sin(qi(o)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:o,c:a,r0:u}=this,d=qi(e-this.center[0]),m=qi(i),y=Math.sqrt(a-2*o*Math.sin(m))/o;return{x:y*Math.sin(d*o),y:y*Math.cos(d*o)-u,z:0}}unproject(e,i){const{n:o,c:a,r0:u}=this,d=u+i;let m=Math.atan2(e,Math.abs(d))*Math.sign(d);d*o<0&&(m-=Math.PI*Math.sign(e)*Math.sign(d));const y=qi(this.center[0])*o;m=J(m,-Math.PI-y,Math.PI-y);const x=j(ao(m/o)+this.center[0],-180,180),T=Math.asin(j((a-(e*e+d*d)*
vendor: 4,505 bytes, line 53
53o*o)/(2*o),-1,1)),S=j(ao(T),-D,D);return new r(x,S)}}const n_=1.340264,r_=-.081106,o_=893e-6,s_=.003796,_0=Math.sqrt(3)/2;class Gz extends ru{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const o=Math.asin(_0*Math.sin(i)),a=o*o,u=a*a*a;return{x:.5*(e*Math.cos(o)/(_0*(n_+3*r_*a+u*(7*o_+9*s_*a)))/Math.PI+.5),y:1-.5*(o*(n_+r_*a+u*(o_+s_*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=o*o,u=a*a*a;for(let T,S,I,M=0;M<12&&(S=o*(n_+r_*a+u*(o_+s_*a))-i,I=n_+3*r_*a+u*(7*o_+9*s_*a),T=S/I,o=j(o-T,-Math.PI/3,Math.PI/3),a=o*o,u=a*a*a,!(Math.abs(T)<1e-12));++M);const d=_0*e*(n_+3*r_*a+u*(7*o_+9*s_*a))/Math.cos(o),m=Math.asin(Math.sin(o)/_0),y=j(180*d/Math.PI,-180,180),x=j(180*m/Math.PI,-D,D);return new r(y,x)}}class $z extends ru{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const o=360*(e-.5),a=j(360*(.5-i),-D,D);return new r(o,a)}}const Tp=Math.PI/2;function g0(n){return Math.tan((Tp+n)/2)}class Hz extends ru{constructor(e){super(e),this.center=e.center||[0,30];const[i,o]=this.parallels=e.parallels||[30,30];let a=qi(i),u=qi(o);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const d=Math.cos(a),m=g0(a);this.n=a===u?Math.sin(a):Math.log(d/Math.cos(u))/Math.log(g0(u)/m),this.f=d*Math.pow(g0(a),this.n)/this.n}project(e,i){i=qi(i),this.southernCenter&&(i=-i),e=qi(e-this.center[0]);const o=1e-6,{n:a,f:u}=this;u>0?i<-Tp+o&&(i=-Tp+o):i>Tp-o&&(i=Tp-o);const d=u/Math.pow(g0(i),a);let m=d*Math.sin(a*e),y=u-d*Math.cos(a*e);return m=.5*(m/Math.PI+.5),y=.5*(y/Math.PI+.5),{x:m,y:this.southernCenter?y:1-y,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:o,f:a}=this,u=a-i,d=Math.sign(u),m=Math.sign(o)*Math.sqrt(e*e+u*u);let y=Math.atan2(e,Math.abs(u))*d;u*o<0&&(y-=Math.PI*Math.sign(e)*d);const x=j(ao(y/o)+this.center[0],-180,180),T=j(ao(2*Math.atan(Math.pow(a/m,1/o))-Tp),-D,D);return new r(x,this.southernCenter?-T:T)}}class GI extends ru{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:v(e),y:b(i),z:0}}unproject(e,i){const o=C(e),a=z(i);return new r(o,a)}}const $I=qi(D);class qz extends ru{project(e,i){const o=(i=qi(i))*i,a=o*o;return{x:.5*((e=qi(e))*(.8707-.131979*o+a*(a*(.003971*o-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=25,u=0,d=o*o;do{d=o*o;const x=d*d;u=(o*(1.007226+d*(.015085+x*(.028874*d-.044475-.005916*x)))-i)/(1.007226+d*(.045255+x*(.259866*d-.311325-.005916*11*x))),o=j(o-u,-$I,$I)}while(Math.abs(u)>1e-6&&--a>0);d=o*o;const m=j(ao(e/(.8707+d*(d*(d*d*d*(.003971-.001529*d)-.013791)-.131979))),-180,180),y=ao(o);return new r(m,y)}}const HI=qi(D);class Zz extends ru{project(e,i){i=qi(i),e=qi(e);const o=Math.cos(i),a=2/Math.PI,u=Math.acos(o*Math.cos(e/2)),d=Math.sin(u)/u,m=.5*(e*a+2*o*Math.sin(e/2)/d)||0,y=.5*(i+Math.sin(i)/d)||0;return{x:.5*(m/Math.PI+.5),y:1-.5*(y/Math.PI+1),z:0}}unproject(e,i){let o=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const d=1e-6;let m=0,y=0;do{const x=Math.cos(a),T=Math.sin(a),S=2*T*x,I=T*T,M=x*x,P=Math.cos(o/2),k=Math.sin(o/2),V=2*P*k,N=k*k,$=1-M*P*P,q=$?1/$:0,Y=$?Math.acos(x*P)*Math.sqrt(1/$):0,re=.5*(2*Y*x*k+2*o/Math.PI)-e,ee=.5*(Y*T+a)-i,ae=.5*q*(M*N+Y*x*P*I)+1/Math.PI,he=q*(V*S/4-Y*T*k),me=.125*q*(S*k-Y*T*M*V),De=.5*q*(I*P+Y*N*x)+.5,xe=he*me-De*ae;m=(ee*he-re*De)/xe,y=(re*me-ee*ae)/xe,o=j(o-m,-Math.PI,Math.PI),a=j(a-y,-HI,HI)}while((Math.abs(m)>d||Math.abs(y)>d)&&--u>0);return new r(ao(o),ao(a))}}class qI extends ru{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qi(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:o,cosPhi:a}=this;return{x:qi(e)*a*o+.5,y:-Math.sin(qi(i))/a*o+.5,z:0}}unproject(e,i){const{scale:o,cosPhi:a}=this,u=-(i-.5)/o,d=j(ao((e-.5)/o)/a,-180,180),m=Math.asin(j(u*a,-1,1)),y=j(ao(m),-D,D);return new r(d,y)}}class Wz extends GI{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,o){const a=Rm(e,i,o);
vendor: 6,272 bytes, line 53
53return qn(a,a,jy(Os(o))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,o){const a=Kc(i.lat,i.lng),u=un([],a),d=o?e._centerAltitude+o:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Si(a,a,u,E(1,0)*ht*d);const m=Ft(new Float64Array(16));return Se(m,e.pixelMatrix,e.globeMatrix),qn(a,a,m),new Ke(a[0],a[1])}pixelsPerMeter(e,i){return E(1,0)*i}pixelSpaceConversion(e,i,o){const a=E(1,e)*i,u=Qt(E(1,45)*i,a,o);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,o){const a=I1(Os(o.canonical));return Se(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:o}=e,a=jy(Os(i));return jt(a,a,qi(o.lng)),Vt(a,a,qi(o.lat)),dt(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,o,a){return Qc(e,i,o,!0)||new Z(0,0)}pointCoordinate3D(e,i,o){const a=this.pointCoordinate(e,i,o,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!Qc(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,u){const d=a.cameraToCenterDistance,m=a._centerAltitude*u,y=a._camera,x=a._camera.forward(),T=Gt([],ai([],x,-d),[0,0,m]),S=a.worldSize/(2*Math.PI),I=[0,0,-S],M=a.width/a.height,P=Math.tan(a.fovAboveCenter),k=ai([],y.up(),P),V=ai([],y.right(),P*M),N=un([],Gt([],Gt([],x,k),V)),$=[];let q;if(new Mt(T,N).closestPointOnSphere(I,S,$)){const Y=Gt([],$,I),re=rr([],Y,T);q=Math.cos(a.fovAboveCenter)*Hn(re)}else{const Y=rr([],T,I),re=rr([],I,T);un(re,re);const ee=Hn(Y)-S;q=Math.sqrt(ee*(ee+2*S));const ae=Math.acos(q/(S+ee))-Math.acos(vn(x,re));q*=Math.cos(ae)}return 1.01*q}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),o=eu(e.zoom);if(o>0){const a=jI(e,E(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),d=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Qt(i,a+u*(1-Math.cos(d)),Math.pow(o,10))}return i}upVector(e,i,o){return Rm(i,o,e,1)}upVectorScale(e){return{metersToTile:ca(Vy(Os(e)))}}}function ZI(n){const e=n.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(n.name){case"mercator":return new GI(n);case"equirectangular":return new $z(n);case"naturalEarth":return new qz(n);case"equalEarth":return new Gz(n);case"winkelTripel":return new Zz(n);case"albers":return i?new qI(n):new Uz(n);case"lambertConformalConic":return i?new qI(n):new Hz(n);case"globe":return new Wz(n)}throw new Error(`Invalid projection name: ${n.name}`)}const Xz=ge.types,Yz=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function a_(n,e,i,o,a,u,d,m,y,x,T,S,I){const M=m?Math.min(oc,Math.round(m[0])):0,P=m?Math.min(oc,Math.round(m[1])):0;n.emplaceBack(e,i,Math.round(32*o),Math.round(32*a),u,d,(M<<1)+(y?1:0),0+(P<<1),16*x,16*T,256*S,256*I)}function l_(n,e,i){n.emplaceBack(e,i)}function c_(n,e,i,o,a,u,d){n.emplaceBack(e,i,o,a,u,d)}const y0=(n,e,i,o)=>{for(let a=0;a<e;a++)n.emplaceBack(i[0],i[1],i[2],o[0],o[1],o[2])};function Sp(n,e,i,o,a){n.emplaceBack(e,i,o,a),n.emplaceBack(e,i,o,a),n.emplaceBack(e,i,o,a),n.emplaceBack(e,i,o,a)}function Kz(n){for(const e of n.sections)if(u1(e.text))return!0;return!1}class bw{constructor(e){this.layoutVertexArray=new fm,this.indexArray=new mr,this.programConfigurations=e,this.segments=new zn,this.dynamicLayoutVertexArray=new ml,this.opacityVertexArray=new Zd,this.placedSymbolArray=new zy,this.iconTransitioningVertexArray=new Yo,this.globeExtVertexArray=new mm,this.zOffsetVertexArray=new za,this.orientationVertexArray=new ym,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getIconVertexData(e,i){const o=[],a=this.layoutVertexArray.uint16;for(let u=0;u<i;++u){const d=12*(e+u);o.push(...a.slice(d,d+12))}return o}updateIconVertexData(e,i,o,a,u,d,m,y,x,T,S,I,M){const P=this.layoutVertexArray.uint16,k=12*e;P[k]=i,P[k+1]=o,P[k+2]=a,P[k+3]=u,P[k+4]=d,P[k+5]=m,P[k+6]=y,P[k+7]=x,P[k+8]=T,P[k+9]=S,P[k+10]=I,P[k+11]=M}upload(e,i,o,a,u,d){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,QL.members,!!d),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,tz.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Yz,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,rz.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ez.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,iz.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,nz.members,!0)),this.opacityVertexBuffer.itemSize=1),(o||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}At(bw,"SymbolBuffers");class Tw{constructor(e,i,o){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new o,this.segments=new zn,this.collisionVertexArray=new _m,this.collisionVertexArrayExt=new ml}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,oz.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,sz.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
53stroy())}}At(Tw,"CollisionBuffers");class v0{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ft([]),this.placementViewportMatrix=Ft([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=vp(this.zoom,i["text-size"],this.worldview),this.iconSizeData=vp(this.zoom,i["icon-size"],this.worldview);const o=this.layers[0].layout,a=o.get("symbol-sort-key"),u=o.get("symbol-z-order");this.lut=e.lut,this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=o.get("text-writing-mode").map(d=>Qo[d]),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const i=this.layers[0].getAppearances();return!(!i||i.length===0)&&i.some(o=>o.getProperty(e)!=null)}createArrays(){this.text=new bw(new Ds(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new bw(new Ds(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new tp,this.lineVertexArray=new ky,this.symbolInstances=new Tm}calculateGlyphDependencies(e,i,o,a,u){for(const d of e){const m=d.codePointAt(0);if(m===void 0)break;if(i[m]=!0,a&&u&&m<=65535){const y=Ym[d];y&&(i[y.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,o,a,u,d){let m=1;const y=e.getUnevaluatedProperties()._values["icon-size"],x=vp(this.zoom,y,this.worldview),T=xp(x,i);if(x.kind!=="constant"&&x.kind!=="camera"||(m=T.uSize),x.kind==="composite"){const{minZoom:S,maxZoom:I}=x,M=y.possiblyEvaluate(new bn(S,{worldview:this.worldview}),a),P=y.possiblyEvaluate(new bn(I,{worldview:this.worldview}),a),k=M.evaluate(o,{},a,u);m=k+(P.evaluate(o,{},a,u)-k)*T.uSizeT}return x.kind==="source"&&(m=y.possiblyEvaluate(new bn(this.zoom,{worldview:this.worldview}),a).evaluate(o,{},a,u)),m*d}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Zy(this.activeReplacements,o)&&(this.activeReplacements=o,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?fo.build(e):e}populate(e,i,o,a){const u=this.layers[0],d=u.layout,m=this.projection.name==="globe",y=d.get("text-font"),x=d.get("text-field"),T=d.get("icon-image"),[S,I]=d.get("icon-size-scale-range"),M=j(i.scaleFactor||1,S,I),P=(x.value.kind!=="constant"||x.value.value instanceof po&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(y.value.kind!=="constant"||y.value.value.length>0),k=T.value.kind!=="constant"||!!T.value.value||Object.keys(T.parameters).length>0,V=this.hasAnyAppearanceProperty("icon-image"),N=d.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!P&&!k&&!V)return;const $=i.iconDependencies,q=i.glyphDependencies,Y=i.availableImages,re=new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),ee=ae=>{const he=ae.id.toString();$.has(he)?$.get(he).push(ae):$.set(he,[ae])};for(const ae of e){const{feature:he,id:me,index:De,sourceLayerIndex:xe}=ae,Be=u._featureFilter.needGeometry,Ge=ve(he,Be);if(!u._featureFilter.filter(re,Ge,o))continue;if(Be||(Ge.geometry=ce(he,o,a)),m&&he.type!==1&&o.z<=5){const Ye=Ge.geometry,pt=.98078528056,ot=(Ot,wt)=>vn(Rm(Ot.x,Ot.y,o,1),Rm(wt.x,wt.y,o,1))<pt;for(let Ot=0;Ot<Ye.length;Ot++)Ye[Ot]=ne(Ye[Ot],ot)}let $e,Je;if(P){const Ye=u.getValueAndResolveTokens("text-field",Ge,o,Y),pt=po.factory(Ye);Kz(pt)&&(this.hasRTLText=!0),(!this.hasRTLText||Yu()==="unavailable"||this.hasRTLText&&La.isParsed())&&($e=lz(pt,u,Ge))}if(k){const Ye=u.getValueAndResolveTokens("icon-image",Ge,o,Y);Je=this.getResolvedImageFromTokens(Ye)}const et=this.layers[0];let We=!1;if(!Je&&V){const Ye=et.getAppearances();for(const pt of Ye)if(pt.getProperty("icon-image")){const ot=et.getAppearanceValueAndResolveTokens(pt,"icon-image",Ge,o,Y);if(ot){Je=this.getResolvedImageFromTokens(ot),We=!0;break}}}if(!$e&&!Je)continue;const Xe=this.sortFeaturesByKey?N.evaluate(Ge,{}
53,o):void 0,Fe={id:me,text:$e,icon:Je,index:De,sourceLayerIndex:xe,geometry:Ge.geometry,properties:he.properties,type:Xz[he.type],sortKey:Xe};if(this.features.push(Fe),this.featureToAppearanceIndex[De]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:me,properties:he.properties,usesAppearanceIconAsPlaceholder:We,isUsingAppearanceVertexData:!1,layoutBasedVertexData:[],activeAppearance:null}),Je){const Ye=et._unevaluatedLayout._values,{iconPrimary:pt,iconSecondary:ot}=e_(Je,this.iconSizeData,Ye["icon-size"],o,this.zoom,Fe,this.pixelRatio,M,this.worldview);ee(pt),ot&&(this.hasAnySecondaryIcon=!0,ee(ot))}const ke=et.getAppearances();if(ke.length!==0&&ke.forEach(Ye=>{if(!Ye.getProperty("icon-image"))return;const pt=this.getCombinedIconPrimary(Ye,et,Ge,o,Y,Fe,M);pt&&ee(pt)}),$e){const Ye=y.evaluate(Ge,{},o).join(","),pt=d.get("text-rotation-alignment")==="map"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Qo.vertical)>=0;for(const ot of $e.sections)if(ot.image){const Ot=ot.image.getPrimary().scaleSelf(this.pixelRatio),wt=Ot.id.toString(),Et=$.get(wt)||[];Et.push(Ot),$.set(wt,Et)}else{const Ot=Wu($e.toString()),wt=ot.fontStack||Ye,Et=q[wt]=q[wt]||{};this.calculateGlyphDependencies(ot.text,Et,pt,this.allowVerticalPlacement,Ot)}}}if(d.get("symbol-placement")==="line"&&(this.features=function(ae){const he={},me={},De=[];let xe=0;function Be(et){De.push(ae[et]),xe++}function Ge(et,We,Xe){const Fe=me[et];return delete me[et],me[We]=Fe,De[Fe].geometry[0].pop(),De[Fe].geometry[0]=De[Fe].geometry[0].concat(Xe[0]),Fe}function $e(et,We,Xe){const Fe=he[We];return delete he[We],he[et]=Fe,De[Fe].geometry[0].shift(),De[Fe].geometry[0]=Xe[0].concat(De[Fe].geometry[0]),Fe}function Je(et,We,Xe){const Fe=Xe?We[0][We[0].length-1]:We[0][0];return`${et}:${Fe.x}:${Fe.y}`}for(let et=0;et<ae.length;et++){const We=ae[et],Xe=We.geometry,Fe=We.text?We.text.toString():null;if(!Fe){Be(et);continue}const ke=Je(Fe,Xe),Ye=Je(Fe,Xe,!0);if(ke in me&&Ye in he&&me[ke]!==he[Ye]){const pt=$e(ke,Ye,Xe),ot=Ge(ke,Ye,De[pt].geometry);delete he[ke],delete me[Ye],me[Je(Fe,De[ot].geometry,!0)]=ot,De[pt].geometry=null}else ke in me?Ge(ke,Ye,Xe):Ye in he?$e(ke,Ye,Xe):(Be(et),he[ke]=xe-1,me[Ye]=xe-1)}return De.filter(et=>et.geometry)}(this.features)),d.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const ae of i.elevationFeatures)this.elevationFeatureIdToIndex.set(ae.id,this.elevationFeatures.length),this.elevationFeatures.push(ae)}}else d.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((ae,he)=>ae.sortKey-he.sortKey)}getCombinedIconPrimary(e,i,o,a,u,d,m){let y,x;const T=e.getUnevaluatedProperties();if(T._values["icon-image"].value!==void 0){const S=i.getAppearanceValueAndResolveTokens(e,"icon-image",o,a,u);y=this.getResolvedImageFromTokens(S)}else{const S=i.getValueAndResolveTokens("icon-image",o,a,u);y=this.getResolvedImageFromTokens(S)}if(y){const S=T._values["icon-size"]||i._unevaluatedLayout._values["icon-size"];x=e_(y,vp(this.zoom,S,this.worldview),S,a,this.zoom,d,this.pixelRatio,m,this.worldview).iconPrimary}return x}updateAppearanceBasedIconTextures(e,i,o,a){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const u=this.layers[0];let d=!1,m=0;const y=u.layout,[x,T]=y.get("icon-size-scale-range"),S=j(1,x,T);for(let I=0;I<this.symbolInstances.length;I++){const M=this.symbolInstances.get(I),P=this.featureToAppearanceIndex[M.featureIndex],k=P!==void 0?this.appearanceFeatureData[P]:void 0;if(k&&M.placedIconSymbolIndex>=0){const V=k.id,N=i&&V!==void 0?i[String(V)]:void 0,$={type:"Point",id:k.id,properties:k.properties,geometry:[]},q=this.layers[0].appearances&&this.layers[0].appearances.find(Y=>Y.isActive({globals:a,feature:$,canonical:e,featureState:N}));if(k.activeAppearance===q){m+=M.numIconVertices;continue}if(q){k.activeAppearance=q;const Y=this.getCombinedIconPrimary(q,u,$,e,o,{sortKey:void 0,text:void 0,icon:null,index:M.featureIndex,sourceLayerIndex:M.featureIndex,geometry:[],properties:k.properties,type:"Point",id:k.id},S);if(!Y)continue;const re=Y.toString(),ee=this.iconAtlasPositions&&this.iconAtlasPositions.get(re);if(ee){const ae=u.getAppearanceValueAndResolveTokens(q,"icon-offset",$,e,o),he=ae&&Array.isArray(ae)?ae:[0,0];let me=c0(ee,void 0,he,u.layout.get("icon-anchor").evaluate($,{},e));const De=u.getAppearanceValueAndResolveTokens(q,"icon-rotate",$,e,o),xe=typeof De=="number"?De:0,Be=ee.sdf,Ge=u.layout.get("icon-text-fit").constantOr("none");Ge!=="none"&&k.textShaping&&k.iconTextFitPadding&&k.fontScale&&(me=fw(me,k.textShaping,Ge,k.iconTextFitPadding,he,k.fontScale));
53const $e=this.calculateEffectiveAppearanceIconSize(q,a.zoom,$,e,o,S),Je=0,et=1+(Math.min(oc,Math.round($e*Ua))<<1),We=yw(me,xe,Be,Ge!=="none",S);k.isUsingAppearanceVertexData||(k.isUsingAppearanceVertexData=!0,k.layoutBasedVertexData=this.icon.getIconVertexData(m,M.numIconVertices));for(let Fe=0;Fe<We.length;++Fe){const ke=We[Fe],Ye=k.layoutBasedVertexData[0]||M.tileAnchorX,pt=k.layoutBasedVertexData[1]||M.tileAnchorY,ot=16*ke.pixelOffsetTL.x,Ot=16*ke.pixelOffsetTL.y,wt=16*ke.pixelOffsetBR.x,Et=16*ke.pixelOffsetBR.y,Pt=16*ke.minFontScaleX,wi=16*ke.minFontScaleY;this.icon.updateIconVertexData(m,Ye,pt,Math.round(32*ke.tl.x),Math.round(32*ke.tl.y),ke.texPrimary.x,ke.texPrimary.y,Je,et,ot,Ot,Pt,wi),this.icon.updateIconVertexData(m+1,Ye,pt,Math.round(32*ke.tr.x),Math.round(32*ke.tr.y),ke.texPrimary.x+ke.texPrimary.w,ke.texPrimary.y,Je,et,wt,Ot,Pt,wi),this.icon.updateIconVertexData(m+2,Ye,pt,Math.round(32*ke.bl.x),Math.round(32*ke.bl.y),ke.texPrimary.x,ke.texPrimary.y+ke.texPrimary.h,Je,et,ot,Et,Pt,wi),this.icon.updateIconVertexData(m+3,Ye,pt,Math.round(32*ke.br.x),Math.round(32*ke.br.y),ke.texPrimary.x+ke.texPrimary.w,ke.texPrimary.y+ke.texPrimary.h,Je,et,wt,Et,Pt,wi),m+=4}const Xe=M.numIconVertices-4*We.length;for(let Fe=0;Fe<Xe;++Fe)this.icon.updateIconVertexData(m+Fe,0,0,0,0,0,0,0,0,0,0,0,0);d=!0}else m+=M.numIconVertices}else if(k.usesAppearanceIconAsPlaceholder)this.layers[0].appearances&&this.layers[0].appearances.length>0&&(this.icon.updateIconVertexData(m,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(m+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(m+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(m+3,0,0,0,0,0,0,0,0,0,0,0,0),d=!0),m+=M.numIconVertices,k.activeAppearance=null;else if(k.isUsingAppearanceVertexData){const re=k.layoutBasedVertexData.length/12;for(let ee=0;ee<re;++ee){const ae=ee*12;this.icon.updateIconVertexData(m+ee,k.layoutBasedVertexData[ae+0],k.layoutBasedVertexData[ae+1],k.layoutBasedVertexData[ae+2],k.layoutBasedVertexData[ae+3],k.layoutBasedVertexData[ae+4],k.layoutBasedVertexData[ae+5],k.layoutBasedVertexData[ae+6],k.layoutBasedVertexData[ae+7],k.layoutBasedVertexData[ae+8],k.layoutBasedVertexData[ae+9],k.layoutBasedVertexData[ae+10],k.layoutBasedVertexData[ae+11])}m+=re,k.isUsingAppearanceVertexData=!1,k.activeAppearance=null,d=!0}else m+=M.numIconVertices,k.activeAppearance=null}}return d}update(e,i,o,a,u,d,m){this.text.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,o,a,d,m,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const o=U(e),a=1/o;let u=!1,d=!1;for(let m=0;m<this.symbolInstances.length;m++){const y=this.symbolInstances.get(m),x=ri(1,0,0),T=ri(0,1,0),{numHorizontalGlyphVertices:S,numVerticalGlyphVertices:I,numIconVertices:M,numVerticalIconVertices:P}=y,k=S>0||I>0,V=M>0,N=this.elevationFeatures[y.elevationFeatureIndex];if(N){const $=new Ke(y.tileAnchorX,y.tileAnchorY),q=.075+N.pointElevation($);y.zOffset!==q&&(i=!0,y.zOffset=q),q!==0&&(this.hasAnyZOffset=!0);const Y=N.computeSlopeNormal($,a),re=Zs(Es(),ri(0,0,1),Y);Ss(x,x,re),Ss(T,T,re),x[2]*=o,T[2]*=o,x[0]===1&&x[1]===0&&x[2]===0&&T[0]===0&&T[1]===1&&T[2]===0||(u=u||k,d=d||V)}if(k&&(y0(this.text.orientationVertexArray,S,x,T),y0(this.text.orientationVertexArray,I,x,T)),V){const{placedIconSymbolIndex:$,verticalPlacedIconSymbolIndex:q}=y;$>=0&&y0(this.icon.orientationVertexArray,M,x,T),q>=0&&y0(this.icon.orientationVertexArray,P,x,T)}}u||(this.text.orientationVertexArray=void 0),d||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,d,m)=>{o+=d,o>u.length&&u.resize(o);for(let y=-d;y<0;y++)u.emplace(y+o,m)},i=(u,d,m)=>{a+=d,a>u.length&&u.resize(a);for(let y=-d;y<0;y++)u.emplace(y+a,m)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let o=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const d=this.symbolInstances.get(u),{numHorizontalGlyphVertices:m,numVerticalGlyphVertices:y,numIconVertices:x}=d,T=d.zOffset,S=x>0;if((m>0||y>0)&&(e(this.text.zOffsetVertexArray,m,T),e(this.text.zOffsetVertexArray,y,T)),S){const{placedIconSymbolIndex:I,verticalPlacedIconSymbolIndex:M}=d;I>=0&&i(this.icon.zOffsetVertexArray,x,T),M>=0&&i(this.icon.zOffsetVertexArray,d.numVerticalIconVertices,T)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,o,a,u){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(d=>d.appearances&&d.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,o,a){return!!(e&&i&&o)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(e,i,o,a)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=ZI(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const o=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,i,o,a,u,d,m,y,x,T,S,I,M,P,k,V,N,$){const q=e.indexArray,Y=e.layoutVertexArray,re=e.globeExtVertexArray,ee=e.segments.prepareSegment(4*$,Y,q,this.canOverlap?d.sortKey:void 0),ae=this.glyphOffsetArray.length,he=ee.vertexLength,me=this.allowVerticalPlacement&&m===Qo.vertical?Math.PI/2:0,De=d.text&&d.text.sections;for(let Ge=0;Ge<i.length;Ge++){const{tl:$e,tr:Je,bl:et,br:We,texPrimary:Xe,texSecondary:Fe,pixelOffsetTL:ke,pixelOffsetBR:Ye,minFontScaleX:pt,minFontScaleY:ot,glyphOffset:Ot,isSDF:wt,sectionIndex:Et}=i[Ge],Pt=ee.vertexLength,wi=Ot[1];if(a_(Y,x.x,x.y,$e.x,wi+$e.y,Xe.x,Xe.y,o,wt,ke.x,ke.y,pt,ot),a_(Y,x.x,x.y,Je.x,wi+Je.y,Xe.x+Xe.w,Xe.y,o,wt,Ye.x,ke.y,pt,ot),a_(Y,x.x,x.y,et.x,wi+et.y,Xe.x,Xe.y+Xe.h,o,wt,ke.x,Ye.y,pt,ot),a_(Y,x.x,x.y,We.x,wi+We.y,Xe.x+Xe.w,Xe.y+Xe.h,o,wt,Ye.x,Ye.y,pt,ot),y){const{x:lt,y:Rt,z:oi}=y.anchor,[zi,ki,di]=y.up;c_(re,lt,Rt,oi,zi,ki,di),c_(re,lt,Rt,oi,zi,ki,di),c_(re,lt,Rt,oi,zi,ki,di),c_(re,lt,Rt,oi,zi,ki,di),Sp(e.dynamicLayoutVertexArray,lt,Rt,oi,me)}else Sp(e.dynamicLayoutVertexArray,x.x,x.y,x.z,me);if(V){const lt=Fe||Xe;l_(e.iconTransitioningVertexArray,lt.x,lt.y),l_(e.iconTransitioningVertexArray,lt.x+lt.w,lt.y),l_(e.iconTransitioningVertexArray,lt.x,lt.y+lt.h),l_(e.iconTransitioningVertexArray,lt.x+lt.w,lt.y+lt.h)}q.emplaceBack(Pt,Pt+1,Pt+2),q.emplaceBack(Pt+1,Pt+2,Pt+3),ee.vertexLength+=4,ee.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ot[0]),Ge!==i.length-1&&Et===i[Ge+1].sectionIndex||e.programConfigurations.populatePaintArrays(Y.length,d,d.index,{}
vendor: 7,259 bytes, line 53
53,M,P,k,De&&De[Et],this.worldview)}const xe=$-i.length;xe!==0&&this._addNullVertices(xe,Y,o,y,re,e,V,ee,q);const Be=y?y.anchor:x;e.placedSymbolArray.emplaceBack(Be.x,Be.y,Be.z,x.x,x.y,ae,this.glyphOffsetArray.length-ae,he,T,S,x.segment,o?o[0]:0,o?o[1]:0,a[0],a[1],m,0,0,0,I,0),e.symbolInstanceIndices.push(N)}_addNullVertices(e,i,o,a,u,d,m,y,x){for(let T=0;T<e;T++){for(let I=0;I<4;I++)a_(i,0,0,0,0,0,0,o,!1,0,0,0,0),a&&c_(u,0,0,0,0,0,0),Sp(d.dynamicLayoutVertexArray,0,0,0,0),m&&l_(d.iconTransitioningVertexArray,0,0);const S=y.vertexLength;x.emplaceBack(S,S+1,S+2),x.emplaceBack(S+1,S+2,S+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,o,a,u,d,m){e.emplaceBack(i,o,a,u,d,Math.round(m.x),Math.round(m.y))}_addCollisionDebugVertices(e,i,o,a,u,d,m){const y=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),x=y.vertexLength,T=m.tileAnchorX,S=m.tileAnchorY;for(let M=0;M<4;M++)o.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(o.collisionVertexArrayExt,i,e.padding,m.zOffset),this._commitLayoutVertex(o.layoutVertexArray,a,u,d,T,S,new Ke(e.x1,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,u,d,T,S,new Ke(e.x2,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,u,d,T,S,new Ke(e.x2,e.y2)),this._commitLayoutVertex(o.layoutVertexArray,a,u,d,T,S,new Ke(e.x1,e.y2)),y.vertexLength+=4;const I=o.indexArray;I.emplaceBack(x,x+1),I.emplaceBack(x+1,x+2),I.emplaceBack(x+2,x+3),I.emplaceBack(x+3,x),y.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,o,a,u,d){for(let m=a;m<u;m++){const y=o.get(m),x=this.getSymbolInstanceTextSize(e,d,i,m);this._addCollisionDebugVertices(y,x,this.textCollisionBox,y.projectedAnchorX,y.projectedAnchorY,y.projectedAnchorZ,d)}}_addIconDebugCollisionBoxes(e,i,o,a,u,d){for(let m=a;m<u;m++){const y=o.get(m),x=this.getSymbolInstanceIconSize(e,i,d.placedIconSymbolIndex);this._addCollisionDebugVertices(y,x,this.iconCollisionBox,y.projectedAnchorX,y.projectedAnchorY,y.projectedAnchorZ,d)}}generateCollisionDebugBuffers(e,i,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Tw(Xd,hI.members,Yo),this.iconCollisionBox=new Tw(Xd,hI.members,Yo);const a=xp(this.iconSizeData,e),u=xp(this.textSizeData,e,o);for(let d=0;d<this.symbolInstances.length;d++){const m=this.symbolInstances.get(d);this._addTextDebugCollisionBoxes(u,e,i,m.textBoxStartIndex,m.textBoxEndIndex,m),this._addTextDebugCollisionBoxes(u,e,i,m.verticalTextBoxStartIndex,m.verticalTextBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.iconBoxStartIndex,m.iconBoxEndIndex,m),this._addIconDebugCollisionBoxes(a,e,i,m.verticalIconBoxStartIndex,m.verticalIconBoxEndIndex,m)}}getSymbolInstanceTextSize(e,i,o,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),d=mw(this.textSizeData,e,u)/Rr;return this.tilePixelRatio*d}getSymbolInstanceIconSize(e,i,o){const a=this.icon.placedSymbolArray.get(o),u=mw(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,o,a){e.emplaceBack(i,-o,-o,a),e.emplaceBack(i,o,-o,a),e.emplaceBack(i,o,o,a),e.emplaceBack(i,-o,o,a)}_updateTextDebugCollisionBoxes(e,i,o,a,u,d,m){for(let y=a;y<u;y++){const x=o.get(y),T=this.getSymbolInstanceTextSize(e,d,i,y);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,T,x.padding,d.zOffset)}}_updateIconDebugCollisionBoxes(e,i,o,a,u,d,m){for(let y=a;y<u;y++){const x=o.get(y),T=this.getSymbolInstanceIconSize(e,i,d.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,T,x.padding,d.zOffset)}}updateCollisionDebugBuffers(e,i,o,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=xp(this.iconSizeData,e,a),d=xp(this.textSizeData,e,o);for(let m=0;m<this.symbolInstances.length;m++){const y=this.symbolInstances.get(m);this._updateTextDebugCollisionBoxes(d,e,i,y.textBoxStartIndex,y.textBoxEndIndex,y,o),this._updateTextDebugCollisionBoxes(d,e,i,y.verticalTextBoxStartIndex,y.verticalTextBoxEndIndex,y,o),this._updateIconDebugCollisionBoxes(u,e,i,y.iconBoxStartIndex,y.iconBoxEndIndex,y,a),this._updateIconDebugCollisionBoxes(u,e,i,y.verticalIconBoxStartIndex,y.verticalIconBoxEndIndex,y,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,o,a,u,d,m,y,x){const T={};if(i<o){const{x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y,featureIndex:re}=e.get(i);T.textBox={x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y},T.textFeatureIndex=re}if(a<u){const{x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y,featureIndex:re}=e.get(a);T.verticalTextBox={x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y},T.verticalTextFeatureIndex=re}if(d<m){const{x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y,featureIndex:re}=e.get(d);T.iconBox={x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y},T.iconFeatureIndex=re}if(y<x){const{x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y,featureIndex:re}=e.get(y);T.verticalIconBox={x1:S,y1:I,x2:M,y2:P,padding:k,projectedAnchorX:V,projectedAnchorY:N,projectedAnchorZ:$,tileAnchorX:q,tileAnchorY:Y},T.verticalIconFeatureIndex=re}return T}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const o=e.placedSymbolArray.get(i),a=o.vertexStartIndex+4*o.numGlyphs;for(let u=o.vertexStartIndex;
vendor: 8,827 bytes, line 53
53u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),o=Math.cos(e),a=[],u=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const y=this.symbolInstances.get(m);a.push(0|Math.round(i*y.tileAnchorX+o*y.tileAnchorY)),u.push(y.featureIndex)}return d.sort((m,y)=>a[m]-a[y]||u[y]-u[m]),d}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===i?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:d,verticalPlacedTextSymbolIndex:m,placedIconSymbolIndex:y,verticalPlacedIconSymbolIndex:x}=o;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),d>=0&&d!==u&&d!==a&&this.addIndicesForPlacedSymbol(this.text,d),m>=0&&this.addIndicesForPlacedSymbol(this.text,m),y>=0&&this.addIndicesForPlacedSymbol(this.icon,y),x>=0&&this.addIndicesForPlacedSymbol(this.icon,x)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let o;return this.elevationFeatures&&i<this.elevationFeatures.length&&(o=this.elevationFeatures[i]),o}}function WI(n,e){return e.replace(/{([^{}]+)}/g,(i,o)=>o in n?String(n[o]):"")}let XI,YI,Sw;At(v0,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),v0.addDynamicAttributes=Sp;class KI{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Ms,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}At(KI,"FormatSectionOverride",{omit:["defaultValue"]});const Ew=()=>Sw||(Sw={layout:XI||(XI=new Un({"symbol-placement":new ct(be.layout_symbol["symbol-placement"]),"symbol-spacing":new ct(be.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ct(be.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new _t(be.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ct(be.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new ct(be.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new ct(be.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new ct(be.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ct(be.layout_symbol["icon-ignore-placement"]),"icon-optional":new ct(be.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ct(be.layout_symbol["icon-rotation-alignment"]),"icon-size":new _t(be.layout_symbol["icon-size"]),"icon-size-scale-range":new ct(be.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new _t(be.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _t(be.layout_symbol["icon-text-fit-padding"]),"icon-image":new _t(be.layout_symbol["icon-image"]),"icon-image-use-theme":new ct({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new _t(be.layout_symbol["icon-rotate"]),"icon-padding":new ct(be.layout_symbol["icon-padding"]),"icon-keep-upright":new ct(be.layout_symbol["icon-keep-upright"]),"icon-offset":new _t(be.layout_symbol["icon-offset"]),"icon-anchor":new _t(be.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ct(be.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ct(be.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ct(be.layout_symbol["text-rotation-alignment"]),"text-field":new _t(be.layout_symbol["text-field"]),"text-font":new _t(be.layout_symbol["text-font"]),"text-size":new _t(be.layout_symbol["text-size"]),"text-size-scale-range":new ct(be.layout_symbol["text-size-scale-range"]),"text-max-width":new _t(be.layout_symbol["text-max-width"]),"text-line-height":new _t(be.layout_symbol["text-line-height"]),"text-letter-spacing":new _t(be.layout_symbol["text-letter-spacing"]),"text-justify":new _t(be.layout_symbol["text-justify"]),"text-radial-offset":new _t(be.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ct(be.layout_symbol["text-variable-anchor"]),"text-anchor":new _t(be.layout_symbol["text-anchor"]),"text-max-angle":new ct(be.layout_symbol["text-max-angle"]),"text-writing-mode":new ct(be.layout_symbol["text-writing-mode"]),"text-rotate":new _t(be.layout_symbol["text-rotate"]),"text-padding":new ct(be.layout_symbol["text-padding"]),"text-keep-upright":new ct(be.layout_symbol["text-keep-upright"]),"text-transform":new _t(be.layout_symbol["text-transform"]),"text-offset":new _t(be.layout_symbol["text-offset"]),"text-allow-overlap":new ct(be.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ct(be.layout_symbol["text-ignore-placement"]),"text-optional":new ct(be.layout_symbol["text-optional"]),visibility:new ct(be.layout_symbol.visibility)})),paint:YI||(YI=new Un({"icon-opacity":new _t(be.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new _t(be.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new _t(be.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new _t(be.paint_symbol["text-emissive-strength"]),"icon-color":new _t(be.paint_symbol["icon-color"]),"icon-halo-color":new _t(be.paint_symbol["icon-halo-color"]),"icon-halo-width":new _t(be.paint_symbol["icon-halo-width"]),"icon-halo-blur":new _t(be.paint_symbol["icon-halo-blur"]),"icon-translate":new ct(be.paint_symbol["icon-translate"]),"icon-translate-anchor":new ct(be.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ct(be.paint_symbol["icon-image-cross-fade"]),"text-opacity":new _t(be.paint_symbol["text-opacity"]),"text-occlusion-opacity":new _t(be.paint_symbol["text-occlusion-opacity"]),"text-color":new _t(be.paint_symbol["text-color"],{runtimeType:Eo,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new _t(be.paint_symbol["text-halo-color"]),"text-halo-width":new _t(be.paint_symbol["text-halo-width"]),"text-halo-blur":new _t(be.paint_symbol["text-halo-blur"]),"text-translate":new ct(be.paint_symbol["text-translate"]),"text-translate-anchor":new ct(be.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new ct(be.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new ct(be.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new ct(be.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new ct(be.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new _t(be.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},Sw);class x0 extends go{constructor(e,i,o,a){super(e,Ew(),i,o,a,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Ft([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEac
vendor: 27,763 bytes, line 53
53h(a=>{a.recalculate(e,i,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const o=this.layout.get("text-writing-mode");if(o){const a=[];for(const u of o)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,o,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===o&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(u,d,m,y){u=Bn(u),d=Gi(d);const x=mt(),T=u/3,S=1-2*T,I=[S,T,T,0,T,S,T,0,T,T,S,0,0,0,0,1],M=.5-.5*d,P=y-m;return Se(x,[P,0,0,0,0,P,0,0,0,0,P,0,m,m,m,1],[d,0,0,0,0,d,0,0,0,0,d,0,M,M,M,1]),Se(x,x,I),x}(e,i,o,a),this._saturation=e,this._contrast=i,this._brightnessMin=o,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,o,a){const u=this.layout.get(e).evaluate(i,{},o,a),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||qu(d.value)||!u?u:WI(i.properties,u)}getAppearanceValueAndResolveTokens(e,i,o,a,u){const d=e.getProperty(i);if(!d)return;const m=d.evaluate(o,{},a,u),y=e.getUnevaluatedProperties()._values[i];return y.isDataDriven()||qu(y.value)||!m||typeof m!="string"?m:WI(o.properties,m)}createBucket(e){return new v0(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Ew().paint.overridableProperties){if(!x0.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),o=new KI(i),a=new Rd(o,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new Uc("source",a):new ql("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Wl(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,o){return!(!this.layout||i.isDataDriven()||o.isDataDriven())&&x0.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const o=e.get("text-field"),a=Ew().paint.properties[i];let u=!1;const d=m=>{for(const y of m)if(a.overrides&&a.overrides.hasOverride(y))return void(u=!0)};if(o.value.kind==="constant"&&o.value.value instanceof po)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{u||(x instanceof Ia&&Pr(x.value)===Ru?d(x.value.sections):x instanceof ta?d(x.sections):x.eachChild(m))},y=o.value;y._styleExpression&&m(y._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,o){return{config:new gl(this,{zoom:i,lut:o}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let JI,QI,eA,tA;var Iw=Ai([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function w0(n,e,i,o,a,u,d,m){const y=[n,e,1,i,o,1,a,u,1],x=[d,m,1],T=He([],y),[S,I,M]=Jn(x,x,T);return vt(y,y,[S,0,0,0,I,0,0,0,M])}function iA(n,e,i,o,a,u,d,m){const y=function(x,T,S,I,M,P,k,V){const N=w0(0,0,1,0,1,1,0,1),$=w0(x,T,S,I,M,P,k,V);return vt($,$,He([],N))}(n,e,i,o,a,u,d,m);return[y[2]/y[8]/ht,y[5]/y[8]/ht]}function b0(n){return[n[0],Math.min(Math.max(n[1],-D),D)]}class nA extends Vl{constructor(e,i,o,a){super(),this.id=e,this.dispatcher=o,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Qs("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Jh(this.map._requestManager.transformRequest(this.url,Su.Image),(o,a)=>{this._imageRequest=null,this._loaded=!0,o?this.fire(new Cu(o)):a&&(this.image=a instanceof HTMLImageElement?Mr.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Zm(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Qs("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Zm||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],o=e[0][1];for(const u of e)u[1]>o&&(o=u[1]),u[1]<i&&(i=u[1]);const a=(o+i)/2;if(a>D?this.onNorthPole=!0:a<-D&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(Z.fromLngLat);this.tileID=function(d){let m=1/0,y=1/0,x=-1/0,T=-1/0;for(const k of d)m=Math.min(m,k.x),y=Math.min(y,k.y),x=Math.max(x,k.x),T=Math.max(T,k.y);const S=Math.max(x-m,T-y),I=Math.max(0,Math.floor(-Math.log2(S))),M=Math.pow(2,I);let P=Math.floor((m+x)/2*M);return P>1&&(P-=1),new mn(I,P,Math.floor((y+T)/2*M))}(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Qs("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Zm||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const N in this.tiles){const $=this.tiles[N];$.state!=="loaded"&&($.state="loaded",$.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=i_(new mn(0,0,0),this.map.transform.projection),o=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(N){const $=N[1].x-N[0].x,q=N[1].y-N[0].y,Y=N[2].x-N[1].x,re=N[2].y-N[1].y,ee=N[3].x-N[2].x,ae=N[3].y-N[2].y,he=N[0].x-N[3].x,me=N[0].y-N[3].y,De=$*re-Y*q,xe=Y*ae-ee*re,Be=ee*me-he*ae,Ge=he*q-$*me;return De>0&&xe>0&&Be>0&&Ge>0||De<0&&xe<0&&Be<0&&Ge<0}(o))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=i_(this.tileID,this.map.transform.projection),[u,d,m,y]=this.coordinates.map(N=>{const $=a.projection.project(N[0],N[1]);return UI(a,$)._round()});this.perspectiveTransform=iA(u.x,u.y,d.x,d.y,m.x,m.y,y.x,y.y);const x=this._boundsArray=new qc;x.emplaceBack(u.x,u.y,0,0),x.emplaceBack(d.x,d.y,ht,0),x.emplaceBack(y.x,y.y,0,ht),x.emplaceBack(m.x,m.y,ht,ht),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(x,Iw.members),this.boundsSegments=zn.simpleSegment(0,0,4,2);const T=[],S=[b0((I=this.coordinates)[0]),b0(I[1]),b0(I[2]),b0(I[3])];var I;const[M,P,k,V]=function(N){let $=N[0][0],q=$,Y=N[0][1],re=Y;for(let ee=1;ee<N.length;ee++)N[ee][0]<$?$=N[ee][0]:N[ee][0]>q&&(q=N[ee][0]),N[ee][1]<Y?Y=N[ee][1]:N[ee][1]>re&&(re=N[ee][1]);return[$,Y,q-$,re-Y]}(S);{const N=new qc,[$,q,Y,re]=function(We){let Xe=We[0].x,Fe=Xe,ke=We[0].y,Ye=ke;for(let pt=1;pt<We.length;pt++)We[pt].x<Xe?Xe=We[pt].x:We[pt].x>Fe&&(Fe=We[pt].x),We[pt].y<ke?ke=We[pt].y:We[pt].y>Ye&&(Ye=We[pt].y);return[Xe,ke,Fe-Xe,Ye-ke]}(o),ee=We=>[(We.x-$)/Y,(We.y-q)/re],[ae,he,me,De]=o.map(ee),xe=function(We,Xe,Fe,ke,Ye,pt,ot,Ot){const wt=w0(0,0,1,0,1,1,0,1);return vt(wt,wt,He([],w0(We,Xe,Fe,ke,Ye,pt,ot,Ot)))}(ae[0],ae[1],he[0],he[1],me[0],me[1],De[0],De[1]);this.elevatedGlobePerspectiveTransform=iA(ae[0],ae[1],he[0],he[1],me[0],me[1],De[0],De[1]);const Be=(We,Xe)=>{T.push(We.lng);const Fe=Math.round((We.lng-M)/k*ht),ke=Math.round((We.lat-P)/V*ht),Ye=ee(Xe),pt=Jn([],[Ye[0],Ye[1],1],xe),ot=Math.round(pt[0]/pt[2]*ht),Ot=Math.round(pt[1]/pt[2]*ht);N.emplaceBack(Fe,ke,ot,Ot)},Ge=o[3].x-o[0].x,$e=o[3].y-o[0].y,Je=o[2].x-o[1].x,et=o[2].y-o[1].y;for(let We=0;We<65;We++){const Xe=We/64,Fe=[o[0].x+Xe*Ge,o[0].y+Xe*$e],ke=[o[1].x+Xe*Je,o[1].y+Xe*et],Ye=ke[0]-Fe[0],pt=ke[1]-Fe[1];for(let ot=0;ot<65;ot++){const Ot=ot/64,wt={x:Fe[0]+Ye*Ot,y:Fe[1]+pt*Ot};Be(i.projection.unproject(wt.x,wt.y),wt)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(N,Iw.members)}{this.maxLongitudeTriangleSize=0;let N=[],$=new mr;const q=(Y,re,ee)=>{$.emplaceBack(Y,re,ee);const ae=T[Y],he=T[re],me=T[ee],De=Math.min(Math.min(ae,he),me),xe=Math.max(Math.max(ae,he),me)-De;xe>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=xe),N.push(De+xe/2)};for(let Y=0;Y<64;Y++)for(let re=0;re<64;re++){const ee=65*Y+re,ae=ee+1,he=ee+65,me=he+1;q(ee,he,ae),q(ae,he,me)}[N,$]=function(Y,re){const ee=Array.from({length:Y.length},(me,De)=>De);ee.sort((me,De)=>Y[me]-Y[De]);const ae=[],he=new mr;for(let me=0;me<ee.length;me++){const De=ee[me];ae.push(Y[De]);const xe=3*De,Be=xe+1;he.emplaceBack(re.uint16[xe],re.uint16[Be],re.uint16[Be+1])}return[ae,he]}(N,$),this.elevatedGlobeTrianglesCenterLongitudes=N,this.elevatedGlobeIndexBuffer=e.createIndexBuffer($)}this.elevatedGlobeSegments=zn.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,k/ht,0,V/ht,0,0,P,M,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,o=i.gl;!this._dirty||this.texture instanceof Zm||(this.texture?this.texture.update(this.image):(this.texture=new K1(i,this.image,o.RGBA8),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const o=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((o[0]-u)/360);var u;const d=new zn,m=(S,I)=>{d.segments.push({vertexOffset:0,primitiveOffset:S,vertexLength:i.segments[0].vertexLength,primitiveLength:I,sortKey:void 0,vaos:{}})},y=.51*this.maxLongitudeTriangleSize;if(Math.abs(o[0]-a)<=y){const S=Fn(o,0,o.length,a+y);return S===o.length||m(S,dr(o,S+1,o.length,a+360-y)-S),d}a<o[0]&&(a+=360);const x=dr(o,0,o.length,a-y);if(x===o.length)return m(0,o.length),d;m(0,x-0);const T=Fn(o,x+1,o.length,a+y);return T!==o.length&&m(T,o.length-T),d}}const Jz=(Math.pow(256,2)-1)/16907520;class rA extends go{constructor(e,i,o,a){super(e,{layout:eA||(eA=new Un({visibility:new ct(be.layout_raster.visibility)})),paint:tA||(tA=new Un({"raster-opacity":new ct(be.paint_raster["raster-opacity"]),"raster-color":new Yl(be.paint_raster["raster-color"]),"raster-color-mix":new ct(be.paint_raster["raster-color-mix"]),"raster-color-range":new ct(be.paint_raster["raster-color-range"]),"raster-hue-rotate":new ct(be.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ct(be.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ct(be.paint_raster["raster-brightness-max"]),"raster-saturation":new ct(be.paint_raster["raster-saturation"]),"raster-contrast":new ct(be.paint_raster["raster-contrast"]),"raster-resampling":new ct(be.paint_raster["raster-resampling"]),"raster-fade-duration":new ct(be.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new ct(be.paint_raster["raster-emissive-strength"]),"raster-array-band":new ct(be.paint_raster["raster-array-band"]),"raster-elevation":new ct(be.paint_raster["raster-elevation"]),"raster-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof nA&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[o,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(o)&&isNaN(a)||o===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Lm({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:o,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[o,a])}}let oA,sA,aA,lA,cA;class uA extends go{constructor(e,i,o,a){super(e,{layout:oA||(oA=new Un({visibility:new ct(be["layout_raster-particle"].visibility)})),paint:sA||(sA=new Un({"raster-particle-array-band":new ct(be["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new ct(be["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Yl(be["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new ct(be["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new ct(be["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new ct(be["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new ct(be["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new ct(be["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this._updateColorRamp(),this.lastInvalidatedAt=Mr.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Lm({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Mr.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Qz extends go{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Aw(n,e,i){const o=[0,0,1],a=Qa([]);return Is(a,a,i?-qi(n)+Math.PI:qi(n)),$o(a,a,-qi(e)),Ss(o,o,a),un(o,o)}const hA={None:0,Model:1,Symbol:2,FillExtrusion:4};class T0{constructor(e,i,o,a){this.message=(e?`${e}: `:"")+o,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function Cw(n,e){const i=n.indexOf("://")===-1;try{return new URL(n,i&&e?"http://example.com":void 0),!0}catch{return!1}}class dA{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class pA{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new wm,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=Math.floor(o[i+2]);const u=1.05*(o[i+2]-a);return a/=100,[o[i]%1*1.05,o[i+1]%1*1.05,u,a]}tileCoordinatesForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=o[i+0];return a=a>ht?a-ht:a,new Ke(Math.trunc(a),Math.trunc(o[i+1]))}translationForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+4],o[i+5],o[i+6]]}rotationScaleForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+10],o[i+11],o[i+12],o[i+13],o[i+14],o[i+15]]}transformForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+4],o[i+10],o[i+11],o[i+12],o[i+5],o[i+13],o[i+14],o[i+15],o[i+6],0,0,0,1]}}class Mw{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+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=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){}populate(e,i,o,a){this.tileToMeter=U(o);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:d,id:m,index:y,sourceLayerIndex:x}of e){const T=m??(d.properties&&d.properties.hasOwnProperty("id")?d.properties.id:void 0),S=ve(d,u);if(!this.layers[0]._featureFilter.filter(new bn(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),S,o))continue;const I={id:T,sourceLayerIndex:x,index:y,geometry:u?S.geometry:ce(d,o,a),properties:d.properties,type:d.type,patterns:{}},M=this.addFeature(I,I.geometry,S);M&&i.featureIndex.insert(d,I.geometry,y,x,this.index,this.instancesPerModel[M].instancedDataArray.length,ht/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let o=0;for(const a of this.modelUris){const u=e.getModel(a,i);if(!u)continue;const d=this.instancesPerModel[a];if(d){const m=.5*Sn(u.aabb.max,u.aabb.min)*d.maxScale+d.maxXYTranslationDistance,y=Math.min(ht,Math.max(m/this.tileToMeter,ht/32));o=Math.max(y,o)}}return o}update(e,i,o,a){for(const u in this.instancesPerModel){const d=this.instancesPerModel[u];for(const m in e)d.idToFeaturesIndex.hasOwnProperty(m)&&(this.evaluate(d.features[d.idToFeaturesIndex[m]],e[m],d,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];for(const a of o.features){const u=this.layers[0],d=a.feature,m=this.canonical,y=u.paint.get("model-rotation").evaluate(d,{},m),x=u.paint.get("model-scale").evaluate(d,{},m),T=u.paint.get("model-translation").evaluate(d,{},m);jr(a.rotation,y)&&jr(a.scale,x)&&jr(a.translation,T)||(this.evaluate(a,a.featureStates,o,!0),e=!0)}}return e}updateReplacement(e,i,o,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Zy(this.activeReplacements,u))return!1;this.activeReplacements=u;let d=!1;for(const m in this.instancesPerModel){const y=this.instancesPerModel[m],x=y.instancedDataArray;for(const T of y.features){const S=T.instancedDataOffset,I=T.instancedDataCount;for(let M=0;M<I;M++){const P=16*(M+S);let k=x.float32[P+0];const V=k>ht;k=V?k-ht:k;const N=Math.floor(k),$=Math.floor(x.float32[P+1]);let q=!1;for(const Y of this.activeReplacements)if(!QS(Y,o,hA.Model,a)&&!(Y.min.x>N||N>Y.max.x||Y.min.y>$||$>Y.max.y)&&(q=rE(nE(N,$,e.canonical,Y.footprintTileId.canonical),Y.footprint),q))break;x.float32[P]=q?k+ht:k,d=d||q!==V}}}return d}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length<0||o.instancedDataArray.length===0||(o.instancedDataBuffer?o.instancedDataBuffer.updateData(o.instancedDataArray):o.instancedDataBuffer=e.createVertexBuffer(o.instancedDataArray,bL.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const o in this.instancesPerModel){const a=this.instancesPerModel[o];a.instancedDataArray.length!==0&&a.instancedDataBuffer&&a.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const o of this.modelUris)i.removeModel(o,"",!0)}addFeature(e,i,o){const a=this.layers[0],u=a.layout.get("model-id").evaluate(o,{},this.canonical);if(!u)return Tt(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),u;(Cw(u,!1)||this.styleDefinedModelURLs[u]!==void 0)&&(this.modelUris.includes(u)||this.modelUris.push(u)),this.instancesPerModel[u]||(this.instancesPerModel[u]=new pA);const d=this.instancesPerModel[u],m=d.instancedDataArray,y=new dA(o,m.length);for(const x of i)for(const T of x){if(T.x<0||T.x>=ht||T.y<0||T.y>=ht)continue;if(this.lookupDim!==0){const I=(this.lookupDim-1)/ht,M=this.lookupDim*(T.y*I|0)+T.x*I|0;if(this.lookup){if(this.lookup[M]!==0)continue;this.lookup[M]=1}}this.instanceCount++;const S=m.length;m.resize(S+1),d.instancesEvaluatedElevation.push(0),m.float32[16*S]=T.x,m.float32[16*S+1]=T.y}return y.instancedDataCount=d.instancedDataArray.length-y.instancedDataOffset,y.instancedDataCount>0&&(e.id&&(d.idToFeaturesIndex[e.id]=d.features.length),d.features.push(y),this.evaluate(y,{},d,!1)),u}getModelUris(){return this.modelUris}evaluate(e,i,o,a){const u=this.layers[0],d=e.feature,m=this.canonical,y=e.rotation=u.paint.get("model-rotation").evaluate(d,i,m),x=e.scale=u.paint.get("model-scale").evaluate(d,i,m),T=e.translation=u.paint.get("model-translation").evaluate(d,i,m),S=Object.assign({},u.paint.get("model-color").evaluate(d,i,m));S.a=u.paint.get("model-color-mix-intensity").evaluate(d,i,m);const I=[];this.maxVerticalOffset<T[2]&&(this.maxVerticalOffset=T[2]);const M=T[0]*T[0]+T[1]*T[1],P=M>0?Math.sqrt(M):0;o.maxScale=Math.max(Math.max(o.maxScale,x[0]),Math.max(x[1],x[2])),o.maxXYTranslationDistance=Math.max(o.maxXYTranslationDistance,P),this.maxScale=Math.max(Math.max(this.maxScale,x[0]),Math.max(x[1],x[2])),$E(I,y,x);const k=Math.round(100*S.a)+S.b/1.05;for(let V=0;V<e.instancedDataCount;++V){const N=e.instancedDataOffset+V,$=16*N,q=o.instancedDataArray.float32;let Y=0;a&&(Y=q[$+6]-o.instancesEvaluatedElevation[N]);const re=0|q[$+1];q[$]=(0|q[$])+S.r/1.05,q[$+1]=re+S.g/1.05,q[$+2]=k,q[$+3]=1/(m.z>10?this.tileToMeter:U(m,re)),q[$+4]=T[0],q[$+5]=T[1],q[$+6]=T[2]+Y,q[$+7]=I[0],q[$+8]=I[1],q[$+9]=I[2],q[$+10]=I[4],q[$+11]=I[5],q[$+12]=I[6],q[$+13]=I[8],q[$+14]=I[9],q[$+15]=I[10],o.instancesEvaluatedElevation[N]=T[2]}}}let fA,mA;At(Mw,"ModelBucket",{omit:["layers"]}),At(pA,"PerModelAttributes"),At(dA,"ModelFeature");class Ep{constructor(e,i,o){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=o}static create(e,i,o){const a=o||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,d=a.tileID,m=1<<i.canonical.z-d.canonical.z;return new Ep(a,u.dim/ht/m,[(i.canonical.x/m-d.canonical.x)*u.dim,(i.canonical.y/m-d.canonical.y)*u.dim])}tileCoordToPixel(e,i){const o=i*this._scale+this._offset[1];return new Ke(Math.floor(e*this._scale+this._offset[0]),Math.floor(o))}getElevationAt(e,i,o,a){const u=e*this._scale+this._offset[0],d=i*this._scale+this._offset[1],m=Math.floor(u),y=Math.floor(d),x=this._dem;return a=!!a,o?Qt(Qt(x.get(m,y,a),x.get(m,y+1,a),d-y),Qt(x.get(m+1,y,a),x.get(m+1,y+1,a),d-y),u-m):x.get(m,y,a)}getElevationAtPixel(e,i,o){return this._dem.get(e,i,!!o)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*E(1,e)*this._dem.stride}}const Pw=new Float32Array(262144),fh=new Uint8Array(262144);function _A(n){let e=0;if(n.meshes)for(const i of n.meshes)e=Math.max(e,i.aabb.max[2]);if(n.children)for(const i of n.children)e=Math.max(e,_A(i));return e}function gA(n,e,i){if(n.meshes)for(const o of n.meshes){if(o.aabb.min[0]===1/0)continue;const a=zt.applyTransform(o.aabb,n.globalMatrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(n.children)for(const o of n.children)gA(o,e,i)}const yA=["","wall","door","roof","window","lamp","logo"];class vA{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:_A(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new zt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const o of this.node.meshes)this.node.lightMeshIndex!==e&&(o.transformedAabb=zt.applyTransformFast(o.aabb,this.node.globalMatrix),i.encapsulate(
53o.transformedAabb)),e++;this.aabb=i}return this.aabb}}class S0{constructor(e,i,o,a,u,d,m,y){this.id=o,this.layers=e,this.layerIds=this.layers.map(x=>x.fqid),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.modelTraits|=_p.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=_p.HasMapboxMeshFeatures),u&&(this.modelTraits|=_p.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=d,this.worldview=y,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const x of i)this.nodesInfo.push(new vA(x)),gA(x,m.featureIndexArray.length,m.grid),m.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,m.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const o of this.getNodesInfo()){const a=o.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,o,a){}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const o=i?this.stateDependentLayers:this.layers;if(!Ta(e,this.states))for(const a of o)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const o of i){const a=o.node;this.uploaded?this.updatePbrBuffer(a):ew(a,e,!0)}for(const o of i)o0(o.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const o of e.meshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);return i}needsReEvaluation(e,i,o){const a=e.transform.projectionOptions,u=e.style.getBrightness(),d=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||u_(o.paint.get("model-color").value,d)||u_(o.paint.get("model-color-mix-intensity").value,d)||u_(o.paint.get("model-roughness").value,d)||u_(o.paint.get("model-emissive-strength").value,d)||u_(o.paint.get("model-height-based-emissive-strength-multiplier").value,d)){this.projection=a,this.brightness=u;const m=this.getNodesInfo();for(const y of m)y.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const o=this.getNodesInfo(),a=this.id.canonical;for(const u of o){const d=u.feature;u.evaluatedTranslation=i.paint.get("model-translation").evaluate(d,{},a),u.evaluatedScale=i.paint.get("model-scale").evaluate(d,{},a)}}evaluate(e,i){const o=this.getNodesInfo();for(const a of o){if(!a.node.meshes)continue;const u=a.feature,d=i&&i[u.id];if(Ta(d,a.state))continue;a.state=structuredClone(d);const m=a.node.meshes&&a.node.meshes[0].featureData,y=a.evaluatedColor[2],x=a.evaluatedRMEA[2],T=this.id.canonical;if(a.hasTranslucentParts=!1,m){for(let S=0;S<yA.length;S++){const I=yA[S];I.length&&(u.properties.part=I);const M=e.paint.get("model-color").evaluate(u,d,T).toPremultipliedRenderColor(null),P=e.paint.get("model-color-mix-intensity").evaluate(u,d,T);a.evaluatedColor[S]=[M.r,M.g,M.b,P],a.evaluatedRMEA[S][0]=e.paint.get("model-roughness").evaluate(u,d,T),a.evaluatedRMEA[S][2]=e.paint.get("model-emissive-strength").evaluate(u,d,T),a.evaluatedRMEA[S][3]=M.a,a.emissionHeightBasedParams[S]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,d,T),!a.hasTranslucentParts&&M.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,tD(a,y!==a.evaluatedColor[2]||x!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,d,T);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,d,T),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,d,T),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,o,a){const u=e.findDEMTileFor(o);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const d=Ep.create(e,o,u);if(!d)return;
53this.modelTraits&_p.HasMapboxMeshFeatures&&this.updateDEM(e,d,o,a);for(const m of this.getNodesInfo()){const y=m.node;if(!y.footprint||!y.footprint.vertices||!y.footprint.vertices.length)continue;const x=y.footprint.vertices;let T=d.getElevationAt(x[0].x,x[0].y,!0,!0);for(let S=1;S<x.length;S++)T=Math.min(T,d.getElevationAt(x[S].x,x[S].y,!0,!0));y.elevation=T}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,o,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(o.canonical))return;const d=i._dem.dim;u.push(o.canonical);let m=!1;for(const y of this.getNodesInfo()){const x=y.node;if(!x.footprint||!x.footprint.grid)continue;const T=x.footprint.grid,S=i.tileCoordToPixel(T.min.x,T.min.y),I=i.tileCoordToPixel(T.max.x,T.max.y),M=Math.min(Math.min(d-I.y,S.x),Math.min(S.y,d-I.x));if(M<0)continue;const P=j(M,2,5);let k=Math.max(0,S.x-P),V=Math.max(0,S.y-P),N=Math.min(I.x+P,d-1),$=Math.min(I.y+P,d-1);for(let ee=V;ee<=$;++ee)for(let ae=k;ae<=N;++ae)fh[ee*d+ae]=255;let q=0,Y=0;for(let ee=0;ee<T.cellsY;++ee)for(let ae=0;ae<T.cellsX;++ae){if(!T.cells[ee*T.cellsX+ae])continue;const he=i.tileCoordToPixel(T.min.x+ae/T.xScale,T.min.y+ee/T.yScale),me=i.tileCoordToPixel(T.min.x+(ae+1)/T.xScale,T.min.y+(ee+1)/T.yScale);for(let De=he.y;De<=Math.min(me.y+1,d-1);++De)for(let xe=he.x;xe<=Math.min(me.x+1,d-1);++xe)fh[De*d+xe]===255&&(fh[De*d+xe]=0,q+=i.getElevationAtPixel(xe,De),Y++)}const re=q/Y;k=Math.max(1,S.x-P),V=Math.max(1,S.y-P),N=Math.min(I.x+P,d-2),$=Math.min(I.y+P,d-2),m=!0;for(let ee=V;ee<=$;++ee)for(let ae=k;ae<=N;++ae)fh[ee*d+ae]===0&&(Pw[ee*d+ae]=i._dem.set(ae,ee,re));for(let ee=1;ee<P;++ee){k=Math.max(1,S.x-ee),V=Math.max(1,S.y-ee),N=Math.min(I.x+ee,d-2),$=Math.min(I.y+ee,d-2);for(let ae=V;ae<=$;++ae)for(let he=k;he<=N;++he){const me=ae*d+he;if(fh[me]===255){let De=0,xe=0,Be=-1,Ge=-1;for(let $e=-1;$e<=1;++$e)for(let Je=-1;Je<=1;++Je){const et=(ae+$e)*d+he+Je;if(fh[et]>=ee)continue;const We=Pw[et],Xe=Math.abs(We);Xe>xe&&(De=We,xe=Xe,Be=Je,Ge=$e)}if(xe>.1){const $e=1-(ee+.5*Math.abs(Be*Ge))/P;let Je=i._dem.get(he,ae)+De*$e;const et=i._dem.get(he+Be,ae+Ge),We=i._dem.get(he-Be,ae-Ge,!0);(Je-et)*(Je-We)>0&&(Je=(et+We)/2),Pw[me]=i._dem.set(he,ae,Je),fh[me]=ee}}}}}m&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Mr.now())}setFilter(e){this.filter=e?Vd(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new bn(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)o0(i.node),tw(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!o.find(d=>d.footprint===u)}}getHeightAtTileCoord(e,i){const o=[],a=[0,0,0],u=Ft([]);for(const d of this.getNodesInfo()){const m=d.node.meshes[0],y=m.transformedAabb;if(e<y.min[0]||i<y.min[1]||e>y.max[0]||i>y.max[1])continue;if(d.node.hidden===!0)return{height:1/0,maxHeight:d.feature.properties.height,hidden:!1,verticalScale:d.evaluatedScale[2]};Ve(u,d.node.globalMatrix),a[0]=e,a[1]=i,qn(a,a,u);const x=(a[0]-m.aabb.min[0])/(m.aabb.max[0]-m.aabb.min[0])*hh|0,T=Math.min(63,(a[1]-m.aabb.min[1])/(m.aabb.max[1]-m.aabb.min[1])*hh|0)*hh+Math.min(63,x),S=m.heightmap[T];if(!(S<0&&d.node.footprint))return d.hiddenByReplacement?void 0:{height:S,maxHeight:d.feature.properties.height,hidden:!1,verticalScale:d.evaluatedScale[2]};if(d.node.footprint.grid.query(new Ke(e,i),new Ke(e,i),o),o.length>0)return{height:void 0,maxHeight:d.feature.properties.height,hidden:d.hiddenByReplacement,verticalScale:d.evaluatedScale[2]}}}}function u_(n,e){return n instanceof Uc&&!n.isLightConstant&&e}function eD(n,e,i,o,a,u,d,m){let y=(61440&e|(61440&e)>>4)>>8,x=(3840&e|(3840&e)>>4)>>4,T=240&e|(240&e)>>4;i[3]>0&&(y=Qt(y,255*i[0],i[3]),x=Qt(x,255*i[1],i[3]),T=Qt(T,255*i[2],i[3]));const S=y<<8|x,I=T<<8|Math.floor(255*o[3]),M=function(ee){const ae=j(ee,0,2);return Math.min(Math.round(.5*ae*255),255)}(o[2])<<8|15*o[0]<<4|15*o[1],P=j(a[0],0,1),k=j(a[1],0,1),V=j(a[2],0,1),N=j(a[3],0,1);let $,q,Y,re;if(P!==k&&d!==u&&k!==P){const ee=d-u;q=1/(ee*(k-P)),Y=-(u+ee*P)/(ee*(k-P));const ae=j(a[4],-1,1);re=Math.pow(10,ae),$=255*V<<8|255*N}else $=65535,q=0,Y=1,re=1;
53if(n.emplaceBack(S,I,M,$,q,Y,re),m){const ee=m.length;m.clear();for(let ae=0;ae<ee;ae++)m.emplaceBack(S,I,M,$,q,Y,re)}}function tD(n,e,i){const o=n.node;let a=0;const u=i&_p.HasMeshoptCompression;for(const d of o.meshes){if(o.lights&&o.lightMeshIndex===a||!d.featureData)continue;d.featureArray=new Kd,d.featureArray.reserve(d.featureData.length);let m=e;for(const y of d.featureData){const x=u?65535&y:y>>16&65535,T=u?y>>16&65535:65535&y,S=(15&T)<8?15&T:0,I=n.evaluatedRMEA[S],M=n.evaluatedColor[S],P=n.emissionHeightBasedParams[S];let k;if(m&&S===2&&o.lights&&(k=new Kd,k.resize(10*o.lights.length)),eD(d.featureArray,x,M,I,P,d.aabb.min[2],d.aabb.max[2],k),k&&m){m=!1;const V=o.meshes[o.lightMeshIndex];V.featureArray=k,V.featureArray._trim()}}d.featureArray._trim(),a++}}At(S0,"Tiled3dModelBucket",{omit:["layers"]}),At(vA,"Tiled3dModelFeature");const iD=["id","tile","layer","source","sourceLayer","state"];class mh{constructor(e,i,o,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=o,this._y=a,this.properties=e?e.properties:{},this.id=u}clone(){const e=new mh(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of iD)this[i]!==void 0&&(e[i]=this[i]);return e}}class _h extends Vl{constructor(e,i,o,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i,this._modelsInfo=new Map}load(){const e=[];for(const i in this._options.models){const o=this._options.models[i],a=this._modelsInfo.get(i);if(a){const u=a.model;u.position=o.position!=null?new r(o.position[0],o.position[1]):new r(0,0),u.orientation=o.orientation!=null?o.orientation:[0,0,0],a.modelSpec=o,_h.applyModelSpecification(u,o),u.computeBoundsAndApplyParent(),this.models.push(u)}else{const u=VE(this.map._requestManager.transformRequest(o.uri,Su.Model).url).then(d=>{if(!d)return;const m=nw(d),y=new HE(i,o.uri,o.position,o.orientation,m);_h.applyModelSpecification(y,o),y.computeBoundsAndApplyParent(),this.models.push(y),this._modelsInfo.set(i,{modelSpec:o,model:y})}).catch(d=>{this.fire(new Cu(new Error(`Could not load model ${i} from ${o.uri}: ${d.message}`)))});e.push(u)}}Promise.allSettled(e).then(()=>{this._loaded=!0,this.fire(new Qs("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this._loaded=!0,this.fire(new Cu(new Error(`Could not load models: ${i.message}`)))})}static applyModelSpecification(e,i){i.nodeOverrides&&_h.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&_h.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(o=>typeof o=="string")){e.nodeOverrideNames=[];for(const o of i)e.nodeOverrideNames.push(o)}else Object.entries(i).forEach(([o,a])=>{const u={orientation:[0,0,0]};if(a.hasOwnProperty("orientation")){const d=a.orientation;d&&(u.orientation=d)}e.nodeOverrides.set(o,u)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(o=>typeof o=="string")){e.materialOverrideNames=[];for(const o of i)e.materialOverrideNames.push(o)}else Object.entries(i).forEach(([o,a])=>{const u={color:new rn(1,1,1),colorMix:0,emissionStrength:0,opacity:1},d=a["model-color"];d!==void 0&&(u.color.r=d[0],u.color.g=d[1],u.color.b=d[2]);const m=a["model-color-mix-intensity"];m!==void 0&&(u.colorMix=m);const y=a["model-emissive-strength"];y!==void 0&&(u.emissionStrength=y);const x=a["model-opacity"];x!==void 0&&(u.opacity=x),e.materialOverrides.set(o,u)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){const e=zs(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(e){this.models=[];const i=new Map;for(const o in e){const a=e[o];if(this._modelsInfo.has(o)){const u=this._modelsInfo.get(o);u&&u.modelSpec.uri===a.uri&&i.set(o,u)}}this._modelsInfo=i,this._options.models=e,this._loaded=!1,this.load()}}function Rw(n,e,i,o){const a=1<<n.z;e.lat=z((o/ht+n.y)/a),e.lng=C((i/ht+n.x)/a)}function nD(n,e,i,o){const a=n.getNodesInfo()[e];
vendor: 4,589 bytes, line 53
53if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const d=a.node,m=i.tile,y=o.calculatePosMatrix(m.tileID.toUnwrapped(),o.worldSize),x=a.evaluatedScale;let T=0;o.elevation&&d.elevation&&(T=d.elevation*o.elevation.exaggeration()),Ce(y,y,[(d.anchor?d.anchor[0]:0)*(x[0]-1),(d.anchor?d.anchor[1]:0)*(x[1]-1),T]),dt(y,y,x);const S=i.queryGeometry,I=S.isPointQuery()?S.screenBounds:S.screenGeometry,M=function(k){const V=Se([],y,k.globalMatrix);Se(V,o.expandedFarZProjMatrix,V);for(let N=0;N<k.meshes.length;++N){const $=k.meshes[N];if(N===k.lightMeshIndex)continue;const q=Q1(I,o,V,$.aabb);q!=null&&(u=Math.min(q,u))}if(k.children)for(const N of k.children)M(N)};if(M(d),u===Number.MAX_VALUE)return;const P=new r(0,0);return Rw(m.tileID.canonical,P,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:P,feature:a.feature}}const rD={circle:class extends go{constructor(n,e,i,o){super(n,{layout:Co||(Co=new Un({"circle-sort-key":new _t(be.layout_circle["circle-sort-key"]),"circle-elevation-reference":new ct(be.layout_circle["circle-elevation-reference"]),visibility:new ct(be.layout_circle.visibility)})),paint:Gn||(Gn=new Un({"circle-radius":new _t(be.paint_circle["circle-radius"]),"circle-color":new _t(be.paint_circle["circle-color"]),"circle-blur":new _t(be.paint_circle["circle-blur"]),"circle-opacity":new _t(be.paint_circle["circle-opacity"]),"circle-translate":new ct(be.paint_circle["circle-translate"]),"circle-translate-anchor":new ct(be.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ct(be.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ct(be.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new _t(be.paint_circle["circle-stroke-width"]),"circle-stroke-color":new _t(be.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new _t(be.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new ct(be.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}createBucket(n){return new on(n)}queryRadius(n){const e=n;return to("circle-radius",this,e)+to("circle-stroke-width",this,e)+$r(this.paint.get("circle-translate"))}queryIntersectsFeature(n,e,i,o,a,u,d,m){const y=_s(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,n.pixelToTileUnitsFactor),x=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return IS(n,o,u,d,m,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",y,x)}getProgramIds(){return["circle"]}getDefaultProgramParams(n,e,i){const o=ES(this);return{config:new gl(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}is3D(n){return!n&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends go{createBucket(n){return new CS(n)}constructor(n,e,i,o){super(n,{layout:MS||(MS=new Un({visibility:new ct(be.layout_heatmap.visibility)})),paint:PS||(PS=new Un({"heatmap-radius":new _t(be.paint_heatmap["heatmap-radius"]),"heatmap-weight":new _t(be.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ct(be.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yl(be.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ct(be.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(n){n==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Lm({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(n){return to("heatmap-radius",this,n)}queryIntersectsFeature(n,e,i,o,a,u,d,m){const y=this.paint.get("heatmap-radius").evaluate(e,i);return IS(n,o,u,d,m,!0,!0,new Ke(0,0),y)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(n,e,i){return n==="heatmap"?{config:new gl(this,{zoom:e,lut:i}
vendor: 17,202 bytes, line 53
53),overrideFog:!1}:{}}},hillshade:class extends go{constructor(n,e,i,o){super(n,{layout:RS||(RS=new Un({visibility:new ct(be.layout_hillshade.visibility)})),paint:LS||(LS=new Un({"hillshade-illumination-direction":new ct(be.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ct(be.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ct(be.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ct(be.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ct(be.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ct(be.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new ct(be.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}},fill:class extends go{constructor(n,e,i,o){super(n,{layout:ZS||(ZS=new Un({"fill-sort-key":new _t(be.layout_fill["fill-sort-key"]),visibility:new ct(be.layout_fill.visibility),"fill-elevation-reference":new ct(be.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new _t(be.layout_fill["fill-construct-bridge-guard-rail"])})),paint:WS||(WS=new Un({"fill-antialias":new ct(be.paint_fill["fill-antialias"]),"fill-opacity":new _t(be.paint_fill["fill-opacity"]),"fill-color":new _t(be.paint_fill["fill-color"]),"fill-outline-color":new _t(be.paint_fill["fill-outline-color"]),"fill-translate":new ct(be.paint_fill["fill-translate"]),"fill-translate-anchor":new ct(be.paint_fill["fill-translate-anchor"]),"fill-pattern":new _t(be.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new ct(be.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new ct(be.paint_fill["fill-emissive-strength"]),"fill-z-offset":new _t(be.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new _t(be.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new _t(be.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){const n=this.paint.get("fill-pattern"),e=n&&n.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(n,e,i){return{config:new gl(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(n,e){super.recalculate(n,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(n){return new O1(n)}queryRadius(){return $r(this.paint.get("fill-translate"))}queryIntersectsFeature(n,e,i,o,a,u){return!n.queryGeometry.isAboveHorizon&&Ji(Ko(n.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,n.pixelToTileUnitsFactor),o)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(n){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return n!=null?e&&!n:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends go{constructor(n,e,i,o){super(n,{layout:xE||(xE=new Un({visibility:new ct(be["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new ct(be["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:wE||(wE=new Un({"fill-extrusion-opacity":new ct(be["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new _t(be["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ct(be["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ct(be["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new _t(be["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new ct(be["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new _t(be["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new _t(be["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new ct(be["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new ct(be["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new ct(be["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new ct(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new ct(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new ct(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new ct(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new ct(be["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new ct(be["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new ct(be["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new _t(be["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new _t(be["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new ct(be["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new ct(be["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new ct(be["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new ct(be["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new _t(be["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new _t(be["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new ct(be["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new Xy(n)}queryRadius(){return $r(this.paint.get("fill-extrusion-translate"))}is3D(n){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(n,e,i,o,a,u,d,m,y){const x=_s(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,n.pixelToTileUnitsFactor),T=this.paint.get("fill-extrusion-height").evaluate(e,i),S=this.paint.get("fill-extrusion-base").evaluate(e,i),I=[0,0],M=m&&u.elevation,P=u.elevation?u.elevation.exaggeration():1,k=n.tile.getBucket(this);if(M&&k instanceof Xy){const Y=k.centroidVertexArray,re=y+1;re<Y.length&&(I[0]=Y.geta_centroid_pos0(re),I[1]=Y.geta_centroid_pos1(re))}if(I[0]===0&&I[1]===1)return!1;u.projection.name==="globe"&&(o=vE([o],[new Ke(0,0),new Ke(ht,ht)],n.tileID.canonical).map(Y=>Y.polygon).flat());const V=M?m:null,[N,$]=CE(u,o,S,T,x,d,V,I,P,u.center.lat,n.tileID.canonical),q=n.queryGeometry;return AE(N,$,q.isPointQuery()?q.screenBounds:q.screenGeometry)}},building:class extends go{constructor(n,e,i,o){super(n,{layout:JE||(JE=new Un({visibility:new ct(be.layout_building.visibility),"building-facade":new _t(be.layout_building["building-facade"]),"building-facade-floors":new _t(be.layout_building["building-facade-floors"]),"building-facade-unit-width":new _t(be.layout_building["building-facade-unit-width"]),"building-facade-window":new _t(be.layout_building["building-facade-window"]),"building-roof-shape":new _t(be.layout_building["building-roof-shape"]),"building-height":new _t(be.layout_building["building-height"]),"building-base":new _t(be.layout_building["building-base"]),"building-flood-light-wall-radius":new _t(be.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new _t(be.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new _t(be.layout_building["building-flip-roof-orientation"])})),paint:QE||(QE=new Un({"building-opacity":new ct(be.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new ct(be.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new ct(be.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new ct(be.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new ct(be.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new ct(be.paint_building["building-vertical-scale"]),"building-cast-shadows":new ct(be.paint_building["building-cast-shadows"]),"building-color":new _t(be.paint_building["building-color"]),"building-emissive-strength":new _t(be.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new ct(be.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new ct(be.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new ct(be.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new ct(be.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new ct(be.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new KE(n)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(n){return!0}queryRadius(n){return 0}queryIntersectsFeature(n,e,i,o,a,u,d,m,y){let x=this.layout.get("building-height").evaluate(e,i);const T=this.layout.get("building-base").evaluate(e,i),S=n.tile.getBucket(this).getFootprint(e);if(S){if(S.hiddenFlags!==0)return!1;x=S.height}const[I,M]=CE(u,o,T,x,new Ke(0,0),d,null,[0,0],1,u.center.lat,n.tileID.canonical),P=n.queryGeometry;return AE(I,M,P.isPointQuery()?P.screenBounds:P.screenGeometry)}},line:class extends go{constructor(n,e,i,o){const a=cI();super(n,a,e,i,o),a.layout&&(this.layout=new Xl(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Vu,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(n,e){super.recalculate(n,e),this.paint._values["line-floorwidth"]=(()=>{if(Xm)return Xm;const i=cI();return Xm=new JL(i.paint.properties["line-width"].specification),Xm.useIntegerZoom=!0,Xm})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new sw(n)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(n,e,i){const o=aI(this);return{config:new gl(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}queryRadius(n){const e=n,i=uI(to("line-width",this,e),to("line-gap-width",this,e)),o=to("line-offset",this,e);return i/2+Math.abs(o)+$r(this.paint.get("line-translate"))}queryIntersectsFeature(n,e,i,o,a,u){if(n.queryGeometry.isAboveHorizon)return!1;const d=Ko(n.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,n.pixelToTileUnitsFactor),m=n.pixelToTileUnitsFactor/2*uI(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),y=this.paint.get("line-offset").evaluate(e,i);return y&&(o=function(x,T){const S=[],I=new Ke(0,0);for(let M=0;M<x.length;M++){const P=x[M],k=[];for(let V=0;V<P.length;V++){const N=P[V],$=P[V+1],q=V===0?I:N.sub(P[V-1])._unit()._perp(),Y=V===P.length-1?I:$.sub(N)._unit()._perp(),re=q._add(Y)._unit();re._mult(1/(re.x*Y.x+re.y*Y.y)),k.push(re._mult(T)._add(N))}S.push(k)}return S}(o,y*n.pixelToTileUnitsFactor)),function(x,T,S){for(let I=0;I<T.length;I++){const M=T[I];if(x.length>=3){for(let P=0;P<M.length;P++)if(fn(x,M[P]))return!0}if(Nn(x,M,S))return!0}return!1}(d,o,m)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(n){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:x0,background:class extends go{constructor(n,e,i,o){super(n,{layout:JI||(JI=new Un({visibility:new ct(be.layout_background.visibility)})),paint:QI||(QI=new Un({"background-pitch-alignment":new ct(be.paint_background["background-pitch-alignment"]),"background-color":new ct(be.paint_background["background-color"]),"background-pattern":new ct(be.paint_background["background-pattern"]),"background-opacity":new ct(be.paint_background["background-opacity"]),"background-emissive-strength":new ct(be.paint_background["background-emissive-strength"]),"background-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(n,e,i){return{overrideFog:!1}}is3D(n){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:rA,"raster-particle":uA,sky:class extends go{constructor(n,e,i,o){super(n,{layout:aA||(aA=new Un({visibility:new ct(be.layout_sky.visibility)})),paint:lA||(lA=new Un({"sky-type":new ct(be.paint_sky["sky-type"]),"sky-atmosphere-sun":new ct(be.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ct(be.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ct(be.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ct(be.paint_sky["sky-gradient-radius"]),"sky-gradient":new Yl(be.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ct(be.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ct(be.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ct(be.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(n){n==="sky-gradient"?this._updateColorRamp():n!=="sky-atmosphere-sun"&&n!=="sky-atmosphere-halo-color"&&n!=="sky-atmosphere-color"&&n!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
53dated=!0)}_updateColorRamp(){this.colorRamp=Lm({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(n){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=n.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(n,e){if(this.paint.get("sky-type")==="atmosphere"){const o=this.paint.get("sky-atmosphere-sun"),a=!o,u=n.style.light,d=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&Tt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?Aw(d.azimuthal,90-d.polar,e):Aw(o[0],90-o[1],e)}const i=this.paint.get("sky-gradient-center");return Aw(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(n){this._skyboxInvalidated=!1,this._lightPosition=n.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const n=this.paint.get("sky-type");return n==="atmosphere"?["skyboxCapture","skybox"]:n==="gradient"?["skyboxGradient"]:null}},slot:class extends go{constructor(n,e,i,o){super(n,{paint:cA||(cA=new Un({}))},e,null)}},model:class extends go{constructor(n,e,i,o){super(n,{layout:fA||(fA=new Un({visibility:new ct(be.layout_model.visibility),"model-id":new _t(be.layout_model["model-id"])})),paint:mA||(mA=new Un({"model-opacity":new _t(be.paint_model["model-opacity"]),"model-rotation":new _t(be.paint_model["model-rotation"]),"model-scale":new _t(be.paint_model["model-scale"]),"model-translation":new _t(be.paint_model["model-translation"]),"model-color":new _t(be.paint_model["model-color"]),"model-color-mix-intensity":new _t(be.paint_model["model-color-mix-intensity"]),"model-type":new ct(be.paint_model["model-type"]),"model-cast-shadows":new ct(be.paint_model["model-cast-shadows"]),"model-receive-shadows":new ct(be.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new ct(be.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new _t(be.paint_model["model-emissive-strength"]),"model-roughness":new _t(be.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new _t(be.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new ct(be.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new ct(be.paint_model["model-front-cutoff"]),"model-elevation-reference":new ct(be.paint_model["model-elevation-reference"]),"model-color-use-theme":new _t({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this.layer=n,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(n){return new Mw(n)}getProgramIds(){return["model"]}is3D(n){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(n){return n instanceof S0?ht-1:0}queryRenderedFeatures(n,e,i){const o=e.getSource();if(!(o&&o instanceof _h))return{};const a=o,u={};u[this.id]=[];const d=u[this.id];let m=0;for(const y of a.models){const x=e.getFeatureState(this.sourceLayer,y.id),T={type:"Unknown",id:y.id,properties:y.featureProperties},S=this.paint.get("model-rotation").evaluate(T,x),I=this.paint.get("model-scale").evaluate(T,x),M=this.paint.get("model-translation").evaluate(T,x),P=this.paint.get("model-elevation-reference");let k=[];r0(k,y,i,y.position,S,I,M,P==="ground",P==="ground",!1),i.projection.name==="globe"&&(k=n0(k,i));const V=Se([],i.projMatrix,k),N=Q1(n.isPointQuery()?n.screenBounds:n.screenGeometry,i,V,y.aabb);if(N!=null){const $=new mh(void 0,0,0,0,y.id);$.layer=this.layer,$.properties=structuredClone(y.featureProperties),$.properties.layer=this.id,$.properties.uri=y.uri,$.properties.orientation=y.orientation,$.sourceLayer=this.sourceLayer,$.geometry={type:"Point",coordinates:[y.position.lng,y.position.lat]},$.state=x,$.source=this.source,d.push({featureIndex:m,feature:$,intersectionZ:N})}++m}return u}queryIntersectsFeature(n,e,i,o,a,u){if(!this.modelManager)return!1;const d=this.modelManager,m=n.tile.getBucket(this);if(!(m&&m instanceof Mw))return!1;for(const y in m.instancesPerModel){const x=m.instancesPerModel[y],T=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(x.idToFeaturesIndex.hasOwnProperty(T)){const S=x.features[x.idToFeaturesIndex[T]],I=d.getModel(y,this.scope);if(!I)return!1;let M=[];const P=new r(0,0),k=m.canonical;let V=Number.MAX_VALUE;for(let N=0;N<S.instancedDataCount;++N){const $=16*(S.instancedDataOffset+N),q=x.instancedDataArray.float32,Y=[q[$+4],q[$+5],q[$+6]];Rw(k,P,Math.floor(q[$]),Math.floor(q[$+1])),r0(M,I,u,P,S.rotation,S.scale,Y,!1,!1,!1),u.projection.name==="globe"&&(M=n0(M,u));const re=Se([],u.projMatrix,M),ee=n.queryGeometry,ae=Q1(ee.isPointQuery()?ee.screenBounds:ee.screenGeometry,u,re,I.aabb);ae!=null&&(V=Math.min(ae,V))}return V!==Number.MAX_VALUE&&V}}return!1}_handleOverridablePaintPropertyUpdate(n,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||n!=="model-color"&&n!=="model-color-mix-intensity"&&n!=="model-rotation"&&n!=="model-scale"&&n!=="model-translation"&&n!=="model-emissive-strength")}_isPropertyZoomDependent(n){const e=this._transitionablePaint._values[n];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof ql}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends go{constructor(n,e,i,o){super(n,{layout:XS||(XS=new Un({"clip-layer-types":ne
53w ct(be.layout_clip["clip-layer-types"]),"clip-layer-scope":new ct(be.layout_clip["clip-layer-scope"])})),paint:YS||(YS=new Un({}))},e,i,o)}recalculate(n,e){super.recalculate(n,e)}createBucket(n){return new KS(n)}is3D(n){return!0}}},Lw=new rn(0,0,0),zw={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},Dw={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},E0={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},oD={PAINT_ORDER_FILL_AND_STROKE:1},h_={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},xA={MASK_TYPE_LUMINANCE:1};function sD(n,e,i){n===1&&e.icons.push(function(o,a){return function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:d}=u;if(d.content_area){const{content_area:m}=d;m.left==null&&(m.left=0),m.top==null&&(m.top=m.left),m.width==null&&(m.width=u.usvg_tree.width),m.height==null&&(m.height=m.width)}if(d.text_placeholder){const{text_placeholder:m}=d;m.top==null&&(m.top=m.left),m.height==null&&(m.height=m.width)}return d.stretch_x&&d.stretch_x.length&&wA(d,"x"),d.stretch_y&&d.stretch_y.length&&wA(d,"y"),u}(o.readFields(aD,{name:void 0},a))}(i,i.readVarint()+i.pos))}function wA(n,e){const i=[],o=n[`stretch_${e}`];let a=null;for(let u=0;u<o.length;u++)a===null?a=i.length===0?o[0]:i[i.length-1][1]+o[u]:(i.push([a,a+o[u]]),a=null);n[`stretch_${e}_areas`]=i}function aD(n,e,i){n===1?e.name=i.readString():n===2?e.metadata=function(o,a){return o.readFields(lD,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):n===3&&(e.usvg_tree=function(o,a){return o.readFields(hD,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function lD(n,e,i){n===1?e.stretch_x=i.readPackedVarint():n===2?e.stretch_y=i.readPackedVarint():n===3?e.content_area=bA(i,i.readVarint()+i.pos):n===4?e.variables.push(function(o,a){return o.readFields(uD,{name:void 0},a)}(i,i.readVarint()+i.pos)):n===5&&(e.text_placeholder=bA(i,i.readVarint()+i.pos))}function bA(n,e){return n.readFields(cD,{},e)}function cD(n,e,i){n===1?e.left=i.readVarint():n===2?e.width=i.readVarint():n===3?e.top=i.readVarint():n===4&&(e.height=i.readVarint())}function uD(n,e,i){n===1?e.name=i.readString():n===2&&(e.rgb_color=C0(i.readVarint()),e.value="rgb_color")}function hD(n,e,i){n===1?e.width=e.height=i.readVarint():n===2?e.height=i.readVarint():n===3?e.children.push(I0(i,i.readVarint()+i.pos)):n===4?e.linear_gradients.push(function(o,a){return o.readFields(yD,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):n===5?e.radial_gradients.push(function(o,a){return o.readFields(xD,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):n===7?e.clip_paths.push(function(o,a){return o.readFields(wD,{children:[]},a)}(i,i.readVarint()+i.pos)):n===8&&e.masks.push(function(o,a){const u=o.readFields(bD,{left:0,width:20,mask_type:xA.MASK_TYPE_LUMINANCE,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u}(i,i.readVarint()+i.pos))}function I0(n,e){return n.readFields(dD,{},e)}function dD(n,e,i){n===1?(e.group=function(o,a){return o.readFields(pD,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):n===2&&(e.path=function(o,a){return o.readFields(mD,{paint_order:1,commands:[],step:1,diffs:[],rule:zw.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function pD(n,e,i){n===1?e.transform=A0(i,i.readVarint()+i.pos):n===2?e.opacity=i.readVarint():n===5?e.clip_path_idx=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(I0(i,i.readVarint()+i.pos))}function A0(n,e){return n.readFields(fD,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function fD(n,e,i){n===1?e.sx=i.readFloat():n===2?e.ky=i.readFloat():n===3?e.kx=i.readFloat():n===4?e.sy=i.readFloat():n===5?e.tx=i.readFloat():n===6&&(e.ty=i.readFloat())}function mD(n,e,i){n===1?e.fill=function(o,a){return o.readFields(_D,{rgb_color:Lw,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):n===2?e.stroke=function(o,a){return o.readFields(gD,{rgb_color:Lw,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):n===3?e.paint_order=i.readVarint():n===5?i.readPackedVarint(e.commands):n===6?e.step=i.readFloat():n===7?i.readPackedSVarint(e.diffs):n===8&&(e.rule=i.readVarint())}function _D(n,e,i){n===1?(e.rgb_color=C0(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?
53(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5&&(e.opacity=i.readVarint())}function C0(n){return new rn((n>>16&255)/255,(n>>8&255)/255,(255&n)/255,1)}function gD(n,e,i){n===1?(e.rgb_color=C0(i.readVarint()),e.paint="rgb_color"):n===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):n===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):n===5?i.readPackedFloat(e.dasharray):n===6?e.dashoffset=i.readFloat():n===7?e.miterlimit=i.readFloat():n===8?e.opacity=i.readVarint():n===9?e.width=i.readFloat():n===10?e.linecap=i.readVarint():n===11&&(e.linejoin=i.readVarint())}function yD(n,e,i){n===1?e.transform=A0(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(TA(i,i.readVarint()+i.pos)):n===4?e.x1=i.readFloat():n===5?e.y1=i.readFloat():n===6?e.x2=i.readFloat():n===7&&(e.y2=i.readFloat())}function TA(n,e){return n.readFields(vD,{offset:0,opacity:255,rgb_color:Lw},e)}function vD(n,e,i){n===1?e.offset=i.readFloat():n===2?e.opacity=i.readVarint():n===3&&(e.rgb_color=C0(i.readVarint()))}function xD(n,e,i){n===1?e.transform=A0(i,i.readVarint()+i.pos):n===2?e.spread_method=i.readVarint():n===3?e.stops.push(TA(i,i.readVarint()+i.pos)):n===4?e.cx=i.readFloat():n===5?e.cy=i.readFloat():n===6?e.r=i.readFloat():n===7?e.fx=i.readFloat():n===8?e.fy=i.readFloat():n===9&&(e.fr=i.readFloat())}function wD(n,e,i){n===1?e.transform=A0(i,i.readVarint()+i.pos):n===2?e.clip_path_idx=i.readVarint():n===3&&e.children.push(I0(i,i.readVarint()+i.pos))}function bD(n,e,i){n===1?e.left=e.top=i.readFloat():n===2?e.width=e.height=i.readFloat():n===3?e.top=i.readFloat():n===4?e.height=i.readFloat():n===5?e.mask_type=i.readVarint():n===6?e.mask_idx=i.readVarint():n===7&&e.children.push(I0(i,i.readVarint()+i.pos))}class TD{static calculate(e={},i=[]){const o=new Map,a=new Map;if(Object.keys(e).length===0)return o;i.forEach(u=>{a.set(u.name,u.rgb_color||new rn(0,0,0))});for(const[u,d]of Object.entries(e))a.has(u)?o.set(a.get(u).toString(),d):console.warn(`Ignoring unknown image variable "${u}"`);return o}}function Ip(n,e=255,i){const o=e/255,a=n.toString(),u=i.has(a)?i.get(a).clone():n.clone();return u.a*=o,u.toString()}function d_(n,e){if(!Ys()){const i=document.createElement("canvas");return i.width=n,i.height=e,i}return new OffscreenCanvas(n,e)}let kw,p_=null;function Ow(n,e,i,o,a){for(const u of o.children)SA(n,e,i,u,a)}function SA(n,e,i,o,a){o.group?(n.save(),function(u,d,m,y,x){const T=y.mask_idx!=null?m.masks[y.mask_idx]:null,S=y.clip_path_idx!=null?m.clip_paths[y.clip_path_idx]:null;if(y.transform&&(d=Ap(y.transform).preMultiplySelf(d)),!function(P,k,V){return P.opacity!==255||k||V}(y,S!=null,T!=null))return void Ow(u,d,m,y,x);const I=d_(u.canvas.width,u.canvas.height),M=I.getContext("2d");Ow(M,d,m,y,x),S&&RA(M,d,m,S),T&&LA(M,d,m,T,x),u.globalAlpha=y.opacity/255,u.drawImage(I,0,0)}(n,e,i,o.group,a),n.restore()):o.path&&(n.save(),function(u,d,m,y,x){u.setTransform(d),y.paint_order===oD.PAINT_ORDER_FILL_AND_STROKE?(EA(u,m,y,x),AA(u,m,y,x)):(AA(u,m,y,x),EA(u,m,y,x))}(n,e,i,o.path,a),n.restore())}function EA(n,e,i,o){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(n.save(),n.beginPath(),zA(i,n),a.paint){case"rgb_color":n.fillStyle=Ip(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":{const d=e.linear_gradients[a.linear_gradient_idx];d.transform&&n.setTransform(Ap(d.transform).preMultiplySelf(n.getTransform())),n.fillStyle=CA(n,d,u,o);break}case"radial_gradient_idx":{const d=e.radial_gradients[a.radial_gradient_idx];d.transform&&n.setTransform(Ap(d.transform).preMultiplySelf(n.getTransform())),n.fillStyle=MA(n,d,u,o)}}n.fill(IA(i)),n.restore()}function IA(n){return n.rule===zw.PATH_RULE_NON_ZERO?"nonzero":n.rule===zw.PATH_RULE_EVEN_ODD?"evenodd":void 0}function AA(n,e,i,o){const a=i.stroke;if(!a)return;const u=DA(i);n.lineWidth=a.width,n.miterLimit=a.miterlimit,n.setLineDash(a.dasharray),n.lineDashOffset=a.dashoffset;const d=a.opacity/255;switch(a.paint){case"rgb_color":n.strokeStyle=Ip(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":n.strokeStyle=CA(n,e.linear_gradients[a.linear_gradient_idx],d,o,!0);break;case"radial_gradient_idx":n.strokeStyle=MA(n,e.radial_gradients[a.radial_gradient_idx],d,o,!0)}switch(a.linejoin){case E0.LINE_JOIN_MITER_CLIP:case E0.LINE_JOIN_MITER:n.lineJoin="miter";break;case E0.LINE_JOIN_ROUND:n.lineJoin="round";break;case E0.LINE_JOIN_BEVEL:n.lineJoin="bevel"}switch(a.linecap){case Dw.LINE_CAP_BUTT:n.lineCap="butt";break;case Dw.LINE_CAP_ROUND:n.lineCap="round";break;case Dw.LINE_CAP_SQUARE:n.lineCap="square"}n.stroke(u)}function CA(n,e,i,o,a=!1){if(e.stops.length===1){const I=e.stops[0];return Ip(I.rgb_color,I.opacity*i,o)}const{x1:u,y1:d,x2:m,y2:y}=e;let x=new DOMPoint(u,d),T=new DOMPoint(m,y);if(a){const I=Ap(e.transform);x=I.transformPoint(x),T=I.transformPoint(T)}const S=n.createLinearGradient(x.x,x.y,T.x,T.y);for(const I of e.stops)S.addColorStop(I.offset,Ip(I.rgb_color,I.opacity*i,o));return S}function MA(n,e,i,o,a=!1){if(e.stops.length===1){const N=e.stops[0];return Ip(N.rgb_color,N.opacity*i,o)}
vendor: 11,517 bytes, line 53
53const u=Ap(e.transform),{fx:d,fy:m,fr:y,cx:x,cy:T,r:S}=e;let I=new DOMPoint(d,m),M=new DOMPoint(x,T),P=y,k=S;if(a){I=u.transformPoint(I),M=u.transformPoint(M);const N=(u.a+u.d)/2;P=y*N,k=e.r*N}const V=n.createRadialGradient(I.x,I.y,P,M.x,M.y,k);for(const N of e.stops)V.addColorStop(N.offset,Ip(N.rgb_color,N.opacity*i,o));return V}function PA(n,e,i,o){const a=o.transform?Ap(o.transform).preMultiplySelf(e):e,u=d_(n.canvas.width,n.canvas.height),d=u.getContext("2d");for(const y of o.children)if(y.group)PA(d,a,i,y.group);else if(y.path){const x=y.path,T=new Path2D;T.addPath(DA(x),a),d.fill(T,IA(x))}const m=o.clip_path_idx!=null?i.clip_paths[o.clip_path_idx]:null;m&&RA(d,a,i,m),n.globalCompositeOperation="source-over",n.drawImage(u,0,0)}function RA(n,e,i,o){const a=d_(n.canvas.width,n.canvas.height);PA(a.getContext("2d"),e,i,o),n.globalCompositeOperation="destination-in",n.drawImage(a,0,0)}function LA(n,e,i,o,a){if(o.children.length===0)return;const u=o.mask_idx!=null?i.masks[o.mask_idx]:null;u&&LA(n,e,i,u,a);const d=n.canvas.width,m=n.canvas.height,y=d_(d,m),x=y.getContext("2d"),T=o.width,S=o.height,I=o.left,M=o.top,P=new Path2D,k=new Path2D;k.rect(I,M,T,S),P.addPath(k,e),x.clip(P);for(const $ of o.children)SA(x,e,i,$,a);const V=x.getImageData(0,0,d,m),N=V.data;if(o.mask_type===xA.MASK_TYPE_LUMINANCE)for(let $=0;$<N.length;$+=4)N[$+3]=N[$+3]/255*(.2126*N[$]+.7152*N[$+1]+.0722*N[$+2]);x.putImageData(V,0,0),n.globalCompositeOperation="destination-in",n.drawImage(y,0,0)}function Ap(n){return n?new DOMMatrix([n.sx,n.ky,n.kx,n.sy,n.tx,n.ty]):new DOMMatrix}function zA(n,e){const i=n.step;let o=n.diffs[0]*i,a=n.diffs[1]*i;e.moveTo(o,a);for(let u=0,d=2;u<n.commands.length;u++)switch(n.commands[u]){case h_.PATH_COMMAND_MOVE:o+=n.diffs[d++]*i,a+=n.diffs[d++]*i,e.moveTo(o,a);break;case h_.PATH_COMMAND_LINE:o+=n.diffs[d++]*i,a+=n.diffs[d++]*i,e.lineTo(o,a);break;case h_.PATH_COMMAND_QUAD:{const m=o+n.diffs[d++]*i,y=a+n.diffs[d++]*i;o=m+n.diffs[d++]*i,a=y+n.diffs[d++]*i,e.quadraticCurveTo(m,y,o,a);break}case h_.PATH_COMMAND_CUBIC:{const m=o+n.diffs[d++]*i,y=a+n.diffs[d++]*i,x=m+n.diffs[d++]*i,T=y+n.diffs[d++]*i;o=x+n.diffs[d++]*i,a=T+n.diffs[d++]*i,e.bezierCurveTo(m,y,x,T,o,a);break}case h_.PATH_COMMAND_CLOSE:e.closePath()}return e}function DA(n){return zA(n,new Path2D)}class M0{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}At(M0,"LRUCache");class Fw{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new io(e,e.data)}getFromCache(e,i,o){return this.cacheMap.has(o)||this.cacheMap.set(o,new M0(150)),this.cacheMap.get(o).get(zs(e.toString(),i))}setInCache(e,i,o,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new M0(150));const u=this.cacheDependenciesMap.get(a),d=zs(e.id.toString(),o);u.get(d)||u.set(d,new Set);const m=this.cacheMap.get(a),y=e.toString();u.get(d).add(y),m.put(zs(e.toString(),o),i)}removeImagesFromCacheByIds(e,i,o=0){if(!this.cacheMap.has(o)||!this.cacheDependenciesMap.has(o))return;const a=this.cacheMap.get(o),u=this.cacheDependenciesMap.get(o);for(const d of e){const m=zs(d.toString(),i);if(u.has(m)){for(const y of u.get(m))a.delete(y);u.delete(m)}}}rasterize(e,i,o,a){const u=this.getFromCache(e,o,a);if(u)return u.clone();const d=function(y,x){const T=TD.calculate(x.params,y.metadata?y.metadata.variables:[]),S=y.usvg_tree,I=S.width,M=S.height,P=Math.max(1,Math.round(I*x.sx)),k=Math.max(1,Math.round(M*x.sy)),V=new DOMMatrix([P/I,0,0,k/M,0,0]);return p_===null&&(p_=d_(10,10),kw=p_.getContext("2d",{willReadFrequently:!0})),p_.width=P,p_.height=k,Ow(kw,V,S,S,T),kw.getImageData(0,0,P,k)}(i.icon,e),m=Fw._getImage(d);return this.setInCache(e,m,o,a),m.clone()}}class kA{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const o=this.toIdx(e,i);return{min:this.minimums[o],max:this.maximums[o]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function OA(n,e,i,o){let a=0,u=Number.MAX_VALUE;for(let d=0;d<3;d++)if(Math.abs(o[d])<1e-15){if(i[d]<n[d]||i[d]>e[d])return null}else{const m=1/o[d];let y=(n[d]-i[d])*m,x=(e[d]-i[d])*m;if(y>x){const T=y;y=x,x=T}if(y>a&&(a=y),x<u&&(u=x),a>u)return null}return a}function FA(n,e,i,o,a,u,d,m,y,x,T){const S=o-n,I=a-e,M=u-i,P=d-n,k=m-e,V=y-i,N=T[1]*V-T[2]*k,$=T[2]*P-T[0]*V,q=T[0]*k-T[1]*P,Y=S*N+I*$+M*q;if(Math.abs(Y)<1e-15)return null;const re=1/Y,ee=x[0]-n,ae=x[1]-e,he=x[2]-i,me=(ee*N+ae*$+he*q)*re;if(me<0||me>1)return null;const De=ae*M-he*I,xe=he*S-ee*M,Be=ee*I-ae*S,Ge=(T[0]*De+T[1]*xe+T[2]*Be)*re;return Ge<0||me+Ge>1?null:(P*De+k*xe+V*Be)*re}function BA(n,e,i){return(n-e)/(i-e)}function NA(n,e,i,o,a,u,d,m,y){const x=1<<i,T=u-o,S=d-a,I=(n+1)/x*T+o,M=(e+0)/x*S+a,P=(e+1)/x*S+a;m[0]=(n+0)/x*T+o,m[1]=M,y[0]=I,y[1]=P}class VA{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(u){const d=Math.ceil(Math.log2(u.dim/8)),m=[];let y=Math.ceil(Math.pow(2,d));const x=1/y,T=(M,P,k,V,N)=>{const $=V?1:0,q=(M+1)*k-$,Y=P*k,re=(P+1)*k-$;N[0]=M*k,N[1]=Y,N[2]=q,N[3]=re};let S=new kA(y);const I=[];for(let M=0;M<y*y;M++){T(M%y,Math.floor(M/y),x,!1,I);const P=ou(I[0],I[1],u),k=ou(I[2],I[1],u),V=ou(I[2],I[3],u),N=ou(I[0],I[3],u);S.minimums.push(Math.min(P,k,V,N)),S.maximums.push(Math.max(P,k,V,N)),S.leaves.push(1)}for(m.push(S),y/=2;y>=1;y/=2){const M=m[m.length-1];S=new kA(y);for(let P=0;P<y*y;P++){T(P%y,Math.floor(P/y),2,!0,I);const k=M.getElevation(I[0],I[1]),V=M.getElevation(I[2],I[1]),N=M.getElevation(I[2],I[3]),$=M.getElevation(I[0],I[3]),q=M.isLeaf(I[0],I[1]),Y=M.isLeaf(I[2],I[1]),re=M.isLeaf(I[2],I[3]),ee=M.isLeaf(I[0],I[3]),ae=Math.min(k.min,V.min,N.min,$.min),he=Math.max(k.max,V.max,N.max,$.max),me=q&&Y&&re&&ee;S.maximums.push(he),S.minimums.push(ae),S.leaves.push(he-ae<=5&&me?1:0)}m.push(S)}return m}(this.dem),o=i.length-1,a=i[o];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,o,0)}raycastRoot(e,i,o,a,u,d,m=1){return OA([e,i,-100],[o,a,this.maximums[0]*m],u,d)}raycast(e,i,o,a,u,d,m=1){if(!this.nodeCount)return null;const y=this.raycastRoot(e,i,o,a,u,d,m);if(y==null)return null;const x=[],T=[],S=[],I=[],M=[{idx:0,t:y,nodex:0,nodey:0,depth:0}];for(;M.length>0;){const{idx:P,t:k,nodex:V,nodey:N,depth:$}=M.pop();if(this.leaves[P]){NA(V,N,$,e,i,o,a,S,I);const Y=1<<$,re=(V+0)/Y,ee=(V+1)/Y,ae=(N+0)/Y,he=(N+1)/Y,me=ou(re,ae,this.dem)*m,De=ou(ee,ae,this.dem)*m,xe=ou(ee,he,this.dem)*m,Be=ou(re,he,this.dem)*m,Ge=FA(S[0],S[1],me,I[0],S[1],De,I[0],I[1],xe,u,d),$e=FA(I[0],I[1],xe,S[0],I[1],Be,S[0],S[1],me,u,d),Je=Math.min(Ge!==null?Ge:Number.MAX_VALUE,$e!==null?$e:Number.MAX_VALUE);if(Je!==Number.MAX_VALUE)return Je;{const et=Si([],u,d,k);if(jA(me,De,Be,xe,BA(et[0],S[0],I[0]),BA(et[1],S[1],I[1]))>=et[2])return k}continue}let q=0;for(let Y=0;Y<this._siblingOffset.length;Y++){NA((V<<1)+this._siblingOffset[Y][0],(N<<1)+this._siblingOffset[Y][1],$+1,e,i,o,a,S,I),S[2]=-100,I[2]=this.maximums[this.childOffsets[P]+Y]*m;const re=OA(S,I,u,d);if(re!=null){const ee=re;x[Y]=ee;let ae=!1;for(let he=0;he<q&&!ae;he++)ee>=x[T[he]]&&(T.splice(he,0,Y),ae=!0);ae||(T[q]=Y),q++}}for(let Y=0;Y<q;Y++){const re=T[Y];M.push({idx:this.childOffsets[P]+re,t:x[re],nodex:(V<<1)+this._siblingOffset[re][0],nodey:(N<<1)+this._siblingOffset[re][1],depth:$+1})}}return null}_addNode(e,i,o){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(o),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,o,a,u){if(e[a].isLeaf(i,o)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const d=a-1,m=e[d];let y=0,x=0;for(let T=0;T<this._siblingOffset.length;T++){const S=2*i+this._siblingOffset[T][0],I=2*o+this._siblingOffset[T][1],M=m.getElevation(S,I),P=m.isLeaf(S,I),k=this._addNode(M.min,M.max,P);P&&(y|=1<<T),x||(x=k)}for(let T=0;T<this._siblingOffset.length;T++)y&1<<T||this._construct(e,2*i+this._siblingOffset[T][0],2*o+this._siblingOffset[T][1],d,x+T)}}function jA(n,e,i,o,a,u){return Qt(Qt(n,i,u),Qt(e,o,u),a)}function ou(n,e,i){const o=i.dim,a=j(n*o-.5,0,o-1),u=j(e*o-.5,0,o-1),d=Math.floor(a),m=Math.floor(u),y=Math.min(d+1,o-1),x=Math.min(m+1,o-1);return jA(i.get(d,m),i.get(y,m),i.get(d,x),i.get(y,x),a-d,u-m)}const SD={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ED(n,e,i){return(256*n*256+256*e+i)/10-1e4}function ID(n,e,i){return 256*n+e+i/256-32768}class P0{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,o,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void Tt(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,d=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let y=0;y<u;y++)d[this._idx(-1,y)]=d[this._idx(0,y)],d[this._idx(u,y)]=d[this._idx(u-1,y)],d[this._idx(y,-1)]=d[this._idx(y,0)],d[this._idx(y,u)]=d[this._idx(y,u-1)];d[this._idx(-1,-1)]=d[this._idx(0,0)],d[this._idx(u,-1)]=d[this._idx(u-1,0)],d[this._idx(-1,u)]=d[this._idx(0,u-1)],d[this._idx(u,u)]=d[this._idx(u-1,u-1)]}const m=o==="terrarium"?ID:ED;for(let y=0;y<d.length;++y){const x=4*y;this.floatView[y]=m(this.pixels[x],this.pixels[x+1],this.pixels[x+2])}this._timestamp=Mr.now()}_buildQuadTree(){this._tree=new VA(this)}get(e,i,o=!1){o&&(e=j(e,-1,this.dim),i=j(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,o){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=o,o-u}static getUnpackVector(e){return SD[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const o=[0,0,0,0],a=P0.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return o[2]=u%256,u=Math.floor(u/256),o[1]=u%256,u=Math.floor(u/256),o[0]=u,o}getPixels(){return new kS({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,d=o*this.dim,m=o*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(o){case-1:d=m-1;break;case 1:m=d+1}const y=-i*this.dim,x=-o*this.dim;for(let T=d;T<m;T++)for(let S=a;S<u;S++){const I=4*this._idx(S,T),M=4*this._idx(S+y,T+x);this.pixels[I+0]=e.pixels[M+0],this.pixels[I+1]=e.pixels[M+1],this.pixels[I+2]=e.pixels[M+2],this.pixels[I+3]=e.pixels[M+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function AD(n,e,i){n===1?e.headerLength=i.readFixed32():n===2?e.x=i.readVarint():n===3?e.y=i.readVarint():n===4?e.z=i.readVarint():n===5&&e.layers.push(function(o,a){return o.readFields(LD,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function CD(n,e,i){n===1?(e.delta_filter=function(o,a){return o.readFields(MD,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):n===2?(i.readVarint(),e.filter="zigzag_filter"):n===3?
53(i.readVarint(),e.filter="bitshuffle_filter"):n===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function MD(n,e,i){n===1&&(e.blockSize=i.readVarint())}function PD(n,e,i){n===1?(i.readVarint(),e.codec="gzip_data"):n===2?(i.readVarint(),e.codec="jpeg_image"):n===3?(i.readVarint(),e.codec="webp_image"):n===4&&(i.readVarint(),e.codec="png_image")}function RD(n,e,i){let o=0,a=0;n===1?e.firstByte=i.readFixed64():n===2?e.lastByte=i.readFixed64():n===3?e.filters.push(function(u,d){return u.readFields(CD,{},d)}(i,i.readVarint()+i.pos)):n===4?e.codec=function(u,d){return u.readFields(PD,{},d)}(i,i.readVarint()+i.pos):n===5?a=i.readFloat():n===6?o=i.readFloat():n===7?e.bands.push(i.readString()):n===8?e.offset=i.readDouble():n===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=o)}function LD(n,e,i){n===1?e.version=i.readVarint():n===2?e.name=i.readString():n===3?e.units=i.readString():n===4?e.tileSize=i.readVarint():n===5?e.buffer=i.readVarint():n===6?e.pixelFormat=i.readVarint():n===7&&e.dataIndex.push(function(o,a){return o.readFields(RD,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function zD(n,e,i){if(n===2)(function(o,a,u){o.readFields(DD,u,a)})(i,i.readVarint()+i.pos,e);else if(n===3)throw new Error("Not implemented")}function DD(n,e,i){if(n===1){let o=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[o++]=i.readVarint()}}function kD(n,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let o=2;o>=1;o--){const a=o===1?1:0,u=o===2?1:0;for(let d=0;d<e[0];d++){const m=e[1]*d;for(let y=a;y<e[1];y++){const x=e[2]*(y+m);for(let T=u;T<e[2];T++){const S=e[3]*(T+x);for(let I=0;I<e[3];I++){const M=S+I;n[M]+=n[M-i]}}}}i*=e[o]}return n}function OD(n){for(let e=0,i=n.length;e<i;e++)n[e]=n[e]>>>1^-(1&n[e]);return n}function FD(n,e){switch(e){case"uint32":return n;case"uint16":for(let i=0;i<n.length;i+=2){const o=n[i],a=n[i+1];n[i]=(240&o)>>4|(61440&o)>>8|(240&a)<<4|61440&a,n[i+1]=15&o|(3840&o)>>4|(15&a)<<8|(3840&a)<<4}return n;case"uint8":for(let i=0;i<n.length;i+=4){const o=n[i],a=n[i+1],u=n[i+2],d=n[i+3];n[i+0]=(192&o)>>6|(192&a)>>4|(192&u)>>2|192&d,n[i+1]=(48&o)>>4|(48&a)>>2|48&u|(48&d)<<2,n[i+2]=(12&o)>>2|12&a|(12&u)<<2|(12&d)<<4,n[i+3]=3&o|(3&a)<<2|(3&u)<<4|(3&d)<<6}return n;default:throw new Error(`Invalid pixel format, "${e}"`)}}At(P0,"DEMData"),At(VA,"DemMinMaxQuadTree",{omit:["dem"]});var Fs=Uint8Array,f_=Uint16Array,BD=Int32Array,UA=new Fs([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]),GA=new Fs([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]),ND=new Fs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$A=function(n,e){for(var i=new f_(31),o=0;o<31;++o)i[o]=e+=1<<n[o-1];var a=new BD(i[30]);for(o=1;o<30;++o)for(var u=i[o];u<i[o+1];++u)a[u]=u-i[o]<<5|o;return{b:i,r:a}},HA=$A(UA,2),qA=HA.b,VD=HA.r;qA[28]=258,VD[258]=28;for(var jD=$A(GA,0).b,ZA=new f_(32768),Er=0;Er<32768;++Er){var Cp=(43690&Er)>>1|(21845&Er)<<1;ZA[Er]=((65280&(Cp=(61680&(Cp=(52428&Cp)>>2|(13107&Cp)<<2))>>4|(3855&Cp)<<4))>>8|(255&Cp)<<8)>>1}var m_=function(n,e,i){for(var o=n.length,a=0,u=new f_(e);a<o;++a)n[a]&&++u[n[a]-1];var d,m=new f_(e);for(a=1;a<e;++a)m[a]=m[a-1]+u[a-1]<<1;d=new f_(1<<e);var y=15-e;for(a=0;a<o;++a)if(n[a])for(var x=a<<4|n[a],T=e-n[a],S=m[n[a]-1]++<<T,I=S|(1<<T)-1;S<=I;++S)d[ZA[S]>>y]=x;return d},__=new Fs(288);for(Er=0;Er<144;++Er)__[Er]=8;for(Er=144;Er<256;++Er)__[Er]=9;for(Er=256;Er<280;++Er)__[Er]=7;for(Er=280;Er<288;++Er)__[Er]=8;var WA=new Fs(32);for(Er=0;Er<32;++Er)WA[Er]=5;var UD=m_(__,9),GD=m_(WA,5),Bw=function(n){for(var e=n[0],i=1;i<n.length;++i)n[i]>e&&(e=n[i]);return e},$a=function(n,e,i){var o=e/8|0;return(n[o]|n[o+1]<<8)>>(7&e)&i},Nw=function(n,e){var i=e/8|0;return(n[i]|n[i+1]<<8|n[i+2]<<16)>>(7&e)}
vendor: 10,180 bytes, line 53
53,$D=["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"],Ha=function(n,e,i){var o=new Error(e||$D[n]);if(o.code=n,Error.captureStackTrace&&Error.captureStackTrace(o,Ha),!i)throw o;return o},HD=new Fs(0),qD=typeof TextDecoder<"u"&&new TextDecoder;try{qD.decode(HD,{stream:!0})}catch{}const ZD={gzip_data:"gzip"};class ua extends Error{constructor(e){super(e),this.name="MRTError"}}const WD={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},XA={uint32:1,uint16:2,uint8:4},XD={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Vw;class R0{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ua(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),o=new DataView(e);if(i[0]!==13)throw new ua("File is not a valid MRT.");return o.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),o=this.getHeaderLength(e);if(i.length<o)throw new ua(`Expected header with length >= ${o} but got buffer of length ${i.length}`);const a=new Vw(i.subarray(0,o)).readFields(AD,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new ua(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new YA(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],o=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=o.dataIndex[a],d=u.firstByte-e.firstByte,m=u.lastByte-e.firstByte;if(o._blocksInProgress.has(a))continue;const y={layerName:o.name,firstByte:d,lastByte:m,pixelFormat:o.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(o.bandShape),buffer:o.buffer,codec:u.codec.codec,filters:u.filters.map(x=>x.filter)};o._blocksInProgress.add(a),i.push(y)}return new KA(i,()=>{i.forEach(a=>o._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(d=>o._blocksInProgress.delete(d.blockIndex)),a)throw a;u.forEach(d=>{this.getLayer(d.layerName).processDecodedData(d)})})}}class YA{constructor({version:e,name:i,units:o,tileSize:a,pixelFormat:u,buffer:d,dataIndex:m},y){if(this.version=e,this.version!==1)throw new ua(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=o,this.tileSize=a,this.buffer=d,this.pixelFormat=WD[u],this.dataIndex=m,this.bandShape=[a+2*d,a+2*d,XA[this.pixelFormat]],this._decodedBlocks=new M0(y?y.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return XA[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[o,a]of this.dataIndex.entries()){for(const[u,d]of a.bands.entries())if(d===e)return{bandIndex:i+u,blockIndex:o,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[o,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:o,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new ua(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,o=-1/0;const a=[],u=new Set;for(const d of e){const{blockIndex:m}=this.getBlockForBand(d);if(m<0)throw new ua(`Invalid band: ${JSON.stringify(d)}`);const y=this.dataIndex[m];a.includes(m)||a.push(m),u.add(m),i=Math.min(i,y.firstByte),o=Math.max(o,y.lastByte)}if(u.size>this.cacheSize)throw new ua(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:o,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:o}=this.getBlockForBand(e);if(i<0)throw new ua(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new ua(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],d=this.bandShape.reduce((x,T)=>x*T,1),m=o*d,y=a.subarray(m,m+d);return{data:y,bytes:new Uint8Array(y.buffer).subarray(y.byteOffset,y.byteOffset+y.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}R0.setPbf=function(n){Vw=n};class KA{constructor(e,i,o){this.tasks=e,this._onCancel=i,this._onComplete=o,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}R0.performDecoding=function(n,e){const i=new Uint8Array(n);return Promise.all(e.tasks.map(o=>{const{layerName:a,firstByte:u,lastByte:d,pixelFormat:m,blockShape:y,blockIndex:x,filters:T,codec:S}=o,I=i.subarray(u,d+1),M=new Uint32Array(y[0]*y[1]*y[2]);let P;if(S!=="gzip_data")throw new ua(`Unhandled codec: ${S}`);return P=function(k,V){if(!globalThis.DecompressionStream&&V==="gzip_data")return Promise.resolve(((Y=function(ae){ae[0]==31&&ae[1]==139&&ae[2]==8||Ha(6,"invalid gzip data");var he=ae[3],me=10;4&he&&(me+=2+(ae[10]|ae[11]<<8));for(var De=(he>>3&1)+(he>>4&1);De>0;De-=!ae[me++]);return me+(2&he)}(q=k))+8>q.length&&Ha(6,"invalid gzip data"),function(ae,he,me,De){var xe=ae.length;if(!xe||he.f&&!he.l)return me||new Fs(0);var Be=!me,Ge=Be||he.i!=2,$e=he.i;Be&&(me=new Fs(3*xe));var Je,et,We=function(dn){var Ki=me.length;if(dn>Ki){var tn=new Fs(Math.max(2*Ki,dn));tn.set(me),me=tn}},Xe=he.f||0,Fe=he.p||0,ke=he.b||0,Ye=he.l,pt=he.d,ot=he.m,Ot=he.n,wt=8*xe;do{if(!Ye){Xe=$a(ae,Fe,1);var Et=$a(ae,Fe+1,3);if(Fe+=3,!Et){var Pt=ae[(Ne=4+((Fe+7)/8|0))-4]|ae[Ne-3]<<8,wi=Ne+Pt;if(wi>xe){$e&&Ha(0);break}Ge&&We(ke+Pt),me.set(ae.subarray(Ne,wi),ke),he.b=ke+=Pt,he.p=Fe=8*wi,he.f=Xe;continue}if(Et==1)Ye=UD,pt=GD,ot=9,Ot=5;else if(Et==2){var lt=$a(ae,Fe,31)+257,Rt=$a(ae,Fe+10,15)+4,oi=lt+$a(ae,Fe+5,31)+1;Fe+=14;for(var zi=new Fs(oi),ki=new Fs(19),di=0;di<Rt;++di)ki[ND[di]]=$a(ae,Fe+3*di,7);Fe+=3*Rt;var hn=Bw(ki),te=(1<<hn)-1,oe=m_(ki,hn);for(di=0;di<oi;){var Ne,Qe=oe[$a(ae,Fe,te)];if(Fe+=15&Qe,(Ne=Qe>>4)<16)zi[di++]=Ne;else{var gt=0,yt=0;for(Ne==16?(yt=3+$a(ae,Fe,3),Fe+=2,gt=zi[di-1]):Ne==17?(yt=3+$a(ae,Fe,7),Fe+=3):Ne==18&&(yt=11+$a(ae,Fe,127),Fe+=7);yt--;)zi[di++]=gt}}var Bt=zi.subarray(0,lt),Ut=zi.subarray(lt);ot=Bw(Bt),Ot=Bw(Ut),Ye=m_(Bt,ot),pt=m_(Ut,Ot)}else Ha(1);if(Fe>wt){$e&&Ha(0);break}}Ge&&We(ke+131072);for(var ui=(1<<ot)-1,yi=(1<<Ot)-1,xi=Fe;;xi=Fe){var Ci=(gt=Ye[Nw(ae,Fe)&ui])>>4;if((Fe+=15&gt)>wt){$e&&Ha(0);break}if(gt||Ha(2),Ci<256)me[ke++]=Ci;else{if(Ci==256){xi=Fe,Ye=null;break}var Jt=Ci-254;Ci>264&&(Jt=$a(ae,Fe,(1<<(Wi=UA[di=Ci-257]))-1)+qA[di],Fe+=Wi);var ni=pt[Nw(ae,Fe)&yi],Vi=ni>>4;if(ni||Ha(3),Fe+=15&ni,Ut=jD[Vi],Vi>3){var Wi=GA[Vi];Ut+=Nw(ae,Fe)&(1<<Wi)-1,Fe+=Wi}if(Fe>wt){$e&&Ha(0);break}Ge&&We(ke+131072);var Xi=ke+Jt;if(ke<Ut){var sn=0-Ut,_n=Math.min(Ut,Xi);for(sn+ke<0&&Ha(3);ke<_n;++ke)me[ke]=(void 0)[sn+ke]}for(;ke<Xi;++ke)me[ke]=me[ke-Ut]}}he.l=Ye,he.p=xi,he.b=ke,he.f=Xe,Ye&&(Xe=1,he.m=ot,he.d=pt,he.n=Ot)}while(!Xe);return ke!=me.length&&Be?(Je=me,((et=ke)==null||et>Je.length)&&(et=Je.length),new Fs(Je.subarray(0,et))):me.subarray(0,ke)}(q.subarray(Y,-8),{i:2},new Fs(((N=q)[($=N.length)-4]|N[$-3]<<8|N[$-2]<<16|N[$-1]<<24)>>>0))));var N,$,q,Y;const re=ZD[V];if(!re)throw new Error(`Unhandled codec: ${V}`);const ee=new globalThis.DecompressionStream(re);return new Response(new Blob([k]).stream().pipeThrough(ee)).arrayBuffer().then(ae=>new Uint8Array(ae))}(I,S).then(k=>(function(V,N){V.readFields(zD,N)}(new Vw(k),M),new XD[m](M.buffer))),P.then(k=>{for(let V=T.length-1;V>=0;V--)switch(T[V]){case"delta_filter":kD(k,y);break;case"zigzag_filter":OD(k);break;case"bitshuffle_filter":FD(k,m);break;default:throw new ua(`Unhandled filter "${T[V]}"`)}return{layerName:a,blockIndex:x,data:k}}).catch(k=>{throw k})}))},At(KA,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),At(R0,"MapboxRasterTile"),At(YA,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class JA{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const o=e[i];this._stringToNumber[o]=i,this._numberToString[i]=o}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class QA{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Gc(ht,16,0),this.featureIndexArray=new Em,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,o,a,u,d=0,m=0){const y=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,a,u,d);const x=this.grid;for(let T=0;T<i.length;T++){const S=i[T],I=[1/0,1/0,-1/0,-1/0];for(let M=0;M<S.length;M++){const P=S[M];I[0]=Math.min(I[0],P.x),I[1]=Math.min(I[1],P.y),I[2]=Math.max(I[2],P.x),I[3]=Math.max(I[3],P.y)}m!==0&&(I[0]-=m,I[1]-=m,I[2]+=m,I[3]+=m),I[0]<ht&&I[1]<ht&&I[2]>=0&&I[3]>=0&&x.insert(y,I[0],I[1],I[2],I[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Ae(new a0(this.rawTileData)).layers,this.sourceLayerCoder=new JA(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:o,transform:a,tileTransform:u,pixelPosMatrix:d,availableImages:m,worldview:y}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const x=i.queryRadius?i.queryRadius:0,T=o.bufferedTilespaceBounds,S=this.grid.query(T.min.x,T.min.y,T.max.x,T.max.y,(k,V,N,$)=>yo(o.bufferedTilespaceGeometry,k-x,V-x,N+x,$+x));S.sort(YD);let I=null;a.elevation&&S.length>0&&(I=Ep.create(a.elevation,this.tileID));const M={};let P;for(let k=0;k<S.length;k++){const V=S[k];if(V===P)continue;P=V;const N=this.featureIndexArray.get(V);let $=null;
53this.is3DTile?this.loadMatchingModelFeature(M,N,e,o,a,y):this.loadMatchingFeature(M,N,e,m,y,(q,Y,re,ee=0)=>($||($=ce(q,this.tileID.canonical,u)),Y.queryIntersectsFeature(o,q,re,$,this.z,a,d,I,ee)))}return M}loadMatchingFeature(e,i,o,a,u,d){const{featureIndex:m,bucketIndex:y,sourceLayerIndex:x,layoutVertexArrayOffset:T}=i,S=this.bucketLayerIDs[y],I=o.layers,M=Object.keys(I);if(M.length&&!It(M,S))return;const P=o.sourceCache,k=this.sourceLayerCoder.decode(x),V=this.vtLayers[k].feature(m),N=this.getId(V,k);for(let $=0;$<S.length;$++){const q=S[$];if(!I[q])continue;const{styleLayer:Y,targets:re}=I[q];let ee={};N!==void 0&&(ee=P.getFeatureState(Y.sourceLayer,N));const ae=!d||d(V,Y,ee,T);if(!ae)continue;const he=new mh(V,this.z,this.x,this.y,N);he.tile=this.tileID.canonical,he.state=ee;let me=this.serializedLayersCache.get(q);me||(me=Y.serialize(),me.id=q,this.serializedLayersCache.set(q,me)),he.source=me.source,he.sourceLayer=me["source-layer"],he.layer=Object.assign({},me),he.layer.paint=eC(me.paint,Y.paint,V,ee,a),he.layer.layout=eC(me.layout,Y.layout,V,ee,a);let De=!1;for(const xe of re){this.updateFeatureProperties(he,xe);const{filter:Be}=xe;if(Be){if(V.properties=he.properties,Be.needGeometry){const Ge=ve(V,!0);if(!Be.filter(new bn(this.tileID.overscaledZ,{worldview:u}),Ge,this.tileID.canonical))continue}else if(!Be.filter(new bn(this.tileID.overscaledZ,{worldview:u}),V))continue}De=!0,xe.targetId&&this.addFeatureVariant(he,xe)}De&&this.appendToResult(e,q,m,he,ae)}}loadMatchingModelFeature(e,i,o,a,u,d){const{featureIndex:m,bucketIndex:y}=i,x=this.bucketLayerIDs[y],T=o.layers,S=Object.keys(T);if(!S.length||It(S,x))for(let I=0;I<x.length;I++){const M=x[I],{styleLayer:P,targets:k}=T[M];if(P.type!=="model")continue;const V=a.tile,N=V.getBucket(P);if(!(N&&N instanceof S0))continue;const $=nD(N,m,a,u);if(!$)continue;const{z:q,x:Y,y:re}=V.tileID.canonical,{feature:ee,intersectionZ:ae,position:he}=$;let me={};ee.id!==void 0&&(me=o.sourceCache.getFeatureState(P.sourceLayer,ee.id));const De=new mh({},q,Y,re,ee.id);De.tile=this.tileID.canonical,De.state=me,De.properties=ee.properties,De.geometry={type:"Point",coordinates:[he.lng,he.lat]};let xe=this.serializedLayersCache.get(M);xe||(xe=P.serialize(),xe.id=M,this.serializedLayersCache.set(M,xe)),De.source=xe.source,De.sourceLayer=xe["source-layer"],De.layer=Object.assign({},xe);let Be=!1;for(const Ge of k){this.updateFeatureProperties(De,Ge);const{filter:$e}=Ge;if($e){if(ee.properties=De.properties,$e.needGeometry){if(!$e.filter(new bn(this.tileID.overscaledZ,{worldview:d}),ee,this.tileID.canonical))continue}else if(!$e.filter(new bn(this.tileID.overscaledZ,{worldview:d}),ee))continue}Be=!0,Ge.targetId&&this.addFeatureVariant(De,Ge)}Be&&this.appendToResult(e,M,m,De,ae)}}updateFeatureProperties(e,i,o){if(i.properties){const a={};for(const u in i.properties){const d=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,o);d!=null&&(a[u]=d)}e.properties=a}}addFeatureVariant(e,i,o){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,o,a,u){let d=e[i];d===void 0&&(d=e[i]=[]),d.push({featureIndex:o,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,o,a,u,d){const m={};this.loadVTLayers();for(const y of e)this.loadMatchingFeature(m,{bucketIndex:i,sourceLayerIndex:o,featureIndex:y,layoutVertexArrayOffset:0},a,u,d);return m}loadFeature(e){const{featureIndex:i,sourceLayerIndex:o}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(o),u=this.vtFeatures[a];if(u[i])return u[i];const d=this.vtLayers[a].feature(i);return u[i]=d,d}hasLayer(e){for(const i of this.bucketLayerIDs)for(const o of i)if(e===o)return!0;return!1}getId(e,i){let o=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=dl(a);if(u.result!=="success"){const d=u.value.map(m=>`${m.key}: ${m.message}`).join(", ");return void Tt(`Failed to create expression for promoteId: ${d}`)}this.promoteIdExpression=u.value}o=this.promoteIdExpression.evaluate({zoom:0},e)}else o=e.properties[a];typeof o=="boolean"&&(o=Number(o))}return o}}function eC(n,e,i,o,a){return Pe(n,(u,d)=>{const m=e instanceof Xl?e.get(d):null;return m&&m.evaluate?m.evaluate(i,o,void 0,a):m})}function YD(n,e){return e-n}At(QA,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const tC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,095 bytes, line 53
53];class jw{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=o>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=tC[15&o];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[m]=new Uint32Array(e,4,1);return new jw(m,d,u,e)}constructor(e,i=64,o=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=tC.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,m=e*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${o}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+y,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+m+y),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+m+y,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=i,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Uw(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:m}=this,y=[0,u.length-1,0],x=[];for(;y.length;){const T=y.pop()||0,S=y.pop()||0,I=y.pop()||0;if(S-I<=m){for(let V=I;V<=S;V++){const N=d[2*V],$=d[2*V+1];N>=e&&N<=o&&$>=i&&$<=a&&x.push(u[V])}continue}const M=I+S>>1,P=d[2*M],k=d[2*M+1];P>=e&&P<=o&&k>=i&&k<=a&&x.push(u[M]),(T===0?e<=P:i<=k)&&(y.push(I),y.push(M-1),y.push(1-T)),(T===0?o>=P:a>=k)&&(y.push(M+1),y.push(S),y.push(1-T))}return x}within(e,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:d}=this,m=[0,a.length-1,0],y=[],x=o*o;for(;m.length;){const T=m.pop()||0,S=m.pop()||0,I=m.pop()||0;if(S-I<=d){for(let V=I;V<=S;V++)nC(u[2*V],u[2*V+1],e,i)<=x&&y.push(a[V]);continue}const M=I+S>>1,P=u[2*M],k=u[2*M+1];nC(P,k,e,i)<=x&&y.push(a[M]),(T===0?e-o<=P:i-o<=k)&&(m.push(I),m.push(M-1),m.push(1-T)),(T===0?e+o>=P:i+o>=k)&&(m.push(M+1),m.push(S),m.push(1-T))}return y}}function Uw(n,e,i,o,a,u){if(a-o<=i)return;const d=o+a>>1;iC(n,e,d,o,a,u),Uw(n,e,i,o,d-1,1-u),Uw(n,e,i,d+1,a,1-u)}function iC(n,e,i,o,a,u){for(;a>o;){if(a-o>600){const x=a-o+1,T=i-o+1,S=Math.log(x),I=.5*Math.exp(2*S/3),M=.5*Math.sqrt(S*I*(x-I)/x)*(T-x/2<0?-1:1);iC(n,e,i,Math.max(o,Math.floor(i-T*I/x+M)),Math.min(a,Math.floor(i+(x-T)*I/x+M)),u)}const d=e[2*i+u];let m=o,y=a;for(g_(n,e,o,i),e[2*a+u]>d&&g_(n,e,o,a);m<y;){for(g_(n,e,m,y),m++,y--;e[2*m+u]<d;)m++;for(;e[2*y+u]>d;)y--}e[2*o+u]===d?g_(n,e,o,y):(y++,g_(n,e,y,a)),y<=i&&(o=y+1),i<=y&&(a=y-1)}}function g_(n,e,i,o){Gw(n,i,o),Gw(e,2*i,2*o),Gw(e,2*i+1,2*o+1)}function Gw(n,e,i){const o=n[e];n[e]=n[i],n[i]=o}function nC(n,e,i,o){const a=n-i,u=e-o;return a*a+u*u}s.$=od,s.A=Ea,s.B=zs,s.C=2,s.D=dp,s.E=Vl,s.F=Jm,s.G=MI,s.H=rd,s.I=co,s.J=Ty,s.K=kt,s.L=Pc,s.M=Md,s.N=Hu,s.O=uy,s.P=Ke,s.Q=qu,s.R=Su,s.S=Nd,s.T=K1,s.U=dl,s.V=T0,s.W=om,s.X=kc,s.Y=Dc,s.Z=Nu,s._=mo,s.a=function(n){return Ri.API_CDN_URL_REGEX.test(n)},s.a$=z,s.a0=ii,s.a1=ls,s.a2=oa,s.a3=class extends T0{},s.a4=Pd,s.a5=cy,s.a6=be,s.a7=function(n){const e=n.value;return e?ii(e)?Cw(e,!0)?[]:[new T0(n.key,e,`invalid url "${e}"`)]:[new T0(n.key,e,`string expected, "${kt(e)}" found`)]:[]},s.a8=vy,s.a9=Un,s.aA=j,s.aB=Se,s.aC=Ur,s.aD=Qr,s.aE=fn,s.aF=v,s.aG=W,s.aH=function(n,e){const i={};for(let o=0;o<e.length;o++){const a=e[o];a in n&&(i[a]=n[a])}return i},s.aI=c,s.aJ=b,s.aK=class{constructor(n){this.entries={}
53,this.scheduler=n}request(n,e,i,o){const a=this.entries[n]=this.entries[n]||{callbacks:[]};if(a.result){const[u,d]=a.result;return this.scheduler?this.scheduler.add(()=>{o(u,d)},e):o(u,d),()=>{}}return a.callbacks.push(o),a.cancel||(a.cancel=i((u,d)=>{a.result=[u,d];for(const m of a.callbacks)this.scheduler?this.scheduler.add(()=>{m(u,d)},e):m(u,d);setTimeout(()=>delete this.entries[n],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==o),a.callbacks.length||(a.cancel(),delete this.entries[n]))}}},s.aL=function(n,e,i){const o=JSON.stringify(n.request);return n.data&&(this.deduped.entries[o]={result:[null,n.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:n.isSymbolTile,zoom:n.tileZoom},a=>{const u=Sa(n.request,(d,m,y)=>{d?a(d):m&&a(null,{rawData:m,vectorTile:i?void 0:new Ae(new a0(m)),responseHeaders:new Map(y.entries())})});return()=>{u.cancel(),a()}},e)},s.aM=function(n){return n?{cacheControl:n.get("Cache-Control"),expires:n.get("Expires")}:{cacheControl:void 0,expires:void 0}},s.aN=Oo,s.aO=function(n){as++,as>Wh&&(n.getActor().send("enforceCacheSizeLimit",Zh),as=0)},s.aP=function(n){return n<=1?1:Math.pow(2,Math.floor(Math.log2(n)))},s.aQ=Vn,s.aR=rA,s.aS=uA,s.aT=r,s.aU=nA,s.aV=function(n,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let o=0;o<n.length;o++){const a=document.createElement("source");Hx(n[o])||(i.crossOrigin="Anonymous"),a.src=n[o],i.appendChild(a)}return{cancel:()=>{}}},s.aW=Zm,s.aX=_h,s.aY=we,s.aZ=i_,s.a_=C,s.aa=ct,s.ab=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return hi(n.expression.evaluate(e))}interpolate(n,e,i){return{x:Qt(n.x,e.x,i),y:Qt(n.y,e.y,i),z:Qt(n.z,e.z,i),azimuthal:Qt(n.azimuthal,e.azimuthal,i),polar:Qt(n.polar,e.polar,i)}}},s.ac=bn,s.ad=ql,s.ae=Z,s.af=qn,s.ag=Hn,s.ah=H,s.ai=Xl,s.aj=eu,s.ak=Qt,s.al=ht,s.am=Cf,s.an=qi,s.ao=rn,s.ap=class{constructor(n){this.specification=n}possiblyEvaluate(n,e){return function([i,o]){const a=hi([1,i,o]);return{x:a.x,y:a.y,z:a.z}}(n.expression.evaluate(e))}interpolate(n,e,i){return{x:Qt(n.x,e.x,i),y:Qt(n.y,e.y,i),z:Qt(n.z,e.z,i)}}},s.aq=function(n,e,i=0,o=!0){const a=new Ke(i,i),u=n.sub(a),d=e.add(a),m=[u,new Ke(d.x,u.y),d,new Ke(u.x,d.y)];return o&&m.push(u.clone()),m},s.ar=function(n,e){const i=[];for(let o=0;o<n.length;o++){const a=J(o-1,-1,n.length-1),u=J(o+1,-1,n.length-1),d=n[o],m=n[u],y=n[a].sub(d).unit(),x=m.sub(d).unit(),T=x.angleWithSep(y.x,y.y),S=y.add(x).unit().mult(-1*e/Math.sin(T/2));i.push(d.add(S))}return i},s.as=UI,s.at=yo,s.au=function(n,e,i=0){return ri(((e.x-i)*n.scale-n.x)*ht,(e.y*n.scale-n.y)*ht,R(e.z,e.y))},s.av=rr,s.aw=un,s.ax=Mt,s.ay=nI,s.az=function(n){let e=1/0,i=1/0,o=-1/0,a=-1/0;for(const u of n)e=Math.min(e,u.x),i=Math.min(i,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y);return{min:new Ke(e,i),max:new Ke(o,a)}},s.b=function(n){return Ri.API_FONTS_REGEX.test(n)},s.b$=nE,s.b0=mr,s.b1=qc,s.b2=ye,s.b3=Ly,s.b4=v0,s.b5=function(){La.isLoading()||La.isLoaded()||Yu()!=="deferred"||yy()},s.b6=Vd,s.b7=ve,s.b8=mh,s.b9=jn,s.bA=Ft,s.bB=qt,s.bC=mt,s.bD=function(n,e){const{x:i,y:o}=n.point,a=bS(i,o,n.worldSize/n._pixelsPerMercatorPixel,0,0);return Se(a,a,I1(Os(e)))},s.bE=tt,s.bF=so,s.bG=Sn,s.bH=Si,s.bI=nr,s.bJ=vn,s.bK=xp,s.bL=Qo,s.bM=mw,s.bN=function(n,e,i,o,a){const u=5*e+2;n.float32[u+0]=i,n.float32[u+1]=o,n.float32[u+2]=a},s.bO=Sp,s.bP=Gr,s.bQ=Do,s.bR=Xs,s.bS=In,s.bT=J,s.bU=function(n,e,i,o){var a=new Ee(4);return a[0]=n,a[1]=e,a[2]=i,a[3]=o,a},s.bV=class{isDataAvailableAtPoint(n){const e=this._source();if(this.isUsingMockSource()||!e||n.y<0||n.y>1)return!1;const i=e.getSource().maxzoom,o=1<<i,a=Math.floor(n.x),u=Math.floor((n.x-a)*o),d=Math.floor(n.y*o),m=this.findDEMTileFor(new Vn(i,a,i,u,d));return!(!m||!m.dem)}getAtPointOrZero(n,e=0){return this.getAtPoint(n,e)||0}getAtPoint(n,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const o=this._source();if(!o||n.y<0||n.y>1)return e;const a=o.getSource().maxzoom,u=1<<a,d=Math.floor(n.x),m=n.x-d,y=new Vn(a,d,a,Math.floor(m*u),Math.floor(n.y*u)),x=this.findDEMTileFor(y);if(!x||!x.dem)return e;const T=x.dem,S=1<<x.tileID.canonical.z,I=(m*S-x.tileID.canonical.x)*T.dim,M=(n.y*S-x.tileID.canonical.y)*T.dim,P=Math.floor(I),k=Math.floor(M);return(i?this.exaggeration():1)*Qt(Qt(T.get(P,k),T.get(P,k+1),M-k),Qt(T.get(P+1,k),T.get(P+1,k+1),M-k),I-P)}static getAtTileOffset(n,e,i,o){const a=1<<n.canonical.z;return o?o.pointElevation(e):i?i.getAtPointOrZero(new Z(n.wrap+(n.canonical.x+e.x/ht)/a,(n.canonical.y+e.
53y/ht)/a)):0}static getAtTileOffsetFunc(n,e,i,o){return(a,u,d)=>{const m=this.getAtTileOffset(n,a,u,d),y=o.upVector(n.canonical,a.x,a.y);return ai(y,y,m*o.upVectorScale(n.canonical,e,i).metersToTile),y}}getForTilePoints(n,e,i,o){if(this.isUsingMockSource())return!1;const a=Ep.create(this,n,o);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(n){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(n);if(!e||!e.dem)return null;const i=e.dem.tree,o=e.tileID,a=1<<n.canonical.z-o.canonical.z;let u=n.canonical.x/a-o.canonical.x,d=n.canonical.y/a-o.canonical.y,m=0;for(let y=0;y<n.canonical.z-o.canonical.z&&!i.leaves[m];y++){u*=2,d*=2;const x=2*Math.floor(d)+Math.floor(u);m=i.childOffsets[m]+x,u%=1,d%=1}return{min:this.exaggeration()*i.minimums[m],max:this.exaggeration()*i.maximums[m]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(n,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(n){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(n){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const n=this.visibleDemTiles;if(n.length===0)return null;let e=!1,i=Number.MAX_VALUE,o=Number.MIN_VALUE;for(const a of n){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),o=Math.max(o,u.max),e=!0)}return e?{min:i,max:o}:null}},s.bW=Yy,s.bX=Hi,s.bY=Rr,s.bZ=QS,s.b_=hA,s.ba=sw,s.bb=O1,s.bc=ce,s.bd=fl,s.be=_l,s.bf=Jc,s.bg=zn,s.bh=up,s.bi=Iw,s.bj=function(n,e){const i=eu(e.zoom);if(i===0)return Os(n);const o=Ny(n),a=E1(o),u=v(o.getWest())*e.worldSize,d=v(o.getEast())*e.worldSize,m=b(o.getNorth())*e.worldSize,y=b(o.getSouth())*e.worldSize,x=[u,m,0],T=[d,m,0],S=[u,y,0],I=[d,y,0],M=Ve([],e.globeMatrix);return qn(x,x,M),qn(T,T,M),qn(S,S,M),qn(I,I,M),a[0]=Va(a[0],S,i),a[1]=Va(a[1],I,i),a[2]=Va(a[2],T,i),a[3]=Va(a[3],x,i),zt.fromPoints(a)},s.bk=jy,s.bl=Ve,s.bm=Rm,s.bn=Va,s.bo=Hc,s.bp=ah,s.bq=si,s.br=Ce,s.bs=R0,s.bt=a0,s.bu=Sa,s.bv=function(n,e){const i=[];for(const o in n)o in e||i.push(o);return i},s.bw=pe,s.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.by=Ta,s.bz=at,s.c=qr,s.c$=function(n,e,i){let o=0;for(let a=0;a<2;++a)n[a]>0&&(o+=(n[a]-0)*(n[a]-0)),e[a]<0&&(o+=(0-e[a])*(0-e[a]));return o},s.c0=rE,s.c1=dw,s.c2=OI,s.c3=xw,s.c4=jw,s.c5=ai,s.c6=Go,s.c7=Qa,s.c8=function(n,e,i){i*=.5;var o=e[0],a=e[1],u=e[2],d=e[3],m=Math.sin(i),y=Math.cos(i);return n[0]=o*y+a*m,n[1]=a*y-o*m,n[2]=u*y+d*m,n[3]=d*y-u*m,n},s.c9=$o,s.cA=Ii,s.cB=Yi,s.cC=UE,s.cD=mn,s.cE=vS,s.cF=function(n,e,i,o,a,u,d,m,y){if(y.name==="globe")return vS(n,e,new mn(i,o,a),!1);const x=i_({z:i,x:o,y:a},y);return new zt([(u+x.x/x.scale)*e,e*(x.y/x.scale),d],[(u+x.x2/x.scale)*e,e*(x.y2/x.scale),m])},s.cG=function(n,e,i){return n[0]=Math.min(e[0],i[0]),n[1]=Math.min(e[1],i[1]),n[2]=Math.min(e[2],i[2]),n[3]=Math.min(e[3],i[3]),n},s.cH=function(n,e,i){return n[0]=Math.max(e[0],i[0]),n[1]=Math.max(e[1],i[1]),n[2]=Math.max(e[2],i[2]),n[3]=Math.max(e[3],i[3]),n},s.cI=function(n){const e=Math.round((n+45+360)%360/90)%4;return Sf[e]},s.cJ=D,s.cK=$s,s.cL=cp,s.cM=function(n){const e=Ft(new Float64Array(16));Se(e,n.pixelMatrix,n.globeMatrix);const i=[0,fs,0],o=[0,ms,0];return qn(i,i,e),qn(o,o,e),[i[0]>0&&i[0]<=n.width&&i[1]>0&&i[1]<=n.height&&!C1(n,new r(n.center.lat,90)),o[0]>0&&o[0]<=n.width&&o[1]>0&&o[1]<=n.height&&!C1(n,new r(n.center.lat,-90))]},s.cN=function(n,e){const{scale:i}=n.tileTransform,o=i*ht/(n.tileSize*Math.pow(2,e.zoom-n.tileID.overscaledZ+n.tileID.canonical.z));return function(a,u,d){var m=u[1],y=u[2],x=u[3],T=d[0],S=d[1];return a[0]=u[0]*T,a[1]=m*T,a[2]=y*S,a[3]=x*S,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[o,o])},s.cO=t0,s.cP=fr,s.cQ=jE,s.cR=function(n){const e=jE(n,!0);return tt([],[e[0],e[1],e[4],e[5]])},s.cS=dt,s.cT=xt,s.cU=Vt,s.cV=function(n){const{x:e,y:i}=n.point,{lng:o,lat:a}=n._center;return bS(e,i,n.worldSize,o,a)}
53,s.cW=Ct,s.cX=ao,s.cY=kn,s.cZ=Zr,s.c_=ps,s.ca=Zn,s.cb=function(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n},s.cc=ar,s.cd=function(n,e,i,o,a){var u=1/Math.tan(e/2);if(n[0]=u/i,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=u,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,a!=null&&a!==1/0){var d=1/(o-a);n[10]=(a+o)*d,n[14]=2*a*o*d}else n[10]=-1,n[14]=-2*o;return n},s.ce=function(n,e,i,o,a,u,d){var m=1/(e-i),y=1/(o-a),x=1/(u-d);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*x,n[11]=0,n[12]=(e+i)*m,n[13]=(a+o)*y,n[14]=(d+u)*x,n[15]=1,n},s.cf=E,s.cg=function(n,e,i){n[4*e+0]=i[0],n[4*e+1]=i[1],n[4*e+2]=i[2],n[4*e+3]=i[3]},s.ch=op,s.ci=th,s.cj=_r,s.ck=la,s.cl=nh,s.cm=ZI,s.cn=function(){var n=new Ee(4);return Ee!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n},s.co=function(n,e,i){var o=e[0],a=e[1],u=e[2],d=e[3],m=Math.sin(i),y=Math.cos(i);return n[0]=o*y+u*m,n[1]=a*y+d*m,n[2]=o*-m+u*y,n[3]=a*-m+d*y,n},s.cp=function(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]&&n[3]===e[3]},s.cq=jr,s.cr=function(n){var e=n[0],i=n[1],o=n[2],a=n[3];return Math.sqrt(e*e+i*i+o*o+a*a)},s.cs=ba,s.ct=Ss,s.cu=sr,s.cv=3,s.cw=2,s.cx=7,s.cy=6,s.cz=oo,s.d=function(n){return Ri.API_TILEJSON_REGEX.test(n)},s.d$=class{constructor(n,e,i,o){this.context=n,this.format=o,this.size=i,this.texture=n.gl.createTexture();const[a,u,d]=this.size,{gl:m}=n;m.bindTexture(m.TEXTURE_3D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&m.texImage3D(m.TEXTURE_3D,0,this.format,a,u,d,0,X1(this.format),Y1(this.format),e.data)}bind(n,e){const{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_3D,this.texture),n!==this.minFilter&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MAG_FILTER,n),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MIN_FILTER,n),this.minFilter=n),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:n}=this.context;n.deleteTexture(this.texture),this.texture=null}},s.d0=function(n){return n*n*n*n*n},s.d1=g,s.d2=45,s.d3=sp,s.d4=function(n,e,i){const o=Math.sqrt(n*n+e*e+i*i),a=o>0?Math.acos(i/o)*zl:0;let u=n!==0||e!==0?Math.atan2(-e,-n)*zl+90:0;return u<0&&(u+=360),[o,u,a]},s.d5=ri,s.d6=hi,s.d7=U,s.d8=Gt,s.d9=zt,s.dA=function(n){return n({pluginStatus:_o,pluginURL:Ra}),Fd.on("pluginStateChange",n),n},s.dB=ih,s.dC=class extends Da{constructor(n){super(n),this.current=ap}set(n,e,i){if(this.fetchUniformLocation(n,e)){for(let o=0;o<9;o++)if(i[o]!==this.current[o]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dD=Dl,s.dE=function(n,e,i){const o=eu(i.zoom),a=n.style.map._antialias,u=n.terrain&&n.terrain.exaggeration()>0;return o===0&&!a&&!u},s.dF=function(n){const e=n.pixelsPerMeter,i=e/E(1,n.center.lat),o=Ft(new Float64Array(16));return Ce(o,o,[n.point.x,n.point.y,0]),dt(o,o,[i,i,e]),Float32Array.from(o)},s.dG=Ny,s.dH=function(n){const e=D-5;n=j(n,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(qi(n))),3);return Math.round(i*(Pm.length-1))},s.dI=function(n,e,i,o){const a=e.getNorth(),u=e.getSouth(),d=e.getWest(),m=e.getEast(),y=1<<n.z,x=m-d,T=a-u,S=x/Yc,I=-T/Pm[i],M=[0,S,0,I,0,0,a,d,0];if(n.z>0){const P=180/o;vt(M,M,[P/x+1,0,0,0,P/T+1,0,-.5*P/S,.5*P/I,1])}return M[2]=y,M[5]=n.x,M[8]=n.y,M},s.dJ=Os,s.dK=function(n,e,i){const o=Ft(new Float64Array(16)),a=(e/(1<<n)-.5)*Math.PI*2;return jt(o,i.globeMatrix,a),Float32Array.from(o)},s.dL=kS,s.dM=ca,s.dN=function(n,e){return[Math.pow(n[0],2.2)*e,Math.pow(n[1],2.2)*e,Math.pow(n[2],2.2)*e]},s.dO=Ie,s.dP=function(n,e){var i=Math.sin(e),o=Math.cos(e);return n[0]=o,n[1]=i,n[2]=0,n[3]=-i,n[4]=o,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},s.dQ=Jn,s.dR=wS,s.dS=Gi,s.dT=Bn,s.dU=256,s.dV=function(n,e){const i=[0,0,0];return qn(i,i,jy(Os(e.canonical))),qn(i,i,n),i},s.dW=n=>({u_matrix:new nh(n),u_texsize:new la(n),u_pixels_to_tile_units:new lp(n),u_device_pixel_ratio:new _r(n),u_width_scale:new _r(n),u_floor_width_scale:new _r(n),u_image:new op(n),u_units_to_pixels:new la(n),u_tile_units_to_pixels:new _r(n),u_alph
53a_discard_threshold:new _r(n),u_trim_offset:new la(n),u_trim_fade_range:new la(n),u_trim_color:new sp(n),u_zbias_factor:new _r(n),u_tile_to_meter:new _r(n),u_ground_shadow_factor:new th(n),u_pattern_transition:new _r(n)}),s.dX=n=>({u_matrix:new nh(n),u_pixels_to_tile_units:new lp(n),u_device_pixel_ratio:new _r(n),u_width_scale:new _r(n),u_floor_width_scale:new _r(n),u_units_to_pixels:new la(n),u_dash_image:new op(n),u_gradient_image:new op(n),u_image_height:new _r(n),u_texsize:new la(n),u_tile_units_to_pixels:new _r(n),u_alpha_discard_threshold:new _r(n),u_trim_offset:new la(n),u_trim_fade_range:new la(n),u_trim_color:new sp(n),u_zbias_factor:new _r(n),u_tile_to_meter:new _r(n),u_ground_shadow_factor:new th(n)}),s.dY=n=>({u_camera_to_center_distance:new _r(n),u_extrude_scale:new lp(n),u_device_pixel_ratio:new _r(n),u_matrix:new nh(n),u_inv_rot_matrix:new nh(n),u_merc_center:new la(n),u_tile_id:new th(n),u_zoom_transition:new _r(n),u_up_dir:new th(n),u_emissive_strength:new _r(n)}),s.dZ=Yd,s.d_=az,s.da=Ti,s.db=function(n){return[Math.pow(n[0],1/2.2),Math.pow(n[1],1/2.2),Math.pow(n[2],1/2.2)]},s.dc=VE,s.dd=nw,s.de=HE,s.df=Cw,s.dg=function(n,e){return n.readFields(sD,{icons:[]},e)},s.dh=Ky,s.di=wp,s.dj=gw,s.dk=Kh,s.dl=Xu,s.dm=Ac,s.dn=Qh,s.dp=Ue,s.dq=function(n){const e=n.indexOf(Jl);return e>=0?n.slice(0,e):n},s.dr=function(n){return n.indexOf(Jl)>=0},s.ds=function(n){const e=n.lastIndexOf(Jl);return e>=0?n.slice(e+1):""},s.dt=function(n){const e=[],i=n.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),n.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.du=function(n,e,i,o){return n.type==="custom"?new Qz(n,e):new rD[n.type](n,e,i,o)},s.dv=it,s.dw=function(n){const e=n.indexOf(Jl);return e>=0?n.slice(e+1):""},s.dx=class extends mh{constructor(n,e){super(n._vectorTileFeature,n._z,n._x,n._y,n.id),n.state&&(this.state=Object.assign({},n.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=n.source,this.sourceLayer=n.sourceLayer,this.layer=n.layer)}toJSON(){const n=super.toJSON();return n.target=this.target,n.namespace=this.namespace,n}},s.dy=Fd,s.dz=Nl,s.e=Ri,s.e$=Ei,s.e0=ES,s.e1=(n,e,i,o,a,u)=>{const d=n.transform,m=d.projection.name==="globe";let y;if(u.paint.get("circle-pitch-alignment")==="map")if(m){const T=wS(d.zoom,e.canonical)*d._pixelsPerMercatorPixel;y=Float32Array.from([T,0,0,T])}else y=d.calculatePixelsToTileUnitsMatrix(i);else y=new Float32Array([d.pixelsToGLUnits[0],0,0,d.pixelsToGLUnits[1]]);const x={u_camera_to_center_distance:n.transform.getCameraToCenterDistance(d.projection),u_matrix:n.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Mr.devicePixelRatio,u_extrude_scale:y,u_inv_rot_matrix:TR,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(m){x.u_inv_rot_matrix=o,x.u_merc_center=a,x.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],x.u_zoom_transition=eu(d.zoom);const T=a[0]*ht,S=a[1]*ht;x.u_up_dir=d.projection.upVector(new mn(0,0,0),T,S)}return x},s.e2=aI,s.e3=fo,s.e4=(n,e,i,o,a,u,d,m,y,x)=>{const T=n.transform,S=T.pitch<15?rI(.07,.7,j((14-T.zoom)/5,0,1)):.07,I=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:sI(n,e,i,o),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:T.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:d,u_image:0,u_tile_units_to_pixels:oI(e,T),u_units_to_pixels:[1/T.pixelsToGLUnits[0],1/T.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:m,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(I?null:i.lut).toArray01(),u_zbias_factor:S,u_tile_to_meter:U(e.tileID.canonical,0),u_ground_shadow_factor:y,u_pattern_transition:x}},s.e5=(n,e,i,o,a,u,d,m,y,x)=>{const T=n.transform,S=T.calculatePixelsToTileUnitsMatrix(e),I=i.paint.get("line-trim-color-use-theme").
vendor: 6,333 bytes, line 53
53constantOr("default")==="none",M=T.pitch<15?rI(.07,.7,j((14-T.zoom)/5,0,1)):.07;return{u_matrix:sI(n,e,i,o),u_pixels_to_tile_units:S,u_device_pixel_ratio:u,u_width_scale:d,u_floor_width_scale:m,u_units_to_pixels:[1/T.pixelsToGLUnits[0],1/T.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:lI(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:oI(e,n.transform),u_alpha_discard_threshold:0,u_trim_offset:y,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(I?null:i.lut).toArray01(),u_zbias_factor:M,u_tile_to_meter:U(e.tileID.canonical,0),u_ground_shadow_factor:x}},s.e6=Re,s.e7=Lm,s.e8=R,s.e9=gs,s.eA=function(n,e){var i=2*Math.acos(e[3]),o=Math.sin(i/2);return o>de?(n[0]=e[0]/o,n[1]=e[1]/o,n[2]=e[2]/o):(n[0]=1,n[1]=0,n[2]=0),i},s.eB=Rw,s.eC=r0,s.eD=n0,s.eE=[1,1,1],s.eF=Ep,s.eG=xa,s.eH=function(n,e,i,o){var a=e[0],u=e[1],d=e[2],m=e[3];return n[0]=a+o*(i[0]-a),n[1]=u+o*(i[1]-u),n[2]=d+o*(i[2]-d),n[3]=m+o*(i[3]-m),n},s.eI=_p,s.eJ=Yo,s.eK=aa,s.eL=function(n,e,i,o,a,u,d,m,y,x,T,S,I,M,P,k){var V=new Ee(16);return V[0]=n,V[1]=e,V[2]=i,V[3]=o,V[4]=a,V[5]=u,V[6]=d,V[7]=m,V[8]=y,V[9]=x,V[10]=T,V[11]=S,V[12]=I,V[13]=M,V[14]=P,V[15]=k,V},s.eM=l,s.eN=Wc,s.eO=xm,s.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ke(1/0,1/0),max:new Ke(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(n,e=!1){const i=tE(new Ke(0,0),new Ke(ht,ht),n),o=[];if(e&&!F1(i,this._globalClipBounds))return o;for(const a of this._activeRegions){if(a.hiddenByOverlap||!F1(i,a))continue;const u=JR(a.min,a.max,n);o.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return o}setSources(n){this._setSources(n.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const o of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(o).buckets[e.layer];a&&a.updateFootprints(o.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(n){const e=n.getFootprints();if(e.length===0)return;const i=n.getOrder(),o=n.getClipMask(),a=n.getClipScope();for(const u of e){if(!u.footprint)continue;const d=tE(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:d.min,max:d.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:o,clipScope:a})}this._sourceIds.push(n.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||qy(e.min,i.min)||qy(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(o,a){const u=(d,m)=>d+m;return o.length-a.length||o.reduce(u,"").localeCompare(a.reduce(u,""))}(e.clipScope,i.clipScope));let n=this._activeRegions.length!==this._prevRegions.length;if(!n){let e=0;for(;!n&&e!==this._activeRegions.length;){const i=this._activeRegions[e],o=this._prevRegions[e];n=i.priority!==o.priority||!eE(i,o)||i.order!==o.order||i.clipMask!==o.clipMask||!Ta(i.clipScope,o.clipScope),this._activeRegions[e].hiddenByOverlap=o.hiddenByOverlap,++e}}if(n){++this._updateTime;for(const i of this._activeRegions)i.order!==Bm&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const o=this._activeRegions;if(i>=o.length)return i;const a=o[i].priority;for(;i<o.length&&o[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,o=e(i);for(;i!==o;){let a=i;const u=i;for(;a!==o;){const d=this._activeRegions[a];d.hiddenByOverlap=!1;for(let m=0;m<u;m++){const y=this._activeRegions[m];if(!y.hiddenByOverlap&&d.order===Bm&&F1(d,y)&&(d.hiddenByOverlap=iE(d.footprint,d.tileId,y.footprint,y.tileId),d.hiddenByOverlap))break}++a}i=o,o=e(i)}}}}_setSources(n){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=n.length-1;e>=0;e--)this._addSource(n[e]);this._computeReplacement()}},s.eQ=Bm,s.eR=class{constructor(n){this._createGrid(n),this._createPoles(n)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const n of this._poleSegments)n.destroy();for(const n of this._gridSegments)n.withSkirts.destroy(),n.withoutSkirts.destroy()}_fillGridMeshWithLods(n,e){const i=new fl,o=new mr,a=[],u=n+1+2,d=e[0]+1,m=e[0]+1+(1+e.length),y=(x,T,S)=>{let I=x===u-1?x-2:x===0?x:x-1;return I+=S?24575:0,[I,T]};for(let x=0;x<u;++x)i.emplaceBack(...y(x,0,!0));for(let x=0;x<d;++x)for(let T=0;T<u;++T)i.emplaceBack(...y(T,x,(T===0||T===u-1)&&!0));for(let x=0;x<e.length;++x){const T=e[x];for(let S=0;S<u;++S)i.emplaceBack(...y(S,T,!0))}for(let x=0;x<e.length;++x){const T=o.length,S=e[x]+1+2,I=new mr;for(let k=0;k<S-1;k++){const V=k===S-2,N=V?u*(m-e.length+x-k):u;for(let $=0;$<u-1;$++){const q=k*u+$;k===0||V||$===0||$===u-2?(I.emplaceBack(q+1,q,q+N),I.emplaceBack(q+N,q+N+1,q+1)):(o.emplaceBack(q+1,q,q+N),o.emplaceBack(q+N,q+N+1,q+1))}}const M=zn.simpleSegment(0,T,i.length,o.length-T);for(let k=0;k<I.uint16.length;k+=3)o.emplaceBack(I.uint16[k],I.uint16[k+1],I.uint16[k+2]);const P=zn.simpleSegment(0,T,i.length,o.length-T);a.push({withoutSkirts:M,withSkirts:P})}return{vertices:i,indices:o,segments:a}}_createGrid(n){const e=this._fillGridMeshWithLods(Yc,Pm);this._gridSegments=e.segments,this._gridBuffer=n.createVertexBuffer(e.vertices,Jc.members),this._gridIndexBuffer=n.createIndexBuffer(e.indices,!0)}_createPoles(n){const e=new mr;for(let d=0;d<=Yc;d++)e.emplaceBack(0,d+1,d+2);this._poleIndexBuffer=n.createIndexBuffer(e,!0);const i=new ec,o=new ec,a=new ec,u=new ec;this._poleSegments=[];for(let d=0,m=0;d<ps;d++){const y=360/(1<<d);i.emplaceBack(0,-Qr,0,.5,0),o.emplaceBack(0,-Qr,0,.5,1),a.emplaceBack(0,-Qr,0,.5,.5),u.emplaceBack(0,-Qr,0,.5,.5);for(let x=0;x<=Yc;
53x++){let T=x/Yc,S=0;const I=Qt(0,y,T),[M,P,k]=tc(wR,bR,I,Qr);i.emplaceBack(M,P,k,T,S),o.emplaceBack(M,P,k,T,1-S);const V=qi(I);T=.5+.5*Math.sin(V),S=.5+.5*Math.cos(V),a.emplaceBack(M,P,k,T,S),u.emplaceBack(M,P,k,T,1-S)}this._poleSegments.push(zn.simpleSegment(m,0,66,64)),m+=66}this._poleNorthVertexBuffer=n.createVertexBuffer(i,ks,!1),this._poleSouthVertexBuffer=n.createVertexBuffer(o,ks,!1),this._texturedPoleNorthVertexBuffer=n.createVertexBuffer(a,ks,!1),this._texturedPoleSouthVertexBuffer=n.createVertexBuffer(u,ks,!1)}getGridBuffers(n,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[n].withSkirts:this._gridSegments[n].withoutSkirts]}getPoleBuffers(n,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[n]]}},s.eS=JS,s.eT=bu,s.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eV=Te,s.eW=G,s.eX=function(n,e,i){return n[0]=e[0]/i[0],n[1]=e[1]/i[1],n[2]=e[2]/i[2],n},s.eY=wu,s.eZ=Kc,s.e_=br,s.ea=Xy,s.eb=yE,s.ec=nc,s.ed=lE,s.ee=aE,s.ef=O,s.eg=function(n,e){if(n===e){var i=e[1],o=e[2],a=e[3],u=e[6],d=e[7],m=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=i,n[6]=e[9],n[7]=e[13],n[8]=o,n[9]=u,n[11]=e[14],n[12]=a,n[13]=d,n[14]=m}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n},s.eh=Jz,s.ei=Ai,s.ej=bm,s.ek=256,s.el=I1,s.em=Xo,s.en=jt,s.eo=function(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n},s.ep=ec,s.eq=sy,s.er=vm,s.es=function(n,e,i,o,a){return j((n-e)/(i-e)*(a-o)+o,o,a)},s.et=Is,s.eu=function(n,e){var i=e[0],o=e[1],a=e[2],u=e[3],d=e[4],m=e[5],y=e[6],x=e[7],T=e[8],S=T*d-m*x,I=-T*u+m*y,M=x*u-d*y,P=i*S+o*I+a*M;return P?(n[0]=S*(P=1/P),n[1]=(-T*o+a*x)*P,n[2]=(m*o-a*d)*P,n[3]=I*P,n[4]=(T*i-a*y)*P,n[5]=(-m*i+a*u)*P,n[6]=M*P,n[7]=(-x*i+o*y)*P,n[8]=(d*i-o*u)*P,n):null},s.ev=2,s.ew=Or,s.ex=Es,s.ey=Ui,s.ez=function(n,e){var i=new Ee(3);Ui(i,e);var o=1/i[0],a=1/i[1],u=1/i[2],d=e[0]*o,m=e[1]*a,y=e[2]*u,x=e[4]*o,T=e[5]*a,S=e[6]*u,I=e[8]*o,M=e[9]*a,P=e[10]*u,k=d+T+P,V=0;return k>0?(V=2*Math.sqrt(k+1),n[3]=.25*V,n[0]=(S-M)/V,n[1]=(I-y)/V,n[2]=(m-x)/V):d>T&&d>P?(V=2*Math.sqrt(1+d-T-P),n[3]=(S-M)/V,n[0]=.25*V,n[1]=(m+x)/V,n[2]=(I+y)/V):T>P?(V=2*Math.sqrt(1+T-d-P),n[3]=(I-y)/V,n[0]=(m+x)/V,n[1]=.25*V,n[2]=(S+M)/V):(V=2*Math.sqrt(1+P-d-T),n[3]=(m-x)/V,n[0]=(I+y)/V,n[1]=(S+M)/V,n[2]=.25*V),n},s.f=function(n){return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},s.f0=function([n,e,i]){const o=Math.hypot(n,e,i),a=Math.atan2(n,i),u=.5*Math.PI-Math.acos(-e/o);return new r(ao(a),ao(u))},s.f1=Hs,s.f2=J1,s.f3=function(n){const e=n.navigator?n.navigator.userAgent:null;return!!function(i){if(lr==null){const o=i.navigator?i.navigator.userAgent:null;lr=!!i.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return lr}(n)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.f4=function(n,e){Zh=n,Wh=e},s.f5=C1,s.f6=TS,s.f7=function(n){const e=[0,0,0],i=Ft(new Float64Array(16));return Se(i,n.pixelMatrix,n.globeMatrix),qn(e,e,i),new Ke(e[0],e[1])},s.f8=function(){const n=$m;n&&(n.isPreloaded()&&n.numActive()===1?(n.release(G1),$m=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},s.f9=function(){Ky().acquire(G1)},s.fA=P0,s.fB=ge,s.fC=function(n){let e=0;if(new Uint32Array(n,0,1)[0]!==kE){const i=new Uint32Array(n,0,7),[,,o,a,u,d]=i;e=i.byteLength+a+u+d+u,(o!==n.byteLength||e>=n.byteLength)&&Tt("Invalid b3dm header information.")}return NE(n,e)},s.fD=function(n,e){const i=nw(n);for(const o of i){for(const a of o.meshes)ML(a);o.lights&&(o.lightMeshIndex=o.meshes.length,o.meshes.push(PL(o.lights,e)))}return i},s.fE=S0,s.fF=Fi,s.fG=PE,s.fH=La,s.fI=Fo,s.fJ=function(n){Cs(),Ks!=null&&Ks.then(e=>{e.keys().then(i=>{for(let o=0;o<i.length-n;o++)e.delete(i[o]).catch(a=>Tt(a.message))}).catch(i=>Tt(i.message))}).catch(e=>Tt(e.message))},s.fa=Yu,s.fb=function(n,e,i=!1){if(_o===Fo.deferred||_o===Fo.loading||_o===Fo.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ra=Mr.resolveURL(n),_o=Fo.deferred,cm=e,Od(),i||yy()},s.fc=function(n){pp=Mr.resolveURL(n),fp||(fp=new dp(Ky(),new Vl)),fp.broadcast("setMeshoptUrl",pp)},s.fd=zE,s.fe=function(n){q1=Mr.resolveURL(n),fp||(fp=new dp(Ky(),new Vl)),fp.broadcast("setDracoUrl",q1)},s.ff=LE,s.fg=Gm,s.fh=function(n){const e=As();if(!e)return;const i=e.delete(qh);n&&i.then(()=>n()).catch(n)},s.fi=uh,s.fj=At,s.fk=tu,s.fl=Ga,s.fm=JA,s.fn=QA,s.fo=eI,s.fp=Oe,s.fq="hd_road_elevation",s.fr=Qi,s.fs=Pe,s.ft=ic,s.fu=_w,s.fv=ph,s.fw=function(n,e,i,o,a,u,d,m=1,y,x,T){n.createArrays(),n.tilePixelRatio=ht/(512*n.overscaling),n.compareText={},n.iconsNeedLinear=!1;const S=n.layers[0].layout,I=n.layers[0]._unevaluatedLayout._values,M={};M.scaleFactor=m,M.textSizeScaleRange=S.get("text-size-scale-range"),M.iconSizeScaleRange=S.get("icon-size-scale-range");const[P,k]=M.textSizeScaleRange,[V,N]=M.iconSizeScaleRange;M.textScaleFactor=j(M.scaleFactor,P,k),M.iconScaleFactor=j(M.scaleFactor,V,N);const $=I["text-size"],q=I["icon-size"];if(n.textSizeData.kind==="composite"){const{minZoom:me,maxZoom:De}=n.textSizeData;M.compositeTextSizes=[$.possiblyEvaluate(new bn(me,{worldview:T}),u),$.possiblyEvaluate(new bn(De,{worldview:T}),u)]}if(n.iconSizeData.kind==="composite"){const{minZoom:me,maxZoom:De}=n.iconSizeData;M.compositeIconSizes=[q.possiblyEvaluate(new bn(me,{worldview:T}),u),q.possiblyEvaluate(new bn(De,{worldview:T}),u)]}M.layoutTextSize=$.possiblyEvaluate(new bn(d+1,{worldview:T}),u),M.layoutIconSize=q.possiblyEvaluate(new bn(d+1,{worldview:T}),u),M.textMaxSize=$.possiblyEvaluate(new bn(18,{worldview:T}),u);const Y=S.get("symbol-placement"),re=S.get("text-rotation-alignment")==="map"&&Y!=="point",ee=S.get("text-size");let ae=!1;const he=[];for(const me of n.features){const De=S.get("text-font").evaluate(me,{},u).join(","),xe=ee.evaluate(me,{},u)*M.textScaleFactor,Be=M.layoutTextSize.evaluate(me,{},u)*M.textScaleFactor,Ge=M.layoutIconSize.evaluate(me,{},u)*M.iconScaleFactor,$e={horizontal:{},vertical:void 0},Je=me.text;let et,We=[0,0];if(Je){const di=Je.toString(),hn=S.get("text-letter-spacing").evaluate(me,{},u)*Rr,te=S.get("text-line-height").evaluate(me,{},u)*Rr,oe=am(di)?hn:0,Ne=S.get("text-anchor").evaluate(me,{},u),Qe=S.get("text-variable-anchor");if(!Qe){const ui=S.get("text-radial-offset").evaluate(me,{},u);
53if(ui)We=OI(Ne,[ui*Rr,vw]);else{const yi=S.get("text-offset").evaluate(me,{},u);We=[yi[0]*Rr,yi[1]*Rr]}}let gt=re?"center":S.get("text-justify").evaluate(me,{},u);const yt=Y==="point",Bt=yt?S.get("text-max-width").evaluate(me,{},u)*Rr:1/0,Ut=ui=>{n.allowVerticalPlacement&&Wu(di)&&($e.vertical=hw(Je,e,i,a,De,Bt,te,Ne,ui,oe,We,Qo.vertical,!0,Be,xe,y))};if(!re&&Qe){const ui=gt==="auto"?Qe.map(xi=>xw(xi)):[gt];let yi=!1;for(let xi=0;xi<ui.length;xi++){const Ci=ui[xi];if(!$e.horizontal[Ci])if(yi)$e.horizontal[Ci]=$e.horizontal[0];else{const Jt=hw(Je,e,i,a,De,Bt,te,"center",Ci,oe,We,Qo.horizontal,!1,Be,xe,y);Jt&&($e.horizontal[Ci]=Jt,yi=Jt.positionedLines.length===1)}}Ut("left")}else{if(gt==="auto"&&(gt=xw(Ne)),yt||S.get("text-writing-mode").indexOf("horizontal")>=0||!Wu(di)){const ui=hw(Je,e,i,a,De,Bt,te,Ne,gt,oe,We,Qo.horizontal,!1,Be,xe,y);ui&&($e.horizontal[gt]=ui)}Ut(yt?"left":gt)}}let Xe,Fe,ke,Ye,pt,ot,Ot=!1;const wt=S.get("icon-text-fit").evaluate(me,{},u);if(me.icon&&me.icon.hasPrimary()){const di=e_(me.icon,n.iconSizeData,I["icon-size"],u,n.zoom,me,y,M.iconScaleFactor,T);Xe=di.iconPrimary,ke=di.iconSecondary;const hn=Xe.toString();if(Fe=o.get(hn),Fe&&(pt=S.get("icon-offset").evaluate(me,{},u),ot=S.get("icon-anchor").evaluate(me,{},u),et=c0(a.get(hn),ke?a.get(ke.toString()):void 0,pt,ot),Ot=Fe.sdf,n.sdfIcons===void 0?n.sdfIcons=Fe.sdf:n.sdfIcons!==Fe.sdf&&Tt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Fe.pixelRatio!==n.pixelRatio||S.get("icon-rotate").constantOr(1)!==0)&&(n.iconsNeedLinear=!0)),ke){const te=ke.toString();Ye=o.get(te)}}ae=ae||!(!me.icon||!me.icon.hasSecondary());const Et=f0($e.horizontal)||$e.vertical;n.iconsInText||(n.iconsInText=!!Et&&Et.iconsInText);const Pt=Be*M.textScaleFactor/Rr,{defaultShapedIcon:wi,verticallyShapedIcon:lt}=Bz(n,et,S,me,u,$e,Pt,pt,wt);wt!=="none"&&et&&(wI(et)||bI(et))&&(p0(0,Fe,Xe,et,wi,wt,x,o,a),p0(0,Ye,ke,et,wi,wt,x,o,a),lt&&(p0(0,Fe,Xe,et,lt,wt,x,o,a),p0(0,Ye,ke,et,lt,wt,x,o,a))),et=wi;const{iconBBox:Rt,iconVerticalBBox:oi,textBBox:zi,textVerticalBBox:ki}=zz(n,et,lt,S,me,u,Ge,pt,M,a,ot,$e,Be,We);he.push({feature:me,shapedTextOrientations:$e,shapedText:Et,shapedIcon:et,iconPrimary:Xe,iconSecondary:ke,iconOffset:pt,iconAnchor:ot,verticallyShapedIcon:lt,layoutTextSize:Be,layoutIconSize:Ge,textOffset:We,isSDFIcon:Ot,iconTextFit:wt,iconCollisionBounds:Rt,iconVerticalCollisionBounds:oi,textCollisionBounds:zi,textVerticalCollisionBounds:ki})}return{featureData:he,sizes:M,hasAnySecondaryIcon:ae,textAlongLine:re,symbolPlacement:Y}},s.fx=PI,s.fy=function(n,e,i,o,a,u,d,m,y,x){n.iconAtlasPositions=x.iconPositions;const{featureData:T,hasAnySecondaryIcon:S,sizes:I,textAlongLine:M,symbolPlacement:P}=e;for(const k of T){const{shapedIcon:V,verticallyShapedIcon:N,feature:$,shapedTextOrientations:q,shapedText:Y,layoutTextSize:re,textOffset:ee,isSDFIcon:ae,iconPrimary:he,iconSecondary:me,iconTextFit:De,iconOffset:xe,iconCollisionBounds:Be,iconVerticalCollisionBounds:Ge,textCollisionBounds:$e}=k;BI(V,x.iconPositions,he,me),BI(N,x.iconPositions,he,me),Fz(q,x.iconPositions),Oz(he,me,x.iconPositions),(Y||V)&&Nz(n,$,q,V,N,y,I,re,0,ee,ae,o,a,d,m,S,De,xe,M,P,Be,Ge,$e)}i&&n.generateCollisionDebugBuffers(u,n.collisionBoxArray,I.textScaleFactor)},s.fz=Ae,s.g=function(n,e){return Nl(Object.assign(n,{method:"GET"}),e)},s.h=function(n){return n.indexOf("mapbox:")===0},s.i=function(n){return Ri.API_STYLE_REGEX.test(n)&&!qr(n)},s.j=Wn,s.k=Js,s.l=function(n){return decodeURIComponent(atob(n).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.m=function(n,e){return Nl(Object.assign(n,{type:"json"}),e)},s.n=Jh,s.o=Mr,s.p=function(n,e){return Nl(Object.assign(n,{method:"POST"}),e)},s.q=io,s.r=Ys,s.s=function(n){try{const e=self[n];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=function(){return $1||($1=new uh("ImageRasterizer")),$1},s.u=function(){return function n(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,n)}()},s.v=function(n){return!!n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)},s.w=Tt,s.x=Fw,s.y=Cu,s.z=Qs}),F(["./shared"],function(s){function de(Te){const j=Te?Te.url.toString():void 0;return j?performance.getEntriesByName(j):[]}function Ee(Te){if(typeof Te=="number"||typeof Te=="boolean"||typeof Te=="string"||Te==null)return JSON.stringify(Te);if(Array.isArray(Te)){let H="[";for(const J of Te)H+=`${Ee(J)},`;return`${H}]`}let j="{";for(const H of Object.keys(Te).sort())j+=`${H}:${Ee(Te[H])},`;return`${j}}`}function tt(Te){let j="";for(const H of s.bx)j+=`/${Ee(Te[H])}`;return j}class Ie{constructor(j){this.keyCache={},this._layers={},this._layerConfigs={},j&&this.replace(j)}replace(j,H){this._layerConfigs={},this._layers={},this.update(j,[],H)}update(j,H,J){this._options=J;for(const ue of j)this._layerConfigs[ue.id]=ue,(this._layers[ue.id]=s.du(ue,this.scope,null,this._options)).compileFilter(J),this.keyCache[ue.id]&&delete this.keyCache[ue.id];for(const ue of H)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const pe=function(ue,ye){const Re={};for(let Pe=0;Pe<ue.length;Pe++){const it=ue[Pe];let Ue=ye&&ye[it.id];Ue||(it.type==="symbol"?Ue=it.id:(Ue=tt(it),it.type==="line"&&it.paint&&function $t(Tt){return typeof Tt=="string"&&Tt==="line-progress"||(Array.isArray(Tt)?Tt.some($t):!(!Tt||typeof Tt!="object")&&Object.values(Tt).some($t))}(it.paint["line-width"])&&(Ue+=`/${Ee(it.paint["line-width"])}`))),ye&&(ye[it.id]=Ue);let It=Re[Ue];It||(It=Re[Ue]=[]),It.push(it)}const we=[];for(const Pe in Re)we.push(Re[Pe]);return we}(Object.values(this._layerConfigs),this.keyCache);for(const ue of pe){const ye=ue.map(It=>this._layers[It.id]),Re=ye[0];if(Re.visibility==="none")continue;const we=Re.source||"";let Pe=this.familiesBySource[we];Pe||(Pe=this.familiesBySource[we]={});const it=Re.sourceLayer||"_geojsonTileLayer";let Ue=Pe[it];Ue||(Ue=Pe[it]=[]),Ue.push(ye)}}}const He=1*s.fl;class vt{constructor(j){const H={},J=[];for(const Re in j){const we=j[Re],Pe=H[Re]={};for(const it in we.glyphs){const Ue=we.glyphs[+it];if(!Ue||Ue.bitmap.width===0||Ue.bitmap.height===0)continue;const It=Ue.metrics.localGlyph?He:1,$t={x:0,y:0,w:Ue.bitmap.width+2*It,h:Ue.bitmap.height+2*It};J.push($t),Pe[it]=$t}}const{w:pe,h:ue}=s.G(J),ye=new s.fk({width:pe||1,height:ue||1});for(const Re in j){const we=j[Re];for(const Pe in we.glyphs){const it=we.glyphs[+Pe];if(!it||it.bitmap.width===0||it.bitmap.height===0)continue;const Ue=H[Re][Pe],It=it.metrics.localGlyph?He:1;s.fk.copy(it.bitmap,ye,{x:0,y:0},{x:Ue.x+It,y:Ue.y+It},it.bitmap)}}this.image=ye,this.positions=H}}function mt(Te,j,H){Te[j]?H&&(Te[j].center=H):Te[j]={floorIds:new Set,center:H||[0,0],floors:{}}}function at(Te,j,H,J){for(const pe of j)mt(Te,pe),Te[pe].floors[H]=J,Te[pe].floorIds.add(H)}function Ft(Te){return{id:Te.properties.id.toString(),center:Te.properties.center.toString().split(";").map(Number)}}function Ve(Te){return{id:Te.properties.id.toString(),isDefault:!!Te.properties.is_default&&Te.properties.is_default,connections:Te.properties.connected_floor_ids?new Set(Te.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:Te.properties.conflicted_floor_ids?new Set(Te.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:Te.properties.building_ids?new Set(Te.properties.building_ids.toString().split(";")):new Set,name:Te.properties.name.toString(),zIndex:Te.properties.z_index}}function Se(Te,j){return j.every(H=>Te.properties&&Te.properties[H]!=null)}function Ce(Te){return Se(Te,["type","id","name"])&&Te.properties.type==="building"}function dt(Te){return Se(Te,["type","id","name","z_index"])&&Te.properties.type==="floor"}s.fj(vt,"GlyphAtlas");class Vt{constructor(j){this.tileID=new s.aQ(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.tileZoom=j.tileZoom,this.uid=j.uid,this.zoom=j.zoom,this.lut=j.lut,this.canonical=j.tileID.canonical,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.scope=j.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.request&&j.request.collectResourceTiming,this.promoteId=j.promoteId,this.isSymbolTile=j.isSymbolTile,this.tileTransform=s.aZ(j.tileID.canonical,j.projection),this.projection=j.projection,this.worldview=j.worldview,this.localizableLayerIds=j.localizableLayerIds,this.brightness=j.brightness,this.extraShadowCaster=!!j.extraShadowCaster,this.tessellationStep=j.tessellationStep,this.scaleFactor=j.scaleFactor,this.worldview=j.worldview,this.indoor=j.indoor}parse(j,H,J,pe,ue,ye){this.status="parsing",this.data=j,this.collisionBoxArray=new s.b3;const Re=new s.fm(Object.keys(j.layers).sort()),we=new s.fn(this.tileID,this.promoteId);we.bucketLayerIDs=[];const Pe={},it=new s.fo(256,256),Ue={featureIndex:we,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:it,availableImages:J,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const mi=this.indoor.indoorState.activeFloorsVisible,pi=function(hi,Fi,jn){const lr=function(Fn,Gi){if(!Fn)return s.w("No source layers defined in indoor specification"),Gi;if(Fn.size===0)return Gi;const Bn=Fn.difference(Gi);for(const gn of Bn)s.w(`Missing source layer required in indoor specification: ${gn}`);return Gi.intersection(Gi)}(Fi.sourceLayers,new Set(Object.keys(hi.layers))),Zn=Fi.indoorState,dr=function(Fn,Gi,Bn,gn){const Ri=new Set,Wn=new Set,qr
53=new Set,Kr=new Map,To={},kl=Fr=>{const qo=Kr.get(Fr)||new Set;for(const lo of Ri)if((Kr.get(lo)||new Set).has(Fr)||qo.has(lo))return!0;return!1};for(const Fr of Gi){const qo=Fn.layers[Fr];if(qo)for(let lo=0;lo<qo.length;lo++){const Ys=qo.feature(lo);if(Ce(Ys)){const{id:Mr,center:Ol}=Ft(Ys);mt(To,Mr,Ol),Ri.add(Mr)}else if(dt(Ys)){const{id:Mr,isDefault:Ol,connections:Ac,conflicts:qh,buildings:Zh,name:Wh,zIndex:Tu}=Ve(Ys);at(To,Zh,Mr,{name:Wh,zIndex:Tu}),Kr.set(Mr,qh),(Mr===gn||Ac.has(gn))&&Ri.add(Mr),Wn.add(Mr),Ol&&qr.add(Mr)}}else s.w(`indoor source layer not found: ${Fr}`)}if(Bn)for(const Fr of Bn)Wn.has(Fr)&&(kl(Fr)||Ri.add(Fr));for(const Fr of qr)Ri.has(Fr)||kl(Fr)||Ri.add(Fr);return{buildings:To,activeFloors:Ri}}(hi,lr,Zn.lastActiveFloors,Zn.selectedFloorId);return jn.send("setIndoorData",dr),dr}(j,this.indoor,ue);Ue.activeFloors=mi?pi.activeFloors:void 0}const It=[],$t=H.familiesBySource[this.source];for(const mi in $t){const pi=j.layers[mi];if(!pi)continue;let hi=!1,Fi=!1,jn=!1;for(const Gi of $t[mi])Gi[0].type==="symbol"?hi=!0:Fi=!0,Gi[0].is3D()&&Gi[0].type!=="model"&&(jn=!0);if(this.extraShadowCaster&&!jn||this.isSymbolTile===!0&&!hi||this.isSymbolTile===!1&&!Fi)continue;pi.version===1&&s.w(`Vector tile source "${this.source}" layer "${mi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const lr=Re.encode(mi),Zn=[],dr=this.localizableLayerIds&&this.localizableLayerIds.has(mi);let Fn=!1;for(let Gi=0,Bn=0;Gi<pi.length;Gi++){const gn=pi.feature(Gi),Ri=we.getId(gn,mi),Wn=gn.properties?gn.properties.worldview:null;if(dr&&this.worldview&&typeof Wn=="string")if(Wn==="all")gn.properties.$localized=!0;else{if(!Wn.split(",").includes(this.worldview))continue;gn.properties.$localized=!0,gn.properties.worldview=this.worldview}!Fn&&gn.properties&&gn.properties.hasOwnProperty(s.fp)&&(Fn=!0),Zn.push({feature:gn,id:Ri,index:Bn,sourceLayerIndex:lr}),Bn++}Fn&&!Ue.elevationFeatures&&j.layers.hasOwnProperty(s.fq)&&(Ue.elevationFeatures=s.fr.parseFrom(j.layers[s.fq],this.canonical));for(const Gi of $t[mi]){const Bn=Gi[0];if(this.extraShadowCaster&&(!Bn.is3D()||Bn.type==="model")||this.isSymbolTile!==void 0&&Bn.type==="symbol"!==this.isSymbolTile||Bn.minzoom&&this.zoom<Math.floor(Bn.minzoom)||Bn.maxzoom&&this.zoom>=Bn.maxzoom||Bn.visibility==="none")continue;jt(Gi,this.zoom,Ue.brightness,J,this.worldview);const gn=Pe[Bn.id]=Bn.createBucket({index:we.bucketLayerIDs.length,layers:Gi,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:lr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:pe,worldview:this.worldview,localizable:dr});we.bucketLayerIDs.push(Gi.map(Wn=>s.B(Wn.id,Wn.scope)));let Ri=gn.prepare?gn.prepare():null;Ri!=null?(Ri=Ri.then(()=>gn.populate(Zn,Ue,this.tileID.canonical,this.tileTransform)),It.push(Ri)):gn.populate(Zn,Ue,this.tileID.canonical,this.tileTransform)}}const Tt=()=>{let mi,pi,hi,Fi,jn,lr;it.trim();const Zn={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},dr=()=>{if(mi)return this.status="done",ye(mi);if(this.extraShadowCaster)this.status="done",ye(null,{buckets:Object.values(Pe).filter(Gi=>!Gi.isEmpty()),featureIndex:we,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ue.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(pi&&hi&&Fi){const Gi=new vt(pi),Bn=new Map;for(const[Wn,qr]of hi.entries()){const{imagePosition:Kr}=s.fu(Wn,qr,s.fv);Bn.set(Wn,Kr)}const gn={};for(const Wn in Pe){const qr=Pe[Wn];qr instanceof s.b4&&(jt(qr.layers,this.zoom,Ue.brightness,J,this.worldview),gn[Wn]=s.fw(qr,pi,Gi.positions,hi,Bn,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,jn,this.worldview))}const Ri={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(ue,hi,jn,()=>{Ri.iconsPending=!1,Fn(gn,Gi,Ri)}),this.rasterizeIfNeeded(ue,Fi,lr,()=>{Ri.patternsPending=!1,Fn(gn,Gi,Ri)})}},Fn=(Gi,Bn,gn,Ri)=>{if(gn.iconsPending||gn.patternsPending)return;const Wn=new s.fx(hi,Fi,this.lut);for(const qr in Pe){const Kr=Pe[qr];if(qr in Gi)s.fy(Kr,Gi[qr],this.showCollisionBoxes,J,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,hi,Wn);else if(Kr.hasPattern&&(Kr instanceof s.ba||Kr instanceof s.bb||Kr instanceof s.ea)){jt(Kr.layers,this.zoom,Ue.brightness,J,this.worldview);const To=Object.fromEntries(Wn.patternPositions);Kr.addFeatures(Ue,this.tileID.canonical,To,J,this.tileTransform,this.brightness)}}this.status="done",ye(null,{buckets:Object.values(Pe).filter(qr=>!qr.isEmpty()),featureIndex:we,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Bn.image,lineAtlas:it,imageAtlas:Wn,brightness:Ue.brightness})};if(!this.extraShadowCaster){const Gi=s.fs(Ue.glyphDependencies,Ri=>Object.keys(Ri).map(Number));Object.keys(Gi).length?ue.send("getGlyphs",{uid:this.uid,stacks:Gi},(Ri,Wn)=>{mi||(mi=Ri,pi=Wn,dr())},void 0,!1,Zn):pi={};const Bn=Array.from(Ue.iconDependencies.keys()).map(Ri=>s.I.parse(Ri));Bn.length?ue.send("getImages",{images:Bn,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"}
53,(Ri,Wn)=>{mi||(mi=Ri,hi=new Map,jn=this.updateImageMapAndGetImageTaskQueue(hi,Wn,Ue.iconDependencies),dr())},void 0,!1,Zn):(hi=new Map,jn=new Map);const gn=Array.from(Ue.patternDependencies.keys()).map(Ri=>s.I.parse(Ri));gn.length?ue.send("getImages",{images:gn,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ri,Wn)=>{mi||(mi=Ri,Fi=new Map,lr=this.updateImageMapAndGetImageTaskQueue(Fi,Wn,Ue.patternDependencies),dr())},void 0,!1,Zn):(Fi=new Map,lr=new Map)}if(Ue.elevationFeatures&&Ue.elevationFeatures.length>0){const Gi=[];for(const gn of Object.values(Pe))if(gn instanceof s.bb){const Ri=gn.getUnevaluatedPortalGraph();Ri&&Gi.push(Ri)}const Bn=s.ft.evaluate(Gi);for(const gn of Object.values(Pe))if(gn instanceof s.bb){const Ri=j.layers[Re.decode(gn.sourceLayerIndex)];gn.setEvaluatedPortalGraph(Bn,Ri,this.tileID.canonical,Ue.availableImages,Ue.brightness)}}dr()};It.length>0?Promise.allSettled(It).then(Tt).catch(ye):Tt()}updateParameters(j){this.scaleFactor=j.scaleFactor,this.showCollisionBoxes=j.showCollisionBoxes,this.projection=j.projection,this.brightness=j.brightness,this.tileTransform=s.aZ(j.tileID.canonical,j.projection),this.extraShadowCaster=j.extraShadowCaster,this.lut=j.lut,this.worldview=j.worldview,this.indoor=j.indoor}rasterizeIfNeeded(j,H,J,pe){Array.from(H.values()).some(ue=>ue.usvg)?this.rasterize(j,H,J,pe):pe()}updateImageMapAndGetImageTaskQueue(j,H,J){const pe=new Map;for(const ue of H.keys()){const ye=J.get(ue)||[];for(const Re of ye){const we=Re.toString(),Pe=H.get(Re.id.toString());Pe.usvg?pe.has(we)||(pe.set(we,Re),j.set(we,Object.assign({},Pe))):j.set(we,Pe)}}return pe}rasterize(j,H,J,pe){this.rasterizeTask=j.send("rasterizeImages",{scope:this.scope,tasks:J},(ue,ye)=>{if(!ue)for(const[Re,we]of ye.entries()){const Pe=Object.assign(H.get(Re),{data:we});H.set(Re,Pe)}pe()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function jt(Te,j,H,J,pe){const ue=new s.ac(j,{brightness:H,worldview:pe});for(const ye of Te)ye.recalculate(ue,J)}class qt extends s.E{constructor(j,H,J,pe,ue,ye,Re){super(),this.actor=j,this.layerIndex=H,this.availableImages=J,this.availableModels=pe,this.loadVectorData=ye||s.aL,this.loading={},this.loaded={},this.deduped=new s.aK(j.scheduler),this.isSpriteLoaded=ue,this.scheduler=j.scheduler,this.brightness=Re}loadTile(j,H){const J=j.uid,pe=j&&j.request,ue=pe&&pe.collectResourceTiming,ye=this.loading[J]=new Vt(j);ye.abort=this.loadVectorData(j,(Re,we)=>{const Pe=!this.loading[J];if(delete this.loading[J],ye.cancelRasterize(),Pe||Re||!we)return ye.status="done",Pe||(this.loaded[J]=ye),H(Re);const it=we.rawData,Ue={},It=s.aM(we.responseHeaders);It&&It.expires&&(Ue.expires=It.expires),It&&It.cacheControl&&(Ue.cacheControl=It.cacheControl),ye.vectorTile=we.vectorTile||new s.fz(new s.bt(it));const $t=()=>{ye.parse(ye.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Tt,mi)=>{if(Tt||!mi)return H(Tt);const pi={};if(ue){const hi=de(pe);hi.length>0&&(pi.resourceTiming=JSON.parse(JSON.stringify(hi)))}H(null,Object.assign({rawTileData:it.slice(0),responseHeaders:we.responseHeaders},mi,Ue,pi))})};this.isSpriteLoaded?$t():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add($t,{type:"parseTile",isSymbolTile:j.isSymbolTile,zoom:j.tileZoom}):$t()}),this.loaded=this.loaded||{},this.loaded[J]=ye})}reloadTile(j,H){const J=this.loaded,pe=j.uid;if(J&&J[pe]){const ue=J[pe];ue.updateParameters(j);const ye=(Re,we)=>{const Pe=ue.reloadCallback;Pe&&(delete ue.reloadCallback,ue.parse(ue.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Pe)),H(Re,we)};ue.status==="parsing"?ue.reloadCallback=ye:ue.status==="done"&&(ue.vectorTile?ue.parse(ue.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye):ye())}else H(null,void 0)}abortTile(j,H){const J=j.uid,pe=this.loading[J];pe&&(pe.abort&&pe.abort(),delete this.loading[J]),H()}removeTile(j,H){const J=this.loaded,pe=j.uid;J&&J[pe]&&delete J[pe],H()}}class si{loadTile(j,H){const{uid:J,encoding:pe,rawImageData:ue,padding:ye}=j,Re=ImageBitmap&&ue instanceof ImageBitmap?this.getImageData(ue,ye):ue;H(null,new s.fA(J,Re,pe,ye<1))}reloadTile(j,H){H(null,null)}abortTile(j,H){H()}removeTile(j,H){H()}getImageData(j,H){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(j.width,j.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=j.width,this.offscreenCanvas.height=j.height,this.offscreenCanvasContext.drawImage(j,
530,0,j.width,j.height);const J=this.offscreenCanvasContext.getImageData(-H,-H,j.width+2*H,j.height+2*H);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),J}}s.bs.setPbf(s.bt);class ji{constructor(j){this._mrt=new s.bs(j.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=j.uid,this.tileID=j.tileID,this.source=j.source}parse(j,H){const J=this._mrt;this.status="parsing",this._entireBuffer=j;try{J.parseHeader(j),this._isHeaderLoaded=!0;const pe=[];for(const ue in J.layers){const ye=J.getLayer(ue),Re=ye.getDataRange(ye.getBandList()),we=J.createDecodingTask(Re),Pe=j.slice(Re.firstByte,Re.lastByte+1),it=s.bs.performDecoding(Pe,we).then(Ue=>we.complete(null,Ue)).catch(Ue=>we.complete(Ue,null));pe.push(it)}Promise.allSettled(pe).then(()=>H(null,J)).catch(ue=>H(ue))}catch(pe){H(pe)}}}class Ui{constructor(j){this.actor=j,this.loading={},this.loaded={}}loadTile(j,H){const J=j.uid,pe=j.request,ue=this.loading[J]=new ji(j),{cancel:ye}=s.bu(pe,(Re,we,Pe)=>{const it=!this.loading[J];if(delete this.loading[J],it||Re||!we)return ue.status="done",it||(this.loaded[J]=ue),H(Re);ue.parse(we,(Ue,It)=>{if(Ue||!It)return H(Ue);H(null,It,Pe)}),this.loaded[J]=ue});ue.abort=ye}reloadTile(j,H){H(null,void 0)}abortTile(j,H){const J=j.uid,pe=this.loading[J];pe&&(pe.abort&&pe.abort(),delete this.loading[J]),H()}removeTile(j,H){const J=j.uid;this.loaded[J]&&delete this.loaded[J],H()}decodeRasterArray(j,H){s.bs.performDecoding(j.buffer,j.task).then(J=>H(null,J)).catch(J=>H(J))}}const ar=s.fB.prototype.toGeoJSON;class fr{constructor(j){this._feature=j,this.extent=s.al,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const H of this._feature.geometry)j.push([new s.P(H[0],H[1])]);return j}{const j=[];for(const H of this._feature.geometry){const J=[];for(const pe of H)J.push(new s.P(pe[0],pe[1]));j.push(J)}return j}}toGeoJSON(j,H,J){return ar.call(this,j,H,J)}}class Ii{constructor(j,H){this.name=j,this.extent=s.al,this.length=H.length,this._jsonFeatures=H}feature(j){return new fr(this._jsonFeatures[j])}}class Cr{constructor(j){this.layers={},this.extent=s.al;for(const H of Object.keys(j))this.layers[H]=new Ii(H,j[H])}}const Hn=64/4096,ri=128;class Ei{constructor(){this.features=new Map}clear(){this.features.clear()}load(j=[],H){for(const J of j){const pe=J.id;if(pe==null)continue;let ue=this.features.get(pe);ue&&this.updateCache(ue,H),J.geometry?(ue=Ti(J),this.updateCache(ue,H),this.features.set(pe,ue)):this.features.delete(pe),this.updateCache(ue,H)}}updateCache(j,H){for(const{canonical:J,uid:pe}of Object.values(H)){const{z:ue,x:ye,y:Re}=J;Gt(j,Math.pow(2,ue),ye,Re)&&delete H[pe]}}getTile(j,H,J){const pe=Math.pow(2,j),ue=[];for(const ye of this.features.values())Gt(ye,pe,H,J)&&ue.push(ai(ye,pe,H,J));return{features:ue}}getFeatures(){return[...this.features.values()]}}function Gt({minX:Te,minY:j,maxX:H,maxY:J},pe,ue,ye){return Te<(ue+1+Hn)/pe&&j<(ye+1+Hn)/pe&&H>(ue-Hn)/pe&&J>(ye-Hn)/pe}function Ti(Te){const{id:j,geometry:H,properties:J}=Te;if(!H)return;if(H.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:pe,coordinates:ue}=H,ye={id:j,type:1,geometry:[],tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Re=ye.geometry;if(pe==="Point")Ct(ue,Re,ye);else if(pe==="MultiPoint")for(const we of ue)Ct(we,Re,ye);else if(pe==="LineString")ye.type=2,qe(ue,Re,ye);else if(pe==="MultiLineString")ye.type=2,ti(ue,Re,ye);else if(pe==="Polygon")ye.type=3,ti(ue,Re,ye,!0);else{if(pe!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ye.type=3;for(const we of ue)ti(we,Re,ye,!0)}return ye}function Ct([Te,j],H,J){const pe=s.aF(Te);let ue=s.aJ(j);ue=ue<0?0:ue>1?1:ue,H.push(pe,ue),J.minX=Math.min(J.minX,pe),J.minY=Math.min(J.minY,ue),J.maxX=Math.max(J.maxX,pe),J.maxY=Math.max(J.maxY,ue)}function qe(Te,j,H,J=!1,pe=!1){const ue=[];for(const ye of Te)Ct(ye,ue,H);j.push(ue),J&&function(ye,Re){let we=0;for(let Pe=0,it=ye.length,Ue=it-2;Pe<it;Ue=Pe,Pe+=2)we+=(ye[Pe]-ye[Ue])*(ye[Pe+1]+ye[Ue+1]);if(we>0===Re)for(let Pe=0,it=ye.length;Pe<it/2;Pe+=2){const Ue=ye[Pe],It=ye[Pe+1];ye[Pe]=ye[it-2-Pe],ye[Pe+1]=ye[it-1-Pe],ye[it-2-Pe]=Ue,ye[it-1-Pe]=It}}(ue,pe)}function ti(Te,j,H,J=!1){for(let pe=0;pe<Te.length;pe++)qe(Te[pe],j,H,J,pe===0)}function ai(Te,j,H,J){const{id:pe,type:ue,geometry:ye,tags:Re}=Te,we=[];if(ue===1)(function(Pe,it,Ue,It,$t){for(let Tt=0;Tt<Pe.length;Tt+=2){const mi=Math.round(s.al*(Pe[Tt+0]*it-Ue)),pi=Math.round(s.al*(Pe[Tt+1]*it-It));$t.push([mi,pi])}})(ye,j,H,J,we);else if(ue===2)for(const Pe of ye)Si(Pe,j,H,J,we);else if(ue===3)for(const Pe of ye)Sn(Pe,j,H,J,we);return{id:pe,type:ue,geometry:we,tags:Re}}function Si(Te,j,H,J,pe){const ue=-ri,ye=s.al+ri;let Re;for(let we=0;we<Te.length-2;we+=2){let Pe=Math.round(s.al*(Te[we+0]*j-H)),it=Math.round(s.al*(Te[we+1]*j-J)),Ue=Math.round(s.al*(Te[we+2]*j-H)),It=Math.round(s.al*(Te[we+3]*j-J));const $t=Ue-Pe,Tt=It-it;Pe<ue&&Ue<ue||(Pe<ue?(it+=Math.round(Tt*((ue-Pe)/$t)),Pe=ue):Ue<ue&&(It=it+Math.round(Tt*((ue-Pe)/$t)),Ue=ue),it<ue&&It<ue||(it<ue?(Pe+=Math.round($t*((ue-it)/Tt)),it=ue):It<ue&&(Ue=Pe+Math.round($t*((ue-it)/Tt)),It=ue),Pe>=ye&&Ue>=ye||(Pe>=ye?(it+=Math.round(Tt*((ye-Pe)/$t)),Pe=ye):Ue>=ye&&(It=it+Math.round(Tt*((ye-Pe)/$t)),Ue=ye),it>=ye&&It>=ye||(it>=ye?(Pe+=Math.round($t*((ye-it)/Tt)),it=ye):It>=ye&&(Ue=Pe+Math.round($t*((ye-it)/Tt)),It=ye),Re&&Pe===Re[Re.length-1][0]&&it===Re[Re.length-1][1]||(Re=[[Pe,it]],pe.push(Re)),Re.push([Ue,It])))))}}function Sn(Te,j,H,J,pe){const ue=(H-Hn)/j,ye=(J-Hn)/j,Re=(H+1+Hn)/j,we=(J+1+Hn)/j;function Pe(It,$t){let Tt=0;return It<ue?Tt|=1:It>Re&&(Tt|=2),$t<ye?Tt|=4:$t>we&&(Tt|=8),Tt}let it=[];for(let It=1;It<=8;It*=2){let $t=Te[Te.length-2],Tt=Te[Te.length-1],mi=!(Pe($t,Tt)&It);for(let pi=0;pi<Te.length;pi+=2){const hi=Te[pi],Fi=Te[pi+1],jn=!(Pe(hi,Fi)&It);
53jn!==mi&&(8&It?it.push($t+(hi-$t)*(we-Tt)/(Fi-Tt),we):4&It?it.push($t+(hi-$t)*(ye-Tt)/(Fi-Tt),ye):2&It?it.push(Re,Tt+(Fi-Tt)*(Re-$t)/(hi-$t)):1&It&&it.push(ue,Tt+(Fi-Tt)*(ue-$t)/(hi-$t))),jn&&it.push(hi,Fi),$t=hi,Tt=Fi,mi=jn}if(!(Te=it).length||It===8)break;it=[]}const Ue=[];for(let It=0;It<it.length;It+=2)Ue.push([Math.round(s.al*(it[It]*j-H)),Math.round(s.al*(it[It+1]*j-J))]);pe.push(Ue)}function Kn({name:Te,features:j},H){H.writeStringField(1,Te),H.writeVarintField(5,s.al);const J=new Map,pe=new Map,ue={keys:J,values:pe,feature:null};for(const ye of j)ue.feature=ye,H.writeMessage(2,br,ue);for(const ye of J.keys())H.writeStringField(3,ye);for(const ye of pe.keys())H.writeMessage(4,oo,ye)}function br(Te,j){const H=Te.feature;H.id!==void 0&&Number.isSafeInteger(+H.id)&&j.writeVarintField(1,+H.id),H.tags&&j.writeMessage(2,Or,Te),j.writeVarintField(3,H.type),j.writeMessage(4,nr,H)}function Or({keys:Te,values:j,feature:H},J){for(const pe of Object.keys(H.tags)){let ue=H.tags[pe];if(ue===null)continue;let ye=Te.get(pe);ye===void 0&&(ye=Te.size,Te.set(pe,ye)),J.writeVarint(ye);const Re=typeof ue;Re!=="string"&&Re!=="boolean"&&Re!=="number"&&(ue=JSON.stringify(ue));let we=j.get(ue);we===void 0&&(we=j.size,j.set(ue,we)),J.writeVarint(we)}}function un(Te,j){return(j<<3)+(7&Te)}function vn(Te){return Te<<1^Te>>31}function nr(Te,j){const{geometry:H,type:J}=Te;let pe=0,ue=0;if(J===1){j.writeVarint(un(1,H.length));for(const ye of H){const Re=ye[0]-pe,we=ye[1]-ue;j.writeVarint(vn(Re)),j.writeVarint(vn(we)),pe+=Re,ue+=we}}else for(const ye of H){j.writeVarint(un(1,1));const Re=ye.length-(J===3?1:0);for(let we=0;we<Re;we++){we===1&&j.writeVarint(un(2,Re-1));const Pe=ye[we][0]-pe,it=ye[we][1]-ue;j.writeVarint(vn(Pe)),j.writeVarint(vn(it)),pe+=Pe,ue+=it}J===3&&j.writeVarint(un(7,1))}}function oo(Te,j){const H=typeof Te;H==="string"?j.writeStringField(1,Te):H==="boolean"?j.writeBooleanField(7,Te):H==="number"&&(Te%1!=0?j.writeDoubleField(3,Te):Te<0?j.writeSVarintField(6,Te):j.writeVarintField(5,Te))}const qn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Te=>Te},Jn=Math.fround||(Ss=new Float32Array(1),Te=>(Ss[0]=+Te,Ss[0]));var Ss;const so=3,jr=5,rr=6;class wu{constructor(j){this.options=Object.assign(Object.create(qn),j),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(j){const{log:H,minZoom:J,maxZoom:pe}=this.options;H&&console.time("total time");const ue=`prepare ${j.length} points`;H&&console.time(ue),this.points=j;const ye=[];for(let we=0;we<j.length;we++){const Pe=j[we];if(!Pe.geometry)continue;const[it,Ue]=Pe.geometry.coordinates,It=Jn($s(it)),$t=Jn(Hs(Ue));ye.push(It,$t,1/0,we,-1,1),this.options.reduce&&ye.push(0)}let Re=this.trees[pe+1]=this._createTree(ye);H&&console.timeEnd(ue);for(let we=pe;we>=J;we--){const Pe=+Date.now();Re=this.trees[we]=this._createTree(this._cluster(Re,we)),H&&console.log("z%d: %d clusters in %dms",we,Re.numItems,+Date.now()-Pe)}return H&&console.timeEnd("total time"),this}getClusters(j,H){let J=((j[0]+180)%360+360)%360-180;const pe=Math.max(-90,Math.min(90,j[1]));let ue=j[2]===180?180:((j[2]+180)%360+360)%360-180;const ye=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)J=-180,ue=180;else if(J>ue){const Ue=this.getClusters([J,pe,180,ye],H),It=this.getClusters([-180,pe,ue,ye],H);return Ue.concat(It)}const Re=this.trees[this._limitZoom(H)],we=Re.range($s(J),Hs(ye),$s(ue),Hs(pe)),Pe=Re.data,it=[];for(const Ue of we){const It=this.stride*Ue;it.push(Pe[It+jr]>1?Go(Pe,It,this.clusterProps):this.points[Pe[It+so]])}return it}getChildren(j){const H=this._getOriginId(j),J=this._getOriginZoom(j),pe="No cluster with the specified id.",ue=this.trees[J];if(!ue)throw new Error(pe);const ye=ue.data;if(H*this.stride>=ye.length)throw new Error(pe);const Re=this.options.radius/(this.options.extent*Math.pow(2,J-1)),we=ue.within(ye[H*this.stride],ye[H*this.stride+1],Re),Pe=[];for(const it of we){const Ue=it*this.stride;ye[Ue+4]===j&&Pe.push(ye[Ue+jr]>1?Go(ye,Ue,this.clusterProps):this.points[ye[Ue+so]])}if(Pe.length===0)throw new Error(pe);return Pe}getLeaves(j,H,J){const pe=[];return this._appendLeaves(pe,j,H=H||10,J=J||0,0),pe}getTile(j,H,J){const pe=this.trees[this._limitZoom(j)],ue=Math.pow(2,j),{extent:ye,radiu
vendor: 4,412 bytes, line 53
53s:Re}=this.options,we=Re/ye,Pe=(J-we)/ue,it=(J+1+we)/ue,Ue={features:[]};return this._addTileFeatures(pe.range((H-we)/ue,Pe,(H+1+we)/ue,it),pe.data,H,J,ue,Ue),H===0&&this._addTileFeatures(pe.range(1-we/ue,Pe,1,it),pe.data,ue,J,ue,Ue),H===ue-1&&this._addTileFeatures(pe.range(0,Pe,we/ue,it),pe.data,-1,J,ue,Ue),Ue.features.length?Ue:null}getClusterExpansionZoom(j){let H=this._getOriginZoom(j)-1;for(;H<=this.options.maxZoom;){const J=this.getChildren(j);if(H++,J.length!==1)break;j=J[0].properties.cluster_id}return H}_appendLeaves(j,H,J,pe,ue){const ye=this.getChildren(H);for(const Re of ye){const we=Re.properties;if(we&&we.cluster?ue+we.point_count<=pe?ue+=we.point_count:ue=this._appendLeaves(j,we.cluster_id,J,pe,ue):ue<pe?ue++:j.push(Re),j.length===J)break}return ue}_createTree(j){const H=new s.c4(j.length/this.stride|0,this.options.nodeSize,Float32Array);for(let J=0;J<j.length;J+=this.stride)H.add(j[J],j[J+1]);return H.finish(),H.data=j,H}_addTileFeatures(j,H,J,pe,ue,ye){for(const Re of j){const we=Re*this.stride,Pe=H[we+jr]>1;let it,Ue,It;if(Pe)it=xa(H,we,this.clusterProps),Ue=H[we],It=H[we+1];else{const mi=this.points[H[we+so]];it=mi.properties;const[pi,hi]=mi.geometry.coordinates;Ue=$s(pi),It=Hs(hi)}const $t={type:1,geometry:[[Math.round(this.options.extent*(Ue*ue-J)),Math.round(this.options.extent*(It*ue-pe))]],tags:it};let Tt;Tt=Pe||this.options.generateId?H[we+so]:this.points[H[we+so]].id,Tt!==void 0&&($t.id=Tt),ye.features.push($t)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,H){const{radius:J,extent:pe,reduce:ue,minPoints:ye}=this.options,Re=J/(pe*Math.pow(2,H)),we=j.data,Pe=[],it=this.stride;for(let Ue=0;Ue<we.length;Ue+=it){if(we[Ue+2]<=H)continue;we[Ue+2]=H;const It=we[Ue],$t=we[Ue+1],Tt=j.within(we[Ue],we[Ue+1],Re),mi=we[Ue+jr];let pi=mi;for(const hi of Tt){const Fi=hi*it;we[Fi+2]>H&&(pi+=we[Fi+jr])}if(pi>mi&&pi>=ye){let hi,Fi=It*mi,jn=$t*mi,lr=-1;const Zn=(Ue/it<<5)+(H+1)+this.points.length;for(const dr of Tt){const Fn=dr*it;if(we[Fn+2]<=H)continue;we[Fn+2]=H;const Gi=we[Fn+jr];Fi+=we[Fn]*Gi,jn+=we[Fn+1]*Gi,we[Fn+4]=Zn,ue&&(hi||(hi=this._map(we,Ue,!0),lr=this.clusterProps.length,this.clusterProps.push(hi)),ue(hi,this._map(we,Fn)))}we[Ue+4]=Zn,Pe.push(Fi/pi,jn/pi,1/0,Zn,-1,pi),ue&&Pe.push(lr)}else{for(let hi=0;hi<it;hi++)Pe.push(we[Ue+hi]);if(pi>1)for(const hi of Tt){const Fi=hi*it;if(!(we[Fi+2]<=H)){we[Fi+2]=H;for(let jn=0;jn<it;jn++)Pe.push(we[Fi+jn])}}}}return Pe}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,H,J){if(j[H+jr]>1){const ye=this.clusterProps[j[H+rr]];return J?Object.assign({},ye):ye}const pe=this.points[j[H+so]].properties,ue=this.options.map(pe);return J&&ue===pe?Object.assign({},ue):ue}}function Go(Te,j,H){return{type:"Feature",id:Te[j+so],properties:xa(Te,j,H),geometry:{type:"Point",coordinates:[(J=Te[j],360*(J-.5)),Ur(Te[j+1])]}};var J}function xa(Te,j,H){const J=Te[j+jr],pe=J>=1e4?`${Math.round(J/1e3)}k`:J>=1e3?Math.round(J/100)/10+"k":J,ue=Te[j+rr],ye=ue===-1?{}:Object.assign({},H[ue]);return Object.assign(ye,{cluster:!0,cluster_id:Te[j+so],point_count:J,point_count_abbreviated:pe})}function $s(Te){return Te/360+.5}function Hs(Te){const j=Math.sin(Te*Math.PI/180),H=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return H<0?0:H>1?1:H}function Ur(Te){const j=(180-360*Te)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function Es(Te,j,H,J){let pe=J;const ue=j+(H-j>>1);let ye,Re=H-j;const we=Te[j],Pe=Te[j+1],it=Te[H],Ue=Te[H+1];for(let It=j+3;It<H;It+=3){const $t=Qa(Te[It],Te[It+1],we,Pe,it,Ue);if($t>pe)ye=It,pe=$t;else if($t===pe){const Tt=Math.abs(It-ue);Tt<Re&&(ye=It,Re=Tt)}}pe>J&&(ye-j>3&&Es(Te,j,ye,J),Te[ye+2]=pe,H-ye>3&&Es(Te,ye,H,J))}function Qa(Te,j,H,J,pe,ue){let ye=pe-H,Re=ue-J;if(ye!==0||Re!==0){const we=((Te-H)*ye+(j-J)*Re)/(ye*ye+Re*Re);we>1?(H=pe,J=ue):we>0&&(H+=ye*we,J+=Re*we)}return ye=Te-H,Re=j-J,ye*ye+Re*Re}function $o(Te,j,H,J){const pe={id:Te??null,type:j,geometry:H,tags:J,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(j==="Point"||j==="MultiPoint"||j==="LineString")Is(pe,H);else if(j==="Polygon")Is(pe,H[0]);else if(j==="MultiLineString")for(const ue of H)Is(pe,ue);else if(j==="MultiPolygon")for(const ue of H)Is(pe,ue[0]);return pe}function Is(Te,j){for(let H=0;H<j.length;H+=3)Te.minX=Math.min(Te.minX,j[H]),Te.minY=Math.min(Te.minY,j[H+1]),Te.maxX=Math.max(Te.maxX,j[H
vendor: 4,279 bytes, line 53
53]),Te.maxY=Math.max(Te.maxY,j[H+1])}function Yr(Te,j,H,J){if(!j.geometry)return;const pe=j.geometry.coordinates;if(pe&&pe.length===0)return;const ue=j.geometry.type,ye=Math.pow(H.tolerance/((1<<H.maxZoom)*H.extent),2);let Re=[],we=j.id;if(H.promoteId?we=j.properties[H.promoteId]:H.generateId&&(we=J||0),ue==="Point")wa(pe,Re);else if(ue==="MultiPoint")for(const Pe of pe)wa(Pe,Re);else if(ue==="LineString")qs(pe,Re,ye,!1);else if(ue==="MultiLineString"){if(H.lineMetrics){for(const Pe of pe)Re=[],qs(Pe,Re,ye,!1),Te.push($o(we,"LineString",Re,j.properties));return}ba(pe,Re,ye,!1)}else if(ue==="Polygon")ba(pe,Re,ye,!0);else{if(ue!=="MultiPolygon"){if(ue==="GeometryCollection"){for(const Pe of j.geometry.geometries)Yr(Te,{id:we,geometry:Pe,properties:j.properties},H,J);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Pe of pe){const it=[];ba(Pe,it,ye,!0),Re.push(it)}}Te.push($o(we,ue,Re,j.properties))}function wa(Te,j){j.push(Zs(Te[0]),Qn(Te[1]),0)}function qs(Te,j,H,J){let pe,ue,ye=0;for(let we=0;we<Te.length;we++){const Pe=Zs(Te[we][0]),it=Qn(Te[we][1]);j.push(Pe,it,0),we>0&&(ye+=J?(pe*it-Pe*ue)/2:Math.sqrt(Math.pow(Pe-pe,2)+Math.pow(it-ue,2))),pe=Pe,ue=it}const Re=j.length-3;j[2]=1,Es(j,0,Re,H),j[Re+2]=1,j.size=Math.abs(ye),j.start=0,j.end=j.size}function ba(Te,j,H,J){for(let pe=0;pe<Te.length;pe++){const ue=[];qs(Te[pe],ue,H,J),j.push(ue)}}function Zs(Te){return Te/360+.5}function Qn(Te){const j=Math.sin(Te*Math.PI/180),H=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return H<0?0:H>1?1:H}function Gr(Te,j,H,J,pe,ue,ye,Re){if(J/=j,ue>=(H/=j)&&ye<J)return Te;if(ye<H||ue>=J)return null;const we=[];for(const Pe of Te){const it=Pe.geometry;let Ue=Pe.type;const It=pe===0?Pe.minX:Pe.minY,$t=pe===0?Pe.maxX:Pe.maxY;if(It>=H&&$t<J){we.push(Pe);continue}if($t<H||It>=J)continue;let Tt=[];if(Ue==="Point"||Ue==="MultiPoint")Ws(it,Tt,H,J,pe);else if(Ue==="LineString")Xs(it,Tt,H,J,pe,!1,Re.lineMetrics);else if(Ue==="MultiLineString")Do(it,Tt,H,J,pe,!1);else if(Ue==="Polygon")Do(it,Tt,H,J,pe,!0);else if(Ue==="MultiPolygon")for(const mi of it){const pi=[];Do(mi,pi,H,J,pe,!0),pi.length&&Tt.push(pi)}if(Tt.length){if(Re.lineMetrics&&Ue==="LineString"){for(const mi of Tt)we.push($o(Pe.id,Ue,mi,Pe.tags));continue}Ue!=="LineString"&&Ue!=="MultiLineString"||(Tt.length===1?(Ue="LineString",Tt=Tt[0]):Ue="MultiLineString"),Ue!=="Point"&&Ue!=="MultiPoint"||(Ue=Tt.length===3?"Point":"MultiPoint"),we.push($o(Pe.id,Ue,Tt,Pe.tags))}}return we.length?we:null}function Ws(Te,j,H,J,pe){for(let ue=0;ue<Te.length;ue+=3){const ye=Te[ue+pe];ye>=H&&ye<=J&&Ho(j,Te[ue],Te[ue+1],Te[ue+2])}}function Xs(Te,j,H,J,pe,ue,ye){let Re=ss(Te);const we=pe===0?Ll:Wt;let Pe,it,Ue=Te.start;for(let pi=0;pi<Te.length-3;pi+=3){const hi=Te[pi],Fi=Te[pi+1],jn=Te[pi+2],lr=Te[pi+3],Zn=Te[pi+4],dr=pe===0?hi:Fi,Fn=pe===0?lr:Zn;let Gi=!1;ye&&(Pe=Math.sqrt(Math.pow(hi-lr,2)+Math.pow(Fi-Zn,2))),dr<H?Fn>H&&(it=we(Re,hi,Fi,lr,Zn,H),ye&&(Re.start=Ue+Pe*it)):dr>J?Fn<J&&(it=we(Re,hi,Fi,lr,Zn,J),ye&&(Re.start=Ue+Pe*it)):Ho(Re,hi,Fi,jn),Fn<H&&dr>=H&&(it=we(Re,hi,Fi,lr,Zn,H),Gi=!0),Fn>J&&dr<=J&&(it=we(Re,hi,Fi,lr,Zn,J),Gi=!0),!ue&&Gi&&(ye&&(Re.end=Ue+Pe*it),j.push(Re),Re=ss(Te)),ye&&(Ue+=Pe)}let It=Te.length-3;const $t=Te[It],Tt=Te[It+1],mi=pe===0?$t:Tt;mi>=H&&mi<=J&&Ho(Re,$t,Tt,Te[It+2]),It=Re.length-3,ue&&It>=3&&(Re[It]!==Re[0]||Re[It+1]!==Re[1])&&Ho(Re,Re[0],Re[1],Re[2]),Re.length&&j.push(Re)}function ss(Te){const j=[];return j.size=Te.size,j.start=Te.start,j.end=Te.end,j}function Do(Te,j,H,J,pe,ue){for(const ye of Te)Xs(ye,j,H,J,pe,ue,!1)}function Ho(Te,j,H,J){Te.push(j,H,J)}function Ll(Te,j,H,J,pe,ue){const ye=(ue-j)/(J-j);return Ho(Te,ue,H+(pe-H)*ye,1),ye}function Wt(Te,j,H,J,pe,ue){const ye=(ue-H)/(pe-H);return Ho(Te,j+(J-j)*ye,ue,1),ye}function Dt(Te,j){const H=[];for(let J=0;J<Te.length;J++){const pe=Te[J],ue=pe.type;let ye;if(ue==="Point"||ue==="MultiPoint"||ue==="LineString")ye=Pi(pe.geometry,j);else if(ue==="MultiLineString"||ue==="Polygon"){ye=[];for(const Re of pe.geometry)ye.push(Pi(Re,j))}else if(ue==="MultiPolygon"){ye=[];for(const Re of pe.geometry){const we=[];for(const Pe of Re)we.push(Pi(Pe,j));ye.push(we)}}H.push($o(pe.id,ue,ye,pe.tags))}return H}function Pi(Te,j){const H=[];H.size=Te.size,Te.start!==void 0&&(H.start=Te.start,H.end=Te.end
53);for(let J=0;J<Te.length;J+=3)H.push(Te[J]+j,Te[J+1],Te[J+2]);return H}function In(Te,j){if(Te.transformed)return Te;const H=1<<Te.z,J=Te.x,pe=Te.y;for(const ue of Te.features){const ye=ue.geometry,Re=ue.type;if(ue.geometry=[],Re===1)for(let we=0;we<ye.length;we+=2)ue.geometry.push(Tr(ye[we],ye[we+1],j,H,J,pe));else for(let we=0;we<ye.length;we++){const Pe=[];for(let it=0;it<ye[we].length;it+=2)Pe.push(Tr(ye[we][it],ye[we][it+1],j,H,J,pe));ue.geometry.push(Pe)}}return Te.transformed=!0,Te}function Tr(Te,j,H,J,pe,ue){return[Math.round(H*(Te*J-pe)),Math.round(H*(j*J-ue))]}function ko(Te,j,H,J,pe){const ue=j===pe.maxZoom?0:pe.tolerance/((1<<j)*pe.extent),ye={features:[],numPoints:0,numSimplified:0,numFeatures:Te.length,source:null,x:H,y:J,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Re of Te)Ic(ye,Re,ue,pe);return ye}function Ic(Te,j,H,J){const pe=j.geometry,ue=j.type,ye=[];if(Te.minX=Math.min(Te.minX,j.minX),Te.minY=Math.min(Te.minY,j.minY),Te.maxX=Math.max(Te.maxX,j.maxX),Te.maxY=Math.max(Te.maxY,j.maxY),ue==="Point"||ue==="MultiPoint")for(let Re=0;Re<pe.length;Re+=3)ye.push(pe[Re],pe[Re+1]),Te.numPoints++,Te.numSimplified++;else if(ue==="LineString")Ke(ye,pe,Te,H,!1,!1);else if(ue==="MultiLineString"||ue==="Polygon")for(let Re=0;Re<pe.length;Re++)Ke(ye,pe[Re],Te,H,ue==="Polygon",Re===0);else if(ue==="MultiPolygon")for(let Re=0;Re<pe.length;Re++){const we=pe[Re];for(let Pe=0;Pe<we.length;Pe++)Ke(ye,we[Pe],Te,H,!0,Pe===0)}if(ye.length){let Re=j.tags||null;if(ue==="LineString"&&J.lineMetrics){Re={};for(const Pe in j.tags)Re[Pe]=j.tags[Pe];Re.mapbox_clip_start=pe.start/pe.size,Re.mapbox_clip_end=pe.end/pe.size}const we={geometry:ye,type:ue==="Polygon"||ue==="MultiPolygon"?3:ue==="LineString"||ue==="MultiLineString"?2:1,tags:Re};j.id!==null&&(we.id=j.id),Te.features.push(we)}}function Ke(Te,j,H,J,pe,ue){const ye=J*J;if(J>0&&j.size<(pe?ye:J))return void(H.numPoints+=j.length/3);const Re=[];for(let we=0;we<j.length;we+=3)(J===0||j[we+2]>ye)&&(H.numSimplified++,Re.push(j[we],j[we+1])),H.numPoints++;pe&&function(we,Pe){let it=0;for(let Ue=0,It=we.length,$t=It-2;Ue<It;$t=Ue,Ue+=2)it+=(we[Ue]-we[$t])*(we[Ue+1]+we[$t+1]);if(it>0===Pe)for(let Ue=0,It=we.length;Ue<It/2;Ue+=2){const $t=we[Ue],Tt=we[Ue+1];we[Ue]=we[It-2-Ue],we[Ue+1]=we[It-1-Ue],we[It-2-Ue]=$t,we[It-1-Ue]=Tt}}(Re,ue),Te.push(Re)}const Ta={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Tf{constructor(j,H){const J=(H=this.options=function(ue,ye){for(const Re in ye)ue[Re]=ye[Re];return ue}(Object.create(Ta),H)).debug;if(J&&console.time("preprocess data"),H.maxZoom<0||H.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(H.promoteId&&H.generateId)throw new Error("promoteId and generateId cannot be used together.");let pe=function(ue,ye){const Re=[];if(ue.type==="FeatureCollection")for(let we=0;we<ue.features.length;we++)Yr(Re,ue.features[we],ye,we);else Yr(Re,ue.type==="Feature"?ue:{geometry:ue},ye);return Re}(j,H);this.tiles={},this.tileCoords=[],J&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",H.indexMaxZoom,H.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),pe=function(ue,ye){const Re=ye.buffer/ye.extent;let we=ue;const Pe=Gr(ue,1,-1-Re,Re,0,-1,2,ye),it=Gr(ue,1,1-Re,2+Re,0,-1,2,ye);return(Pe||it)&&(we=Gr(ue,1,-Re,1+Re,0,-1,2,ye)||[],Pe&&(we=Dt(Pe,1).concat(we)),it&&(we=we.concat(Dt(it,-1)))),we}(pe,H),pe.length&&this.splitTile(pe,0,0,0),J&&(pe.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(j,H,J,pe,ue,ye,Re){const we=[j,H,J,pe],Pe=this.options,it=Pe.debug;for(;we.length;){pe=we.pop(),J=we.pop(),H=we.pop(),j=we.pop();const Ue=1<<H,It=zl(H,J,pe);let $t=this.tiles[It];if(!$t&&(it>1&&console.time("creation"),$t=this.tiles[It]=ko(j,H,J,pe,Pe),this.tileCoords.push({z:H,x:J,y:pe}),it)){it>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",H,J,pe,$t.numFeatures,$t.numPoints,$t.numSimplified),console.timeEnd("creation"));const Gi=`z${H}`;this.stats[Gi]=(this.stats[Gi]||0)+1,this.total++}if($t.source=j,ue==null){if(H===Pe.indexMaxZoom||$t.numPoints<=Pe.indexMaxPoints)continue}else{if(H===Pe.maxZoom||H===ue)continue;if(ue!=null){const Gi=ue-H;if(J!==ye>>Gi||pe!==Re>>Gi)continue}}if($t.source=null,j.length===0)continue;it>1&&console.time("clipping");const Tt=.5*Pe.buffer/Pe.extent,mi=.5-Tt,pi=.5+Tt,hi=1+Tt;let Fi=null,jn=null,lr=null,Zn=null,dr=Gr(j,Ue,J-Tt,J+pi,0,$t.minX,$t.maxX,Pe),Fn=Gr(j,Ue,J+mi,J+hi,0,$t.minX,$t.maxX,Pe);j=null,dr&&(Fi=Gr(dr,Ue,pe-Tt,pe+pi,1,$t.minY,$t.maxY,Pe),jn=Gr(dr,Ue,pe+mi,pe+hi,1,$t.minY,$t.maxY,Pe),dr=null),Fn&&(lr=Gr(Fn,Ue,pe-Tt,pe+pi,1,$t.minY,$t.maxY,Pe),Zn=Gr(Fn,Ue,pe+mi,pe+hi,1,$t.minY,$t.maxY,Pe),Fn=null),it>1&&console.timeEnd("clipping"),we.push(Fi||[],H+1,2*J,2*pe),we.push(jn||[],H+1,2*J,2*pe+1),we.push(lr||[],H+1,2*J+1,2*pe),we.push(Zn||[],H+1,2*J+1,2*pe+1)}}getTile(j,H,J){j=+j,H=+H,J=+J;const pe=this.options,{extent:ue,debug:ye}=pe;if(j<0||j>24)return null;const Re=1<<j,we=zl(j,H=H+Re&Re-1,J);if(this.tiles[we])return In(this.tiles[we],ue);ye>1&&console.log("drilling down to z%d-%d-%d",j,H,J);let Pe,it=j,Ue=H,It=J;for(;!Pe&&it>0;)it--,Ue>>=1,It>>=1,Pe=this.tiles[zl(it,Ue,It)];return Pe&&Pe.source?(ye>1&&(console.log("found parent tile z%d-%d-%d",it,Ue,It),console.time("drilling down")),this.splitTile(Pe.source,it,Ue,It,j,H,J),ye>1&&console.timeEnd("drilling down"),this.tiles[we]?In(this.tiles[we],ue):null):null}}function zl(Te,j,H){return 32*((1<<Te)*H+j)+Te}function qi(Te,j){const H=Te.tileID.canonical;if(!this._geoJSONIndex)return void j(null,null);const J=this._geoJSONIndex.getTile(H.z,H.x,H.y);if(!J)return void j(null,null);const pe=Pe=>Pe.tags&&"3d_elevation_id"in Pe.tags&&"source"in Pe.tags&&Pe.tags.source==="elevation",ue=J.features.filter(Pe=>pe(Pe));let ye={_geojsonTileLayer:J.features};ue.length>0&&(ye={_geojsonTileLayer:J.features.filter(Pe=>!pe(Pe)),hd_road_elevation:ue});const Re=new Cr(ye),we=function(Pe){const it=new s.bt;for(const Ue of Object.keys(Pe))it.writeMessage(3,Kn,{name:Ue,features:Pe[Ue]});return it.finish()}(ye).buffer;j(null,{vectorTile:Re,rawData:we})}class ao extends qt{constructor(j,H,J,pe,ue,ye,Re){super(j,H,J,pe,ue,qi,Re),ye&&(this.loadGeoJSON=ye),this._dynamicIndex=new Ei}loadData(j,H){const J=j&&j.request,pe=J&&J.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(j,(ue,ye)=>{if(ue||!ye)return H(ue);if(typeof ye!="object")return H(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));{try{if(j.filter){const we=s.U(j.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(we.result==="error")throw new Error(we.value.map(Pe=>`${Pe.key}: ${Pe.message}`).join(", "));ye.features=ye.features.filter(Pe=>we.value.evaluate({zoom:0},Pe))}j.dynamic?(ye.type==="Feature"&&(ye={type:"FeatureCollection",features:[ye]}),j.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ye.features,this.loaded),j.cluster&&(ye.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=j.cluster?new wu(function({superclusterOptions:we,clusterProperties:Pe}){if(!Pe||!we)return we;const it={},Ue={},It={accumulated:null,zoom:0},$t={properties:null},Tt=Object.keys(Pe);for(const mi of Tt){const[pi,hi]=Pe[mi],Fi=s.U(hi),jn=s.U(typeof pi=="string"?[pi,["accumulated"],["get",mi]]:pi);it[mi]=Fi.value,Ue[mi]=jn.value}return we.map=mi=>{$t.properties=mi;const pi={};for(const hi of Tt)pi[hi]=it[hi].evaluate(It,$t);return pi},we.reduce=(mi,pi)=>{$t.properties=pi;for(const hi of Tt)It.accumulated=mi[hi],mi[hi]=Ue[hi].evaluate(It,$t)},we}(j)).load(ye.features):j.dynamic?this._dynamicIndex:function(we,Pe){return new Tf(we,Pe)}(ye,j.geojsonVtOptions)}catch(we){return H(we)}const Re={};if(pe){const we=de(J);we&&(Re.resourceTiming={},Re.resourceTiming[j.source]=JSON.parse(JSON.stringify(we)))}H(null,Re)}})}reloadTile(j,H){const J=this.loaded;return J&&J[j.uid]?j.partial?H(null,void 0):super.reloadTile(j,H):this.loadTile(j,H)}loadGeoJSON(j,H){if(j.request)s.m(j.request,H);else{if(typeof j.data!="string")return H(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return H(null,JSON.parse(j.data))}catch{return H(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(j,H){try{H(null,this._geoJSONIndex.getClusterExpansionZoom(j.clusterId))}catch(J){H(J)}}getClusterChildren(j,H){try{H(null,this._geoJSONIndex.getChildren(j.clusterId))}catch(J){H(J)}}getClusterLeaves(j,H){try{H(null,this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset))}catch(J){H(J)}}}class Sf{constructor(j,H,J){this.tileID=new s.aQ(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.tileZoom=j.tileZoom,this.uid=j.uid,this.zoom=j.zoom,this.canonical=j.tileID.canonical,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=j.projection,this.brightness=H,this.worldview=J}parse(j,H,J,pe){this.status="parsing";const ue=new s.aQ(J.tileID.overscaledZ,J.tileID.wrap,J.tileID.canonical.z,J.tileID.canonical.x,J.tileID.canonical.y),ye=[],Re=H.familiesBySource[J.source],we=new s.fn(ue,J.promoteId);we.bucketLayerIDs=[],we.is3DTile=!0,s.fC(j).then(Pe=>{if(!Pe)return pe(new Error("Could not parse tile"));const it=Pe.json.extensionsUsed&&Pe.json.extensionsUsed.includes("MAPBOX_mesh_features")||Pe.json.asset.extras&&Pe.json.asset.extras.MAPBOX_mesh_features,Ue=Pe.json.extensionsUsed&&Pe.json.extensionsUsed.includes("EXT_meshopt_compression"),It=new s.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const $t in Re)for(const Tt of Re[$t]){const mi=Tt[0];we.bucketLayerIDs.push(Tt.map(Fi=>s.B(Fi.id,Fi.scope))),mi.recalculate(It,[]);const pi=s.fD(Pe,1/s.d7(J.tileID.canonical)),hi=new s.fE(Tt,pi,ue,it,Ue,this.brightness,we,this.worldview);
53it||(hi.needsUpload=!0),ye.push(hi),hi.evaluate(mi)}this.status="done",pe(null,{buckets:ye,featureIndex:we,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Pe=>pe(new Error(Pe.message)))}}class Dl{constructor(j,H,J,pe,ue,ye,Re,we){this.actor=j,this.layerIndex=H,this.availableImages=J,this.availableModels=pe,this.brightness=Re,this.loading={},this.loaded={},this.worldview=we}loadTile(j,H){const J=j.uid,pe=this.loading[J]=new Sf(j,this.brightness,this.worldview);s.bu(j.request,(ue,ye)=>{const Re=!this.loading[J];return delete this.loading[J],Re||ue?(pe.status="done",Re||(this.loaded[J]=pe),H(ue)):ye&&ye.byteLength!==0?void pe.parse(ye,this.layerIndex,j,(we,Pe)=>{pe.status="done",this.loaded=this.loaded||{},this.loaded[J]=pe,we||!Pe?H(we):H(null,Pe)}):(pe.status="done",this.loaded[J]=pe,H())})}reloadTile(j,H){const J=this.loaded,pe=j.uid;if(J&&J[pe]){const ue=J[pe];ue.projection=j.projection,ue.brightness=j.brightness;const ye=(Re,we)=>{ue.reloadCallback&&(delete ue.reloadCallback,this.loadTile(j,H)),H(Re,we)};ue.status==="parsing"?ue.reloadCallback=ye:ue.status==="done"&&this.loadTile(j,H)}}abortTile(j,H){const J=j.uid;this.loading[J]&&delete this.loading[J],H()}removeTile(j,H){const J=this.loaded,pe=j.uid;J&&J[pe]&&delete J[pe],H()}}class bu{constructor(j){this.self=j,this.actor=new s.fG(j,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cm({name:"mercator"}),this.workerSourceTypes={vector:qt,geojson:ao,"raster-dem":si,"raster-array":Ui,"batched-model":Dl},this.workerSources={},this.self.registerWorkerSource=(H,J)=>{if(this.workerSourceTypes[H])throw new Error(`Worker source with name "${H}" already registered.`);this.workerSourceTypes[H]=J},this.self.registerRTLTextPlugin=H=>{if(s.fH.isParsed())throw new Error("RTL text plugin already registered.");s.fH.setState({pluginStatus:s.fI.parsed,pluginURL:s.fH.getPluginURL()}),s.fH.applyArabicShaping=H.applyArabicShaping,s.fH.processBidirectionalText=H.processBidirectionalText,s.fH.processStyledBidirectionalText=H.processStyledBidirectionalText;for(const J of this.rtlPluginParsingListeners)J(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(j,H,J){delete this.layerIndexes[j],delete this.availableImages[j],delete this.availableModels[j],delete this.workerSources[j],J()}checkIfReady(j,H,J){J()}setReferrer(j,H){this.referrer=H}spriteLoaded(j,H){this.isSpriteLoaded[j]||(this.isSpriteLoaded[j]={});const{scope:J,isLoaded:pe}=H;if(this.isSpriteLoaded[j][J]=pe,this.workerSources[j]&&this.workerSources[j][J])for(const ue in this.workerSources[j][J]){const ye=this.workerSources[j][J][ue];for(const Re in ye){const we=ye[Re];we instanceof qt&&(we.isSpriteLoaded=pe,we.fire(new s.z("isSpriteLoaded")))}}}setImages(j,H,J){this.availableImages[j]||(this.availableImages[j]={});const{scope:pe,images:ue}=H;if(this.availableImages[j][pe]=ue,this.workerSources[j]&&this.workerSources[j][pe]){for(const ye in this.workerSources[j][pe]){const Re=this.workerSources[j][pe][ye];for(const we in Re)Re[we].availableImages=ue}J()}else J()}setModels(j,{scope:H,models:J},pe){if(this.availableModels[j]||(this.availableModels[j]={}),this.availableModels[j][H]=J,this.workerSources[j]&&this.workerSources[j][H]){for(const ue in this.workerSources[j][H]){const ye=this.workerSources[j][H][ue];for(const Re in ye)ye[Re].availableModels=J}pe()}else pe()}setProjection(j,H){this.projections[j]=s.cm(H)}setBrightness(j,H,J){this.brightness=H,J()}setWorldview(j,H,J){this.worldview=H,J()}setLayers(j,H,J){this.getLayerIndex(j,H.scope).replace(H.layers,H.options),J()}updateLayers(j,H,J){this.getLayerIndex(j,H.scope).update(H.layers,H.removedIds,H.options),J()}loadTile(j,H,J){H.projection=this.projections[j]||this.defaultProjection,this.getWorkerSource(j,H.type,H.source,H.scope).loadTile(H,J)}decodeRasterArray(j,H,J){this.getWorkerSource(j,H.type,H.source,H.scope).decodeRasterArray(H,J)}reloadTile(j,H,J){H.projection=this.projections[j]||this.defaultProjection,this.getWorkerSource(j,H.type,H.source,H.scope).reloadTile(H,J)}abortTile(j,H,J){this.getWorkerSource(j,H.type,H.source,H.scope).abortTile(H,J)}removeTile(j,H,J){this.getWorkerSource(j,H.type,H.source,H.scope).removeTile(H,J)}removeSource(j,H,J){if(!(this.workerSources[j]&&this.workerSources[j][H.scope]&&this.workerSources[j][H.scope][H.type]&&this.workerSources[j][H.scope][H.type][H.source]))return;const pe=this.workerSources[j][H.scope][H.type][H.source];delete this.workerSources[j][H.scope][H.type][H.source],pe.removeSource!==void 0?pe.removeSource(H,J):J()}loadWorkerSource(j,H,J){try{this.self.importScripts(H.url),J()}catch(pe){J(pe)}}syncRTLPluginState(j,H,J){if(s.fH.isParsed())J(null,!0);else if(s.fH.isParsing())this.rtlPluginParsingListeners.push(J);else try{s.fH.setState(H);const pe=s.fH.getPluginURL();!s.fH.isLoaded()||s.fH.isParsed()||s.fH.isParsing()||pe==null||(s.fH.setState({pluginStatus:s.fI.parsing,pluginURL:s.fH.getPluginURL()}),this.self.importScripts(pe),s.fH.isParsed()?J(null,!0):this.rtlPluginParsingListeners.push(J))}catch(pe){J(pe)}}setDracoUrl(j,H){this.dracoUrl=H}getAvailableImages(j,H){this.availableImages[j]||(this.availableImages[j]={});let J=this.availableImages[j][H];return J||(J=[]),J}getAvailableModels(j,H){this.availableModels[j]||(this.availableModels[j]={});let J=this.availableModels[j][H];return J||(J={}),J}getLayerIndex(j,H){this.layerIndexes[j]||(this.layerIndexes[j]={});let J=this.layerIndexes[j][H];return J||(J=this.layerIndexes[j][H]=new Ie,J.scope=H),J}getWorkerSource(j,H,J,pe){const ue=this.workerSources;return ue[j]||(ue[j]={}),ue[j][pe]||(ue[j][pe]={}),ue[j][pe][H]||(ue[j][pe][H]={}),this.isSpriteLoaded[j]||(this.isSpriteLoaded[j]={}),ue[j][pe][H][J]||(ue[j][pe][H][J]=new this.workerSourceTypes[H]({send:(ye,Re,we,Pe,it,Ue)=>this.actor.send(ye,Re,we,j,it,Ue),scheduler:this.actor.scheduler},this.getLayerIndex(j,pe),this.getAvailableImages(j,pe),this.getAvailableModels(j,pe),this.isSpriteLoaded[j][pe],void 0,this.brightness,this.worldview)),ue[j][pe][H][J]}rasterizeImagesWorker(j,H,J){const pe=new Map;for(const[ue,{image:ye,imageVariant:Re}]of H.tasks.entries()){const we=this.imageRasterizer.rasterize(Re,
53ye,H.scope,j);pe.set(ue,we)}J(void 0,pe)}removeRasterizedImages(j,H,J){this.imageRasterizer.removeImagesFromCacheByIds(H.imageIds,H.scope,j),J()}enforceCacheSizeLimit(j,H){s.fJ(H)}getWorkerPerformanceMetrics(j,H,J){J(void 0,void 0)}}return s.fF(self)&&(self.worker=new bu(self)),bu}),F(["./shared"],function(s){var de="3.17.0";const Ee={create:"create",load:"load",fullLoad:"fullLoad"},tt={mark(l){performance.mark(l)},measure(l,t,r){performance.measure(l,t,r)}};function Ie(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var He,vt={},mt=function(){if(He)return vt;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var _,g,v=new Blob([""],{type:"text/javascript"}),b=URL.createObjectURL(v);try{g=new Worker(b),_=!0}catch{_=!1}return g&&g.terminate(),URL.revokeObjectURL(b),_}()?function(){var _=document.createElement("canvas");_.width=_.height=1;var g=_.getContext("2d");if(!g)return!1;var v=g.getImageData(0,0,1,1);return v&&v.width===_.width}()?(r[p=c&&c.failIfMajorPerformanceCaveat]===void 0&&(r[p]=function(_){var g,v=function(b){var E=document.createElement("canvas"),C=Object.create(l.webGLContextAttributes);return C.failIfMajorPerformanceCaveat=b,E.getContext("webgl2",C)}(_);if(!v)return!1;try{g=v.createShader(v.VERTEX_SHADER)}catch{return!1}
53return!(!g||v.isContextLost())&&(v.shaderSource(g,"void main() {}"),v.compileShader(g),v.getShaderParameter(g,v.COMPILE_STATUS)===!0)}(p)),r[p]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var p}He=1,vt.supported=l,vt.notSupportedReason=t;var r={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},vt}();function at(l,t,r){const c=document.createElement(l);return t!=null&&(c.className=t),r&&r.appendChild(c),c}function Ft(l,t,r){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const p of Object.keys(t))c.setAttributeNS(null,p,String(t[p]));return r&&r.appendChild(c),c}const Ve=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Se=Ve&&Ve.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Ce;function dt(){Ve&&Se&&(Ce=Ve[Se],Ve[Se]="none")}function Vt(){Ve&&Se&&(Ve[Se]=Ce)}function jt(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",jt,!0)}function qt(){window.addEventListener("click",jt,!0),window.setTimeout(()=>{window.removeEventListener("click",jt,!0)},0)}function si(l,t){const r=l.getBoundingClientRect();return ar(l,r,t)}function ji(l,t){const r=l.getBoundingClientRect(),c=[];for(let p=0;p<t.length;p++)c.push(ar(l,r,t[p]));return c}function Ui(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function ar(l,t,r){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((r.clientX-t.left)*c,(r.clientY-t.top)*c)}const fr="01",Ii="NO_ACCESS_TOKEN";class Cr{constructor(t,r,c){this._transformRequestFn=t,this._customAccessToken=r,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let r="";for(let c=0;c<10;c++)r+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",fr,r].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,r){return this._transformRequestFn&&this._transformRequestFn(t,r)||{url:t}}normalizeStyleURL(t,r){if(!s.h(t))return t;const c=ri(t);return c.params.push(`sdk=js-${de}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeGlyphsURL(t,r){if(!s.h(t))return t;const c=ri(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeModelURL(t,r){if(!s.h(t))return t;const c=ri(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||r)}normalizeSourceURL(t,r,c,p){if(!s.h(t))return t;const _=ri(t);return _.path=`/v4/${_.authority}.json`,_.params.push("secure"),c&&_.params.push(`language=${c}`),p&&_.params.push(`worldview=${p}`),this._makeAPIURL(_,this._customAccessToken||r)}normalizeIconsetURL(t,r){const c=ri(t);return s.h(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||r)):Ei(c)}normalizeSpriteURL(t,r,c,p){const _=ri(t);return s.h(t)?(_.path=`/styles/v1${_.path}/sprite${r}${c}`,this._makeAPIURL(_,this._customAccessToken||p)):(_.path+=`${r}${c}`,Ei(_))}normalizeTileURL(t,r,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.h(t))return t;const p=ri(t);p.path=p.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||c&&p.authority!=="raster"&&c===512?"@2x":""}${s.k.supported?".webp":"$1"}`),p.authority==="raster"?p.path=`/${s.e.RASTER_URL_PREFIX}${p.path}`:p.authority==="rasterarrays"?p.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${p.path}`:p.authority==="3dtiles"?p.path=`/${s.e.TILES3D_URL_PREFIX}${p.path}`:(p.path=p.path.replace(/^.+\/v4\//,"/"),p.path=`/${s.e.TILE_URL_VERSION}${p.path}`);const _=this._customAccessToken||function(g){for(const v of g){const b=v.match(/^access_token=(.*)$/);if(b)return b[1]}return null}(p.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&_&&this._skuToken&&p.params.push(`sku=${this._skuToken}`),this._makeAPIURL(p,_)}canonicalizeTileURL(t,r){const c=ri(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let p="mapbox://";c.path.match(/^\/raster\/v1\//)?p+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?p+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:p+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let _=c.params;return r&&(_=_.filter(g=>!g.match(/^access_token=/))),_.length&&(p+=`?${_.join("&")}`),p}canonicalizeTileset(t,r){const c=!!r&&s.h(r),p=[];for(const _ of t.tiles||[])s.j(_)?p.push(this.canonicalizeTileURL(_,c)):p.push(_);return p}_makeAPIURL(t,r){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",p=ri(s.e.API_URL);if(t.protocol=p.protocol,t.authority=p.authority,t.protocol==="http"){const _=t.params.indexOf("secure");_>=0&&t.params.splice(_,1)}if(p.path!=="/"&&(t.path=`${p.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return Ei(t);if(r=r||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(r[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(_=>_.indexOf("access_token")===-1),t.params.push(`access_token=${r||""}`),Ei(t)}}const Hn=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ri(l){const t=l.match(Hn);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Ei(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const Gt="mapbox.eventData";function Ti(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.l(t[1]))}catch{return null}}class Ct{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const r=Ti(s.e.ACCESS_TOKEN);let c="";return c=r&&r.u?s.f(r.u):s.e.ACCESS_TOKEN||"",t?`${Gt}.${t}:${c}`:`${Gt}:${c}`}fetchEventData(){const t=s.s("localStorage"),r=this.getStorageKey(),c=this.getStorageKey("uuid"),p=this.getStorageKey("uuidTimestamp");if(t)try{const _=localStorage.getItem(r);_&&(this.eventData=JSON.parse(_));const g=localStorage.getItem(c);g&&(this.anonId=g);const v=localStorage.getItem(p);v&&(this.anonIdTimestamp=Number(v));const b=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<b)&&this.refreshUUID()}catch{s.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=s.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=s.s("localStorage"),r=this.getStorageKey(),c=this.getStorageKey("uuid"),p=this.getStorageKey("uuidTimestamp"),_=this.anonId,g=this.anonIdTimestamp;if(t&&_)try{localStorage.setItem(c,_),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData)),g&&localStorage.setItem(p,g.toString())}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}
53postEvent(t,r,c,p){if(!s.e.EVENTS_URL)return;const _=ri(s.e.EVENTS_URL);_.params.push(`access_token=${p||s.e.ACCESS_TOKEN||""}`);const g={event:this.type,created:new Date(t).toISOString()},v=r?Object.assign(g,r):g,b={url:Ei(_),headers:{"Content-Type":"text/plain"},body:JSON.stringify([v])};this.pendingRequest=s.p(b,E=>{this.pendingRequest=null,c(E),this.saveEventData(),this.processRequests(p)})}queueRequest(t,r){this.queue.push(t),this.processRequests(r)}}class qe extends Ct{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!s.e.EVENTS_URL||!t&&!s.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID();const r=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:r},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:r,payload:c}=this.queue.shift();this.postEvent(r,c,()=>{},t)}}const ti=new class extends Ct{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(r=>s.h(r)||s.j(r))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Ti(s.e.ACCESS_TOKEN),r=t?t.u:s.e.ACCESS_TOKEN;let c=r!==this.eventData.tokenU;s.v(this.anonId)||(this.refreshUUID(),c=!0);const p=this.queue.shift();if(this.eventData.lastSuccess){const _=new Date(this.eventData.lastSuccess),g=new Date(p),v=(p-this.eventData.lastSuccess)/864e5;c=c||v>=1||v<-1||_.getDate()!==g.getDate()}else c=!0;c?this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:de,skuId:fr,"enabled.telemetry":!1,userId:this.anonId},_=>{_||(this.eventData.lastSuccess=p,this.eventData.tokenU=r)},l):this.processRequests()}},ai=ti.postTurnstileEvent.bind(ti),Si=new class extends Ct{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,r,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(r||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},r):this.errorCb(new Error(Ii)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:r}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID(),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:de,skuId:fr,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},Sn=Si.postMapLoadEvent.bind(Si),Kn=new class extends Ct{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:r,style:c,importedStyles:p}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const _=this.getMapInstanceId(r),g={mapInstanceId:_,eventId:this.getEventId(_),style:c};p.length&&(g.importedStyles=p),this.queueRequest({timestamp:Date.now(),payload:g},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:r}=this.queue.shift();this.postEvent(t,r,()=>{},l)}},br=Kn.postStyleLoadEvent.bind(Kn),Or=new qe({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),un=Or.postMetricsEvent.bind(Or),vn=new qe({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),nr=vn.postMetricsEvent.bind(vn),oo=new class extends Ct{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:r}=this.queue.shift(),c=function(p){const _=performance.getEntriesByType("resource"),g=performance.getEntriesByType("mark"),v=function(D){const B={};if(D){for(const O in D)if(O!=="other")for(const G of D[O]){const U=`${O}ResolveRangeMin`,Z=`${O}ResolveRangeMax`,K=`${O}RequestCount`,W=`${O}RequestCachedCount`;B[U]=Math.min(B[U]||1/0,G.startTime),B[Z]=Math.max(B[Z]||-1/0,G.responseEnd);const le=ne=>{B[ne]===void 0&&(B[ne]=0),++B[ne]};G.transferSize!==void 0&&G.transferSize===0&&le(W),le(K)}}return B}(function(D,B){const O={};if(D)for(const G of D){const U=B(G);O[U]===void 0&&(O[U]=[]),O[U].push(G)}return O}(_,Ie)),b=window.devicePixelRatio,E=navigator.connection||navigator.mozConnection||navigator.webkitConnection,C=E?E.effectiveType:void 0,z={counters:[],metadata:[],attributes:[]},R=(D,B,O)=>{O!=null&&D.push({name:B,value:O.toString()})};for(const D in v)R(z.counters,D,v[D]);if(p.interactionRange[0]!==1/0&&p.interactionRange[1]!==-1/0&&(R(z.counters,"interactionRangeMin",p.interactionRange[0]),R(z.counters,"interactionRangeMax",p.interactionRange[1])),g)for(const D of Object.values(Ee)){const B=g.find(O=>O.name===D);B&&R(z.counters,D,B.startTime)}return R(z.counters,"visibilityHidden",p.visibilityHidden),R(z.attributes,"style",function(D){if(D)for(const B of D){const O=B.name.split("?")[0];if(s.i(O)){const G=O.split("/").slice(-2);if(G.length===2)return`mapbox://styles/${G[0]}/${G[1]}`}}}(_)),R(z.attributes,"terrainEnabled",p.terrainEnabled?"true":"false"),R(z.attributes,"fogEnabled",p.fogEnabled?"true":"false"),R(z.attributes,"projection",p.projection),R(z.attributes,"zoom",p.zoom),R(z.metadata,"devicePixelRatio",b),R(z.metadata,"connectionEffectiveType",C),R(z.metadata,"navigatorUserAgent",navigator.userAgent),R(z.metadata,"screenWidth",window.screen.width),R(z.metadata,"screenHeight",window.screen.height),R(z.metadata,"windowWidth",window.innerWidth),R(z.metadata,"windowHeight",window.innerHeight),R(z.metadata,"mapWidth",p.width/b),R(z.metadata,"mapHeight",p.height/b),R(z.metadata,"webglRenderer",p.renderer),R(z.metadata,"webglVendor",p.vendor),R(z.metadata,"sdkVersion",de),R(z.metadata,"sdkIdentifier","mapbox-gl-js"),z}(r);for(const p of c.metadata);for(const p of c.counters);for(const p of c.attributes);this.postEvent(t,c,()=>{},l)}},qn=oo.postPerformanceEvent.bind(oo),Jn=new class extends Ct{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,r,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const p=ri(s.e.API_URL+s.e.SESSION_PATH);p.params.push(`sku=${t||""}`),p.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const _={url:Ei(p),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(_,g=>{this.pendingRequest=null,r(g),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,r,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(r||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},r):this.errorCb(new Error(Ii)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:r}=this.queue.shift();
vendor: 4,086 bytes, line 53
53t&&this.success[t]||this.getSession(r,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},Ss=Jn.getSessionAPI.bind(Jn),so=new Set;function jr(l,t){t?so.add(l):so.delete(l)}class rr{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,r){this._updatedSourceCaches[t]=r,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const r=t.scope;this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._updatedLayers[r].add(t.id),this.setDirty()}removeLayer(t){const r=t.scope;this._removedLayers[r]=this._removedLayers[r]||{},this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._removedLayers[r][t.id]=t,this._updatedLayers[r].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const r in this._updatedLayers)t[r]=t[r]||{},t[r].updatedIds=Array.from(this._updatedLayers[r].values());for(const r in this._removedLayers)t[r]=t[r]||{},t[r].removedIds=Object.keys(this._removedLayers[r]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,r){this._updatedImages[r]=this._updatedImages[r]||new Set,this._updatedImages[r].add(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function wu(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Go extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.r()&&(this.imageRasterizerDispatcher=new s.D(s.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const r=this.atlasTexture.get(t);r&&(r.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,r){this.imageProviders.has(r)||this.imageProviders.set(r,new Map),this.imageProviders.get(r).set(t.id,t)}removeImageProvider(t,r){this.imageProviders.has(r)&&this.imageProviders.get(r).delete(t)}getPendingImageProviders(){const t=[];for(const r of this.imageProviders.values())for(const c of r.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.x),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,r){if(this.loaded.get(r)!==t&&(this.loaded.set(r,t),t)){for(const{ids:c,callback:p}of this.requestors)this._notify(c,r,p);this.requestors=[]}}hasImage(t,r){return!!this.getImage(t,r)}getImage(t,r){return this.images.get(r).get(t.toString())}addImage(t,r,c){this._validate(t,c)&&this.images.get(r).set(t.toString(),c)}_validate(t,r){let c=!0;
53return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(r.content,r)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,r){if(!t)return!0;let c=0;for(const p of t){if(p[0]<c||p[1]<p[0]||r<p[1])return!1;c=p[1]}return!0}_validateContent(t,r){return t?t.length!==4||!r.usvg&&(t[0]<0||r.data.width<t[0]||t[1]<0||r.data.height<t[1]||t[2]<0||r.data.width<t[2]||t[3]<0||r.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,r,c){const p=this.images.get(r).get(t.toString());c.version=p.version+1,this.images.get(r).set(t.toString(),c),this.updatedImages.get(r).add(t),this.removeFromImageRasterizerCache(t,r)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,r){this.spriteFormat!=="raster"&&(s.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:r}):this.imageRasterizer.removeImagesFromCacheByIds([t],r))}removeImage(t,r){const c=this.images.get(r),p=c.get(t.toString());c.delete(t.toString()),this.patterns.get(r).delete(t.toString()),this.removeFromImageRasterizerCache(t,r),p.userImage&&p.userImage.onRemove&&p.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(r=>s.I.from(r))}getImages(t,r,c){const p=[],_=[],g=this.imageProviders.get(r);for(const C of t){if(!C.iconsetId){p.push(C);continue}const z=g.get(C.iconsetId);z&&(this.getImage(C,r)?_.push(C):z.addPendingRequest(C))}if(p.length===0)return void this._notify(_,r,c);let v=!0;const b=!!this.loaded.get(r),E=this.images.get(r);if(!b)for(const C of p)E.has(C.toString())||(v=!1);b||v?this._notify(p,r,c):this.requestors.push({ids:p,scope:r,callback:c})}rasterizeImages(t,r){const c=new Map,{tasks:p,scope:_}=t;for(const[g,v]of p.entries()){const b=this.getImage(v.id,_);b&&c.set(g,{image:b,imageVariant:v})}this._rasterizeImages(_,c,r)}_rasterizeImages(t,r,c){if(s.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:r,scope:t},c);else{const p=new Map;for(const[_,{image:g,imageVariant:v}]of r.entries())p.set(_,this.imageRasterizer.rasterize(v,g,t,0));c(void 0,p)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,r,c){const p=this.images.get(r),_=new Map;for(const g of t){if(!p.get(g.toString())){if(g.iconsetId)continue;this.fire(new s.z("styleimagemissing",{id:g.name}))}const v=p.get(g.toString());if(!v){s.w(`Image "${g.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const b={data:v.usvg?null:v.data.clone(),pixelRatio:v.pixelRatio,sdf:v.sdf,usvg:v.usvg,version:v.version,stretchX:v.stretchX,stretchY:v.stretchY,content:v.content,hasRenderCallback:!!(v.userImage&&v.userImage.render)};v.usvg&&Object.assign(b,{width:v.icon.usvg_tree.width,height:v.icon.usvg_tree.height}),_.set(s.I.toString(g),b)}c(null,_)}getPixelSize(t){const{width:r,height:c}=this.atlasImage.get(t);return{width:r,height:c}}getPattern(t,r,c){const p=t.toString(),_=this.patterns.get(r),g=_.get(p),v=this.getImage(t,r);if(!v)return null;if(g){if(g.position.version===v.version)return g.position;g.position.version=v.version}else{if(v.usvg&&!v.data){const b=this.getPatternInFlightId(p,r);if(this.patternsInFlight.has(b))return null;this.patternsInFlight.add(b);const E=new s.A(t).scaleSelf(s.o.devicePixelRatio),C=new Map([[E.toString(),{image:v,imageVariant:E}]]);return this._rasterizeImages(r,C,(z,R)=>this.storePatternImage(E,r,v,c,R)),null}this.storePattern(t,r,v)}return this._updatePatternAtlas(r,c),_.get(p).position}getPatternInFlightId(t,r){return s.B(t,r)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,r,c,p,_){const g=t.toString(),v=_?_.get(g):void 0;v&&(c.data=v,this.storePattern(t.id,r,c),this._updatePatternAtlas(r,p),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),r)))}storePattern(t,r,c){const p={w:c.data.width+2*s.C,h:c.data.height+2*s.C,x:0,y:0},_=new s.F(p,c,s.C);this.patterns.get(r).set(t.toString(),{bin:p,position:_})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,r){const c=t.gl;let p=this.atlasTexture.get(r);p?this.dirty&&(p.update(this.atlasImage.get(r)),this.dirty=!1):(p=new s.T(t,this.atlasImage.get(r),c.RGBA8),this.atlasTexture.set(r,p)),p.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,r){const c=this.patterns.get(t),p=Array.from(c.values()).map(({bin:E})=>E),{w:_,h:g}=s.G(p),v=this.atlasImage.get(t);v.resize({width:_||1,height:g||1});const b=this.images.get(t);for(const[E,{bin:C,position:z}]of c.entries()){let R=z.padding;const D=C.x+R,B=C.y+R,O=b.get(E).data,G=O.width,U=O.height;R=R>1?R-1:R,s.q.copy(O,v,{x:0,y:0},{x:D,y:B},{width:G,height:U},r),s.q.copy(O,v,{x:0,y:U-R},{x:D,y:B-R},{width:G,height:R},r),s.q.copy(O,v,{x:0,y:0},{x:D,y:B+U},{width:G,height:R},r),s.q.copy(O,v,{x:G-R,y:0},{x:D-R,y:B},{width:R,height:U},r),s.q.copy(O,v,{x:0,y:0},{x:D+G,y:B},{width:R,height:U},r),s.q.copy(O,v,{x:G-R,y:U-R},{x:D-R,y:B-R},{width:R,height:R},r),s.q.copy(O,v,{x:0,y:U-R},{x:D+G,y:B-R},{width:R,height:R},r),s.q.copy(O,v,{x:0,y:0},{x:D+G,y:B+U},{width:R,height:R},r),s.q.copy(O,v,{x:G-R,y:0},{x:D-R,y:B+U},{width:R,height:R},r)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
53dispatchRenderCallbacks(t,r){const c=this.images.get(r);for(const p of t){if(this.callbackDispatchedThisFrame.get(r).has(p.toString()))continue;this.callbackDispatchedThisFrame.get(r).add(p.toString());const _=c.get(p.toString());wu(_)&&this.updateImage(p,r,_)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function xa(l){const t=l.value,r=l.valueSpec,c=l.style,p=l.styleSpec,_=l.key,g=l.arrayElementValidator||Dt;if(!Array.isArray(t))return[new s.V(_,t,`array expected, ${s.K(t)} found`)];if(r.length&&t.length!==r.length)return[new s.V(_,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new s.V(_,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let v={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};p.$version<7&&(v.function=r.function),s.H(r.value)&&(v=r.value);let b=[];for(let E=0;E<t.length;E++)b=b.concat(g({array:t,arrayIndex:E,value:t[E],valueSpec:v,style:c,styleSpec:p,key:`${_}[${E}]`},!0));return b}function $s(l){const t=l.key,r=l.value,c=l.valueSpec;if(!s.L(r))return[new s.V(t,r,`number expected, ${s.K(r)} found`)];if(r!=r)return[new s.V(t,r,"number expected, NaN found")];if("minimum"in c){let p=c.minimum;if(Array.isArray(c.minimum)&&(p=c.minimum[l.arrayIndex]),r<p)return[new s.V(t,r,`${r} is less than the minimum value ${p}`)]}if("maximum"in c){let p=c.maximum;if(Array.isArray(c.maximum)&&(p=c.maximum[l.arrayIndex]),r>p)return[new s.V(t,r,`${r} is greater than the maximum value ${p}`)]}return[]}function Hs(l){const t=l.key,r=l.value;if(!s.H(r))return[new s.V(t,r,`object expected, ${s.K(r)} found`)];const c=l.valueSpec,p=s.J(r.type);let _,g,v,b={};const E=p!=="categorical"&&r.property===void 0,C=!E,z=function(O){const G=O.stops;return Array.isArray(G)&&Array.isArray(G[0])&&s.H(G[0][0])}(r),R=Pi({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(O){if(p==="identity")return[new s.V(O.key,O.value,'identity function may not have a "stops" property')];let G=[];const U=O.value;return G=G.concat(xa({key:O.key,value:U,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:D})),Array.isArray(U)&&U.length===0&&G.push(new s.V(O.key,U,"array must have at least one stop")),G},default:function(O){return Dt({key:O.key,value:O.value,valueSpec:c,style:O.style,styleSpec:O.styleSpec})}}});return p==="identity"&&E&&R.push(new s.V(l.key,l.value,'missing required property "property"')),p==="identity"||r.stops||R.push(new s.V(l.key,l.value,'missing required property "stops"')),p==="exponential"&&c.expression&&!s.M(c)&&R.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(C&&!s.N(c)?R.push(new s.V(l.key,l.value,"property functions not supported")):E&&!s.O(c)&&R.push(new s.V(l.key,l.value,"zoom functions not supported"))),p!=="categorical"&&!z||r.property!==void 0||R.push(new s.V(l.key,l.value,'"property" property is required')),R;function D(O){let G=[];const U=O.value,Z=O.key;if(!Array.isArray(U))return[new s.V(Z,U,`array expected, ${s.K(U)} found`)];if(U.length!==2)return[new s.V(Z,U,`array length 2 expected, length ${U.length} found`)];if(z){if(!s.H(U[0]))return[new s.V(Z,U,`object expected, ${s.K(U[0])} found`)];const K=U[0];if(K.zoom===void 0)return[new s.V(Z,U,"object stop key must have zoom")];if(K.value===void 0)return[new s.V(Z,U,"object stop key must have value")];const W=s.J(K.zoom);if(typeof W!="number")return[new s.V(Z,K.zoom,"stop zoom values must be numbers")];if(v&&v>W)return[new s.V(Z,K.zoom,"stop zoom values must appear in ascending order")];W!==v&&(v=W,g=void 0,b={}),G=G.concat(Pi({key:`${Z}[0]`,value:U[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:$s,value:B}}))}else G=G.concat(B({key:`${Z}[0]`,value:U[0],style:O.style,styleSpec:O.styleSpec},U));return s.Q(s.S(U[1]))?G.concat([new s.V(`${Z}[1]`,U[1],"expressions are not allowed in function stops.")]):G.concat(Dt({key:`${Z}[1]`,value:U[1],valueSpec:c,style:O.style,styleSpec:O.styleSpec}))}function B(O,G){const U=s.K(O.value),Z=s.J(O.value),K=O.value!==null?O.value:G;if(_){if(U!==_)return[new s.V(O.key,K,`${U} stop domain type must match previous stop domain type ${_}`)]}else _=U;if(U!=="number"&&U!=="string"&&U!=="boolean"&&typeof Z!="number"&&typeof Z!="string"&&typeof Z!="boolean")return[new s.V(O.key,K,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&p!=="categorical"){let W=`number expected, ${U} found`;return s.N(c)&&p===void 0&&(W+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(O.key,K,W)]}return p!=="categorical"||U!=="number"||typeof Z=="number"&&isFinite(Z)&&Math.floor(Z)===Z?p!=="categorical"&&U==="number"&&typeof Z=="number"&&typeof g=="number"&&g!==void 0&&Z<g?[new s.V(O.key,K,"stop domain values must appear in ascending order")]:(g=Z,p==="categorical"&&Z in b?[new s.V(O.key,K,"stop domain values must be unique")]:(b[Z]=!0,[])):[new s.V(O.key,K,`integer expected, found ${String(Z)}`)]}}function Ur(l){const t=(l.expressionContext==="property"?s.W:s.U)(s.S(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new s.V(`${l.key}${c.key}`,l.value,c.message));const r=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!r.outputDefined())return[new s.V(l.ke
53y,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Z(r))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return Es(r,l);if(l.expressionContext==="appearance")return Qa(r,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.X(r,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s.Y(r))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Es(l,t){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const p of t.valueSpec.expression.parameters)r.delete(p);if(r.size===0)return[];const c=[];return l instanceof s._&&r.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(p=>{c.push(...Es(p,t))}),c)}function Qa(l,t){const r=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const p of t.valueSpec.expression.parameters)r.add(p);if(r.size===0)return[];const c=[];return l instanceof s._&&!r.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] is not an allowed parameter`)]:(l.eachChild(p=>{c.push(...Qa(p,t))}),c)}function $o(l){const t=l.key,r=l.value,c=l.valueSpec,p=[];return Array.isArray(c.values)?c.values.indexOf(s.J(r))===-1&&p.push(new s.V(t,r,`expected one of [${c.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(c.values).indexOf(s.J(r))===-1&&p.push(new s.V(t,r,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(r)} found`)),p}function Is(l){return s.a2(s.S(l.value))?Ur(Object.assign({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Yr(l)}function Yr(l){const t=l.value,r=l.key;if(!Array.isArray(t))return[new s.V(r,t,`array expected, ${s.K(t)} found`)];if(t.length<1)return[new s.V(r,t,"filter array must have at least 1 element")];const c=l.styleSpec;let p=$o({key:`${r}[0]`,value:t[0],valueSpec:c.filter_operator});const _=()=>{t.length>=2&&(s.a0(t[1])||p.push(new s.V(`${r}[1]`,t[1],`string expected, ${s.K(t[1])} found`)));for(let g=2;g<t.length;g++)s.J(t[1])==="$type"?p=p.concat($o({key:`${r}[${g}]`,value:t[g],valueSpec:c.geometry_type})):s.a0(t[g])||s.L(t[g])||s.$(t[g])||p.push(new s.V(`${r}[${g}]`,t[g],`string, number, or boolean expected, ${s.K(t[g])} found.`))};switch(s.J(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.J(t[1])==="$type"&&p.push(new s.V(r,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&p.push(new s.V(r,t,`filter array for operator "${t[0]}" must have 3 elements`)),_();break;case"==":case"!=":t.length!==3&&p.push(new s.V(r,t,`filter array for operator "${t[0]}" must have 3 elements`)),_();break;case"in":case"!in":_();break;case"any":case"all":case"none":for(let g=1;g<t.length;g++)p=p.concat(Yr({key:`${r}[${g}]`,value:t[g],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":t.length!==2?p.push(new s.V(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):s.a0(t[1])||p.push(new s.V(`${r}[1]`,t[1],`string expected, ${s.K(t[1])} found`))}return p}function wa(l,t){const r=l.key,c=l.style,p=l.layer,_=l.styleSpec,g=l.value,v=l.objectKey,b=_[`${t}_${l.layerType}`];if(!b)return[];const E=v.match(/^(.*)-use-theme$/);if(E&&b[E[1]])return s.Q(s.S(g))?[].concat(Dt({key:r,value:g,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:_,expressionContext:"property",propertyType:t,propertyKey:v})):Dt({key:r,value:g,valueSpec:{type:"string"},style:c,styleSpec:_});const C=v.match(/^(.*)-transition$/);if(t==="paint"&&C&&b[C[1]]&&b[C[1]].transition)return Dt({key:r,value:g,valueSpec:_.transition,style:c,styleSpec:_});const z=l.valueSpec||b[v];if(!z)return[new s.a3(r,g,`unknown property "${v}"`)];let R;if(s.a0(g)&&s.N(z)&&!z.tokens&&(R=/^{([^}]+)}$/.exec(g))){const B=`\`{ "type": "identity", "property": ${R?JSON.stringify(R[1]):'"_"'} }\``;return[new s.V(r,g,`"${v}" does not support interpolation syntax
54Use an identity property function instead: ${B}.`)]}const D=[];if(l.layerType==="symbol")v!=="text-field"||!c||c.glyphs||c.imports||D.push(new s.V(r,g,'use of "text-field" requires a style "glyphs" property')),v==="text-font"&&s.a4(s.S(g))&&s.J(g.type)==="identity"&&D.push(new s.V(r,g,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&p&&p.layout&&p.layout.hasOwnProperty("model-id")&&s.N(z)&&(s.a5(z)||s.O(z))){const B=s.W(s.S(g),z).value,O="expression"in B&&B.expression||"_styleExpression"in B&&B._styleExpression&&B._styleExpression.expression;O&&!s.X(O,["measure-light"])&&(v==="model-emissive-strength"&&s.Y(O)&&s.Z(O)||D.push(new s.V(r,g,`${v} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return D.concat(Dt({key:l.key,value:g,valueSpec:z,style:c,styleSpec:_,expressionContext:"property",propertyType:t,propertyKey:v}))}function qs(l){return wa(l,"paint")}function ba(l){return wa(l,"layout")}function Zs(l){let t=[];const r=l.value,c=l.key,p=l.style,_=l.styleSpec;if(!s.H(r))return[new s.V(c,r,"object expected")];r.type||r.ref||t.push(new s.V(c,r,'either "type" or "ref" is required'));let g=s.J(r.type);const v=s.J(r.ref);if(r.id){const b=s.J(r.id);for(let E=0;E<l.arrayIndex;E++){const C=p.layers[E];s.J(C.id)===b&&t.push(new s.V(c,r.id,`duplicate layer id "${b}", previously used at line ${C.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(E=>{E in r&&t.push(new s.V(c,r[E],`"${E}" is prohibited for ref layers`))}
54),p.layers.forEach(E=>{s.J(E.id)===v&&(b=E)}),b?b.ref?t.push(new s.V(c,r.ref,"ref cannot reference another ref layer")):g=s.J(b.type):typeof v=="string"&&t.push(new s.V(c,r.ref,`ref layer "${v}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(r.source)if(s.a0(r.source)){const b=p.sources&&p.sources[r.source],E=b&&s.J(b.type);b?E==="vector"&&g==="raster"?t.push(new s.V(c,r.source,`layer "${r.id}" requires a raster source`)):E==="raster"&&g!=="raster"?t.push(new s.V(c,r.source,`layer "${r.id}" requires a vector source`)):E!=="vector"||r["source-layer"]?E==="raster-dem"&&g!=="hillshade"?t.push(new s.V(c,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="raster-array"||["raster","raster-particle"].includes(g)?g==="line"&&r.paint&&(r.paint["line-gradient"]||r.paint["line-trim-offset"])&&E==="geojson"&&!b.lineMetrics?t.push(new s.V(c,r,`layer "${r.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):g==="raster-particle"&&E!=="raster-array"&&t.push(new s.V(c,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,r.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new s.V(c,r.source,`source "${r.source}" not found`))}else t.push(new s.V(`${c}.source`,r.source,'"source" must be a string'));else t.push(new s.V(c,r,'missing required property "source"'));return t=t.concat(Pi({key:c,value:r,valueSpec:_.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Dt({key:`${c}.type`,value:r.type,valueSpec:_.layer.type,style:l.style,styleSpec:l.styleSpec,object:r,objectKey:"type"}),filter:b=>Is(Object.assign({layerType:g},b)),layout:b=>Pi({layer:r,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>ba(Object.assign({layerType:g},E))}}),paint:b=>Pi({layer:r,key:b.key,value:b.value,valueSpec:{},style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":E=>qs(Object.assign({layerType:g,layer:r},E))}}),appearances(b){const E=xa({key:b.key,value:b.value,valueSpec:b.valueSpec,style:b.style,styleSpec:b.styleSpec,arrayElementValidator:R=>function(D){const{key:B,layer:O,layerType:G}=D,U=s.J(D.value),Z=s.J(U.name),K=s.J(U.condition),W=Pi({key:B,value:U,valueSpec:D.styleSpec.appearance,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{condition:le=>function(ne){const se=[];return se.push(...Ur({key:ne.key,value:ne.object.condition,valueSpec:s.a6.appearance.condition,expressionContext:"appearance"})),se}(Object.assign({layer:O,layerType:G},le)),properties:le=>function(ne){const se=[],{styleSpec:ie,layer:Q,layerType:ce}=ne,ve=ie[`paint_${ce}`],ge=ie[`layout_${ce}`],Le=ne.object[ne.objectKey];for(const ze in Le){const je=ze in ve?"paint":ze in ge?"layout":void 0;
54if(!je){se.push(new s.V(ne.key,ze,`unknown property "${ze}" for layer type "${ce}"`));continue}const nt=Object.assign({},ne,{key:`${ne.key}.${ze}`,object:Le,objectKey:ze,layer:Q,layerType:ce,value:Le[ze],valueSpec:je==="paint"?ve[ze]:ge[ze]});se.push(...wa(nt,je))}return se}(Object.assign({layer:O,layerType:G},le))}});return Z!=="hidden"&&K===void 0&&W.push(new s.V(D.key,"name",'Appearance with name different than "hidden" must have a condition')),W}(Object.assign({layerType:g,layer:r},R))}),C=Array.isArray(b.value)?b.value:[],z=new Set;return C.forEach((R,D)=>{const B=s.J(R.name);if(B)if(z.has(B)){const O=s.J(r.id);E.push(new s.V(b.key,B,`Duplicated appearance name "${B}" for layer "${O}"`))}else z.add(B)}),E}}})),t}function Qn({key:l,value:t}){return s.a0(t)?[]:[new s.V(l,t,`string expected, ${s.K(t)} found`)]}const Gr={promoteId:function l({key:t,value:r}){if(s.a0(r))return Qn({key:t,value:r});if(Array.isArray(r)){const p=[],_=s.S(r),g=s.U(_);return g.result==="error"&&g.value.forEach(v=>{p.push(new s.V(`${t}${v.key}`,null,`${v.message}`))}),s.X(g.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"])||p.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),p}if(!s.H(r))return[new s.V(t,r,`string, expression or object expected, "${s.K(r)}" found`)];const c=[];for(const p in r)c.push(...l({key:`${t}.${p}`,value:r[p]}));return c}};function Ws(l){const t=l.value,r=l.key,c=l.styleSpec,p=l.style;if(!s.H(t))return[new s.V(r,t,`object expected, ${s.K(t)} found`)];if(!("type"in t))return[new s.V(r,t,'"type" is required')];const _=s.J(t.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(_)&&("url"in t||"tiles"in t||g.push(new s.a3(r,t,'Either "url" or "tiles" is required.'))),_){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(Pi({key:r,value:t,valueSpec:c[`source_${_.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Gr})),g;case"geojson":if(g=Pi({key:r,value:t,valueSpec:c.source_geojson,style:p,styleSpec:c,objectElementValidators:Gr}),"cluster"in t&&"clusterProperties"in t){if(!s.H(t.clusterProperties))return[new s.V(`${r}.clusterProperties`,t,`object expected, ${s.K(t)} found`)];for(const v in t.clusterProperties){const b=t.clusterProperties[v];if(!Array.isArray(b))return[new s.V(`${r}.clusterProperties.${v}`,b,"array expected")];const[E,C]=b,z=typeof E=="string"?[E,["accumulated"],["get",v]]:E;g.push(...Ur({key:`${r}.${v}.map`,value:C,expressionContext:"cluster-map"})),g.push(...Ur({key:`${r}.${v}.reduce`,value:z,expressionContext:"cluster-reduce"}))}}return g;case"video":return Pi({key:r,value:t,valueSpec:c.source_video,style:p,styleSpec:c});case"image":return Pi({key:r,value:t,valueSpec:c.source_image,style:p,styleSpec:c});case"canvas":return[new s.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $o({key:`${r}.type`,value:t.type,valueSpec:{values:Xs(c)}})}}function Xs(l){return l.source.reduce((t,r)=>{const c=l[r];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values||{}))),t},[])}function ss(l){const t=l.value,r=l.styleSpec,c=r.light,p=l.style;if(t===void 0)return[];if(!s.H(t))return[new s.V("light",t,`object expected, ${s.K(t)} found`)];let _=[];for(const g in t){const v=g.match(/^(.*)-transition$/),b=g.match(/^(.*)-use-theme$/);_=_.concat(b&&c[b[1]]?Dt({key:g,value:t[g],valueSpec:{type:"string"},style:p,styleSpec:r}):v&&c[v[1]]&&c[v[1]].transition?Dt({key:g,value:t[g],valueSpec:r.transition,style:p,styleSpec:r}):c[g]?Dt({key:g,value:t[g],valueSpec:c[g],style:p,styleSpec:r}):[new s.V(g,t[g],`unknown property "${g}"`)])}return _}function Do(l){const t=l.value;if(!t)return[];const r=l.key;if(!s.H(t))return[new s.V(r,t,`object expected, ${s.K(t)} found`)];let c=[];const p=l.styleSpec,_=p["light-3d"],g=l.style,v=l.style.lights;for(const C of["type","id"])if(!(C in t))return c=c.concat([new s.V(r,t,`missing property "${C}"`)]),c;if(!s.a0(t.type))return c=c.concat([new s.V(`${r}.type`,t.type,"string expected")]),c;if(v)for(let C=0;C<l.arrayIndex;C++){const z=s.J(t.type),R=v[C];s.J(R.type)===z&&c.push(new s.V(r,t.id,`duplicate light type "${t.type}", previously defined at line ${R.id.__line__}`))}const b=`properties_light_${t.type}`;if(!(b in p))return c=c.concat([new s.V(`${r}.type`,t,`Invalid light type ${t.type}`)]),c;const E=p[b];for(const C in t)if(C==="properties"){const z=t[C];if(!s.H(z))return c=c.concat([new s.V("properties",z,`object expected, ${s.K(z)} found`)]),c;for(const R in z){const D=R.match(/^(.*)-transition$/),B=R.match(/^(.*)-use-theme$/);c=c.concat(B&&E[B[1]]?Dt({key:C,value:z[R],valueSpec:{type:"string"},style:g,styleSpec:p}):D&&E[D[1]]&&E[D[1]].transition?Dt({key:C,value:t[C],valueSpec:p.transition,style:g,styleSpec:p}):E[R]?Dt({key:R,value:z[R],valueSpec:E[R],style:g,styleSpec:p}):[new s.a3(l.key,z[R],`unknown property "${R}"`)])}}else c=c.concat(_[C]?Dt({key:C,value:t[C],valueSpec:_[C],style:g,styleSpec:p}):[new s.a3(C,t[C],`unknown property "${C}"`)]);return c}function Ho(l){const t=l.value,r=l.key,c=l.style,p=l.styleSpec,_=p.terrain;if(t==null)return[];if(!s.H(t))return[new s.V("terrain",t,`object expected, ${s.K(t)} found`)];let g=[];for(const v in t){const b=v.match(/^(.*)-transition$/),E=v.match(/^(.*)-use-theme$/);g=g.concat(E&&_[E[1]]?Dt({key:v,value:t[v],valueSpec:{type:"string"},style:c,styleSpec:p}):b&&_[b[1]]&&_[b[1]].transition?Dt({key:v,value:t[v],valueSpec:p.transition,style:c,styleSpec:p}):_[v]?Dt({key:v,value:t[v],valueSpec:_[v],style:c,styleSpec:p}):[new s.a3(v,t[v],`unknown property "${v}"`)])}if(t.source)if(s.a0(t.source)){const v=c.sources&&c.sources[t.source],b=v&&s.J(v.type);v?b!=="raster-dem"&&g.push(new s.V(`${r}.source`,t.source,`terrain cannot be used with a source of type ${b}, it only be used with a "raster-dem" source type`)):g.push(new s.V(`${r}.source`,t.source,`source "${t.source}" not found`))}else g.push(new s.V(`${r}.source`,t.source,"source must be a string"));else g.push(new s.V(r,t,'terrain is missing required property "source"'));return g}function Ll(l){const t=l.value,r=l.style,c=l.styleSpec,p=c.fog;if(t===void 0)return[];if(!s.H(t))return[new s.V("fog",t,`object expected, ${s.K(t)} found`)];let _=[];for(const g in t){const v=g.match(/^(.*)-transition$/),b=g.match(/^(.*)-use-theme$/);_=_.concat(b&&p[b[1]]?Dt({key:g,value:t[g],valueSpec:{type:"string"},style:r,styleSpec:c}):v&&p[v[1]]&&p[v[1]].transition?Dt({key:g,value:t[g],valueSpec:c.transition,style:r,styleSpec:c}):p[g]?Dt({key:g,value:t[g],valueSpec:p[g],style:r,styleSpec:c}):[new s.a3(g,t[g],`unknown property "${g}
54"`)])}return _}const Wt={"*":()=>[],array:xa,boolean:function(l){const t=l.value,r=l.key;return s.$(t)?[]:[new s.V(r,t,`boolean expected, ${s.K(t)} found`)]},number:$s,color:function({key:l,value:t}){return s.a0(t)?s.a1.parseCSSColor(t)===null?[new s.V(l,t,`color expected, "${t}" found`)]:[]:[new s.V(l,t,`color expected, ${s.K(t)} found`)]},enum:$o,filter:Is,function:Hs,layer:Zs,object:Pi,source:Ws,model:s.a7,light:ss,"light-3d":Do,terrain:Ho,fog:Ll,string:Qn,formatted:function(l){return Qn(l).length===0?[]:Ur(l)},resolvedImage:function(l){return Qn(l).length===0?[]:Ur(l)},projection:function(l){const t=l.value,r=l.styleSpec,c=r.projection,p=l.style;if(s.H(t)){let _=[];for(const g in t)_=_.concat(Dt({key:g,value:t[g],valueSpec:c[g],style:p,styleSpec:r}));return _}return s.a0(t)?[]:[new s.V("projection",t,`object or string expected, ${s.K(t)} found`)]},import:function(l){const t=l.key,{value:r,styleSpec:c}=l;if(!s.H(r))return[new s.V(t,r,"import must be an object")];const{data:p,..._}=r;Object.defineProperty(_,"__line__",{value:r.__line__,enumerable:!1});let g=Pi(Object.assign({},l,{value:_,valueSpec:c.import}));return s.J(_.id)===""&&g.push(new s.V(`${l.key}.id`,_,"import id can't be an empty string")),p&&(g=g.concat(Tr(p,c,{key:`${l.key}.data`}))),g},iconset:function(l){const t=l.value,r=l.key,c=l.styleSpec,p=l.style;if(!s.H(t))return[new s.V(r,t,"object expected")];if(!t.type)return[new s.V(r,t,'"type" is required')];const _=s.J(t.type);let g=[];if(g=g.concat(Pi({key:r,value:t,valueSpec:c[`iconset_${_}`],style:p,styleSpec:c})),function(v,b){return!(v!=="source"||!b.source)}(_,t)){const v=p.sources&&p.sources[t.source],b=v&&s.J(v.type);v?b!=="raster-array"&&g.push(new s.V(r,t.source,`iconset cannot be used with a source of type ${String(b)}, it only be used with a "raster-array" source type`)):g.push(new s.V(r,t.source,`source "${t.source}" not found`))}return g}};function Dt(l,t=!1){const r=l.value,c=l.valueSpec,p=l.styleSpec;if(c.expression){if(s.a4(s.J(r)))return Hs(l);if(s.Q(s.S(r)))return Ur(l)}if(c.type&&Wt[c.type]){const _=Wt[c.type](l);return t===!0&&_.length>0&&Array.isArray(l.value)?Ur(l):_}return Pi(Object.assign({},l,{valueSpec:c.type?p[c.type]:c}))}function Pi(l){const t=l.key,r=l.value,c=l.valueSpec||{},p=l.objectElementValidators||{},_=l.style,g=l.styleSpec;if(!s.H(r))return[new s.V(t,r,`object expected, ${s.K(r)} found`)];let v=[];for(const b in r){const E=b.split(".")[0];let C;p[E]?C=p[E]:c[E]?C=Dt:p["*"]?C=p["*"]:c["*"]&&(C=Dt),C?v=v.concat(C({key:(t&&`${t}.`)+b,value:r[b],valueSpec:c[E]||c["*"],style:_,styleSpec:g,object:r,objectKey:b},r)):v.push(new s.a3(t,r[b],`unknown property "${b}"`))}for(const b in c){if(p[b])continue;const E=c[b];E.required&&E.default===void 0&&r[b]===void 0&&v.push(new s.V(t,r,`missing required property "${b}"`))}return v}function In({key:l,value:t}){const r=Qn({key:l,value:t});if(r.length)return r;const c=t;return c.indexOf("{fontstack}")===-1&&r.push(new s.V(l,t,'"glyphs" url must include a "{fontstack}" token')),c.indexOf("{range}")===-1&&r.push(new s.V(l,t,'"glyphs" url must include a "{range}" token')),r}function Tr(l,t=s.a6,r={}){return Pi({key:r.key||"",value:l,valueSpec:Object.assign(t.$root,{"*":{type:"*"}}),styleSpec:t,style:l,objectElementValidators:{glyphs:In}})}function ko(l,t=s.a6){return H(Tr(l,t))}const Ic=l=>H(Ws(l)),Ke=l=>H(ss(l)),Ta=l=>H(Do(l)),Tf=l=>H(Ho(l)),zl=l=>H(Ll(l)),qi=l=>H(function(t){const r=t.value,c=t.style,p=t.styleSpec,_=p.snow;if(r===void 0)return[];if(!s.H(r))return[new s.V("snow",r,`object expected, ${s.K(r)} found`)];let g=[];for(const v in r){const b=v.match(/^(.*)-transition$/);g=g.concat(b&&_[b[1]]&&_[b[1]].transition?Dt({key:v,value:r[v],valueSpec:p.transition,style:c,styleSpec:p}):_[v]?Dt({key:v,value:r[v],valueSpec:_[v],style:c,styleSpec:p}):[new s.a3(v,r[v],`unknown property "${v}"`)])}return g}(l)),ao=l=>H(function(t){const r=t.value,c=t.style,p=t.styleSpec,_=p.rain;if(r===void 0)return[];if(!s.H(r))return[new s.V("rain",r,`object expected, ${s.K(r)} found`)];let g=[];for(const v in r){const b=v.match(/^(.*)-transition$/);g=g.concat(b&&_[b[1]]&&_[b[1]].transition?Dt({key:v,value:r[v],valueSpec:p.transition,style:c,styleSpec:p}):_[v]?Dt({key:v,value:r[v],valueSpec:_[v],style:c,styleSpec:p}):[new s.a3(v,r[v],`unknown property "${v}"`)])}return g}(l)),Sf=l=>H(Zs(l)),Dl=l=>H(Is(l)),bu=l=>H(qs(l)),Te=l=>H(ba(l)),j=l=>H(s.a7(l));function H(l){return l.slice().sort((t,r)=>t.line&&r.line?t.line-r.line:0)}function J(l,t){let r=!1;if(t&&t.length)for(const c of t)c instanceof s.a3?s.w(c.message):(l.fire(new s.y(new Error(c.message))),r=!0);return r}const pe=s.a6.light;let ue;class ye extends s.E{constructor(t,r="flat"){super(),this._transitionable=new s.a8(ue||(ue=new s.a9({anchor:new s.aa(pe.anchor),position:new s.ab(pe.position),color:new s.aa(pe.color),intensity:new s.aa(pe.intensity)}))),this.setLight(t,r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r,c={}
54){this._validate(Ke,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=r)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,c){return(!c||c.validate!==!1)&&J(this,t.call(ko,Object.assign({value:r,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}const Re=s.a6.terrain;let we=class extends s.E{constructor(l,t,r,c,p){super(),this.scope=r,this._transitionable=new s.a8(new s.a9({source:new s.aa(Re.source),exaggeration:new s.aa(Re.exaggeration)}),r,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=p}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new s.ac(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let r=-1,c=-1,p=1;for(const _ of t.zoomStops)p=t.evaluate(new s.ac(_,{worldview:this.worldview})),p>.01?(r=_,c=-1):c=_;return p<.01&&r>0&&c>r?[r,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof s.ad}};const Pe=45,it=65,Ue=.05;function It(l,t,r,c){const p=s.ah(Pe,it,r),[_,g]=$t(l,c);let v=1-Math.min(1,Math.exp((t-_)/(g-_)*-6));return v*=v*v,v=Math.min(1,1.00747*v),v*p*l.alpha}function $t(l,t){const r=.5/Math.tan(.5*t);return[l.range[0]+r,l.range[1]+r]}function Tt(l,t,r,c,p){const _=s.af([],[t,r,c],p.mercatorFogMatrix);return It(l,s.ag(_),p.pitch,p._fov)}function mi(l,t,r,c,p,_,g){const v=[[r,c,0],[p,c,0],[p,_,0],[r,_,0]];let b=Number.MAX_VALUE,E=-Number.MAX_VALUE;for(const C of v){const z=s.af([],C,t),R=s.ag(z);b=Math.min(b,R),E=Math.max(E,R)}return[It(l,b,g.pitch,g._fov),It(l,E,g.pitch,g._fov)]}const pi=s.a6.fog;class hi extends s.E{constructor(t,r,c,p){super();const _=new s.a9({range:new s.aa(pi.range),color:new s.aa(pi.color),"color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.aa(pi["high-color"]),"high-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.aa(pi["space-color"]),"space-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new s.aa(pi["horizon-blend"]),"star-intensity":new s.aa(pi["star-intensity"]),"vertical-range":new s.aa(pi["vertical-range"])});this._transitionable=new s.a8(_,c,new Map(p)),this.set(t,p),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new s.ai(_),this.scope=c}get state(){const t=this._transform,r=t.projection.name==="globe",c=s.aj(t.zoom),p=this.properties.get("range"),_=[.5,3];return{range:r?[s.ak(_[0],p[0],c),s.ak(_[1],p[1],c)]:p,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,r,c={}){if(this._validate(zl,t,c))return;const p=Object.assign({},t);for(const _ of Object.keys(pi))p[_]===void 0&&(p[_]=pi[_].default);this._options=p,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const r=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.ah(Pe,it,t))*r.a}getOpacityAtLatLng(t,r){return this._transform.projection.supportsFog?function(c,p,_){const g=s.ae.fromLngLat(p),v=_.elevation?_.elevation.getAtPointOrZero(g):0;return Tt(c,g.x,g.y,v,_)}(this.state,t,r):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const r=this._transform.calculateFogTileMatrix(t.toUnwrapped());return mi(this.state,r,0,0,s.al,s.al,this._transform)}getOpacityForBounds(t,r,c,p,_){return this._transform.projection.supportsFog?mi(this.state,t,r,c,p,_,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?$t(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const r=[4,5,6,7];for(const c of r){const p=t.points[c];let _;if(p[2]>=0)_=p;else{const g=t.points[c-4];_=s.am(g,p,g[2]/(g[2]-p[2]))}if(Tt(this.state,_[0],_[1],0,this._transform)>=Ue)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,c){return(!c||c.validate!==!1)&&J(this,t.call(ko,Object.assign({value:r,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}let Fi,jn,lr,Zn,dr=class extends s.E{constructor(l,t,r,c){super();const p=Fi||(Fi=new s.a9({density:new s.aa(s.a6.snow.density),intensity:new s.aa(s.a6.snow.intensity),color:new s.aa(s.a6.snow.color),opacity:new s.aa(s.a6.snow.opacity),vignette:new s.aa(s.a6.snow.vignette),"vignette-color":new s.aa(s.a6.snow["vignette-color"]),"center-thinning":new s.aa(s.a6.snow["center-thinning"]),direction:new s.aa(s.a6.snow.direction),"flake-size":new s.aa(s.a6.snow["flake-size"])}));this._transitionable=new s.a8(p,r,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(p),this.scope=r}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),r=this.properties.get("direction"),c=s.an(r[0]),p=-Math.max(s.an(r[1]),.01),_=[Math.cos(c)*Math.cos(p),Math.sin(c)*Math.cos(p),Math.sin(p)],g=this.properties.get("vignette"),v=this.properties.get("vignette-color");return v.a=g,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:_,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:v}}get(){return this._transitionable.serialize()}set(l,t,r={}
54){if(this._validate(qi,l,r))return;const c=Object.assign({},l),p=s.a6.snow;for(const _ of Object.keys(p))c[_]===void 0&&(c[_]=p[_].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,r){return(!r||r.validate!==!1)&&J(this,l.call(ko,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}},Fn=class extends s.E{constructor(l,t,r,c){super();const p=jn||(jn=new s.a9({density:new s.aa(s.a6.rain.density),intensity:new s.aa(s.a6.rain.intensity),color:new s.aa(s.a6.rain.color),opacity:new s.aa(s.a6.rain.opacity),vignette:new s.aa(s.a6.rain.vignette),"vignette-color":new s.aa(s.a6.rain["vignette-color"]),"center-thinning":new s.aa(s.a6.rain["center-thinning"]),direction:new s.aa(s.a6.rain.direction),"droplet-size":new s.aa(s.a6.rain["droplet-size"]),"distortion-strength":new s.aa(s.a6.rain["distortion-strength"])}));this._transitionable=new s.a8(p,r,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(p),this.scope=r}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),r=this.properties.get("direction"),c=s.an(r[0]),p=-Math.max(s.an(r[1]),.01),_=[Math.cos(c)*Math.cos(p),Math.sin(c)*Math.cos(p),Math.sin(p)],g=this.properties.get("vignette-color");return g.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:_,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:g}}get(){return this._transitionable.serialize()}set(l,t,r={}){if(this._validate(ao,l,r))return;const c=Object.assign({},l),p=s.a6.rain;for(const _ of Object.keys(p))c[_]===void 0&&(c[_]=p[_].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,r){return(!r||r.validate!==!1)&&J(this,l.call(ko,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}};class Gi extends s.E{constructor(t,r,c,p){super(),this.scope=c,this._options=t,this.properties=new s.ai(r),this._transitionable=new s.a8(r,c,new Map(p)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,r){this._options=t,this._transitionable.setTransitionOrValue(t.properties,r)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class Bn{constructor(t,r,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,r){let c,p;if(t instanceof s.P||typeof t[0]=="number"){const _=s.P.convert(t);c=[_],p=r.isPointAboveHorizon(_)}else{const _=s.P.convert(t[0]),g=s.P.convert(t[1]),v=_.add(g)._div(2);c=[_,g],p=s.aq(_,g).every(b=>r.isPointAboveHorizon(b))&&r.isPointAboveHorizon(v)}return new Bn(c,p,r)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const r=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.aq(r,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<c.x?p.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?p[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(p[3]=this.cameraPoint)),s.ar(p,t)}bufferedCameraGeometryGlobe(t){const r=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],p=s.aq(r,c,t),_=this.cameraPoint.clone();switch(3*((_.y>r.y)+(_.y>c.y))+((_.x>r.x)+(_.x>
54c.x))){case 0:p[0]=_,p[4]=_.clone();break;case 1:p.splice(1,0,_);break;case 2:p[1]=_;break;case 3:p.splice(4,0,_);break;case 5:p.splice(2,0,_);break;case 6:p[3]=_;break;case 7:p.splice(3,0,_);break;case 8:p[2]=_}return p}containsTile(t,r,c,p=0){const _=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/r._pixelsPerMercatorPixel+1,g=c?this._bufferedCameraMercator(_,r):this._bufferedScreenMercator(_,r);let v=t.tileID.wrap+(g.unwrapped?p:0);const b=g.polygon.map(G=>s.as(t.tileTransform,G,v));if(!s.at(b,0,0,s.al,s.al))return;v=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?p:0);const E=this.screenGeometryMercator.polygon.map(G=>s.au(t.tileTransform,G,v)),C=E.map(G=>new s.P(G[0],G[1])),z=r.getFreeCameraOptions().position||new s.ae(0,0,0),R=s.au(t.tileTransform,z,v),D=E.map(G=>{const U=s.av(G,G,R);return s.aw(U,U),new s.ax(R,U)}),B=s.ay(t,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:C,tilespaceRays:D,bufferedTilespaceGeometry:b,bufferedTilespaceBounds:(O=s.az(b),O.min.x=s.aA(O.min.x,0,s.al),O.min.y=s.aA(O.min.y,0,s.al),O.max.x=s.aA(O.max.x,0,s.al),O.max.y=s.aA(O.max.y,0,s.al),O),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:B};var O}_bufferedScreenMercator(t,r){const c=Wn(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let p;return p=r.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),r):{polygon:this.bufferedScreenGeometry(t).map(_=>r.pointCoordinate3D(_)),unwrapped:!0},this._screenRaycastCache[c]=p,p}}_bufferedCameraMercator(t,r){const c=Wn(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let p;return p=r.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),r):{polygon:this.bufferedCameraGeometry(t).map(_=>r.pointCoordinate3D(_)),unwrapped:!0},this._cameraRaycastCache[c]=p,p}}_projectAndResample(t,r){const c=function(_,g){const v=s.aB([],g.pixelMatrix,g.globeMatrix),b=[0,-s.aD,0,1],E=[0,s.aD,0,1],C=[0,0,0,1];s.aC(b,b,v),s.aC(E,E,v),s.aC(C,C,v);const z=new s.P(b[0]/b[3],b[1]/b[3]),R=new s.P(E[0]/E[3],E[1]/E[3]),D=s.aE(_,z)&&b[3]<C[3],B=s.aE(_,R)&&E[3]<C[3];if(!D&&!B)return null;const O=function(se,ie,Q){for(let ce=1;ce<se.length;ce++){const ve=Ri(ie.pointCoordinate3D(se[ce-1]).x),ge=Ri(ie.pointCoordinate3D(se[ce]).x);if(Q<0){if(ve<ge)return{idx:ce,t:-ve/(ge-1-ve)}}else if(ge<ve)return{idx:ce,t:(1-ve)/(ge+1-ve)}}return null}(_,g,D?-1:1);if(!O)return null;const{idx:G,t:U}=O;let Z=G>1?gn(_.slice(0,G),g):[],K=G<_.length?gn(_.slice(G),g):[];Z=Z.map(se=>new s.P(Ri(se.x),se.y)),K=K.map(se=>new s.P(Ri(se.x),se.y));const W=[...Z];W.length===0&&W.push(K[K.length-1]);const le=s.ak(W[W.length-1].y,(K.length===0?Z[0]:K[0]).y,U);let ne;return ne=D?[new s.P(0,le),new s.P(0,0),new s.P(1,0),new s.P(1,le)]:[new s.P(1,le),new s.P(1,1),new s.P(0,1),new s.P(0,le)],W.push(...ne),K.length===0?W.push(Z[0]):W.push(...K),{polygon:W.map(se=>new s.ae(se.x,se.y)),unwrapped:!1}}(t,r);if(c)return c;const p=function(_,g){let v=!1,b=-1/0,E=0;for(let z=0;z<_.length-1;z++)_[z].x>b&&(b=_[z].x,E=z);for(let z=0;z<_.length-1;z++){const R=(E+z)%(_.length-1),D=_[R],B=_[R+1];Math.abs(D.x-B.x)>.5&&(D.x<B.x?(D.x+=1,R===0&&(_[_.length-1].x+=1)):(B.x+=1,R+1===_.length-1&&(_[0].x+=1)),v=!0)}const C=s.aF(g.center.lng);return v&&C<Math.abs(C-1)&&_.forEach(z=>{z.x-=1}),{polygon:_,unwrapped:v}}(gn(t,r).map(_=>new s.P(Ri(_.x),_.y)),r);return{polygon:p.polygon.map(_=>new s.ae(_.x,_.y)),unwrapped:p.unwrapped}}}function gn(l,t){return s.aG(l,r=>{const c=t.pointCoordinate3D(r);r.x=c.x,r.y=c.y},1/256)}function Ri(l){return l<0?1+l%1:l%1}function Wn(l){return 100*l|0}function qr(l,t,r,c,p){const _=function(v,b){if(v)return p(v);if(b){if(l.url&&b.tiles&&l.tiles&&delete l.tiles,b.variants){if(!Array.isArray(b.variants))return p(new Error("variants must be an array"));for(const C of b.variants){if(C==null||typeof C!="object"||C.constructor!==Object)return p(new Error("variant must be an object"));if(!Array.isArray(C.capabilities))return p(new Error("capabilities must be an array"));if(C.capabilities.length===1&&C.capabilities[0]==="meshopt"){b=Object.assign(b,C);break}}}const E=s.aH(Object.assign({},b,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);E.tiles=t.canonicalizeTileset(E,l.url),p(null,E)}},g=function(v,b,E){if(!v)return null;if(!b&&!E)return v;E=E||v.worldview_default;const C=Object.values(v.language||{});if(C.length===0)return null;const z=Object.values(v.worldview||{});if(z.length===0)return null;const R=C.every(B=>B===b),D=z.every(B=>B===E);return R&&D?v:b in(v.language_options||{})||E in(v.worldview_options||{})?null:v.language_options&&v.worldview_options?v:null}(l.data,r,c);return g?s.o.frame(()=>_(null,g)):l.url?s.m(t.transformRequest(t.normalizeSourceURL(l.url,null,r,c),s.R.Source),_):s.o.frame(()=>{const{data:v,...b}=l;_(null,b)})}function Kr(l,t){const r=Math.pow(2,t.z),c=Math.floor(s.aF(l.getWest())*r),p=Math.floor(s.aJ(l.getNorth())*r),_=Math.ceil(s.aF(l.getEast())*r),g=Math.ceil(s.aJ(l.getSouth())*r);return t.x>=c&&t.x<_&&t.y>=p&&t.y<g}class To{constructor(t,r,c){this.bounds=t?s.aI.convert(this.validateBounds(t)):null,this.minzoom=r||0,this.maxzoom=c||24}
54validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const r of t)this.extraBounds.push(s.aI.convert(this.validateBounds(r)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!Kr(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const r of this.extraBounds)if(Kr(r,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const r=new To(t.bounds,t.minzoom,t.maxzoom);return r.addExtraBounds(t.extra_bounds),r}}class kl extends s.E{constructor(t,r,c,p){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,s.aH(r,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(p),this._tileWorkers={},this._deduped=new s.aK}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=qr(this._options,this.map._requestManager,r,c,(p,_)=>{if(this._tileJSONRequest=null,this._loaded=!0,p)r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new s.y(p));else if(_){if(Object.assign(this,_),this.hasWorldviews=!!_.worldview_options,_.worldview_default&&(this.worldviewDefault=_.worldview_default),_.vector_layers){this.vectorLayers=_.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const g of _.vector_layers)this.vectorLayerIds.push(g.id),_.worldview&&_.worldview[g.source]&&this.localizableLayerIds.add(g.id)}this.tileBounds=To.fromTileJSON(_),ai(_.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(p)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,r){const c=t.tileID.canonical.url(this.tiles,this.scheme),p=this.map._requestManager.normalizeTileURL(c),_=this.map._requestManager.transformRequest(p,s.R.Tile),g=this.map.style?this.map.style.getLut(this.scope):null,v=g?{image:g.image.clone()}:null,b={request:_,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:v,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
54ype,source:this.id,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&s.h(c)&&(b.localizableLayerIds=this.localizableLayerIds),b.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=r:t.request=t.actor.send("reloadTile",b,E.bind(this));else if(t.actor=this._tileWorkers[p]=this._tileWorkers[p]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",b,E.bind(this),void 0,!0);else{const C=s.aL.call({deduped:this._deduped},b,(z,R)=>{if(z||!R)E.call(this,z);else{const D=s.aM(R.responseHeaders);b.data={rawData:R.rawData.slice(0),expires:D.expires,cacheControl:D.cacheControl},t.actor&&t.actor.send("loadTile",b,E.bind(this),void 0,!0)}},!0);t.request={cancel:C}}function E(C,z){return delete t.request,t.aborted?r(null):C&&C instanceof s.aN&&C.status!==404?r(C):(z&&z.resourceTiming&&(t.resourceTiming=z.resourceTiming),this.map._refreshExpiredTiles&&z&&t.setExpiryData(z),t.loadVectorData(z,this.map.painter),s.aO(this.dispatcher),r(null,z),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
54ype,source:this.id,scope:this.scope})}unloadTile(t,r){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Fr extends s.E{constructor(t,r,c,p){super(),this.id=t,this.dispatcher=c,this.setEventedParent(p),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"},r),Object.assign(this,s.aH(r,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const r=this.map.getWorldview();this._tileJSONRequest=qr(this._options,this.map._requestManager,null,r,(c,p)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.y(c)):p&&(Object.assign(this,p),p.raster_layers&&(this.rasterLayers=p.raster_layers,this.rasterLayerIds=this.rasterLayers.map(_=>_.id)),this.tileBounds=To.fromTileJSON(p),ai(p.tiles),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,r){const c=s.o.devicePixelRatio>=2,p=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.n(this.map._requestManager.transformRequest(p,s.R.Tile),(_,g,v)=>{if(delete t.request,t.aborted)return t.state="unloaded",r(null);if(_)return t.state="errored",r(_);if(!g)return r(null);const b=s.aM(v);this.map._refreshExpiredTiles&&t.setExpiryData(b),t.setTexture(g,this.map.painter),t.state="loaded",s.aO(this.dispatcher),r(null)})}abortTile(t,r){t.request&&(t.request.cancel(),delete t.request),r&&r()}unloadTile(t,r){t.texture&&t.texture instanceof s.T?(t.destroy(!1),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function qo([l,t],r,c,{scaled:p=!0}={}){const{tileSize:_,buffer:g}=c,{x:v,y:b,z:E}=r;if(!isFinite(v)||!isFinite(b)||!isFinite(E))throw new Error("Invalid MRT header");const C=2**E,z=C*s.aF(l),R=C*s.aJ(t);return function([D,B],O,{scaled:G=!0}={}){if(!O)throw new Error("bandView is undefined");const{data:U,tileSize:Z,buffer:K,offset:W,scale:le,dimension:ne}=O;if(D<-K||D>Z+K||B<-K||B>Z+K)throw new Error(`Point (${D}, ${B}) out of bounds for tileSize=${Z}, buffer=${K}`);const se=(B+K)*(Z+2*K)+(D+K);
54if(new Uint32Array(U.buffer)[se]===4294967295)return null;let ie=[];ie=G?[]:new O.data.constructor(ne);for(let Q=0;Q<ne;Q++)ie[Q]=Math.round(1e12*(U[ne*se+Q]*le+W))/1e12;return ie}([Math.min(Math.max(-g,Math.floor((z-v)*_)),_-1+g),Math.min(Math.max(-g,Math.floor((R-b)*_)),_-1+g)],c,{scaled:p})}class lo extends Fr{constructor(t,r,c,p){super(t,r,c,p),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},r)}triggerRepaint(t){const r=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);r&&r.enabled&&c&&r._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,r){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(c,s.R.Tile),_={request:p,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=p,t.actor||(t.actor=this.dispatcher.getActor());const g=(v,b,E)=>{if(delete t.request,t.aborted)return t.state="unloaded",r(null);if(v)return v.name==="AbortError"?void 0:(t.state="errored",r(v));if(this.map._refreshExpiredTiles&&b){const C=s.aM(E);t.setExpiryData(C)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!b)return r(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=b}r(null)};t.request=this.partial?t.fetchHeader(void 0,g.bind(this)):t.actor.send("loadTile",_,g.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
54ype,source:this.id,scope:this.scope})}unloadTile(t,r){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!1);for(const p of c.values())this.map.painter.saveTileTexture(p)}else t.destroy()}prepareTile(t,r,c,p){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(r,c,p,(_,g)=>{if(_)return t.state="errored",this.fire(new s.y(_)),void this.triggerRepaint(t);g&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,g,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const r=this.rasterLayers.find(({id:_})=>_===t),c=r&&r.fields,p=c&&c.bands&&c.bands;return p?p[0]:0}getTextureDescriptor(t,r,c){if(!t)return;const p=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!p)return;let _=null;r instanceof s.aR?_=r.paint.get("raster-array-band"):r instanceof s.aS&&(_=r.paint.get("raster-particle-array-band"));const g=_||this.getInitialBand(p);if(g==null)return;if(!t.textureDescriptorPerLayer.get(r.id))return void this.prepareTile(t,p,r.id,g);if(t.updateNeeded(r.id,g)&&!c)return;const v=t.textureDescriptorPerLayer.get(r.id);return Object.assign({},v,{texture:t.texturePerLayer.get(r.id)})}getImages(t,r){const c=new Map;for(const p of t)for(const _ of r){const[g,v]=_.split("/"),b=p.getLayer(g);if(!b||!b.hasBand(v)||!b.hasDataForBand(v))continue;const{bytes:E,tileSize:C,buffer:z}=b.getBandView(v),R=C+2*z,D={data:new s.q({width:R,height:R},E),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(_,D)}return c}queryRasterArrayValueByBandId(t,r,c){const p=r._mrt;return new Promise(_=>{const g={},v=new Set;for(const[b,E]of Object.entries(p.layers)){if(c.layerName&&b!==c.layerName)continue;const C={};g[b]=C;for(const{bands:z}of E.dataIndex)for(const R of z)c.bands&&!c.bands.includes(R)||(v.add(s.B(b,R)),r.fetchBand(b,null,R,D=>{s.o.frame(()=>{C[R]=D?null:qo([t.lng,t.lat],p,E.getBandView(R)),v.delete(s.B(b,R)),v.size===0&&_(g)})},!1))}v.size===0&&_(g)})}_loadTileForQuery(t,r){if(this._loadTileLoaded[t.uid])return void r(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(r);this._loadTilePending[t.uid]=[r];const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),p=this.map._requestManager.transformRequest(c,s.R.Tile);t.actor.send("loadTile",{request:p,uid:t.uid,tileID:t.tileID,type:this.t
54ype,source:this.id,scope:this.scope,partial:!1},(_,g,v)=>{if(_)return this._loadTilePending[t.uid].forEach(b=>b(_,null)),void delete this._loadTilePending[t.uid];if(!g)return this._loadTilePending[t.uid].forEach(b=>b(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&g){const b=s.aM(v);t.setExpiryData(b)}t._mrt=g,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(b=>b(null,g)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(t,r,c){return new Promise((p,_)=>{this._loadTileForQuery(r,(g,v)=>{g?_(g):p(v?this.queryRasterArrayValueByBandId(t,r,c):null)})})}queryRasterArrayValue(t,r){const c=s.aT.convert(t),p=this.findLoadedParent(c);return p&&p._mrt?r.bands||!this.partial?this.queryRasterArrayValueByBandId(c,p,r):this.queryRasterArrayValueByAllBands(c,p,r):Promise.resolve(null)}findLoadedParent(t){const r=s.ae.fromLngLat(t,this.map.transform.tileSize),c=this.maxzoom+1,p=1<<c,_=Math.floor(r.x),g=Math.floor((r.x-_)*p),v=Math.floor(r.y*p),b=this.map.style.getSourceCache(this.id),E=new s.aQ(c,_,c,g,v);return b.findLoadedParent(E,this.minzoom)}}const Ys={vector:kl,raster:Fr,"raster-dem":class extends Fr{constructor(l,t,r,c){super(l,t,r,c),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const r=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(p,_){p&&(l.state="errored",t(p)),_&&(l.dem=_,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.n(this.map._requestManager.transformRequest(r,s.R.Tile),(function(p,_,g){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(p)l.state="errored",t(p);else if(_){const v=s.aM(g);this.map._refreshExpiredTiles&&l.setExpiryData(v);const b=ImageBitmap&&_ instanceof ImageBitmap&&s.r(),E=1-(_.width-s.aP(_.width))/2;E<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const C=b?_:s.o.getImageData(_,E),z={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
54ype,scope:this.scope,rawImageData:C,encoding:this.encoding,padding:E};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",z,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,r=Math.pow(2,t.z),c=(t.x-1+r)%r,p=t.x===0?l.wrap-1:l.wrap,_=(t.x+1+r)%r,g=t.x+1===r?l.wrap+1:l.wrap,v={};return v[new s.aQ(l.overscaledZ,p,t.z,c,t.y).key]={backfilled:!1},v[new s.aQ(l.overscaledZ,g,t.z,_,t.y).key]={backfilled:!1},t.y>0&&(v[new s.aQ(l.overscaledZ,p,t.z,c,t.y-1).key]={backfilled:!1},v[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},v[new s.aQ(l.overscaledZ,g,t.z,_,t.y-1).key]={backfilled:!1}),t.y+1<r&&(v[new s.aQ(l.overscaledZ,p,t.z,c,t.y+1).key]={backfilled:!1},v[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},v[new s.aQ(l.overscaledZ,g,t.z,_,t.y+1).key]={backfilled:!1}),v}},"raster-array":lo,geojson:class extends s.E{constructor(l,t,r,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=r.getActor(),this.setEventedParent(c),this._data=t.data,this._options=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const p=s.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*p,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*p,extent:s.al,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.al,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*p,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const r of this._data.features)t.set(r.id,r);for(const r of l.features)t.set(r.id,r);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,r,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:r},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:l},this.workerOptions);t.scope=this.scope;const r=this._data;typeof r=="string"?(t.request=this.map._requestManager.transformRequest(s.o.resolveURL(r),s.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,p)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new s.y(c));else{const _={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&p&&p.resourceTiming&&p.resourceTiming[this.id]&&(_.resourceTiming=p.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.z("data",_)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const r=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,p=c?{image:c.image.clone()}
54:null,_=this._partialReload,g={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:p,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:_,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};l.request=this.actor.send(r,g,(v,b)=>_&&!b?(l.state="loaded",t(null)):(delete l.request,l.destroy(!1),l.aborted?t(null):v?t(v):(l.loadVectorData(b,this.map.painter,r==="reloadTile"),t(null))),void 0,r==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
54,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aU{constructor(l,t,r,c){super(l,t,r,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,s.R.Source).url);s.aV(this.urls,(t,r)=>{this._loaded=!0,t?this.fire(new s.y(t)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new s.y(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aU,model:s.aX,"batched-model":class extends s.E{constructor(l,t,r,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map.getWorldview();this._tileJSONRequest=qr(this._options,this.map._requestManager,t,r,(c,p)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),r&&r.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new s.y(c))):p&&(Object.assign(this,p),p.bounds&&(this.tileBounds=new To(p.bounds,this.minzoom,this.maxzoom)),ai(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const r=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(r,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
54ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.o.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const _=Object.values(l.buckets);for(const g of _)g.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,p.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,p.bind(this),void 0,!0);function p(_,g){return l.aborted?t(null):_&&_.status!==404?t(_):(this.map._refreshExpiredTiles&&g&&l.setExpiryData(g),l.loadModelData(g,this.map.painter),l.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends s.aU{constructor(l,t,r,c){super(l,t,r,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(_=>typeof _!="number"))||this.fire(new s.y(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.y(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.y(new s.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,r,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new To(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,s.aH(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:r,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:r,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:r,y:c,z:p}=l.tileID.canonical,_=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:r,y:c,z:p},{signal:_.signal})).then((function(g){return delete l.request,l.aborted?(l.state="unloaded",t(null)):g===void 0?(l.state="errored",t(null)):g===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):function(v){return v instanceof ImageData||v instanceof HTMLCanvasElement||v instanceof ImageBitmap||v instanceof HTMLImageElement}(g)?(this.loadTileData(l,g),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(g=>{g.name!=="AbortError"&&(l.state="errored",t(g))}),l.request.cancel=()=>_.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!1),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:r,y:c,z:p}=l.tileID.canonical;this._implementation.unloadTile({x:r,y:c,z:p})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
54).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}}},Mr=function(l,t,r,c){const p=new Ys[t.type](l,t,r,c);if(p.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${p.id}`);return s.aY(["load","abort","unload","serialize","prepare"],p),p};function Ol(l,t,r=""){return`${r}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:p,importId:_}=c;return`featureset:${p}${_?`:import:${_}`:""}`}}(l.target)}`}function Ac(l,t,r,c=""){if(l.uniqueFeatureID){const p=Ol(l,t,c);if(r.has(p))return!0;r.add(p)}return!1}function qh(l,t,r,c,p=!1){const _=t.sourceCache.transform,g=t.sourceCache.tilesIn(l,t.has3DLayers,p);g.sort(Tu);const v=[];for(const b of g){const E=b.tile.queryRenderedFeatures(t,b,r,c,_,p);Object.keys(E).length&&v.push({wrappedTileID:b.tile.tileID.wrapped().key,queryResults:E})}for(const b in t.layers){const E=t.layers[b];if(E.styleLayer){const C=E.styleLayer.queryRenderedFeatures(l,t.sourceCache,c);Object.keys(C).length&&v.push({wrappedTileID:0,queryResults:C})}}return v.length===0?{}:function(b){const E={},C={};for(const z of b){const R=z.queryResults,D=z.wrappedTileID,B=C[D]=C[D]||{};for(const O in R){const G=R[O],U=B[O]=B[O]||{},Z=E[O]=E[O]||[];for(const K of G)U[K.featureIndex]||(U[K.featureIndex]=!0,Z.push(K))}}return E}(v)}function Zh(l,t,r,c,p,_){const g={},v=c.queryRenderedSymbols(l),b=[];for(const E of Object.keys(v).map(Number))b.push(p[E]);b.sort(Tu);for(const E of b){const C=E.featureIndex.lookupSymbolFeatures(v[E.bucketInstanceId],E.bucketIndex,E.sourceLayerIndex,t,r,_);for(const z in C){const R=g[z]=g[z]||[],D=C[z];D.sort((B,O)=>{const G=E.featureSortOrder;if(G){const U=G.indexOf(B.featureIndex);return G.indexOf(O.featureIndex)-U}return O.featureIndex-B.featureIndex});for(const B of D)R.push(B)}}return g}function Wh(l,t){const r=l.getRenderableIds().map(_=>l.getTileByID(_)),c=[],p={};for(let _=0;_<r.length;_++){const g=r[_],v=g.tileID.canonical.key;p[v]||(p[v]=!0,g.querySourceFeatures(c,t))}return c}function Tu(l,t){const r=l.tileID,c=t.tileID;return r.overscaledZ-c.overscaledZ||r.canonical.y-c.canonical.y||r.wrap-c.wrap||r.canonical.x-c.canonical.x}function Ks(l,t){const r={};if(!t)return r;for(const c of l){const p=c.layerIds.map(_=>t.getLayer(_)).filter(Boolean);if(p.length!==0){c.layers=p,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(_=>p.filter(g=>g.id===_)[0]));for(const _ of p)r[_.fqid]=c}}return r}const So=32,As=33,Cs=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,r=0,c=0,p=0,_=0,g=0,v=0;for(1&t?p=_=g=So:r=c=v=So;(t>>=1)>1;){const E=r+p>>1,C=c+_>>1;1&t?(p=r,_=c,r=g,c=v):(r=p,c=_,p=g,_=v),g=E,v=C}const b=4*l;Cs[b+0]=r,Cs[b+1]=c,Cs[b+2]=p,Cs[b+3]=_}const as=new Uint16Array(2178),Js=new Uint8Array(1089),el=new Uint16Array(1089);function Fl(l){return l===0?-.03125:l===32?.03125:0}const Xh=(()=>({type:2,extent:s.al,loadGeometry:()=>[[new s.P(0,0),new s.P(s.al+1,0),new s.P(s.al+1,s.al+1),new s.P(0,s.al+1),new s.P(0,0)]]}))();class Bl{constructor(t,r,c,p,_,g){this.tileID=t,this.uid=s.b2(),this.uses=0,this.tileSize=r,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=_,p&&p.style&&(this._lastUpdatedBrightness=p.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",p&&p.transform&&(this.projection=p.transform.projection),this.worldview=g,this._hasAppearances=null}registerFadeDuration(t){const r=t+this.timeAdded;r<s.o.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,r,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Ks(t.buckets,r.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const _=this.buckets[p];if(_ instanceof s.b4){if(this.hasSymbolBuckets=!0,!c)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const _=this.buckets[p];if(_ instanceof s.b4&&_.hasRTLText){this.hasRTLText=!0,s.b5();break}}this.queryPadding=0;for(const p in this.buckets){const _=this.buckets[p],g=r.style.getOwnLayer(p);if(!g)continue;const v=g.queryRadius(_);this.queryPadding=Math.max(this.queryPadding,v)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b3}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,r,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Ks(t.buckets,r.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,r){for(const _ in this.buckets){const g=this.buckets[_];if(g.uploadPending()){let v={},b=[],E={zoom:0,pitch:0,brightness:0,worldview:""};if(r){if(r.style){b=r.style.listImages();const C=g.layers[0],z=C.sourceLayer||"_geojsonTileLayer",R=r.style.getLayerSourceCache(C);R&&(v=R._state.getState(z,void 0))}E={zoom:r.transform.zoom||0,pitch:r.transform.pitch||0,brightness:r.style.getBrightness()||0,worldview:r.worldview||""}}g.upload(t,this.tileID.canonical,v,b,E)}}const c=t.gl,p=this.imageAtlas;p&&!p.uploaded&&(this.imageAtlasTexture=new s.T(t,p.image,c.RGBA8,{useMipmap:!!p.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,c.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,c.R8),this.lineAtlas.uploaded=!0)}prepare(t,r,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!r||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const p=r.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(r)),(this._lastUpdatedBrightness||p||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&p&&Math.abs(this._lastUpdatedBrightness-
54p)<.001||(this.updateBuckets(r,this._lastUpdatedBrightness!==p),this._lastUpdatedBrightness=p))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const r in this.buckets){const c=this.buckets[r];c.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,c.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,r,c,p,_,g){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const v=this.evaluateQueryRenderedFeaturePadding(),b=function(E,C){const z=s.bq([],[.5*E.width,.5*-E.height,1]);return s.br(z,z,[1,-1,0]),s.aB(z,z,E.calculateProjMatrix(C.toUnwrapped())),Float32Array.from(z)}(_,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:r,pixelPosMatrix:b,transform:p,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:v})}querySourceFeatures(t,r){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const p=c.loadVTLayers(),_=r?r.sourceLayer:"",g=p._geojsonTileLayer||p[_];if(!g)return;const v=s.b6(r&&r.filter),{z:b,x:E,y:C}=this.tileID.canonical,z={z:b,x:E,y:C};for(let R=0;R<g.length;R++){const D=g.feature(R);if(v.needGeometry){const G=s.b7(D,!0);if(!v.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),G,this.tileID.canonical))continue}else if(!v.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),D))continue;const B=c.getId(D,_),O=new s.b8(D,b,E,C,B);O.tile=z,t.push(O)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const r=this.expirationTime;if(t.cacheControl){const c=s.b9(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let p=!1;if(this.expirationTime>c)p=!1;else if(r)if(this.expirationTime<r)p=!0;else{const _=this.expirationTime-r;_?this.expirationTime=c+Math.max(_,3e4):p=!0}else p=!0;p?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}hasAppearances(t){for(const r in this.buckets)if(t.style.hasLayer(r)&&this.buckets[r].layers.some(c=>c.appearances&&c.appearances.length>0))return!0;return!1}updateBuckets(t,r){if(!this.latestFeatureIndex||!t.style)return;const c=t.style.listImages(),p=t.style.getBrightness();for(const _ in this.buckets){if(!t.style.hasLayer(_))continue;const g=this.buckets[_],v=g.layers[0],b=v.sourceLayer||"_geojsonTileLayer",E=t.style.getLayerSourceCache(v);let C={};E&&(C=E._state.getState(b,void 0));const z=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},R=Object.keys(C).length>0&&!r;g.hasAppearances=g.layers.some(O=>O.appearances&&O.appearances.length>0);const D=R?g.stateDependentLayers:g.layers;if(R&&g.stateDependentLayers.length!==0||r){const O=this.latestFeatureIndex.loadVTLayers();g.update(C,O[b],c,z,D,r,p)}if(R&&g.stateDependentLayers.length!==0||r||g.hasAppearances){const O={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};g.updateAppearances(this.tileID.canonical,C,c,O)}(g instanceof s.ba||g instanceof s.bb)&&t._terrain&&t._terrain.enabled&&E&&g.uploadPending()&&t._terrain._clearRenderCacheForTile(E.id,this.tileID);const B=t&&t.style&&t.style.getOwnLayer(_);B&&(this.queryPadding=Math.max(this.queryPadding,B.queryRadius(g)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.o.now()+t}setTexture(t,r){const c=r.context,p=c.gl;this.texture=this.texture||r.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,p.RGBA8,{useMipmap:!0}),this.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE))}
vendor: 6,365 bytes, line 54
54setDependencies(t,r){const c={};for(const p of r)c[p]=!0;this.dependencies[t]=c}hasDependency(t,r){for(const c of t){const p=this.dependencies[c];if(p){for(const _ of r)if(p[_])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,r){if(!r||r.name==="mercator"||this._tileDebugBuffer)return;const c=s.bc(Xh,this.tileID.canonical,this.tileTransform)[0],p=new s.bd,_=new s.be;for(let g=0;g<c.length;g++){const{x:v,y:b}=c[g];p.emplaceBack(v,b),_.emplaceBack(g)}_.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(_),this._tileDebugBuffer=t.createVertexBuffer(p,s.bf.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,p.length,_.length)}_makeTileBoundsBuffers(t,r){if(this._tileBoundsBuffer||!r||r.name==="mercator")return;const c=s.bc(Xh,this.tileID.canonical,this.tileTransform)[0];let p,_;if(this.isRaster){const g=function(v,b){const E=s.aZ(v,b),C=Math.pow(2,v.z);for(let G=0;G<As;G++)for(let U=0;U<As;U++){const Z=s.a_((v.x+(U+Fl(U))/So)/C),K=s.a$((v.y+(G+Fl(G))/So)/C),W=b.project(Z,K),le=G*As+U;as[2*le+0]=Math.round((W.x*E.scale-E.x)*s.al),as[2*le+1]=Math.round((W.y*E.scale-E.y)*s.al)}Js.fill(0),el.fill(0);for(let G=2045;G>=0;G--){const U=4*G,Z=Cs[U+0],K=Cs[U+1],W=Cs[U+2],le=Cs[U+3],ne=Z+W>>1,se=K+le>>1,ie=ne+se-K,Q=se+Z-ne,ce=K*As+Z,ve=le*As+W,ge=se*As+ne,Le=Math.hypot((as[2*ce+0]+as[2*ve+0])/2-as[2*ge+0],(as[2*ce+1]+as[2*ve+1])/2-as[2*ge+1])>=16;Js[ge]=Js[ge]||(Le?1:0),G<1022&&(Js[ge]=Js[ge]||Js[(K+Q>>1)*As+(Z+ie>>1)]||Js[(le+Q>>1)*As+(W+ie>>1)])}const z=new s.b1,R=new s.b0;let D=0;function B(G,U){const Z=U*As+G;return el[Z]===0&&(z.emplaceBack(as[2*Z+0],as[2*Z+1],G*s.al/So,U*s.al/So),el[Z]=++D),el[Z]-1}function O(G,U,Z,K,W,le){const ne=G+Z>>1,se=U+K>>1;if(Math.abs(G-W)+Math.abs(U-le)>1&&Js[se*As+ne])O(W,le,G,U,ne,se),O(Z,K,W,le,ne,se);else{const ie=B(G,U),Q=B(Z,K),ce=B(W,le);R.emplaceBack(ie,Q,ce)}}return O(0,0,So,So,So,0),O(So,So,0,0,0,So),{vertices:z,indices:R}}(this.tileID.canonical,r);p=g.vertices,_=g.indices}else{p=new s.b1,_=new s.b0;for(const{x:v,y:b}of c)p.emplaceBack(v,b,0,0);const g=s.bh(p.int16.subarray(0,4*p.length),void 0,4);for(let v=0;v<g.length;v+=3)_.emplaceBack(g[v],g[v+1],g[v+2])}this._tileBoundsBuffer=t.createVertexBuffer(p,s.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(_),this._tileBoundsSegments=s.bg.simpleSegment(0,0,p.length,_.length)}_makeGlobeTileDebugBuffers(t,r){const c=r.projection;if(!c||c.name!=="globe"||r.freezeTileCoverage)return;const p=this.tileID.canonical,_=s.bj(p,r),g=s.bk(_),v=s.aj(r.zoom);let b;v>0&&(b=s.bl(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,p,r,g,b,v),this._makeGlobeTileDebugTextBuffer(t,p,r,g,b,v)}_globePoint(t,r,c,p,_,g,v){let b=s.bm(t,r,c);if(g){const E=1<<c.z,C=s.aF(p.center.lng),z=s.aJ(p.center.lat),R=(c.x+.5)/E-C;let D=0;R>.5?D=-1:R<-.5&&(D=1);let B=(t/s.al+c.x)/E+D,O=(r/s.al+c.y)/E;B=(B-C)*p._pixelsPerMercatorPixel+C,O=(O-z)*p._pixelsPerMercatorPixel+z;const G=[B*p.worldSize,O*p.worldSize,0];s.af(G,G,g),b=s.bn(b,G,v)}return s.af(b,b,_)}_makeGlobeTileDebugBorderBuffer(t,r,c,p,_,g){const v=new s.bd,b=new s.be,E=new s.bo,C=(R,D,B,O,G)=>{const U=(B-R)/(G-1),Z=(O-D)/(G-1),K=v.length;for(let W=0;W<G;W++){const le=R+W*U,ne=D+W*Z;v.emplaceBack(le,ne);const se=this._globePoint(le,ne,r,c,p,_,g);E.emplaceBack(se[0],se[1],se[2]),b.emplaceBack(K+W)}},z=s.al;C(0,0,z,0,16),C(z,0,z,z,16),C(z,z,0,z,16),C(0,z,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(b),this._tileDebugBuffer=t.createVertexBuffer(v,s.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(E,s.bp.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,v.length,b.length)}_makeGlobeTileDebugTextBuffer(t,r,c,p,_,g){const v=s.al/4,b=new s.bd,E=new s.b0,C=new s.bo,z=25;E.reserve(32),b.reserve(z),C.reserve(z);const R=(D,B)=>z*D+B;for(let D=0;D<z;D++){const B=D*v;for(let O=0;O<z;O++){const G=O*v;b.emplaceBack(G,B);const U=this._globePoint(G,B,r,c,p,_,g);C.emplaceBack(U[0],U[1],U[2])}}for(let D=0;D<4;D++)for(let B=0;B<4;B++){const O=R(D,B),G=R(D,B+1),U=R(D+1,B),Z=R(D+1,B+1);E.emplaceBack(O,G,U),E.emplaceBack(U,G,Z)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(E),this._tileDebugTextBuffer=t.createVertexBuffer(b,s.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(C,s.bp.members),this._tileDebugTextSegments=s.bg.simpleSegment(0,0,z,32)}destroy(t=!0){for(const r in this.buckets)this.buckets[r].destroy(t);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof s.T&&(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"}}s.bs.setPbf(s.bt);class Yh extends Bl{constructor(t,r,c,p,_){super(t,r,c,p,_),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
54getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,r,c){const p=c.context,_=p.gl;let g=this.texturePerLayer.get(t)||c.getTileTexture(r.width);g&&g instanceof s.T?g.update(r,{premultiply:!1}):g=new s.T(p,r,_.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,g)}flushQueues(t){const r=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;r.length;)r.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const r=this._workQueuePerLayer.get(t)||[];for(;r.length;)r.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const r=this._fetchQueuePerLayer.get(t)||[];for(;r.length;)r.pop()()}}fetchHeader(t=16384,r){const c=this._mrt=new s.bs(30),p=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.bu(p,(_,g,v)=>{if(_)r(_);else try{const b=c.getHeaderLength(g);if(b>t)return void(this.request=this.fetchHeader(b,r));c.parseHeader(g),this._isHeaderLoaded=!0;let E=0;for(const C of Object.values(c.layers))E=Math.max(E,C.dataIndex[C.dataIndex.length-1].lastByte);g.byteLength>=E&&(this.entireBuffer=g),r(null,this.entireBuffer||g,v)}catch(b){r(b)}}),this.request}fetchBandForRender(t,r,c,p){this.fetchBand(t,r,c,_=>{if(_)return void p(_);this.updateTextureDescriptor(t,r,c);const g=this.textureDescriptorPerLayer.get(r);p(null,g?g.img:null)})}fetchBand(t,r,c,p,_=!0){const g=this._mrt;if(!this._isHeaderLoaded||!g)return void p(new Error("Tile header is not ready"));const v=this.actor;if(!v)return void p(new Error("Can't fetch tile band without an actor"));let b;const E=s.B(String(c),s.B(this.tileID.key,t));let C=this._taskQueue.get(E);C?C.add(p):(C=new Set,C.add(p),this._taskQueue.set(E,C));const z=(O,G)=>{b.complete(O,G),O?p(O):(C.forEach(U=>U(null,G)),this._taskQueue.delete(E))},R=(O,G)=>{if(O)return p(O);const U=v.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:G,task:b},z,void 0,!0);if(r!==null){const Z=this._workQueuePerLayer.get(r)||[];Z.push(()=>{U&&U.cancel(),b.cancel()}),this._workQueuePerLayer.has(r)||this._workQueuePerLayer.set(r,Z)}};let D;try{D=g.getLayer(t)}catch(O){if(this.state==="reloading")return;throw O}if(!D)return void p(new Error(`Unknown sourceLayer "${t}"`));
54if(D.hasDataForBand(c))return C.forEach(O=>O(null,null)),void this._taskQueue.delete(E);const B=D.getDataRange([c]);if(b=g.createDecodingTask(B),!b||b.tasks.length)if(r!==null&&this.flushQueues(r),this.entireBuffer)R(null,this.entireBuffer.slice(B.firstByte,B.lastByte+1));else{const O=Object.assign({},this.requestParams,{headers:{Range:`bytes=${B.firstByte}-${B.lastByte}`}}),G=s.bu(O,R);if(r!==null){const U=this._fetchQueuePerLayer.get(r)||[];U.push(()=>{G.cancel(),b.cancel()}),this._fetchQueuePerLayer.has(r)||this._fetchQueuePerLayer.set(r,U)}}}updateNeeded(t,r){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==r||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,r,c){if(!this._mrt)return;const p=this._mrt.getLayer(t);if(!p||!p.hasBand(c)||!p.hasDataForBand(c))return;const{bytes:_,tileSize:g,buffer:v,offset:b,scale:E}=p.getBandView(c),C=g+2*v,z=new s.q({width:C,height:C},_),R=this.texturePerLayer.get(r);R&&R instanceof s.T&&R.update(z,{premultiply:!1}),this.textureDescriptorPerLayer.set(r,{layer:t,band:c,img:z,buffer:v,offset:b,tileSize:g,format:p.pixelFormat,mix:[E,256*E,65536*E,16777216*E]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const r of this.texturePerLayer.values())r&&r instanceof s.T&&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}}class kg{constructor(t,r){this.max=t,this.onRemove=r,this.reset()}reset(){for(const t in this.data)for(const r of this.data[t])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(t,r,c){const p=t.wrapped().key;this.data[p]===void 0&&(this.data[p]=[]);const _={value:r,timeout:void 0};if(c!==void 0&&(_.timeout=setTimeout(()=>{this.remove(t,_)},c)),this.data[p].push(_),this.order.push(p),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const r=this.data[t].shift();return r.timeout&&clearTimeout(r.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),r.value}getByKey(t){const r=this.data[t];return r?r[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,r){if(!this.has(t))return this;const c=t.wrapped().key,p=r===void 0?0:this.data[c].indexOf(r),_=this.data[c][p];return this.data[c].splice(p,1),_.timeout&&clearTimeout(_.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(_.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(t){const r=[];for(const c in this.data)for(const p of this.data[c])t(p.value)||r.push(p);for(const c of r)this.remove(c.value.tileID,c)}}class Su{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,r,c){const p=String(r);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][p]=this.stateChanges[t][p]||{},Object.assign(this.stateChanges[t][p],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const _ in this.state[t])_!==p&&(this.deletedStates[t][_]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][p]===null){this.deletedStates[t][p]={};for(const _ in this.state[t][p])c[_]||(this.deletedStates[t][p][_]=null)}else for(const _ in c)this.deletedStates[t]&&this.deletedStates[t][p]&&this.deletedStates[t][p][_]===null&&delete this.deletedStates[t][p][_]}removeFeatureState(t,r,c){if(this.deletedStates[t]===null)return;const p=String(r);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&r!==void 0)this.deletedStates[t][p]!==null&&(this.deletedStates[t][p]=this.deletedStates[t][p]||{},this.deletedStates[t][p][c]=null);else if(r!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][p])for(c in this.deletedStates[t][p]={},this.stateChanges[t][p])this.deletedStates[t][p][c]=null;else this.deletedStates[t][p]=null;else this.deletedStates[t]=null}getState(t,r){const c=this.state[t]||{},p=this.stateChanges[t]||{},_=this.deletedStates[t];if(_===null)return{};if(r!==void 0){const v=String(r),b=Object.assign({},c[v],p[v]);if(_){const E=_[r];if(E===null)return{};for(const C in E)delete b[C]}return b}const g=Object.assign({},c,p);if(_)for(const v in _)delete g[v];return g}initializeTileState(t,r){t.refreshFeatureState(r)}coalesceChanges(t,r){const c={};for(const p in this.stateChanges){this.state[p]=this.state[p]||{};const _={};for(const g in this.stateChanges[p])this.state[p][g]||(this.state[p][g]={}),Object.assign(this.state[p][g],this.stateChanges[p][g]),_[g]=this.state[p][g];c[p]=_}for(const p in this.deletedStates){this.state[p]=this.state[p]||{};const _={};if(this.deletedStates[p]===null)for(const g in this.state[p])_[g]={},this.state[p][g]={};else for(const g in this.deletedStates[p]){if(this.deletedStates[p][g]===null)this.state[p][g]={};else if(this.state[p][g])for(const v of Object.keys(this.deletedStates[p][g]))delete this.state[p][g][v];_[g]=this.state[p][g]}c[p]=c[p]||{},Object.assign(c[p],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const p in t)t[p].refreshFeatureState(r)}}class Oo extends s.E{constructor(t,r,c){super(),this.id=t,this._onlySymbols=c,r.on("data",p=>{p.dataType==="source"&&p.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&p.dataType==="source"&&p.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new kg(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
54,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Su,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,r){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,r)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const r in this._tiles){const c=this._tiles[r];c.upload(t,this.map?this.map.painter:void 0),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Kh).map(t=>t.key)}getRenderableIds(t,r){const c=[];for(const p in this._tiles)this._isIdRenderable(+p,t,r)&&c.push(this._tiles[p]);return t?c.sort((p,_)=>{const g=p.tileID,v=_.tileID,b=new s.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle),E=new s.P(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return g.overscaledZ-v.overscaledZ||E.y-b.y||E.x-b.x}).map(p=>p.tileID.key):c.map(p=>p.tileID).sort(Kh).map(p=>p.key)}hasRenderableParent(t){const r=this.findLoadedParent(t,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(t,r,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(r||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,r){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=r),this._loadTile(c,this._tileLoaded.bind(this,c,t,r)))}_tileLoaded(t,r,c,p,_){if(p){if(t.state="errored",p.status!==404)this._source.fire(new s.y(p,{tile:t}));else{if(this._source.fire(new s.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const v=this.map.painter.terrain;this.update(this.transform,v.getScaledDemTileSize(),!0),v.resetTileLookupCache(this.id)}else this.update(this.transform)}return}t.timeAdded=s.o.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let g=new Map;_&&_.responseHeaders&&(g=_.responseHeaders),this._source.fire(new s.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:g}))}_backfillDEM(t){const r=this.getRenderableIds();for(let p=0;p<r.length;p++){const _=r[p];if(t.neighboringTiles&&t.neighboringTiles[_]){const g=this.getTileByID(_);c(t,g),c(g,t)}}function c(p,_){if(!p.dem||p.dem.borderReady)return;p.needsHillshadePrepare=!0,p.needsDEMTextureUpload=!0;let g=_.tileID.canonical.x-p.tileID.canonical.x;const v=_.tileID.canonical.y-p.tileID.canonical.y,b=Math.pow(2,p.tileID.canonical.z),E=_.tileID.key;g===0&&v===0||Math.abs(v)>1||(Math.abs(g)>1&&(Math.abs(g+b)===1?g+=b:Math.abs(g-b)===1&&(g-=b)),_.dem&&p.dem&&(p.dem.backfillBorder(_.dem,g,v),p.neighboringTiles&&p.neighboringTiles[E]&&(p.neighboringTiles[E].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,r,c,p){for(const _ in this._tiles){let g=this._tiles[_];if(p[_]||!g.hasData()||g.tileID.overscaledZ<=r||g.tileID.overscaledZ>c)continue;let v=g.tileID;for(;g&&g.tileID.overscaledZ>
54r+1;){const E=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[E.key],g&&g.hasData()&&(v=E)}let b=v;for(;b.overscaledZ>r;)if(b=b.scaledTo(b.overscaledZ-1),t[b.key]){p[v.key]=v;break}}}findLoadedParent(t,r){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=r?c:null}for(let c=t.overscaledZ-1;c>=r;c--){const p=t.scaledTo(c),_=this._getLoadedTile(p);if(_)return _}}_getLoadedTile(t){const r=this._tiles[t.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,r){r=r||this._source.tileSize;const c=Math.ceil(t.width/r)+1,p=Math.ceil(t.height/r)+1,_=Math.floor(c*p*5),g=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,_):_,v=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(v)}handleWrapJump(t){const r=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,r){const c={};for(const p in this._tiles){const _=this._tiles[p];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+r),c[_.tileID.key]=_}this._tiles=c;for(const p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(const p in this._tiles)this._setTileReloadTimer(+p,this._tiles[p])}}update(t,r,c,p,_){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,r),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const g=this._source.type==="batched-model";let v,b=this._source.maxzoom;const E=this.map&&this.map.painter?this.map.painter._terrain:null;if(E&&E.sourceCache===this&&E.attenuationRange()){const R=E.attenuationRange()[0],D=Math.floor(R)-Math.log2(E.getDemUpscale());b>D&&(b=D)}if(this.used||this.usedForTerrain){if(this._source.tileID)v=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new s.aQ(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y));else if(this.tileCoverLift!==0){const R=t.clone();R.tileCoverLift=this.tileCoverLift,v=R.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:b,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:g}),this._source.minzoom<=1&&t.projection.name==="globe"&&(v.push(new s.aQ(1,0,1,0,0)),v.push(new s.aQ(1,0,1,1,0)),v.push(new s.aQ(1,0,1,0,1)),v.push(new s.aQ(1,0,1,1,1)))}else if(v=t.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:b,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:g}),this._source.hasTile){const R=this._source.hasTile.bind(this._source);v=v.filter(D=>R(D))}}else v=[];
54if(v.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Nl(this._source.type)){const R=t.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),D=Math.min(R,this._source.maxzoom);if(g){const B=t.extendTileCover(v,D);for(const O of B)v.push(O)}else if(_){const B=t.extendTileCoverToNearPlane(v,this.transform.getFrustum(D),D);for(const O of B)v.push(O)}else if(this.castsShadows&&p){const B=t.extendTileCover(v,D,p,16);for(const O of B)this._shadowCasterTiles[O.key]=!0,v.push(O)}}const C=this._updateRetainedTiles(v);if(Nl(this._source.type)&&v.length!==0){const R={},D={},B=Object.keys(C);for(const G of B){const U=C[G],Z=this._tiles[G];if(!Z||Z.fadeEndTime&&Z.fadeEndTime<=s.o.now())continue;const K=this.findLoadedParent(U,Math.max(U.overscaledZ-Oo.maxOverzooming,this._source.minzoom));K&&(this._addTile(K.tileID),R[K.tileID.key]=K.tileID),D[G]=U}const O=v[v.length-1].overscaledZ;for(const G in this._tiles){const U=this._tiles[G];if(C[G]||!U.hasData())continue;let Z=U.tileID;for(;Z.overscaledZ>O;){Z=Z.scaledTo(Z.overscaledZ-1);const K=this._tiles[Z.key];if(K&&K.hasData()&&D[Z.key]){C[G]=U.tileID;break}}}for(const G in R)C[G]||(this._coveredTiles[G]=!0,C[G]=R[G])}for(const R in C)this._tiles[R].clearFadeHold();const z=s.bv(this._tiles,C);for(const R of z){const D=this._tiles[R];D.hasSymbolBuckets&&!D.holdingForFade()?D.setHoldDuration(this.map._fadeDuration):D.hasSymbolBuckets&&!D.symbolFadeFinished()||this._removeTile(+R)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const r={};if(t.length===0)return r;const c={},p=t.reduce((E,C)=>Math.min(E,C.overscaledZ),1/0),_=t[0].overscaledZ,g=Math.max(_-Oo.maxOverzooming,this._source.minzoom),v=Math.max(_+Oo.maxUnderzooming,this._source.minzoom),b={};for(const E of t){const C=this._addTile(E);r[E.key]=E,C.hasData()||p<this._source.maxzoom&&(b[E.key]=E)}this._retainLoadedChildren(b,p,v,r);for(const E of t){let C=this._tiles[E.key];if(C.hasData())continue;if(E.canonical.z>=this._source.maxzoom){const R=E.children(this._source.maxzoom)[0],D=this.getTile(R);if(D&&D.hasData()){r[R.key]=R;continue}}else{const R=E.children(this._source.maxzoom);if(r[R[0].key]&&r[R[1].key]&&r[R[2].key]&&r[R[3].key])continue}let z=C.wasRequested();for(let R=E.overscaledZ-1;R>=g;--R){const D=E.scaledTo(R);if(c[D.key]||(c[D.key]=!0,C=this.getTile(D),!C&&z&&(C=this._addTile(D)),C&&(r[D.key]=D,z=C.wasRequested(),C.hasData())))break}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const r=[];let c,p=this._tiles[t].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){c=this._loadedParentTiles[p.key];break}r.push(p.key);const _=p.scaledTo(p.overscaledZ-1);if(c=this._getLoadedTile(_),c)break;p=_}for(const _ of r)this._loadedParentTiles[_]=c}}_addTile(t){let r=this._tiles[t.key];if(r)return r.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),r;r=this._cache.getAndRemove(t),r&&(this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,r)));const c=!!r;if(!c){const p=this.map?this.map.painter:null,_=this._source.tileSize*t.overscaleFactor();r=this._source.type==="raster-array"?new Yh(t,_,this.transform.tileZoom,p,this._isRaster):new Bl(t,_,this.transform.tileZoom,p,this._isRaster,this._source.worldview),this._loadTile(r,this._tileLoaded.bind(this,r,t.key,r.state))}return r.uses++,this._tiles[t.key]=r,c||this._source.fire(new s.z("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,r){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=r.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const r=this._tiles[t];r&&(r.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),r.uses>0||(r.hasData()&&r.state!=="reloading"||r.state==="empty"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
54)}tilesIn(t,r,c){const p=[],_=this.transform;if(!_)return p;const g=_.projection.name==="globe",v=s.aF(_.center.lng);for(const b in this._tiles){const E=this._tiles[b];if(c&&E.clearQueryDebugViz(),E.holdingForFade())continue;let C;if(g){const z=E.tileID.canonical;if(z.z===0){const R=[Math.abs(s.aA(v,...Sa(z,-1))-v),Math.abs(s.aA(v,...Sa(z,1))-v)];C=[0,2*R.indexOf(Math.min(...R))-1]}else{const R=[Math.abs(s.aA(v,...Sa(z,-1))-v),Math.abs(s.aA(v,...Sa(z,0))-v),Math.abs(s.aA(v,...Sa(z,1))-v)];C=[R.indexOf(Math.min(...R))-1]}}else C=[0];for(const z of C){const R=t.containsTile(E,_,r,z);R&&p.push(R)}}return p}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,r){const c=this.getRenderableIds(t,r).map(_=>this._tiles[_].tileID),p=this.transform.projection.name==="globe";for(const _ of c)_.projMatrix=this.transform.calculateProjMatrix(_.toUnwrapped()),_.expandedProjMatrix=p?this.transform.calculateProjMatrix(_.toUnwrapped(),!1,!0):_.projMatrix;return c}sortCoordinatesByDistance(t){const r=t.slice(),c=this.transform._camera.position,p=this.transform._camera.forward(),_={};for(const g of r){const v=1/(1<<g.canonical.z);_[g.key]=((g.canonical.x+.5)*v+g.wrap-c[0])*p[0]+((g.canonical.y+.5)*v-c[1])*p[1]-c[2]*p[2]}return r.sort((g,v)=>_[g.key]-_[v.key]),r}hasTransition(){if(this._source.hasTransition())return!0;if(Nl(this._source.type))for(const t in this._tiles){const r=this._tiles[t];if(r.fadeEndTime!==void 0&&r.fadeEndTime>=s.o.now())return!0}return!1}setFeatureState(t,r,c){this._state.updateState(t=t||"_geojsonTileLayer",r,c)}removeFeatureState(t,r,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",r,c)}getFeatureState(t,r){return this._state.getState(t=t||"_geojsonTileLayer",r)}setDependencies(t,r,c){const p=this._tiles[t];p&&p.setDependencies(r,c)}reloadTilesForDependencies(t,r){for(const c in this._tiles)this._tiles[c].hasDependency(t,r)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,r))}_preloadTiles(t,r){if(!this._sourceLoaded){const b=()=>{this._sourceLoaded&&(this._source.off("data",b),this._preloadTiles(t,r))};return void this._source.on("data",b)}const c=new Map,p=Array.isArray(t)?t:[t],_=this.map.painter.terrain,g=this.usedForTerrain&&_?_.getScaledDemTileSize():this._source.tileSize;for(const b of p){const E=b.coveringTiles({tileSize:g,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const C of E)c.set(C.key,C);this.usedForTerrain&&b.updateElevation(!1)}const v=Array.from(c.values());s.bw(v,(b,E)=>{const C=new Bl(b,this._source.tileSize*b.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(C,z=>{this._source.type==="raster-dem"&&C.dem&&this._backfillDEM(C),E(z,C)})},r)}}function Kh(l,t){const r=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-r||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function Nl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function Sa(l,t){const r=1<<l.z;return[l.x/r+t,(l.x+1)/r+t]}Oo.maxOverzooming=10,Oo.maxUnderzooming=3;class Hx{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,r=!1;for(const c in this.style._mergedLayers){const p=this.style._mergedLayers[c];if(p.type==="fill-extrusion"||p.type==="building")this.layers.push({layer:p,visible:t,visibilityChanged:r});else if(p.type==="model"){const _=this.style.getLayerSource(p);_&&_.type==="batched-model"&&this.layers.push({layer:p,visible:t,visibilityChanged:r})}}}onNewFrame(t){this.layersGotHidden=!1;for(const r of this.layers){const c=r.layer;let p=!1;c.type==="fill-extrusion"?p=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?p=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(p=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!p&&r.visible,r.visible=p}}updateZOffset(t,r){this.currentBuildingBuckets=[];for(const p of this.layers){const _=p.layer,g=this.style.getLayerSourceCache(_);let v=1;_.type==="fill-extrusion"?v=p.visible?_.paint.get("fill-extrusion-vertical-scale"):0:_.type==="building"&&(v=p.visible?_.paint.get("building-vertical-scale"):0);let b=g?g.getTile(r):null;if(!b&&g)for(const E in g._tiles){const C=g._tiles[E];if(r.canonical.isChildOf(C.tileID.canonical)){b=C;break}}this.currentBuildingBuckets.push({bucket:b?b.getBucket(_):null,tileID:b?b.tileID:r,verticalScale:v})}t.hasAnyZOffset=!1;let c=!1;for(let p=0;p<t.symbolInstances.length;p++){const _=t.symbolInstances.get(p),g=_.zOffset,v=this._getHeightAtTileOffset(r,_.tileAnchorX,_.tileAnchorY);_.zOffset=v!==Number.NEGATIVE_INFINITY?v:g,c||g===_.zOffset||(c=!0),t.hasAnyZOffset||_.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,r,c,p){let _=r,g=c;if(t.canonical.z!==p.canonical.z){const v=p.canonical,b=1/(1<<t.canonical.z-v.z);
54_=(r+t.canonical.x*s.al)*b-v.x*s.al|0,g=(c+t.canonical.y*s.al)*b-v.y*s.al|0}return{tileX:_,tileY:g}}_getHeightAtTileOffset(t,r,c){let p,_;for(let g=0;g<this.layers.length;++g){const v=this.layers[g].layer;if(v.type!=="fill-extrusion"&&v.type!=="building")continue;const{bucket:b,tileID:E,verticalScale:C}=this.currentBuildingBuckets[g];if(!b)continue;const{tileX:z,tileY:R}=this._mapCoordToOverlappingTile(t,r,c,E),D=b.getHeightAtTileCoord(z,R);D&&D.height!==void 0&&(D.hidden?p=D.height:_=Math.max(D.height*C,_||0))}if(_!==void 0)return _;for(let g=0;g<this.layers.length;++g){const v=this.layers[g];if(v.layer.type!=="model"||!v.visible)continue;const{bucket:b,tileID:E}=this.currentBuildingBuckets[g];if(!b)continue;const{tileX:C,tileY:z}=this._mapCoordToOverlappingTile(t,r,c,E),R=b.getHeightAtTileCoord(C,z);if(R&&!R.hidden)return R.height===void 0&&p!==void 0?Math.min(R.maxHeight,p)*R.verticalScale:R.height?R.height*R.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Og(l,t){const r={};for(const c in l)c!=="ref"&&(r[c]=l[c]);return s.bx.forEach(c=>{c in t&&(r[c]=t[c])}),r}function Eu(l){l=l.slice();const t=Object.create(null);for(let r=0;r<l.length;r++)t[l[r].id]=l[r];for(let r=0;r<l.length;r++)"ref"in l[r]&&(l[r]=Og(l[r],t[l[r].ref]));return l}const $i={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 Jh(l,t,r){r.push({command:$i.addSource,args:[l,t[l]]})}function Ef(l,t,r){t.push({command:$i.removeSource,args:[l]}),r[l]=!0}function Fg(l,t,r,c){Ef(l,r,c),Jh(l,t,r)}function Bg(l,t,r){let c;for(c in l[r])if(l[r].hasOwnProperty(c)&&c!=="data"&&!s.by(l[r][c],t[r][c]))return!1;for(c in t[r])if(t[r].hasOwnProperty(c)&&c!=="data"&&!s.by(l[r][c],t[r][c]))return!1;return!0}function tl(l,t,r,c,p,_){let g;for(g in t=t||{},l=l||{})l.hasOwnProperty(g)&&(s.by(l[g],t[g])||r.push({command:_,args:[c,g,t[g],p]}));for(g in t)t.hasOwnProperty(g)&&!l.hasOwnProperty(g)&&(s.by(l[g],t[g])||r.push({command:_,args:[c,g,t[g],p]}))}function Iu(l){return l.id}function Au(l,t){return l[t.id]=t,l}function If(l,t,r){const c=t.createTileMatrix(l,l.worldSize,r.toUnwrapped());return s.aB(new Float32Array(16),l.projMatrix,c)}function Qh(l,t,r){if(t.projection.name===r.projection.name)return l.projMatrix;const c=r.clone();return c.setProjection(t.projection),If(c,t.getProjection(),l)}function Qs(l,t,r){return t.name===r.projection.name?l.projMatrix:If(r,t,l)}class Cu{constructor(t,r){this.reset(t,r)}reset(t,r){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.aA(t,0,1);let r=1,c=this._distances[r];const p=t*this.paddedLength+this.padding;for(;c<p&&r<this._distances.length;)c=this._distances[++r];const _=r-1,g=this._distances[_],v=c-g,b=v>0?(p-g)/v:0;return this.points[_].mult(1-b).add(this.points[r].mult(b))}}class Af{constructor(t,r,c){const p=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(r/c);for(let g=0;g<this.xCellCount*this.yCellCount;g++)p.push([]),_.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=r,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}
54insert(t,r,c,p,_){this._forEachCell(r,c,p,_,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(r),this.bboxes.push(c),this.bboxes.push(p),this.bboxes.push(_)}insertCircle(t,r,c,p){this._forEachCell(r-p,c-p,r+p,c+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(r),this.circles.push(c),this.circles.push(p)}_insertBoxCell(t,r,c,p,_,g){this.boxCells[_].push(g)}_insertCircleCell(t,r,c,p,_,g){this.circleCells[_].push(g)}_query(t,r,c,p,_,g){if(c<0||t>this.width||p<0||r>this.height)return!_&&[];const v=[];if(t<=0&&r<=0&&this.width<=c&&this.height<=p){if(_)return!0;for(let b=0;b<this.boxKeys.length;b++)v.push({key:this.boxKeys[b],x1:this.bboxes[4*b],y1:this.bboxes[4*b+1],x2:this.bboxes[4*b+2],y2:this.bboxes[4*b+3]});for(let b=0;b<this.circleKeys.length;b++){const E=this.circles[3*b],C=this.circles[3*b+1],z=this.circles[3*b+2];v.push({key:this.circleKeys[b],x1:E-z,y1:C-z,x2:E+z,y2:C+z})}return g?v.filter(g):v}return this._forEachCell(t,r,c,p,this._queryCell,v,{hitTest:_,seenUids:{box:{},circle:{}}},g),_?v.length>0:v}_queryCircle(t,r,c,p,_){const g=t-c,v=t+c,b=r-c,E=r+c;if(v<0||g>this.width||E<0||b>this.height)return!p&&[];const C=[];return this._forEachCell(g,b,v,E,this._queryCellCircle,C,{hitTest:p,circle:{x:t,y:r,radius:c},seenUids:{box:{},circle:{}}},_),p?C.length>0:C}query(t,r,c,p,_){return this._query(t,r,c,p,!1,_)}hitTest(t,r,c,p,_){return this._query(t,r,c,p,!0,_)}hitTestCircle(t,r,c,p){return this._queryCircle(t,r,c,!0,p)}_queryCell(t,r,c,p,_,g,v,b){const E=v.seenUids,C=this.boxCells[_];if(C!==null){const R=this.bboxes;for(const D of C)if(!E.box[D]){E.box[D]=!0;const B=4*D;if(t<=R[B+2]&&r<=R[B+3]&&c>=R[B+0]&&p>=R[B+1]&&(!b||b(this.boxKeys[D]))){if(v.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[D],x1:R[B],y1:R[B+1],x2:R[B+2],y2:R[B+3]})}}}const z=this.circleCells[_];if(z!==null){const R=this.circles;for(const D of z)if(!E.circle[D]){E.circle[D]=!0;const B=3*D;if(this._circleAndRectCollide(R[B],R[B+1],R[B+2],t,r,c,p)&&(!b||b(this.circleKeys[D]))){if(v.hitTest)return g.push(!0),!0;{const O=R[B],G=R[B+1],U=R[B+2];g.push({key:this.circleKeys[D],x1:O-U,y1:G-U,x2:O+U,y2:G+U})}}}}}_queryCellCircle(t,r,c,p,_,g,v,b){const E=v.circle,C=v.seenUids,z=this.boxCells[_];if(z!==null){const D=this.bboxes;for(const B of z)if(!C.box[B]){C.box[B]=!0;const O=4*B;if(this._circleAndRectCollide(E.x,E.y,E.radius,D[O+0],D[O+1],D[O+2],D[O+3])&&(!b||b(this.boxKeys[B])))return g.push(!0),!0}}const R=this.circleCells[_];if(R!==null){const D=this.circles;for(const B of R)if(!C.circle[B]){C.circle[B]=!0;const O=3*B;if(this._circlesCollide(D[O],D[O+1],D[O+2],E.x,E.y,E.radius)&&(!b||b(this.circleKeys[B])))return g.push(!0),!0}}}_forEachCell(t,r,c,p,_,g,v,b){const E=this._convertToXCellCoord(t),C=this._convertToYCellCoord(r),z=this._convertToXCellCoord(c),R=this._convertToYCellCoord(p);for(let D=E;D<=z;D++)for(let B=C;B<=R;B++)if(_.call(this,t,r,c,p,this.xCellCount*B+D,g,v,b))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,r,c,p,_,g){const v=p-t,b=_-r,E=c+g;return E*E>v*v+b*b}_circleAndRectCollide(t,r,c,p,_,g,v){const b=(g-p)/2,E=Math.abs(t-(p+b));if(E>b+c)return!1;const C=(v-_)/2,z=Math.abs(r-(_+C));if(z>C+c)return!1;if(E<=b||z<=C)return!0;const R=E-b,D=z-C;return R*R+D*D<=c*c}}const il={unknown:0,flipRequired:1,flipNotRequired:2},Vl=Math.tan(85*Math.PI/180);function co(l,t,r,c,p,_,g){const v=s.bC();if(r)if(_.name==="globe"){const b=s.bD(p,t);s.aB(v,v,b)}else{const b=s.bE([],g);v[0]=b[0],v[1]=b[1],v[4]=b[2],v[5]=b[3],c||s.bB(v,v,p.angle)}else s.aB(v,p.labelPlaneMatrix,l);return v}function ed(l,t,r,c,p,_,g){const v=co(l,t,r,c,p,_,g);return _.name==="globe"&&r||(v[2]=v[6]=v[10]=v[14]=0),v}function Mu(l,t,r,c,p,_,g){if(r){if(_.name==="globe"){const v=co(l,t,r,c,p,_,g);return s.bl(v,v),s.aB(v,l,v),v}{const v=s.bz(l),b=s.bA([]);return b[0]=g[0],b[1]=g[1],b[4]=g[2],b[5]=g[3],s.aB(v,v,b),c||s.bB(v,v,-p.angle),v}}return p.glCoordMatrix}function ls(l,t,r,c){const p=[l,t,r,1];r?s.aC(p,p,c):Nt(p,p,c);const _=p[3];return p[0]/=_,p[1]/=_,p[2]/=_,p}function rn(l,t){return Math.min(.5+l/t*.5,1.5)}function Ng(l,t){const r=l[0]/l[3],c=l[1]/l[3];return r>=-t[0]&&r<=t[0]&&c>=-t[1]&&c<=t[1]}function Vg(l,t,r,c,p,_,g,v,b,E,C=1){const z=r.transform,R=c?l.textSizeData:l.iconSizeData,D=s.bK(R,r.transform.zoom,C),B=z.projection.name==="globe",O=[256/r.width*2+1,256/r.height*2+1],G=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;G.clear();let U=null;B&&(U=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const Z=l.lineVertexArray,K=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,W=r.transform.width/r.transform.height;let le,ne=!1;for(let se=0;se<K.length;se++){const ie=K.get(se),{numGlyphs:Q,writingMode:ce}=ie;if(ce!==s.bL.vertical||ne||le===s.bL.horizontal||(ne=!0),le=ce,(ie.hidden||ce===s.bL.vertical)&&!ne){Ms(Q,G);continue}ne=!1;const ve=new s.P(ie.tileAnchorX,ie.tileAnchorY),ge=l.elevationType==="road",Le=!!z.elevation||ge;let{x:ze,y:je,z:nt}=z.projection.projectTilePoint(ve.x,ve.y,E.canonical),Ae=null;if(Le){const St=ge?l.getElevationFeatureForText(se):null;Ae={getElevation:b,elevation:z.elevation,elevationFeature:St};const[Ht,ci,Li]=b(ve,z.elevation,St);ze+=Ht,je+=ci,nt+=Li}const fe=[ze,je,nt,1];if(s.aC(fe,fe,t),!Ng(fe,O)){Ms(Q,G);continue}const Oe=fe[3],Me=rn(r.transform.getCameraToCenterDistance(z.projection),Oe),Ze=s.bM(R,D,ie),ft=g?Ze/Me:Ze*Me,bt=ls(ze,je,nt,p);if(bt[3]<=0){Ms(Q,G);continue}let ut={};const rt=s.an(l.layers[0].layout.get("text-max-angle")),Lt=Math.cos(rt),Mt=g?null:Ae,xt=Cf(ie,ft,!1,v,t,p,_,l.glyphOffsetArray,Z,G,U,bt,ve,ut,W,Mt,z.projection,E,g,Lt);ne=xt.useVertical,Mt&&xt.needsFlipping&&(ut={}),(xt.notEnoughRoom||ne||xt.needsFlipping&&Cf(ie,ft,!0,v,t,p,_,l.glyphOffsetArray,Z,G,U,bt,ve,ut,W,Mt,z.projection,E,g,Lt).notEnoughRoom)&&Ms(Q,G)}c?(l.text.dynamicLayoutVertexBuffer.updateData(G),U&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(U)):(l.icon.dynamicLayoutVertexBuffer.updateData(G),U&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(U))}function jg(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G){const{lineStartIndex:U,glyphStartIndex:Z,segment:K}
54=v,W=Z+v.numGlyphs,le=U+v.lineLength,ne=t.getoffsetX(Z),se=t.getoffsetX(W-1),ie=Cc(l*ne,r,c,p,_,g,K,U,le,b,E,C,z,R,!0,D,B,O,G);if(!ie)return null;const Q=Cc(l*se,r,c,p,_,g,K,U,le,b,E,C,z,R,!0,D,B,O,G);return Q?{first:ie,last:Q}:null}function Qt(l,t,r,c){return l===s.bL.horizontal&&Math.abs(c)>Math.abs(r)?{useVertical:!0}:l===s.bL.vertical?c>0?{needsFlipping:!0}:null:t!==il.unknown&&function(p,_){return p===0||Math.abs(_/p)>Vl}(r,c)?t===il.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Cf(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z,K){const W=t/24,le=l.lineOffsetX*W,ne=l.lineOffsetY*W,{lineStartIndex:se,glyphStartIndex:ie,numGlyphs:Q,segment:ce,writingMode:ve,flipState:ge}=l,Le=se+l.lineLength,ze=je=>{if(C){const[Oe,Me,Ze]=je.up,ft=E.length;s.bN(C,ft+0,Oe,Me,Ze),s.bN(C,ft+1,Oe,Me,Ze),s.bN(C,ft+2,Oe,Me,Ze),s.bN(C,ft+3,Oe,Me,Ze)}const[nt,Ae,fe]=je.point;s.bO(E,nt,Ae,fe,je.angle)};if(Q>1){const je=jg(W,v,le,ne,r,z,R,l,b,_,D,O,!1,G,U,Z,K);if(!je)return{notEnoughRoom:!0};if(c&&!r){let[nt,Ae,fe]=je.first.point,[Oe,Me,Ze]=je.last.point;[nt,Ae]=ls(nt,Ae,fe,g),[Oe,Me]=ls(Oe,Me,Ze,g);const ft=Qt(ve,ge,(Oe-nt)*B,Me-Ae);if(l.flipState=ft&&ft.needsFlipping?il.flipRequired:il.flipNotRequired,ft)return ft}ze(je.first);for(let nt=ie+1;nt<ie+Q-1;nt++){const Ae=Cc(W*v.getoffsetX(nt),le,ne,r,z,R,ce,se,Le,b,_,D,O,!1,!1,G,U,Z,K);if(!Ae)return E.length-=4*(nt-ie),{notEnoughRoom:!0};ze(Ae)}ze(je.last)}else{if(c&&!r){const nt=ls(R.x,R.y,0,p),Ae=se+ce+1,fe=new s.P(b.getx(Ae),b.gety(Ae)),Oe=ls(fe.x,fe.y,0,p),Me=Oe[3]>0?Oe:cs(R,fe,nt,1,p,void 0,G,U.canonical),Ze=Qt(ve,ge,(Me[0]-nt[0])*B,Me[1]-nt[1]);if(l.flipState=Ze&&Ze.needsFlipping?il.flipRequired:il.flipNotRequired,Ze)return Ze}const je=Cc(W*v.getoffsetX(ie),le,ne,r,z,R,ce,se,Le,b,_,D,O,!1,!1,G,U,Z,K);if(!je)return{notEnoughRoom:!0};ze(je)}return{}}function Pu(l,t,r,c,p){const{x:_,y:g,z:v}=c.projectTilePoint(l.x,l.y,t);if(!p)return ls(_,g,v,r);const[b,E,C]=p.getElevation(l,p.elevation,p.elevationFeature);return ls(_+b,g+E,v+C,r)}function cs(l,t,r,c,p,_,g,v){const b=Pu(l.sub(t)._unit()._add(l),v,p,g,_);return s.av(b,r,b),s.aw(b,b),s.bH(b,r,b,c)}function Cc(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z){const K=c?l-t:l+t;let W=K>0?1:-1,le=0;c&&(W*=-1,le=Math.PI),W<0&&(le+=Math.PI);let ne=v+g+(W>0?0:1)|0,se=p,ie=p,Q=0,ce=0;const ve=Math.abs(K),ge=[],Le=[];let ze=_,je=ze,nt=s.bF([]);const Ae=()=>cs(je,ze,ie,ve-Q+1,C,R,O,G.canonical);for(;Q+ce<=ve;){if(ne+=W,ne<v||ne>=b)return null;if(ie=se,je=ze,ge.push(ie),D&&Le.push(je),ze=new s.P(E.getx(ne),E.gety(ne)),se=z[ne],!se){const Mt=Pu(ze,G.canonical,C,O,R);se=Mt[3]>0?z[ne]=Mt:Ae()}Q+=ce;const rt=s.av([],se,ie),Lt=s.bG(ie,se);if(r&&Lt>0&&ce>0&&s.bJ(nt,rt)/(ce*Lt)<Z)return null;ce=Lt,nt=rt}B&&R&&(z[ne]&&(se=Ae(),ce=s.bG(ie,se),nt=s.av([],se,ie)),z[ne]=se);const fe=(ve-Q)/ce,Oe=ze.sub(je)._mult(fe)._add(je),Me=s.bH([],ie,nt,fe);let Ze=[0,0,1],ft=nt[0],bt=nt[1];if(U&&(Ze=O.upVector(G.canonical,Oe.x,Oe.y),Ze[0]!==0||Ze[1]!==0||Ze[2]!==1)){const rt=[Ze[2],0,-Ze[0]],Lt=s.bI([],Ze,rt);s.aw(rt,rt),s.aw(Lt,Lt),ft=s.bJ(nt,rt),bt=s.bJ(nt,Lt)}if(r){const rt=s.bI([],Ze,nt);s.aw(rt,rt),s.bH(Me,Me,rt,r*W)}const ut=le+Math.atan2(bt,ft);return ge.push(Me),D&&Le.push(Oe),{point:Me,angle:ut,path:ge,tilePath:Le,up:Ze}}function Ms(l,t){const r=t.length,c=r+4*l;t.resize(c),t.float32.fill(-1/0,4*r,4*c)}function Nt(l,t,r){const c=t[0],p=t[1];return l[0]=r[0]*c+r[4]*p+r[12],l[1]=r[1]*c+r[5]*p+r[13],l[3]=r[3]*c+r[7]*p+r[15],l}const Oi=100;class ln{constructor(t,r,c=new Af(t.width+200,t.height+200,25),p=new Af(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=p,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Oi,this.screenBottomBoundary=t.height+Oi,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=r}placeCollisionBox(t,r,c,p,_,g,v,b,E,C,z){let R=c.projectedAnchorX,D=c.projectedAnchorY,B=c.projectedAnchorZ;const O=c.tileAnchorX,G=c.tileAnchorY,U=c.elevation,Z=c.tileID,K=t.getProjection();if(U&&Z){const[Le,ze,je]=K.upVector(Z.canonical,c.tileAnchorX,c.tileAnchorY),nt=K.upVectorScale(Z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;R+=Le*U*nt,D+=ze*U*nt,B+=je*U*nt}const W=t.projection.name==="globe",le=t.projection.name==="globe"?s.aj(this.transform.zoom):0;if(Z&&W&&le<1&&!g){const Le=1<<Z.canonical.z,ze=s.bP(O,G);s.bQ(ze,ze,1/s.al),s.bR(ze,ze,s.bP(Z.canonical.x,Z.canonical.y)),s.bQ(ze,ze,1/Le),s.bS(ze,ze,s.bP(p[0],p[1])),ze[0]=s.bT(ze[0],-.5,.5),s.bQ(ze,ze,s.al);const je=s.bU(ze[0],ze[1],s.al/(2*Math.PI),1);s.aC(je,je,_),R=s.ak(R,je[0],le),D=s.ak(D,je[1],le),B=s.ak(B,je[2],le)}const ne=this.projectAndGetPerspectiveRatio(C,R,D,B,c.tileID,K.name==="globe"||!!U||this.transform.pitch>0,K),se=E*ne.perspectiveRatio,ie=(c.x1*r+v.x-c.padding)*se+ne.point.x,Q=(c.y1*r+v.y-c.padding)*se+ne.point.y,ce=(c.x2*r+v.x+c.padding)*se+ne.point.x,ve=(c.y2*r+v.y+c.padding)*se+ne.point.y,ge=ne.perspectiveRatio<=.55||ne.occluded;return!this.isInsideGrid(ie,Q,ce,ve)||!b&&this.grid.hitTest(ie,Q,ce,ve,z)||ge?{box:[],offscreen:!1,occluded:ne.occluded}:{box:[ie,Q,ce,ve],offscreen:this.isOffscreen(ie,Q,ce,ve),occluded:!1}}placeCollisionCircles(t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G){const U=[],Z=this.transform.elevation,K=t.getProjection(),W=t.elevationType==="road",le=!!Z||W,ne=s.bV.getAtTileOffsetFunc(G,this.transform.center.lat,this.transform.worldSize,K),se=new s.P(c.tileAnchorX,c.tileAnchorY),ie=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:Q,y:ce,z:ve}=K.projectTilePoint(ie.x,ie.y,G.canonical),ge=null;if(le){const Lt=W?t.getElevationFeatureForText(p):null;ge={getElevation:ne,elevation:Z,elevationFeature:Lt};const[Mt,xt,St]=ne(se,Z,Lt);Q+=Mt,ce+=xt,ve+=St}const Le=K.name==="globe",ze=this.projectAndGetPerspectiveRatio(b,Q,ce,ve,G,Le||!!Z||this.transform.pitch>0,K),{perspectiveRatio:je}=ze,nt=(R?v/je:v*je)/s.bY,Ae=ls(Q,ce,ve,E),fe=c.lineOffsetX*nt,Oe=c.lineOffsetY*nt,Me=s.an(t.layers[0].layout.get("text-max-angle")),Ze=Math.cos(Me),ft=ze.signedDistanceFromCamera>0?jg(nt,g,fe,Oe,W&&c.flipState===1,Ae,ie,c,_,E,{},le&&!R?ge:null,R&&le,K,G,R,Ze):null;let bt=!1,ut=!1,rt=!0;
vendor: 5,189 bytes, line 54
54if(ft&&!ze.occluded){const Lt=.5*B*je+O,Mt=new s.P(-100,-100),xt=new s.P(this.screenRightBoundary,this.screenBottomBoundary),St=new Cu,{first:Ht,last:ci}=ft,Li=Ht.path.length;let Yi=[];for(let li=Li-1;li>=1;li--)Yi.push(Ht.path[li]);for(let li=1;li<ci.path.length;li++)Yi.push(ci.path[li]);const zt=2.5*Lt;C&&(Yi=Yi.map(([li,Qi,cn],on)=>(le&&!Le&&(cn=ne(on<Li-1?Ht.tilePath[Li-1-on]:ci.tilePath[on-Li+2],Z,ge.elevationFeature)[2]),ls(li,Qi,cn,C))),Yi.some(li=>li[3]<=0)&&(Yi=[]));let Zi=[];if(Yi.length>0){let li=1/0,Qi=-1/0,cn=1/0,on=-1/0;for(const Hi of Yi)li=Math.min(li,Hi[0]),cn=Math.min(cn,Hi[1]),Qi=Math.max(Qi,Hi[0]),on=Math.max(on,Hi[1]);Qi>=Mt.x&&li<=xt.x&&on>=Mt.y&&cn<=xt.y&&(Zi=[Yi.map(Hi=>new s.P(Hi[0],Hi[1]))],(li<Mt.x||Qi>xt.x||cn<Mt.y||on>xt.y)&&(Zi=s.bW(Zi,Mt.x,Mt.y,xt.x,xt.y)))}for(const li of Zi){St.reset(li,.25*Lt);let Qi=0;Qi=St.length<=.5*Lt?1:Math.ceil(St.paddedLength/zt)+1;for(let cn=0;cn<Qi;cn++){const on=cn/Math.max(Qi-1,1),Hi=St.lerp(on),_i=Hi.x+Oi,Ji=Hi.y+Oi;U.push(_i,Ji,Lt,0);const Nn=_i-Lt,Cn=Ji-Lt,en=_i+Lt,Ni=Ji+Lt;if(rt=rt&&this.isOffscreen(Nn,Cn,en,Ni),ut=ut||this.isInsideGrid(Nn,Cn,en,Ni),!r&&this.grid.hitTestCircle(_i,Ji,Lt,D)&&(bt=!0,!z))return{circles:[],offscreen:!1,collisionDetected:bt,occluded:!1}}}}return{circles:!z&&bt||!ut?[]:U,offscreen:rt,collisionDetected:bt,occluded:ze.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const r=[];let c=1/0,p=1/0,_=-1/0,g=-1/0;for(const C of t){const z=new s.P(C.x+Oi,C.y+Oi);c=Math.min(c,z.x),p=Math.min(p,z.y),_=Math.max(_,z.x),g=Math.max(g,z.y),r.push(z)}const v=this.grid.query(c,p,_,g).concat(this.ignoredGrid.query(c,p,_,g)),b={},E={};for(const C of v){const z=C.key;if(b[z.bucketInstanceId]===void 0&&(b[z.bucketInstanceId]={}),b[z.bucketInstanceId][z.featureIndex])continue;const R=[new s.P(C.x1,C.y1),new s.P(C.x2,C.y1),new s.P(C.x2,C.y2),new s.P(C.x1,C.y2)];s.bX(r,R)&&(b[z.bucketInstanceId][z.featureIndex]=!0,E[z.bucketInstanceId]===void 0&&(E[z.bucketInstanceId]=[]),E[z.bucketInstanceId].push(z.featureIndex))}return E}insertCollisionBox(t,r,c,p,_){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:p,collisionGroupID:_},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,r,c,p,_){const g=r?this.ignoredGrid:this.grid,v={bucketInstanceId:c,featureIndex:p,collisionGroupID:_};for(let b=0;b<t.length;b+=4)g.insertCircle(v,t[b],t[b+1],t[b+2])}projectAndGetPerspectiveRatio(t,r,c,p,_,g,v){const b=[r,c,p,1];let E=!1;p||this.transform.pitch>0?(s.aC(b,b,t),this.fogState&&_&&v.name!=="globe"&&(E=function(R,D,B,O,G,U){const Z=U.calculateFogTileMatrix(G),K=[D,B,O];return s.af(K,K,Z),It(R,s.ag(K),U.pitch,U._fov)}(this.fogState,r,c,p,_.toUnwrapped(),this.transform)>.9)):Nt(b,b,t);const C=b[3];return{point:new s.P((b[0]/C+1)/2*this.transform.width+Oi,(-b[1]/C+1)/2*this.transform.height+Oi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(v)/C*.5,1.5),signedDistanceFromCamera:C,occluded:g&&b[2]>C||E}}isOffscreen(t,r,c,p){return c<Oi||t>=this.screenRightBoundary||p<Oi||r>this.screenBottomBoundary}isInsideGrid(t,r,c,p){return c>=0&&t<this.gridRightBoundary&&p>=0&&r<this.gridBottomBoundary}getViewportMatrix(){const t=s.bA([]);return s.br(t,t,[-100,-100,0]),t}}class Eo{constructor(t,r,c,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?r:-r))):p&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class ea{constructor(t,r,c,p,_,g=!1){this.text=new Eo(t?t.text:null,r,c,_),this.icon=new Eo(t?t.icon:null,r,p,_),this.clipped=g}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class nn{constructor(t,r,c,p=!1){this.text=t,this.icon=r,this.skipFade=c,this.clipped=p}}class td{constructor(){this.invProjMatrix=s.bC(),this.viewportMatrix=s.bC(),this.circles=[]}}class Ru{constructor(t,r,c,p,_){this.bucketInstanceId=t,this.featureIndex=r,this.sourceLayerIndex=c,this.bucketIndex=p,this.tileID=_}}class Lu{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const r=++this.maxGroupID;this.collisionGroups[t]={ID:r,predicate:c=>c.collisionGroupID===r}}return this.collisionGroups[t]}}function Jr(l,t,r,c,p){const{horizontalAlign:_,verticalAlign:g}=s.c1(l),v=-(_-.5)*t,b=-(g-.5)*r,E=s.c2(l,c);return new s.P(v+E[0]*p,b+E[1]*p)}function cr(l,t,r,c,p){const _=new s.P(l,t);return r&&_._rotate(c?p:-p),_}class qx{constructor(t,r,c,p,_,g){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new ln(this.transform,_),this.buildingIndex=g,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Lu(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,r,c,p,_=1){const g=c.getBucket(r),v=c.latestFeatureIndex;if(!g||!v||r.fqid!==g.layerIds[0])return;const b=g.layers[0].layout,E=g.layers[0].paint,C=c.collisionBoxArray,z=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ
54),R=c.tileSize/s.al,D=c.tileID.toUnwrapped();this.transform.setProjection(g.projection);const B=(O=c.tileID,G=g.getProjection(),U=this.transform,G.name===this.projection?U.calculateProjMatrix(O.toUnwrapped()):If(U,G,O));var O,G,U;const Z=b.get("text-pitch-alignment")==="map",K=b.get("text-rotation-alignment")==="map";r.compileFilter(r.options);const W=r.dynamicFilter(),le=r.dynamicFilterNeedsFeature(),ne=this.transform.calculatePixelsToTileUnitsMatrix(c),se=ed(B,c.tileID.canonical,Z,K,this.transform,g.getProjection(),ne);let ie=null;const Q=g.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(Z){const fe=Mu(B,c.tileID.canonical,Z,K,this.transform,g.getProjection(),ne);ie=s.aB([],this.transform.labelPlaneMatrix,fe)}let ce=null;W&&c.latestFeatureIndex&&(ce={unwrappedTileID:D,dynamicFilter:W,dynamicFilterNeedsFeature:le}),this.retainedQueryData[g.bucketInstanceId]=new Ru(g.bucketInstanceId,v,g.sourceLayerIndex,g.index,c.tileID);const[ve,ge]=g.layers[0].layout.get("text-size-scale-range"),Le=s.aA(_,ve,ge),[ze,je]=b.get("icon-size-scale-range"),nt=s.aA(_,ze,je),Ae={bucket:g,layout:b,paint:E,posMatrix:B,invMatrix:Q,mercatorCenter:[s.aF(this.transform.center.lng),s.aJ(this.transform.center.lat)],textLabelPlaneMatrix:se,labelToScreenMatrix:ie,clippingData:ce,scale:z,textPixelRatio:R,holdingForFade:c.holdingForFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:s.bK(g.textSizeData,this.transform.zoom,Le),partiallyEvaluatedIconSize:s.bK(g.iconSizeData,this.transform.zoom,nt),collisionGroup:this.collisionGroups.get(g.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(p)for(const fe of g.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Me,symbolInstanceEnd:Ze}=fe;t.push({sortKey:Oe,symbolInstanceStart:Me,symbolInstanceEnd:Ze,parameters:Ae})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:Ae})}attemptAnchorPlacement(t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z,K,W,le){const{textOffset0:ne,textOffset1:se,crossTileID:ie}=O,Q=[ne,se],ce=Jr(t,g,v,Q,b),ve=this.collisionIndex.placeCollisionBox(U,b,r,c,p,_,cr(ce.x,ce.y,E,C,this.transform.angle),B,z,R,D.predicate);if(K){const ge=U.getSymbolInstanceIconSize(le,this.transform.zoom,O.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(U,ge,K,c,p,_,cr(ce.x,ce.y,E,C,this.transform.angle),B,z,R,D.predicate).box.length===0)return}if(ve.box.length>0){let ge;return this.prevPlacement&&this.prevPlacement.variableOffsets[ie]&&this.prevPlacement.placements[ie]&&this.prevPlacement.placements[ie].text&&(ge=this.prevPlacement.variableOffsets[ie].anchor),this.variableOffsets[ie]={textOffset:Q,width:g,height:v,anchor:t,textScale:b,prevAnchor:ge},this.markUsedJustification(U,t,O,Z),U.allowVerticalPlacement&&(this.markUsedOrientation(U,Z,O),this.placedOrientations[ie]=Z),{shift:ce,placedGlyphBoxes:ve}}}placeLayerBucketPart(t,r,c,p,_=1){const{bucket:g,layout:v,paint:b,posMatrix:E,textLabelPlaneMatrix:C,labelToScreenMatrix:z,clippingData:R,textPixelRatio:D,mercatorCenter:B,invMatrix:O,holdingForFade:G,collisionBoxArray:U,partiallyEvaluatedTextSize:Z,partiallyEvaluatedIconSize:K,collisionGroup:W,latestFeatureIndex:le}=t.parameters,ne=v.get("text-optional"),se=v.get("icon-optional"),ie=v.get("text-allow-overlap"),Q=v.get("icon-allow-overlap"),ce=v.get("text-rotation-alignment")==="map",ve=v.get("icon-rotation-alignment")==="map",ge=v.get("text-pitch-alignment")==="map",Le=b.get("symbol-z-offset"),ze=v.get("symbol-elevation-reference")==="sea",je=v.get("symbol-placement"),[nt,Ae]=v.get("text-size-scale-range"),[fe,Oe]=v.get("icon-size-scale-range"),Me=s.aA(_,nt,Ae),Ze=s.aA(_,fe,Oe),ft=v.get("text-variable-anchor"),bt=ce&&je!=="point",ut=ve&&je!=="point",rt=ft&&g.hasTextData(),Lt=g.hasIconTextFit()&&rt&&g.hasIconData();this.transform.setProjection(g.projection);const Mt=rt||bt,xt=ut||Lt;let St=ie&&(Q||!g.hasIconData()||se),Ht=Q&&(ie||!g.hasTextData()||ne);const ci=!Le.isConstant();!g.collisionArrays&&U&&g.deserializeCollisionBoxes(U),c&&p&&g.updateCollisionDebugBuffers(this.transform.zoom,U,Me,Ze);const Li=(zt,Zi,li)=>{const{crossTileID:Qi,numVerticalGlyphVertices:cn}=zt;let on=null;if(R&&R.dynamicFilterNeedsFeature||ci){const Gn=this.retainedQueryData[g.bucketInstanceId];on=le.loadFeature({featureIndex:zt.featureIndex,bucketIndex:Gn.bucketIndex,sourceLayerIndex:Gn.sourceLayerIndex,layoutVertexArrayOffset:0});const er=on.properties?on.properties.worldview:null;if(g.localizable&&g.worldview&&typeof er=="string")if(er==="all")on.properties.$localized=!0;else{if(!er.split(",").includes(g.worldview))return;on.properties.$localized=!0,on.properties.worldview=g.worldview}}if(R&&!(0,R.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:g.worldview},on,this.retainedQueryData[g.bucketInstanceId].tileID.canonical,new s.P(zt.tileAnchorX,zt.tileAnchorY),this.transform.calculateDistanceTileData(R.unwrappedTileID)))return this.placements[Qi]=new nn(!1,!1,!1,!0),void r.add(Qi);const Hi=Le.evaluate(on,{});if(r.has(Qi))return;if(G)return void(this.placements[Qi]=new nn(!1,!1,!1));let _i=!1,Ji=!1,Nn=!0,Cn=!1,en=!1,Ni=null,gi={box:null,offscreen:null,occluded:null},En={box:null}
vendor: 4,604 bytes, line 54
54,Xn=null,Dn=null,fn=null,yo=0,Zr=0,gr=0;li.textFeatureIndex?yo=li.textFeatureIndex:zt.useRuntimeCollisionCircles&&(yo=zt.featureIndex),li.verticalTextFeatureIndex&&(Zr=li.verticalTextFeatureIndex);const eo=g.elevationFeatures?g.elevationFeatures[zt.elevationFeatureIndex]:void 0,to=Gn=>{Gn.tileID=this.retainedQueryData[g.bucketInstanceId].tileID;const er=this.transform.elevation;Gn.elevation=ze?Hi:Hi+s.bV.getAtTileOffset(Gn.tileID,new s.P(Gn.tileAnchorX,Gn.tileAnchorY),er,eo),Gn.elevation+=zt.zOffset},$r=li.textBox;if($r){to($r);const Gn=mn=>{let sr=s.bL.horizontal;if(g.allowVerticalPlacement&&!mn&&this.prevPlacement){const Vn=this.prevPlacement.placedOrientations[Qi];Vn&&(this.placedOrientations[Qi]=Vn,sr=Vn,this.markUsedOrientation(g,sr,zt))}return sr},er=(mn,sr)=>{if(g.allowVerticalPlacement&&cn>0&&li.verticalTextBox){for(const Vn of g.writingModes)if(Vn===s.bL.vertical?(gi=sr(),En=gi):gi=mn(),gi&&gi.box&&gi.box.length)break}else gi=mn()};if(ft){let mn=ft;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Qi]){const kn=this.prevPlacement.variableOffsets[Qi];mn.indexOf(kn.anchor)>0&&(mn=mn.filter(gs=>gs!==kn.anchor),mn.unshift(kn.anchor))}const sr=(kn,gs,sh)=>{const ks=g.getSymbolInstanceTextSize(Z,zt,this.transform.zoom,Zi),ah=(kn.x2-kn.x1)*ks+2*kn.padding,Jc=(kn.y2-kn.y1)*ks+2*kn.padding,ca=zt.hasIconTextFit&&!Q?gs:null;ca&&to(ca);let Ba={box:[],offscreen:!1,occluded:!1};const Qc=ie?2*mn.length:mn.length;for(let yl=0;yl<Qc;++yl){const Na=this.attemptAnchorPlacement(mn[yl%mn.length],kn,B,O,Mt,ah,Jc,ks,ce,ge,D,E,W,yl>=mn.length,zt,Zi,g,sh,ca,Z,K);if(Na&&(Ba=Na.placedGlyphBoxes,Ba&&Ba.box&&Ba.box.length)){_i=!0,Ni=Na.shift;break}}return Ba};er(()=>sr($r,li.iconBox,s.bL.horizontal),()=>{const kn=li.verticalTextBox;return kn&&to(kn),g.allowVerticalPlacement&&!(gi&&gi.box&&gi.box.length)&&cn>0&&kn?sr(kn,li.verticalIconBox,s.bL.vertical):{box:null,offscreen:null,occluded:null}}),gi&&(_i=gi.box,Nn=gi.offscreen,Cn=gi.occluded);const Vn=Gn(!(!gi||!gi.box));if(!_i&&this.prevPlacement){const kn=this.prevPlacement.variableOffsets[Qi];kn&&(this.variableOffsets[Qi]=kn,this.markUsedJustification(g,kn.anchor,zt,Vn))}}else{const mn=(sr,Vn)=>{const kn=g.getSymbolInstanceTextSize(Z,zt,this.transform.zoom,Zi),gs=this.collisionIndex.placeCollisionBox(g,kn,sr,B,O,Mt,new s.P(0,0),ie,D,E,W.predicate);return gs&&gs.box&&gs.box.length&&(this.markUsedOrientation(g,Vn,zt),this.placedOrientations[Qi]=Vn),gs};er(()=>mn($r,s.bL.horizontal),()=>{const sr=li.verticalTextBox;return g.allowVerticalPlacement&&cn>0&&sr?(to(sr),mn(sr,s.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Gn(!!(gi&&gi.box&&gi.box.length))}}if(Xn=gi,_i=Xn&&Xn.box&&Xn.box.length>0,Nn=Xn&&Xn.offscreen,Cn=Xn&&Xn.occluded,zt.useRuntimeCollisionCircles){const Gn=zt.centerJustifiedTextSymbolIndex>=0?zt.centerJustifiedTextSymbolIndex:zt.verticalPlacedTextSymbolIndex,er=g.text.placedSymbolArray.get(Gn),mn=s.bM(g.textSizeData,Z,er),sr=v.get("text-padding");Dn=this.collisionIndex.placeCollisionCircles(g,ie,er,Gn,g.lineVertexArray,g.glyphOffsetArray,mn,E,C,z,c,ge,W.predicate,zt.collisionCircleDiameter*mn/s.bY,sr,this.retainedQueryData[g.bucketInstanceId].tileID),_i=ie||Dn.circles.length>0&&!Dn.collisionDetected,Nn=Nn&&Dn.offscreen,Cn=Dn.occluded}if(li.iconFeatureIndex&&(gr=li.iconFeatureIndex),li.iconBox){const Gn=er=>{to(er);const mn=zt.hasIconTextFit&&Ni?cr(Ni.x,Ni.y,ce,ge,this.transform.angle):new s.P(0,0),sr=g.getSymbolInstanceIconSize(K,this.transform.zoom,zt.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(g,sr,er,B,O,xt,mn,Q,D,E,W.predicate)};En&&En.box&&En.box.length&&li.verticalIconBox?(fn=Gn(li.verticalIconBox),Ji=fn.box.length>0):(fn=Gn(li.iconBox),Ji=fn.box.length>0),Nn=Nn&&fn.offscreen,en=fn.occluded}const Ko=ne||zt.numHorizontalGlyphVertices===0&&cn===0,_s=se||zt.numIconVertices===0;if(Ko||_s?_s?Ko||(Ji=Ji&&_i):_i=Ji&&_i:Ji=_i=Ji&&_i,_i&&Xn&&Xn.box&&this.collisionIndex.insertCollisionBox(Xn.box,v.get("text-ignore-placement"),g.bucketInstanceId,En&&En.box&&Zr?Zr:yo,W.ID),Ji&&fn&&this.collisionIndex.insertCollisionBox(fn.box,v.get("icon-ignore-placement"),g.bucketInstanceId,gr,W.ID),Dn&&(_i&&this.collisionIndex.insertCollisionCircles(Dn.circles,v.get("text-ignore-placement"),g.bucketInstanceId,yo,W.ID),c)){const Gn=g.bucketInstanceId;let er=this.collisionCircleArrays[Gn];er===void 0&&(er=this.collisionCircleArrays[Gn]=new td);for(let mn=0;mn<Dn.circles.length;mn+=4)er.circles.push(Dn.circles[mn+0]),er.circles.push(Dn.circles[mn+1]),er.circles.push(Dn.circles[mn+2]),er.circles.push(Dn.collisionDetected?1:0)}const Co=g.projection.name!=="globe";
54St=St&&(Co||!Cn),Ht=Ht&&(Co||!en),this.placements[Qi]=new nn(_i||St,Ji||Ht,Nn||g.justReloaded),r.add(Qi)},Yi=this.retainedQueryData[g.bucketInstanceId].tileID;if(g.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(g,Yi),g.elevationType==="road"&&g.updateRoadElevation(Yi.canonical),g.updateZOffset(),g.sortFeaturesByY){const zt=g.getSortedSymbolIndexes(this.transform.angle);for(let Zi=zt.length-1;Zi>=0;--Zi){const li=zt[Zi];Li(g.symbolInstances.get(li),li,g.collisionArrays[li])}g.hasAnyZOffset&&s.w(`${g.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(g.hasAnyZOffset){const zt=g.getSortedIndexesByZOffset();for(let Zi=0;Zi<zt.length;++Zi){const li=zt[Zi];Li(g.symbolInstances.get(li),li,g.collisionArrays[li])}}else for(let zt=t.symbolInstanceStart;zt<t.symbolInstanceEnd;zt++)Li(g.symbolInstances.get(zt),zt,g.collisionArrays[zt]);if(c&&g.bucketInstanceId in this.collisionCircleArrays){const zt=this.collisionCircleArrays[g.bucketInstanceId];s.bl(zt.invProjMatrix,E),zt.viewportMatrix=this.collisionIndex.getViewportMatrix()}g.justReloaded=!1}markUsedJustification(t,r,c,p){const{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:g,rightJustifiedTextSymbolIndex:v,verticalPlacedTextSymbolIndex:b,crossTileID:E}=c,C=s.c3(r),z=p===s.bL.vertical?b:C==="left"?_:C==="center"?g:C==="right"?v:-1;_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=z>=0&&_!==z?0:E),g>=0&&(t.text.placedSymbolArray.get(g).crossTileID=z>=0&&g!==z?0:E),v>=0&&(t.text.placedSymbolArray.get(v).crossTileID=z>=0&&v!==z?0:E),b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=z>=0&&b!==z?0:E)}markUsedOrientation(t,r,c){const p=r===s.bL.horizontal||r===s.bL.horizontalOnly?r:0,_=r===s.bL.vertical?r:0,{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:v,rightJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:E}=c,C=t.text.placedSymbolArray;g>=0&&(C.get(g).placedOrientation=p),v>=0&&(C.get(v).placedOrientation=p),b>=0&&(C.get(b).placedOrientation=p),E>=0&&(C.get(E).placedOrientation=_)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let c=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const p=r?r.symbolFadeChange(t):1,_=r?r.opacities:{},g=r?r.variableOffsets:{},v=r?r.placedOrientations:{};for(const b in this.placements){const E=this.placements[b],C=_[b];C?(this.opacities[b]=new ea(C,p,E.text,E.icon,null,E.clipped),c=c||E.text!==C.text.placed||E.icon!==C.icon.placed):(this.opacities[b]=new ea(null,p,E.text,E.icon,E.skipFade,E.clipped),c=c||E.text||E.icon)}for(const b in _){const E=_[b];if(!this.opacities[b]){const C=new ea(E,p,!1,!1);C.isHidden()||(this.opacities[b]=C,c=c||E.text.placed||E.icon.placed)}}for(const b in g)this.variableOffsets[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.variableOffsets[b]=g[b]);for(const b in v)this.placedOrientations[b]||!this.opacities[b]||this.opacities[b].isHidden()||(this.placedOrientations[b]=v[b]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:t)}updateLayerOpacities(t,r,c,p){p&&(this.lastReplacementSourceUpdateTime=p.updateTime);const _=new Set;for(const g of r){const v=g.getBucket(t);v&&g.latestFeatureIndex&&t.fqid===v.layerIds[0]&&(this.updateBucketOpacities(v,_,g,g.collisionBoxArray,c,p,g.tileID,t.scope),v.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(v,g.tileID),v.elevationType==="road"&&v.updateRoadElevation(g.tileID.canonical),v.updateZOffset())}}updateBucketOpacities(t,r,c,p,_,g,v,b){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const E=t.layers[0].layout,C=t.layers[0].paint,z=!!t.layers[0].dynamicFilter(),R=new ea(null,0,!1,!1,!0),D=E.get("text-allow-overlap"),B=E.get("icon-allow-overlap"),O=E.get("text-variable-anchor"),G=E.get("text-rotation-alignment")==="map",U=E.get("text-pitch-alignment")==="map",Z=C.get("symbol-z-offset"),K=E.get("symbol-elevation-reference")==="sea",W=!
vendor: 5,735 bytes, line 54
54Z.isConstant(),le=new ea(null,0,D&&(B||!t.hasIconData()||E.get("icon-optional")),B&&(D||!t.hasTextData()||E.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);const ne=(ie,Q,ce)=>{for(let ve=0;ve<Q/4;ve++)ie.opacityVertexArray.emplaceBack(ce)};let se=0;g&&t.updateReplacement(v,g);for(let ie=0;ie<t.symbolInstances.length;ie++){const Q=t.symbolInstances.get(ie),{numHorizontalGlyphVertices:ce,numVerticalGlyphVertices:ve,crossTileID:ge,numIconVertices:Le,tileAnchorX:ze,tileAnchorY:je}=Q;let nt=null;const Ae=this.retainedQueryData[t.bucketInstanceId];W&&Q&&Ae&&(nt=c.latestFeatureIndex.loadFeature({featureIndex:Q.featureIndex,bucketIndex:Ae.bucketIndex,sourceLayerIndex:Ae.sourceLayerIndex,layoutVertexArrayOffset:0}));const fe=Z.evaluate(nt,{}),Oe=r.has(ge);let Me=this.opacities[ge];Oe?Me=R:Me||(Me=le,this.opacities[ge]=Me),r.add(ge);const Ze=ce>0||ve>0,ft=Le>0,bt=this.placedOrientations[ge],ut=bt===s.bL.vertical,rt=bt===s.bL.horizontal||bt===s.bL.horizontalOnly;!Ze&&!ft||Me.isHidden()||se++;let Lt=!1;if((Ze||ft)&&g)for(const Mt of t.activeReplacements){if(s.bZ(Mt,_,s.b_.Symbol,b)||Mt.min.x>ze||ze>Mt.max.x||Mt.min.y>je||je>Mt.max.y)continue;const xt=s.b$(ze,je,v.canonical,Mt.footprintTileId.canonical);if(Lt=s.c0(xt,Mt.footprint),Lt)break}if(Ze){const Mt=Lt?jl:fo(Me.text);ne(t.text,ce,ut?jl:Mt),ne(t.text,ve,rt?jl:Mt);const xt=Me.text.isHidden(),{leftJustifiedTextSymbolIndex:St,centerJustifiedTextSymbolIndex:Ht,rightJustifiedTextSymbolIndex:ci,verticalPlacedTextSymbolIndex:Li}=Q,Yi=t.text.placedSymbolArray,zt=xt||ut?1:0;St>=0&&(Yi.get(St).hidden=zt),Ht>=0&&(Yi.get(Ht).hidden=zt),ci>=0&&(Yi.get(ci).hidden=zt),Li>=0&&(Yi.get(Li).hidden=xt||rt?1:0);const Zi=this.variableOffsets[ge];Zi&&this.markUsedJustification(t,Zi.anchor,Q,bt);const li=this.placedOrientations[ge];li&&(this.markUsedJustification(t,"left",Q,li),this.markUsedOrientation(t,li,Q))}if(ft){const Mt=Lt?jl:fo(Me.icon),{placedIconSymbolIndex:xt,verticalPlacedIconSymbolIndex:St}=Q,Ht=t.icon.placedSymbolArray,ci=Me.icon.isHidden()?1:0;xt>=0&&(ne(t.icon,Le,ut?jl:Mt),Ht.get(xt).hidden=ci),St>=0&&(ne(t.icon,Q.numVerticalIconVertices,rt?jl:Mt),Ht.get(St).hidden=ci)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Mt=t.collisionArrays[ie];if(Mt){let xt=new s.P(0,0),St=!0;if(Mt.textBox||Mt.verticalTextBox){if(O){const ci=this.variableOffsets[ge];ci?(xt=Jr(ci.anchor,ci.width,ci.height,ci.textOffset,ci.textScale),G&&xt._rotate(U?this.transform.angle:-this.transform.angle)):St=!1}z&&(St=!Me.clipped),Mt.textBox&&nl(t.textCollisionBox.collisionVertexArray,Me.text.placed,!St||ut,fe,K,xt.x,xt.y),Mt.verticalTextBox&&nl(t.textCollisionBox.collisionVertexArray,Me.text.placed,!St||rt,fe,K,xt.x,xt.y)}const Ht=St&&!!(!rt&&Mt.verticalIconBox);Mt.iconBox&&nl(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,Ht,fe,K,Q.hasIconTextFit?xt.x:0,Q.hasIconTextFit?xt.y:0),Mt.verticalIconBox&&nl(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,!Ht,fe,K,Q.hasIconTextFit?xt.x:0,Q.hasIconTextFit?xt.y:0)}}}if(t.fullyClipped=se===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const ie=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=ie.invProjMatrix,t.placementViewportMatrix=ie.viewportMatrix,t.collisionCircleArray=ie.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,r){const c=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*c>t}isStale(){return this.stale}setStale(){this.stale=!0}}function nl(l,t,r,c,p,_,g){l.emplaceBack(t?1:0,r?1:0,_||0,g||0,c,p?1:0),l.emplaceBack(t?1:0,r?1:0,_||0,g||0,c,p?1:0),l.emplaceBack(t?1:0,r?1:0,_||0,g||0,c,p?1:0),l.emplaceBack(t?1:0,r?1:0,_||0,g||0,c,p?1:0)}const Mf=Math.pow(2,25),zu=Math.pow(2,24),id=Math.pow(2,17),Pf=Math.pow(2,16),nd=Math.pow(2,9),po=Math.pow(2,8),Ea=Math.pow(2,1);function fo(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,r=Math.floor(127*l.opacity);return r*Mf+t*zu+r*id+t*Pf+r*nd+t*po+r*Ea+t}const jl=0;class Mc{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,r,c,p,_,g){const v=this._bucketParts;for(;this._currentTileIndex<t.length;)if(r.getBucketParts(v,p,t[this._currentTileIndex],this._sortAcrossTiles,g),this._currentTileIndex++,_())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((b,E)=>b.sortKey-E.sortKey));this._currentPartIndex<v.length;){const b=v[this._currentPartIndex];
vendor: 4,987 bytes, line 54
54if(r.placeLayerBucketPart(b,this._seenCrossTileIDs,c,b.symbolInstanceStart===0,g),this._currentPartIndex++,_())return!0}return!1}}class Pr{constructor(t,r,c,p,_,g,v,b,E){this.placement=new qx(t,_,g,v,b,E),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,r,c,p,_){const g=s.o.now(),v=()=>{const b=s.o.now()-g;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const b=r[t[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(b.type==="symbol"&&b.visibility!=="none"&&(!b.minzoom||b.minzoom<=E)&&(!b.maxzoom||b.maxzoom>E)){const C=b,z=C.layout.get("symbol-z-elevate"),R=C.layout.get("symbol-sort-key").constantOr(1)!==void 0,D=C.layout.get("symbol-z-order"),B=D==="viewport-y"||D==="auto"&&!(D!=="viewport-y"&&R),O=C.layout.get("text-allow-overlap")||C.layout.get("icon-allow-overlap")||C.layout.get("text-ignore-placement")||C.layout.get("icon-ignore-placement"),G=B&&O,U=this._inProgressLayer=this._inProgressLayer||new Mc(C),Z=s.B(b.source,b.scope);if(U.continuePlacement(z||G?p[Z]:c[Z],this.placement,this._showCollisionBoxes,b,v,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const us=512/s.al/2;class Ia{constructor(t,r,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c4(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const p=t.canonical.x*s.al,_=t.canonical.y*s.al;for(let g=0;g<r.length;g++){const{key:v,crossTileID:b,tileAnchorX:E,tileAnchorY:C}=r.get(g),z=Math.floor((p+E)*us),R=Math.floor((_+C)*us);this.index.add(z,R),this.keys.push(v),this.crossTileIDs.push(b)}this.index.finish()}findMatches(t,r,c){const p=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),_=us/Math.pow(2,r.canonical.z-this.tileID.canonical.z),g=r.canonical.x*s.al,v=r.canonical.y*s.al;for(let b=0;b<t.length;b++){const E=t.get(b);if(E.crossTileID)continue;const{key:C,tileAnchorX:z,tileAnchorY:R}=E,D=Math.floor((g+z)*_),B=Math.floor((v+R)*_),O=this.index.range(D-p,B-p,D+p,B+p).sort((G,U)=>G-U);for(const G of O){const U=this.crossTileIDs[G];if(this.keys[G]===C&&!c.has(U)){c.add(U),E.crossTileID=U;break}}}}}class Sr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Rf{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const r=Math.round((t-this.lng)/360);if(r!==0)for(const c in this.indexes){const p=this.indexes[c],_={};for(const g in p){const v=p[g];v.tileID=v.tileID.unwrapTo(v.tileID.wrap+r),_[v.tileID.key]=v}this.indexes[c]=_}this.lng=t}addBucket(t,r,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let _=0;_<r.symbolInstances.length;_++)r.symbolInstances.get(_).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const p=this.usedCrossTileIDs[t.overscaledZ];for(const _ in this.indexes){const g=this.indexes[_];if(Number(_)>t.overscaledZ)for(const v in g){const b=g[v];b.tileID.isChildOf(t)&&b.findMatches(r.symbolInstances,t,p)}else{const v=g[t.scaledTo(Number(_)).key];v&&v.findMatches(r.symbolInstances,t,p)}}for(let _=0;_<r.symbolInstances.length;_++){const g=r.symbolInstances.get(_);g.crossTileID||(g.crossTileID=c.generate(),p.add(g.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ia(t,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(t,r){for(const c of r.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let r=!1;for(const c in this.indexes){const p=this.indexes[c];for(const _ in p)t[p[_].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,p[_]),delete p[_],r=!0)}return r}}class Ps{constructor(){this.layerIndexes={},this.crossTileIDs=new Sr,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,r,c,p){let _=this.layerIndexes[t.fqid];_===void 0&&(_=this.layerIndexes[t.fqid]=new Rf);let g=!1;const v={};p.name!=="globe"&&_.handleWrapJump(c);for(const b of r){const E=b.getBucket(t);E&&t.fqid===E.layerIds[0]&&(E.bucketInstanceId||(E.bucketInstanceId=++this.maxBucketInstanceId),_.addBucket(b.tileID,E,this.crossTileIDs)&&(g=!0),v[E.bucketInstanceId]=!0)}return _.removeStaleBuckets(v)&&(g=!0),g}pruneUnusedLayers(t){const r={};t.forEach(c=>{r[c]=!0});for(const c in this.layerIndexes)r[c]||delete this.layerIndexes[c]}}const ta=771;class fi{constructor(t,r,c,p){this.blendFunction=t,this.blendColor=r.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=p}}fi.Replace=[1,0,1,0],fi.disabled=new fi(fi.Replace,s.ao.transparent,[!1,!1,!1,!1]),fi.unblended=new fi(fi.Replace,s.ao.transparent,[!0,!0,!0,!0]),fi.alph
54aBlended=new fi([1,ta,1,ta],s.ao.transparent,[!0,!0,!0,!0]),fi.alphaBlendedNonPremultiplied=new fi([770,ta,770,ta],s.ao.transparent,[!0,!0,!0,!0]),fi.multiply=new fi([774,0,774,0],s.ao.transparent,[!0,!0,!0,!0]),fi.additive=new fi([1,1,1,1],s.ao.transparent,[!0,!0,!0,!0]);class kt{constructor(t,r,c){this.func=t,this.mask=r,this.range=c}}kt.ReadOnly=!1,kt.ReadWrite=!0,kt.disabled=new kt(519,kt.ReadOnly,[0,1]);const rd=7680;class ii{constructor(t,r,c,p,_,g){this.test=t,this.ref=r,this.mask=c,this.fail=p,this.depthFail=_,this.pass=g}}ii.disabled=new ii({func:519,mask:0},0,0,rd,rd,rd);const Pc=1029,od=2305;class ei{constructor(t,r,c){this.enable=t,this.mode=r,this.frontFace=c}}function ia(l,t){const r=s.ca(l,3);s.cc(l,t),s.cg(l,3,r)}function Lf(l,t){const r=s.c7([]);return s.c8(r,r,-t),s.c9(r,r,-l),r}function sd(l,t){const r=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ag(r)>=1e-15){const g=s.aw([],r);s.c5(c,g,s.bJ(c,g)),t[0]=c[0],t[1]=c[1]}const p=s.bI([],t,l);if(s.c6(p)<1e-15)return null;const _=Math.atan2(-p[1],p[0]);return Lf(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),_)}ei.disabled=new ei(!1,Pc,od),ei.backCCW=new ei(!0,Pc,od),ei.backCW=new ei(!0,Pc,2304),ei.frontCW=new ei(!0,1028,2304),ei.frontCCW=new ei(!0,1028,od);class mo{constructor(t,r){this.position=t,this.orientation=r}get position(){return this._position}set position(t){if(t){const r=t instanceof s.ae?t:new s.ae(t[0],t[1],t[2]);
vendor: 4,352 bytes, line 54
54this._renderWorldCopies&&(r.x=s.bT(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(t,r,c){if(this.orientation=null,!this.position)return;const p=this.position,_=c||(this._elevation?this._elevation.getAtPointOrZero(s.ae.fromLngLat(t)):0),g=s.ae.fromLngLat(t,_),v=[g.x-p.x,g.y-p.y,g.z-p.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=sd(v,r)}setPitchBearing(t,r){this.orientation=Lf(s.an(t),s.an(-r))}}class ad{constructor(t,r){this._transform=s.bA([]),this.orientation=r,this.position=t}get mercatorPosition(){const t=this.position;return new s.ae(t[0],t[1],t[2])}get position(){const t=s.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var r;t&&s.cg(this._transform,3,[(r=t)[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c7([]),t&&ia(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,r){this._orientation=Lf(t,r),ia(this._transform,this._orientation)}forward(){const t=s.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,r){const c=new Float64Array(16);return s.bl(c,this.getWorldToCamera(t,r)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,r,c){const p=this.position;s.c5(p,p,-t);const _=new Float64Array(16);return s.bq(_,[c,c,c]),s.br(_,_,p),_[10]*=r,_}getWorldToCamera(t,r){const c=new Float64Array(16),p=new Float64Array(4),_=this.position;return s.cb(p,this._orientation),s.c5(_,_,-t),s.cc(c,p),s.br(c,c,_),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=r,c[9]*=r,c[10]*=r,c[11]*=r,c}getCameraToClipPerspective(t,r,c,p){const _=new Float64Array(16);return s.cd(_,t,r,c,p),_}getCameraToClipOrthographic(t,r,c,p,_,g){const v=new Float64Array(16);return s.ce(v,t,r,c,p,_,g),v}getDistanceToElevation(t,r=!1){const c=t===0?0:s.cf(t,r?s.a$(this.position[1]):this.position[1]),p=this.forward();return(c-this.position[2])/p[2]}clone(){return new ad([...this.position],[...this.orientation])}}const Br={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class ld{constructor(t=0,r=0,c=0,p=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(c)||c<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=c,this.right=p}interpolate(t,r,c){return r.top!=null&&t.top!=null&&(this.top=s.ak(t.top,r.top,c)),r.bottom!=null&&t.bottom!=null&&(this.bottom=s.ak(t.bottom,r.bottom,c)),r.left!=null&&t.left!=null&&(this.left=s.ak(t.left,r.left,c)),r.right!=null&&t.right!=null&&(this.right=s.ak(t.right,r.right,c)),this}getCenter(t,r){const c=s.aA((this.left+t-this.right)/2,0,t),p=s.aA((this.top+r-this.bottom)/2,0,r);return new s.P(c,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ld(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Rs=15;class zf{constructor(t,r,c,p,_,g,v){this.tileSize=512,this._renderWorldCopies=_===void 0||_,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=c??0,this._maxPitch=p??60,this.setProjection(g),this.setMaxBounds(v),this.width=0,this.height=0,this._center=new s.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new ld,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new ad,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new zf(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
54xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Rs}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,r=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
54xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return s.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const r=this.projection?this.getProjection():void 0;this.projection=s.cm(this.projectionOptions);const c=this.getProjection(),p=!s.by(r,c);return p&&this._calcMatrices(),this.mercatorFromTransition=!1,p}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cm({name:"mercator"});const r=t!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bT(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const r=-t*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=s.cn(),s.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const r=s.aA(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=s.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const r=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,r=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
540&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!r||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;r||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let p=0,_=0;for(let g=0;g<r.length;g++){const v=new s.P(r[g][0]*this.width,c+r[g][1]*(this.height-c)),b=t.pointCoordinate(v);if(!b)continue;const E=1/Math.hypot(b[0]-this._camera.position[0],b[1]-this._camera.position[1]);p+=b[3]*E,_+=E}return _===0?NaN:p/_}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*r,p=this._mercatorZfromZoom(t),_=this._mercatorZfromZoom(this._maxZoom),g=Math.max(p-c,_);this._setZoom(this._zoomFromMercatorZ(g))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}equals(t){const r=this.elevation,c=t.elevation,p=r!=null!=(c!=null)||r&&c&&r.exaggeration()!==c.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!p}computeZoomRelativeTo(t){const r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[r.x,r.y,r.z]:[t.x,t.y,t.z];const p=s.ag(s.av([],this._camera.position,c));return s.aA(this._zoomFromMercatorZ(p),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let r=!1;if(t.orientation&&!s.cp(t.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cq(c,this._camera.position)||(this._setCameraPosition(c),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,r=new mo;return r.position=new s.ae(t[0],t[1],t[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(t){if(!s.cr(t))return!1;s.cs(t,t);const r=s.ct([],[0,0,-1],t),c=s.ct([],[0,-1,0],t);if(c[2]<0)return!1;const p=sd(r,c);return!!p&&(this._camera.orientation=p,!0)}_setCameraPosition(t){const r=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,p=this.cameraToCenterDistance;t[2]=s.aA(t[2],p/c,p/r),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,r,c){this._unmodified=!1,this._edgeInsets.interpolate(t,r,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const r=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,r)}getVisibleUnwrappedCoordinates(t){const r=[new s.cu(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),p=this.pointCoordinate(new s.P(this.width,0)),_=this.pointCoordinate(new s.P(this.width,this.height)),g=this.pointCoordinate(new s.P(0,this.height)),v=Math.floor(Math.min(c.x,p.x,_.x,g.x)),b=Math.floor(Math.max(c.x,p.x,_.x,g.x)),E=1;for(let C=v-E;C<=b+E;C++)C!==0&&r.push(new s.cu(C,t))}return r}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,r,c,p){let _=[];const g=c!=null,v=!g;if(v&&this.zoom<r||g&&c[0]===0&&c[1]===0)return _;const b=new Set,E=(z,R,D,B,O)=>{const G=s.cY(R,z,D,B,O);b.has(G)||(_.push(new s.aQ(z,R,D,B,O)),b.add(G))};for(let z=0;z<t.length;z++){const R=t[z];if(v&&R.canonical.z!==r||g&&p!==void 0&&p>
54R.canonical.z)continue;const D=R.canonical,B=R.overscaledZ,O=R.wrap,G=1<<D.z,U=D.x+1<G,Z=D.x>0,K=D.y+1<G,W=D.y>0,le=R.wrap-(Z?0:1),ne=R.wrap+(U?0:1),se=Z?D.x-1:G-1,ie=U?D.x+1:0;if(g)c[0]<0?(E(B,ne,D.z,ie,D.y),c[1]<0&&K&&(E(B,O,D.z,D.x,D.y+1),E(B,ne,D.z,ie,D.y+1)),c[1]>0&&W&&(E(B,O,D.z,D.x,D.y-1),E(B,ne,D.z,ie,D.y-1))):c[0]>0?(E(B,le,D.z,se,D.y),c[1]<0&&K&&(E(B,O,D.z,D.x,D.y+1),E(B,le,D.z,se,D.y+1)),c[1]>0&&W&&(E(B,O,D.z,D.x,D.y-1),E(B,le,D.z,se,D.y-1))):c[1]<0&&K?E(B,O,D.z,D.x,D.y+1):W&&E(B,O,D.z,D.x,D.y-1);else{const Q=R.visibleQuadrants;1&Q&&(E(B,le,D.z,se,D.y),W&&(E(B,O,D.z,D.x,D.y-1),E(B,le,D.z,se,D.y-1))),2&Q&&(E(B,ne,D.z,ie,D.y),W&&(E(B,O,D.z,D.x,D.y-1),E(B,ne,D.z,ie,D.y-1))),4&Q&&(E(B,le,D.z,se,D.y),K&&(E(B,O,D.z,D.x,D.y+1),E(B,le,D.z,se,D.y+1))),8&Q&&(E(B,ne,D.z,ie,D.y),K&&(E(B,O,D.z,D.x,D.y+1),E(B,ne,D.z,ie,D.y+1)))}}const C=[];for(const z of _)_.some(R=>z.isChildOf(R))||C.push(z);if(_=C.filter(z=>!t.some(R=>!!(z.overscaledZ<r&&R.isChildOf(z))||z.equals(R)||z.isChildOf(R))),v){const z=1<<r,R=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),D=[z*R.x,z*R.y],B=4,O=B*B;_=_.filter(G=>{const U=G.canonical.x+.5-D[0],Z=G.canonical.y+.5-D[1];return U*U+Z*Z<O})}return _}extendTileCoverToNearPlane(t,r,c){const p=[],_=new Set;for(const Z of t)_.add(Z.key);const g=(Z,K,W,le,ne)=>{const se=s.cY(K,Z,W,le,ne);_.has(se)||(p.push(new s.aQ(Z,K,W,le,ne)),_.add(se))},v=t.reduce((Z,K)=>Math.max(Z,K.overscaledZ),c),b=1<<c,E=[new s.P(0,0),new s.P(s.al,0),new s.P(s.al,s.al),new s.P(0,s.al)],C=new s.P(0,0),z=new s.P(0,0),R=(Z,K)=>{const W=Math.floor(Z[0]),le=Math.floor(Z[1]),ne=(Z[0]-W)*s.al,se=(Z[1]-le)*s.al,ie=Math.floor(K[0]),Q=Math.floor(K[1]),ce=(K[0]-ie)*s.al,ve=(K[1]-Q)*s.al;for(let ge=-1;ge<=1;ge++){const Le=W+ge;if(!(Le<0||Le>=b)){C.x=ne-ge*s.al,z.x=ce-(Le-ie)*s.al;for(let ze=-1;ze<=1;ze++){const je=le+ze;C.y=se-ze*s.al,z.y=ve-(je-Q)*s.al,s.cZ(C,z,E)&&g(v,0,c,Le,je)}}}},D=r.points,B=D[s.cv],O=D[s.cw],G=this._projectToGround(B,D[s.cx]),U=this._projectToGround(O,D[s.cy]);return R(B,G),R(O,U),p}_projectToGround(t,r){return s.cz(s.cA(),t,r,t[2]/(t[2]-r[2]))}coveringTiles(t){let r=this.coveringZoomLevel(t);const c=r,p=this.elevation&&this.elevation.exaggeration(),_=p&&!t.isTerrainDEM,g=this.projection.name==="mercator";if(t.minzoom!==void 0&&r<t.minzoom)return[];t.maxzoom!==void 0&&r>t.maxzoom&&(r=t.maxzoom);const v=this.locationCoordinate(this.center),b=this.center.lat,E=1<<r,C=[E*v.x,E*v.y,0],z=this.projection.name==="globe",R=!z,D=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,R),B=z?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),O=E*s.cf(1,this.center.lat),G=this._camera.position[2]/s.cf(1,this.center.lat),U=[E*B.x,E*B.y,G*(R?1:O)],Z=z||p,K=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),W=this.isLODDisabled(!0)?r:0;let le;if(this._elevation&&t.isTerrainDEM)le=1e4*this._elevation.exaggeration();else if(this._elevation){const fe=this._elevation.getMinMaxForVisibleTiles();le=fe?fe.max:this._centerAltitude}else le=this._centerAltitude;const ne=t.isTerrainDEM?-le:this._elevation?this._elevation.getMinElevationBelowMSL():0,se=this.projection.isReprojectedInTileSpace?s.cC(this):1,ie=fe=>{const Me=new s.ae(fe.x+25e-6,fe.y,fe.z),Ze=new s.ae(fe.x,fe.y+25e-6,fe.z),ft=fe.toLngLat(),bt=Me.toLngLat(),ut=Ze.toLngLat(),rt=this.locationCoordinate(ft),Lt=this.locationCoordinate(bt),Mt=this.locationCoordinate(ut),xt=Math.hypot(Lt.x-rt.x,Lt.y-rt.y),St=Math.hypot(Mt.x-rt.x,Mt.y-rt.y);return Math.sqrt(xt*St)*se/25e-6},Q=fe=>{const Oe=le,Me=ne;return{aabb:s.cF(this,E,0,0,0,fe,Me,Oe,this.projection),zoom:0,x:0,y:0,minZ:Me,maxZ:Oe,wrap:fe,fullyVisible:!1}},ce=[];let ve=[];const ge=r,Le=t.reparseOverscaled?c:r,ze=(G-this._centerAltitude)*O,je=fe=>{if(!this._elevation||!fe.tileID||!g)return;const Oe=this._elevation.getMinMaxForTile(fe.tileID),Me=fe.aabb;Oe?(Me.min[2]=Oe.min,Me.max[2]=Oe.max,Me.center[2]=(Me.min[2]+Me.max[2])/2):(fe.shouldSplit=Ae(fe),fe.shouldSplit||(Me.min[2]=Me.max[2]=Me.center[2]=this._centerAltitude))},nt=(fe,Oe)=>{if(.707*Oe<fe)return 1;const Me=Oe/fe;return Me/(1.4144271570014144+(Math.pow(1.1,Me-1.4144271570014144+1)-1)/(1.1-1)-1)},Ae=fe=>{if(fe.zoom<W)return!0;
54if(fe.zoom===ge)return!1;if(fe.shouldSplit!=null)return fe.shouldSplit;const Oe=fe.aabb.distanceX(U),Me=fe.aabb.distanceY(U);let Ze=ze,ft=1;if(z){Ze=fe.aabb.distanceZ(U);const St=Math.pow(2,fe.zoom),Ht=s.a$((fe.y+1)/St),ci=s.a$(fe.y/St),Li=Math.min(Math.max(b,Ht),ci),Yi=s.d1(Li)/s.d1(b);if(ft=Li===b?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Yi/this._mercatorScaleRatio),this.zoom<=s.c_&&fe.zoom===ge-1&&Yi>=.9)return!0}else if(_&&(Ze=fe.aabb.distanceZ(U)*O),this.projection.isReprojectedInTileSpace&&c<=5){const St=Math.pow(2,fe.zoom),Ht=ie(new s.ae((fe.x+.5)/St,(fe.y+.5)/St));ft=Ht>.85?1:Ht}if(!g&&!z){const St=Math.sqrt(Oe*Oe+Me*Me+Ze*Ze);let Ht=(1<<ge-fe.zoom)*K*ft;return Ht*=nt(Math.max(Ze,ze),St),St<Ht}let bt=Number.MAX_VALUE,ut=0;const rt=fe.aabb.getCorners(),Lt=[];for(const St of rt){s.av(Lt,St,U),z||(_?Lt[2]*=O:Lt[2]=ze);const Ht=s.bJ(Lt,this._camera.forward());Ht<bt&&(bt=Ht,ut=Math.abs(Lt[2]))}let Mt=(1<<ge-fe.zoom)*K*ft;if(Mt*=nt(Math.max(ut,ze),bt),bt<Mt)return!0;const xt=fe.aabb.closestPoint(C);return xt[0]===C[0]&&xt[1]===C[1]};if(this.renderWorldCopies)for(let fe=1;fe<=3;fe++)ce.push(Q(-fe)),ce.push(Q(fe));for(ce.push(Q(0));ce.length>0;){const fe=ce.pop(),Oe=fe.x,Me=fe.y;let Ze=fe.fullyVisible;const ft=()=>this.projection.name==="globe"&&(fe.y===0||fe.y===(1<<fe.zoom)-1);if(!Ze){let bt=Z?fe.aabb.intersects(D):fe.aabb.intersectsFlat(D);if(bt===0&&ft()){const ut=new s.cD(fe.zoom,Oe,Me);bt=s.cE(this,E,ut,!0).intersects(D)}if(bt===0)continue;Ze=bt===2}if(fe.zoom!==ge&&Ae(fe))for(let bt=0;bt<4;bt++){const ut=(Oe<<1)+bt%2,rt=(Me<<1)+(bt>>1),Lt={aabb:g?fe.aabb.quadrant(bt):s.cF(this,E,fe.zoom+1,ut,rt,fe.wrap,fe.minZ,fe.maxZ,this.projection),zoom:fe.zoom+1,x:ut,y:rt,wrap:fe.wrap,fullyVisible:Ze,tileID:void 0,shouldSplit:void 0,minZ:fe.minZ,maxZ:fe.maxZ};_&&!z&&(Lt.tileID=new s.aQ(fe.zoom+1===ge?Le:fe.zoom+1,fe.wrap,fe.zoom+1,ut,rt),je(Lt)),ce.push(Lt)}else{const bt=fe.zoom===ge?Le:fe.zoom;if(t.minzoom&&t.minzoom>bt)continue;let ut=0;if(!Ze){let xt=Z?fe.aabb.intersectsPrecise(D):fe.aabb.intersectsPreciseFlat(D);if(xt===0&&ft()){const St=new s.cD(fe.zoom,Oe,Me);xt=s.cE(this,E,St,!0).intersectsPrecise(D)}if(xt===0)continue;if(t.calculateQuadrantVisibility)if(D.containsPoint(fe.aabb.center))ut=15;else for(let St=0;St<4;St++)fe.aabb.quadrant(St).intersects(D)!==0&&(ut|=1<<St)}const rt=C[0]-(.5+Oe+(fe.wrap<<fe.zoom))*(1<<r-fe.zoom),Lt=C[1]-.5-Me,Mt=fe.tileID?fe.tileID:new s.aQ(bt,fe.wrap,fe.zoom,Oe,Me);t.calculateQuadrantVisibility&&(Mt.visibleQuadrants=ut),ve.push({tileID:Mt,distanceSq:rt*rt+Lt*Lt})}}if(this.fogCullDistSq){const fe=this.fogCullDistSq,Oe=this.horizonLineFromTop();ve=ve.filter(Me=>{const Ze=[0,0,0,1],ft=[s.al,s.al,0,1],bt=this.calculateFogTileMatrix(Me.tileID.toUnwrapped());s.aC(Ze,Ze,bt),s.aC(ft,ft,bt);const ut=s.cG([],Ze,ft),rt=s.cH([],Ze,ft),Lt=s.c$(ut,rt);if(Lt===0)return!0;let Mt=!1;const xt=this._elevation;if(xt&&Lt>fe&&Oe!==0){const St=this.calculateProjMatrix(Me.tileID.toUnwrapped());let Ht;t.isTerrainDEM||(Ht=xt.getMinMaxForTile(Me.tileID)),Ht||(Ht={min:ne,max:le});const ci=s.cI(this.rotation),Li=[ci[0]*s.al,ci[1]*s.al,Ht.max];s.af(Li,Li,St),Mt=(1-Li[1])*this.height*.5<Oe}return Lt<fe||Mt})}return ve.sort((fe,Oe)=>fe.distanceSq-Oe.distanceSq).map(fe=>fe.tileID)}resize(t,r){this.width=t,this.height=r,this.pixelsToGLUnits=[2/t,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log2(t)}project(t){const r=s.aA(t.lat,-s.cJ,s.cJ),c=this.projection.project(t.lng,r);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,r){let c,p;const _=this.centerPoint;if(this.projection.name==="globe"){const v=this.worldSize;c=(r.x-_.x)/v,p=(r.y-_.y)/v}else{const v=this.pointCoordinate(r),b=this.pointCoordinate(_);c=v.x-b.x,p=v.y-b.y}const g=this.locationCoordinate(t);this.setLocation(new s.ae(g.x-c,g.y-p))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,r){return this.projection.locationPoint(this,t,r)}locationPoint3D(t,r){return this.projection.locationPoint(this,t,r,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,r){return this.coordinateLocation(this.pointCoordinate3D(t,r))}locationCoordinate(t,r){const c=r?s.cf(r,t.lat):void 0,p=this.projection.project(t.lng,t.lat);return new s.ae(p.x,p.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,r){const c=r??this._centerAltitude,p=[t.x,t.y,0,1],_=[t.x,t.y,1,1];s.aC(p,p,this.pixelMatrixInverse),s.aC(_,_,this.pixelMatrixInverse);const g=_[3];s.cK(p,p,1/p[3]),s.cK(_,_,1/g);const v=p[2],b=_[2];return{p0:p,p1:_,t:v===b?0:(c-v)/(b-v)}}screenPointToMercatorRay(t){const r=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aC(r,r,this.pixelMatrixInverse),s.aC(c,c,this.pixelMatrixInverse),s.cK(r,r,1/r[3]),s.cK(c,c,1/c[3]),r[2]=s.cf(r[2],this._center.lat)*this.worldSize,c[2]=s.cf(c[2],this._center.lat)*this.worldSize,s.cK(r,r,1/this.worldSize),s.cK(c,c,1/this.worldSize),new s.ax([r[0],r[1],r[2]],s.aw([],s.av([],c,r)))}rayIntersectionCoordinate(t){const{p0:r,p1:c,t:p}=t,_=s.cf(r[2],this._center.lat),g=s.cf(c[2],this._center.lat);return new s.ae(s.ak(r[0],c[0],p)/this.worldSize,s.ak(r[1],c[1],p)/this.worldSize,s.ak(_,g,p))}pointCoordinate(t,r=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,r)}pointCoordinate3D(t,r){if(!this.elevation)return this.pointCoordinate(t,r);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new s.ae(c[0],c[1],c[2]);let p=0,_=this.horizonLineFromTop();if(t.y>_)return this.pointCoordinate(t,r);const g=.02*_,v=t.clone();for(let b=0;b<10&&_-p>g;b++){v.y=s.ak(p,_,.66);const E=this.projection.pointCoordinate3D(this,v.x,v.y);E?(_=v.y,c=E):p=v.y}return c?new s.ae(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cL)return!this.isPointAboveHorizon(t);const r=this.pointCoordinate(t);return r.y>=0&&r.y<=1}_coordinatePoint(t,r){const c=r&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,p=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return s.aC(p,p,this.pixelMatrix),p[3]>0?new s.P(p[0]/p[3],p[1]/p[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:r}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,p=this.width-this._edgeInsets.right,_=this.pointLocation3D(new s.P(r,t)),g=this.pointLocation3D(new s.P(p,t)),v=this.pointLocation3D(new s.P(p,c)),b=this.pointLocation3D(new s.P(r,c));let E=Math.min(_.lng,g.lng,v.lng,b.lng),C=Math.max(_.lng,g.lng,v.lng,b.lng),z=Math.min(_.lat,g.lat,v.lat,b.lat),R=Math.max(_.lat,g.lat,v.lat,b.lat);const D=Math.pow(2,-this.zoom)/16*270,B=this.projection.name==="globe"?1:4,O=(G,U,Z,K,W)=>{const le=(G+Z)/2,ne=(U+K)/2,se=new s.P(le,ne),{lng:ie,lat:Q}=this.pointLocation3D(se),ce=Math.max(0,E-ie,z-Q,ie-C,Q-R);E=Math.min(E,ie),C=Math.max(C,ie),z=Math.min(z,Q),R=Math.max(R,Q),(W<B||ce>D)&&(O(G,U,le,ne,W+1),O(le,ne,Z,K,W+1))};if(O(r,t,p,t,1),O(p,t,p,c,1),O(p,c,r,c,1),O(r,c,r,t,1),this.projection.name==="globe"){const[G,U]=s.cM(this);
54G?(R=90,C=180,E=-180):U&&(z=-90,C=180,E=-180)}return new s.aI(new s.aT(E,z),new s.aT(C,R))}_getBoundsRectangular(t,r){const{top:c,left:p}=this._edgeInsets,_=this.height-this._edgeInsets.bottom,g=this.width-this._edgeInsets.right,v=new s.P(p,c),b=new s.P(g,c),E=new s.P(g,_),C=new s.P(p,_);let z=this.pointCoordinate(v,t),R=this.pointCoordinate(b,t);const D=this.pointCoordinate(E,r),B=this.pointCoordinate(C,r),O=(G,U)=>(U.y-G.y)/(U.x-G.x);return z.y>1&&R.y>=0?z=new s.ae((1-B.y)/O(B,z)+B.x,1):z.y<0&&R.y<=1&&(z=new s.ae(-B.y/O(B,z)+B.x,0)),R.y>1&&z.y>=0?R=new s.ae((1-D.y)/O(D,R)+D.x,1):R.y<0&&z.y<=1&&(R=new s.ae(-D.y/O(D,R)+D.x,0)),new s.aI().extend(this.coordinateLocation(z)).extend(this.coordinateLocation(R)).extend(this.coordinateLocation(B)).extend(this.coordinateLocation(D))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const r=t.visibleDemTiles.reduce((c,p)=>{if(p.dem){const _=p.dem.tree;c.min=Math.min(c.min,_.minimums[0]),c.max=Math.max(c.max,_.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*t.exaggeration(),r.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-r*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-s.cJ,this.maxLat=s.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aF(this.minLng)*this.tileSize,this.worldMaxX=s.aF(this.maxLng)*this.tileSize,this.worldMinY=s.aJ(this.maxLat)*this.tileSize,this.worldMaxY=s.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,r){return this.projection.createTileMatrix(this,r,t)}calculateDistanceTileData(t){const r=t.key,c=this._distanceTileDataCache;if(c[r])return c[r];const p=t.canonical,_=1/this.height,g=this.cameraWorldSize,v=g/this.zoomScale(p.z),b=(p.x+Math.pow(2,p.z)*t.wrap)*v,E=p.y*v,C=this.point;C.x*=g/this.worldSize,C.y*=g/this.worldSize;const z=this.angle,R=Math.sin(-z),D=-Math.cos(-z);return c[r]={bearing:[R,D],center:[(C.x-b)*_,(C.y-E)*_],scale:v/s.al*_},c[r]}calculateFogTileMatrix(t){const r=t.key,c=this._fogTileMatrixCache;if(c[r])return c[r];const p=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return s.aB(p,this.worldToFogMatrix,p),c[r]=new Float32Array(p),c[r]}calculateProjMatrix(t,r=!1,c=!1){const p=t.key;let _;if(_=c?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache,_[p])return _[p];const g=this.calculatePosMatrix(t,this.worldSize);let v;return v=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,s.aB(g,v,g),_[p]=new Float32Array(g),_[p]}calculatePixelsToTileUnitsMatrix(t){const r=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[r])return c[r];const p=s.cN(t,this);return c[r]=p,c[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,r=s.bq([],[t,t,t]);return s.aB(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const r=s.cf(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(r),p=this._camera.forward(),_=s.cf(1,this._center.lat);c[2]/=_,p[2]/=_,s.aw(p,p);const g=t.raycast(c,p,t.exaggeration());if(g){const v=s.bH([],c,p,g),b=new s.ae(v[0],v[1],s.cf(v[2],s.a$(v[1]))),E=(b.z+s.ag([b.x-c[0],b.y-c[1],b.z-c[2]*_]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(E),this._centerAltitude=b.toAltitude(),this._center=this.coordinateLocation(b),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const r=this._elevation,c=s.cf(1,this._center.lat)*this.worldSize,p=this._computeCameraPosition(c),_=r.getAtPointOrZero(new s.ae(...p)),g=this.pixelsPerMeter/this.worldSize*_,v=this._minimumHeightOverTerrain(),b=p[2]-g;if(b<=v)if(b<0||t){const E=this.locationCoordinate(this._center,this._centerAltitude),C=[p[0],p[1],E.z-p[2]],z=s.ag(C);C[2]-=(v-b)/this._pixelsPerMercatorPixel;const R=s.ag(C);if(R===0)return;s.c5(C,C,z/R*this._pixelsPerMercatorPixel),this._camera.position=[p[0],p[1],E.z*this._pixelsPerMercatorPixel-C[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const R=this.center;return R.lat=s.aA(R.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(R.lng=s.aA(R.lng,this.minLng,this.maxLng)),this.center=R,void(this._constraining=!1)}const r=this._unmodified,{x:c,y:p}=this.point;let _=0,g=c,v=p;const b=this.width/2,E=this.height/2,C=this.worldMinY*this.scale,z=this.worldMaxY*this.scale;if(p-E<C&&(v=C+E),p+E>z&&(v=z-E),z-C<this.height&&(_=Math.max(_,this.height/(z-C)),v=(z+C)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const R=this.worldMinX*this.scale,D=this.worldMaxX*this.scale,B=this.worldSize/2-(R+D)/2;g=(c+B+this.worldSize)%this.worldSize-B,g-b<R&&(g=R+b),g+b>D&&(g=D-b),D-R<this.width&&(_=Math.max(_,this.width/(D-R)),g=(D+R)/2)}g===c&&v===p||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(g,v))),_&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(_)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
54_calcMatrices(){if(!this.height)return;const t=this.centerOffset,r=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cf(1,this.center.lat)/s.cf(1,s.d2));const p=s.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,p),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const _=this.projection.zAxisUnit==="meters"?c:1,g=this._camera.getWorldToCamera(this.worldSize,_);let v;const b=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(b[8]=2*-t.x/this.width,b[9]=2*t.y/this.height,this.isOrthographic){let Q=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ce=Q*this.aspect,ve=-ce,ge=-Q;ce-=t.x,ve-=t.x,Q+=t.y,ge+=t.y,v=this._camera.getCameraToClipOrthographic(ve,ce,ge,Q,this._nearZ,this._farZ),((Le,ze,je,nt)=>{for(let Ae=0;Ae<16;Ae++)Le[Ae]=s.ak(ze[Ae],je[Ae],nt)})(v,v,b,s.d0(this.pitch>=Rs?1:this.pitch/Rs))}else v=b;const E=s.cP([],b,g);let C=s.cP([],v,g);if(this.projection.isReprojectedInTileSpace){const Q=this.locationCoordinate(this.center),ce=s.bA([]);s.br(ce,ce,[Q.x*this.worldSize,Q.y*this.worldSize,0]),s.aB(ce,ce,s.cQ(this)),s.br(ce,ce,[-Q.x*this.worldSize,-Q.y*this.worldSize,0]),s.aB(C,C,ce),s.aB(E,E,ce),this.inverseAdjustmentMatrix=s.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cS([],C,[this.worldSize,this.worldSize,this.worldSize/_,1]),this.projMatrix=C,this.invProjMatrix=s.bl(new Float64Array(16),this.projMatrix),r){const Q=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Q[8]=2*-t.x/this.width,Q[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cP([],Q,g)}else this.expandedFarZProjMatrix=this.projMatrix;const z=s.bl([],v);this.frustumCorners=s.cT.fromInvProjectionMatrix(z,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!r);const R=new Float32Array(16);s.bA(R),s.cS(R,R,[1,-1,1]),s.cU(R,R,this._pitch),s.bB(R,R,this.angle);const D=s.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bz(D);const B=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;D[8]=2*-t.x/this.width,D[9]=2*(t.y+B)/this.height,this.skyboxMatrix=s.aB(R,D,R);const O=this.point,G=O.x,U=O.y,Z=this.width%2/2,K=this.height%2/2,W=Math.cos(this.angle),le=Math.sin(this.angle),ne=G-Math.round(G)+W*Z+le*K,se=U-Math.round(U)+W*K+le*Z,ie=new Float64Array(C);if(s.br(ie,ie,[ne>.5?ne-1:ne,se>.5?se-1:se,0]),this.alignedProjMatrix=ie,C=s.bC(),s.cS(C,C,[this.width/2,-this.height/2,1]),s.br(C,C,[1,-1,0]),this.labelPlaneMatrix=C,C=s.bC(),s.cS(C,C,[1,-1,1]),s.br(C,C,[-1,-1,0]),s.cS(C,C,[2/this.width,2/this.height,1]),this.glCoordMatrix=C,this.pixelMatrix=s.aB(new Float64Array(16),this.labelPlaneMatrix,E),this._calcFogMatrices(),this._distanceTileDataCache={},C=s.bl(new Float64Array(16),this.pixelMatrix),!C)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=C,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cV(this);const Q=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.af(Q,Q,g),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=C;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,c=this._camera.position,p=1/this.height/this._pixelsPerMercatorPixel,_=[t,t,r];s.c5(_,_,p),s.c5(c,c,-1),s.cW(c,c,_);const g=s.bC();s.br(g,g,c),s.cS(g,g,_),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,r,p)}_computeCameraPosition(t){const r=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),p=this.point,_=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-t/this.worldSize*this._centerAltitude;return[p.x/this.worldSize-c[0]*_,p.y/this.worldSize-c[1]*_,t/this.worldSize*this._centerAltitude-c[2]*_]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],p=t[2];let _=1;this.projection.wrap&&(this.center=this.center.wrap()),p>0&&(_=Math.min((r-c)/p,1)),this._camera.position=s.bH([],this._camera.position,t,_),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,r=this._camera.forward(),{pitch:c,bearing:p}=this._camera.getPitchBearing(),_=s.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.an(this._maxPitch)),v=Math.max((t[2]-_)/Math.cos(c),g),b=this._zoomFromMercatorZ(v);s.bH(t,t,r,v),this._pitch=s.aA(c,s.an(this.minPitch),s.an(this.maxPitch)),this.angle=s.bT(p,-Math.PI,Math.PI),this._setZoom(s.aA(b,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let r=0,c=s.cL,p=0,_=1/0;for(;c-r>1e-6&&c>r;){const g=r+.5*(c-r),v=this.tileSize*Math.pow(2,g),b=this.getCameraToCenterDistance(this.projection,g,v),E=this.scaleZoom(b/(Math.max(0,t)*this.tileSize)),C=Math.abs(g-E);C<_&&(_=C,p=g),g<E?r=g:c=g}return p}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,r){const c=Math.min(t.x,r.x),p=Math.max(t.x,r.x),_=Math.min(t.y,r.y),g=Math.max(t.y,r.y);if(_<this.horizonLineFromTop(!1))return!0;
54if(this.projection.name!=="mercator")return!1;const v=[new s.P(c,_),new s.P(p,g),new s.P(c,g),new s.P(p,_)],b=this.renderWorldCopies?-3:0,E=this.renderWorldCopies?4:1;for(const C of v){const z=this.pointRayIntersection(C);if(z.t<0)return!0;const R=this.rayIntersectionCoordinate(z);if(R.x<b||R.y<0||R.x>E||R.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,r){const c=s.ag(s.av([],this._camera.position,t)),p=this._zoomFromMercatorZ(c)+r;return c-this._mercatorZfromZoom(p)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([r,c,p],_){const g=[r,c,p,1];s.aC(g,g,_);const v=g[3]=Math.max(g[3],1e-6);return g[0]/=v,g[1]/=v,g[2]/=v,g}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,r=this.zoom,c=this.worldSize){const p=s.cO(t,r,this.width,this.height,1024),_=t.pixelSpaceConversion(this.center.lat,c,p);let g=.5/Math.tan(.5*this._fov)*this.height*_;return this.isOrthographic&&(g=s.ak(1,g,s.d0(this.pitch>=Rs?1:this.pitch/Rs))),g}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.aB(t,t,this.globeMatrix),t}getFrustum(t){return s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const rl=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=l.transform,c=Math.max(Math.abs(r._zoom-(l.minCutoffZoom-1)),1),p=r.isLODDisabled(!1)?s.ah(60,45,r.pitch):s.ah(30,15,r.pitch),_=r._farZ-r._nearZ,g=t*r.height,v=((1-(b=p))*r.cameraToCenterDistance+b*(r._farZ+g))*c;var b;return{shouldRenderCutoff:p<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(v-r._nearZ)/_,(v-g-r._nearZ)/_]}}},hs=2048;class Du{constructor(t,r){this.aabb=t,this.lastCascade=r}}class Zx{add(t,r){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],r.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],r.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],r.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],r.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],r.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],r.max[2])):this.receivers[t.key]=new Du(r,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,r,c){const p=s.d9.fromPoints(t.points);let _=0;for(const g in this.receivers){const v=this.receivers[g];if(!v||!p.intersectsAabb(v.aabb))continue;v.aabb.min=p.closestPoint(v.aabb.min),v.aabb.max=p.closestPoint(v.aabb.max);const b=v.aabb.getCorners();for(let E=0;E<c.length;E++){let C=!0;for(const z of b){const R=[z[0]*r,z[1]*r,z[2]];if(s.af(R,R,c[E].matrix),R[0]<-1||R[0]>1||R[1]<-1||R[1]>1){C=!1;break}}if(v.lastCascade=E,_=Math.max(_,E),C)break}}return _+1}}class Rc{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Zx,this._depthMode=new kt(t.context.gl.LEQUAL,kt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,r){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;const p=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||p<=0||(this._shadowLayerCount=c.style.order.reduce((B,O)=>{const G=c.style._mergedLayers[O];return B+(G.hasShadowPass()&&!G.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const _=c.context,g=hs,v=hs;if(this._cascades.length===0||hs!==this._cascades[0].texture.size[0]){this._cascades=[];for(let B=0;B<2;++B){const O=c._shadowMapDebug,G=_.gl,U=_.createFramebuffer(g,v,O?1:0,"texture"),Z=new s.T(_,{width:g,height:v,data:null},G.DEPTH_COMPONENT16);if(U.depthAttachment.set(Z.texture),O){const K=new s.T(_,{width:g,height:v,data:null},G.RGBA8);U.colorAttachment0.set(K.texture)}this._cascades.push({framebuffer:U,texture:Z,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cB,scale:0})}}this.shadowDirection=Ou(r);let b=0;if(t.elevation){const B=t.elevation,O=[1e4,-1e4];B.visibleDemTiles.filter(G=>G.dem).forEach(G=>{const U=G.dem.tree;O[0]=Math.min(O[0],U.minimums[0]),O[1]=Math.max(O[1],U.maximums[0])}),O[0]!==1e4&&(b=(O[1]-O[0])*B.exaggeration())}const E=1.5*t.cameraToCenterDistance,C=3*E,z=new Float64Array(16);for(let B=0;B<this._cascades.length;++B){const O=this._cascades[B];let G=t.height/50,U=1;B===0?U=E:(G=E,U=C);const[Z,K]=ol(t,this.shadowDirection,G,U,hs,b);O.scale=t.scale,O.matrix=Z,O.boundingSphereRadius=K,s.bl(z,O.matrix),O.frustum=s.cB.fromInvProjectionMatrix(z,1,0,!0),O.far=U}const R=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[R].far,this._cascades[R].far],this._uniformValues.u_shadow_intensity=p,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=hs,this._uniformValues.u_shadowmap_0=Br.ShadowMap0,this._uniformValues.u_shadowmap_1=Br.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const D=c.transform.elevation;for(const B of this._groundShadowTiles){let O={min:0,max:0};if(D){const G=D.getMinMaxForTile(B);G&&(O=G)}this.addShadowReceiver(B.toUnwrapped(),O.min,O.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,r){if(!this.enabled)return;const c=this.painter,p=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),p.viewport.set([0,0,hs,hs]);for(let _=0;_<this._numCascadesToRender;++_){c.currentShadowCascade=_,p.bindFramebuffer.set(this._cascades[_].framebuffer.framebuffer),p.clear({color:s.ao.white,depth:1});for(const g of t.order){const v=t._mergedLayers[g];if(!v.hasShadowPass()||v.isHidden(c.transform.zoom))continue;const b=t.getLayerSourceCache(v),E=b?r[b.id]:void 0;(v.type==="model"||E&&E.length)&&c.renderLayer(c,b,v,E)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,r=t.style,c=t.context,p=c.gl,_=r.directionalLight,g=r.ambientLight;if(!_||!g)return;const v=[],b=rl(t,t.longestCutoffRange);b.shouldRenderCutoff&&v.push("RENDER_CUTOFF"),v.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&v.push("NORMAL_OFFSET");const E=Aa(r,_,g),C=new kt(p.LEQUAL,kt.ReadOnly,t.depthRangeFor3D),z=new ii({func:p.EQUAL,mask:255},0,255,p.KEEP,p.KEEP,p.KEEP);for(const R of this._groundShadowTiles){const D=R.toUnwrapped(),B=t.isTileAffectedByFog(R),O=t.getOrCreateProgram("groundShadow",{defines:v,overrideFog:B});this.setupShadows(D,O),t.uploadCommonUniforms(c,O,D,null,b);const G={u_matrix:t.transform.calculateProjMatrix(D),u_ground_shadow_factor:E};O.draw(t,p.TRIANGLES,C,z,fi.multiply,ei.disabled,G,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?fi.unblended:fi.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const r=this.painter.transform,c=r.calculatePosMatrix(t,r.worldSize);return s.aB(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
54calculateShadowPassMatrixFromMatrix(t){const r=s.bz(t);return s.aB(r,this._cascades[this.painter.currentShadowCascade].matrix,t),r}setupShadows(t,r,c){if(!this.enabled)return;const p=this.painter.transform,_=this.painter.context,g=_.gl,v=this._uniformValues,b=new Float64Array(16),E=p.calculatePosMatrix(t,p.worldSize);for(let C=0;C<this._cascades.length;C++)s.aB(b,this._cascades[C].matrix,E),v[C===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(b),_.activeTexture.set(g.TEXTURE0+Br.ShadowMap0+C),this._cascades[C].texture.bindExtraParam(g.LINEAR,g.LINEAR,g.CLAMP_TO_EDGE,g.CLAMP_TO_EDGE,g.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const C=s.d7(t.canonical),z=2/p.tileSize*s.al/hs,R=z*this._cascades[0].boundingSphereRadius,D=z*this._cascades[this._cascades.length-1].boundingSphereRadius,B=(c==="vector-tile"?1:3)*function(O,G,U,Z,K){const W=s.aA((O-22)/-22,0,1);return .125*(1-W)+4*W}(p.zoom);v.u_shadow_normal_offset=[C,R*B,D*B],v.u_shadow_bias=[1e-4,.0012,.012]}else v.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(_,v)}setupShadowsFromMatrix(t,r,c=!1){if(!this.enabled)return;const p=this.painter.context,_=p.gl,g=this._uniformValues,v=new Float64Array(16);for(let b=0;b<2;b++)s.aB(v,this._cascades[b].matrix,t),g[b===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(v),p.activeTexture.set(_.TEXTURE0+Br.ShadowMap0+b),this._cascades[b].texture.bindExtraParam(_.LINEAR,_.LINEAR,_.CLAMP_TO_EDGE,_.CLAMP_TO_EDGE,_.GREATER);this.useNormalOffset=c,c?(g.u_shadow_normal_offset=[1,3,3],g.u_shadow_bias=[6e-5,.0012,.012]):g.u_shadow_bias=[36e-5,.0012,.012],r.setShadowUniformValues(p,g)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,r,c,p){if(p[2]>=0)return{};const _=function(b,E,C){const z=C/(1<<b.canonical.z);return new s.d9([b.canonical.x*z+b.wrap*C,b.canonical.y*z+b.wrap*C,0],[(b.canonical.x+1)*z+b.wrap*C,(b.canonical.y+1)*z+b.wrap*C,E])}(t,r,c).getCorners(),g=r/-p[2];p[0]<0?(s.d8(_[0],_[0],[p[0]*g,0,0]),s.d8(_[3],_[3],[p[0]*g,0,0])):p[0]>0&&(s.d8(_[1],_[1],[p[0]*g,0,0]),s.d8(_[2],_[2],[p[0]*g,0,0])),p[1]<0?(s.d8(_[0],_[0],[0,p[1]*g,0]),s.d8(_[1],_[1],[0,p[1]*g,0])):p[1]>0&&(s.d8(_[2],_[2],[0,p[1]*g,0]),s.d8(_[3],_[3],[0,p[1]*g,0]));const v={};return v.vertices=_,v.planes=[ku(_[1],_[0],_[4]),ku(_[2],_[1],_[5]),ku(_[3],_[2],_[6]),ku(_[0],_[3],_[7])],v}addShadowReceiver(t,r,c){this._receivers.add(t,s.d9.fromTileIdAndHeight(t,r,c))}getMaxCascadeForTile(t){const r=this._receivers.get(t);return r&&r.lastCascade?r.lastCascade:0}}function ku(l,t,r){const c=s.av([],r,t),p=s.av([],l,t),_=s.bI([],c,p),g=s.ag(_);return g===0?[0,0,1,0]:(s.c5(_,_,1/g),[_[0],_[1],_[2],-s.bJ(_,t)])}function Ou(l){const t=l.properties.get("direction"),r=s.d4(t.x,t.y,t.z);r[2]=s.aA(r[2],0,75);const c=s.d6([r[0],r[1],r[2]]);return s.d5(c.x,c.y,c.z)}function Aa(l,t,r){const c=t.properties.get("color-use-theme")==="none",p=t.properties.get("color"),_=t.properties.get("intensity"),g=t.properties.get("direction"),v=[g.x,g.y,g.z],b=r.properties.get("color-use-theme")==="none",E=r.properties.get("color"),C=r.properties.get("intensity"),z=Math.max(s.bJ([0,0,1],v),0),R=[0,0,0];s.c5(R,E.toPremultipliedRenderColor(b?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),C);const D=[0,0,0];return s.c5(D,p.toPremultipliedRenderColor(c?null:l.getLut(r.scope)).toArray01Linear().slice(0,3),z*_),s.db([R[0]>0?R[0]/(R[0]+D[0]):0,R[1]>0?R[1]/(R[1]+D[1]):0,R[2]>0?R[2]/(R[2]+D[2]):0])}function ol(l,t,r,c,p,_){const g=l.zoom,v=l.scale,b=l.worldSize,E=1/b,C=l.aspect,z=Math.sqrt(1+C*C)*Math.tan(.5*l.fovX),R=z*z,D=c-r,B=c+r;let O,G;R>D/B?(O=c,G=c*z):(O=.5*B*(1+R),G=.5*Math.sqrt(D*D+2*(c*c+r*r)*R+B*B*R*R));const U=l.projection.pixelsPerMeter(l.center.lat,b),Z=l._camera.getCameraToWorldMercator(),K=[0,0,-O*E];s.af(K,K,Z);let W=G*E;const le=l._edgeInsets;if(!(le.left===0&&le.top===0&&le.right===0&&le.bottom===0||le.left===le.right&&le.top===le.bottom)){const Ze=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?U:1),ft=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,r,c);ft[8]=2*-l.centerOffset.x/l.width,ft[9]=2*l.centerOffset.y/l.height;const bt=new Float64Array(16);s.cP(bt,ft,Ze);const ut=new Float64Array(16);s.bl(ut,bt);const rt=s.cB.fromInvProjectionMatrix(ut,b,g,!0);for(const Lt of rt.points){const Mt=((ne=Lt)[0]/=v,ne[1]/=v,ne[2]=s.cf(ne[2],l._center.lat),ne);
54W=Math.max(W,s.c6(s.da([],K,Mt)))}}var ne;W*=p/(p-1);const se=Math.acos(t[2]),ie=Math.atan2(-t[0],-t[1]),Q=new ad;Q.position=K,Q.setPitchBearing(se,ie);const ce=Q.getWorldToCamera(b,U),ve=W*b,ge=Math.min(l._mercatorZfromZoom(17)*b*-2,-2*ve),Le=Q.getCameraToClipOrthographic(-ve,ve,-ve,ve,ge,(ve+_*U)/t[2]),ze=new Float64Array(16);s.aB(ze,Le,ce);const je=s.d5(Math.floor(1e6*K[0])/1e6*b,Math.floor(1e6*K[1])/1e6*b,0),nt=.5*p,Ae=[0,0,0];s.af(Ae,je,ze),s.c5(Ae,Ae,nt);const fe=[Math.floor(Ae[0]),Math.floor(Ae[1]),Math.floor(Ae[2])],Oe=[0,0,0];s.av(Oe,Ae,fe),s.c5(Oe,Oe,-1/nt);const Me=new Float64Array(16);return s.bA(Me),s.br(Me,Me,Oe),s.aB(ze,Me,ze),[ze,ve]}class Wx extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,r){return s.dc(this.requestManager.transformRequest(r,s.R.Model).url).then(c=>{if(!c)return;const p=s.dd(c),_=new s.de(t,r,void 0,void 0,p);return _.computeBoundsAndApplyParent(),_}).catch(c=>{if(c&&c.status===404)return null;this.fire(new s.y(new Error(`Could not load model ${t} from ${r}: ${c.message}`)))})}load(t,r,c={forceReload:!1}){this.models[r]||(this.models[r]={});const p=Object.keys(t),_=[],g=[];for(const v of p){const b=t[v];this.hasURLBeenRequested(b)&&!c.forceReload||(this.modelByURL[b]={modelId:v,scope:r},_.push(this.loadModel(v,b)),g.push(v)),this.models[r][v]||(this.models[r][v]={model:null,numReferences:1})}this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+g.length,Promise.allSettled(_).then(v=>{for(let b=0;b<v.length;b++){const{status:E}=v[b];if(E==="rejected")continue;const{value:C}=v[b];this.models[r][g[b]]||(this.models[r][g[b]]={model:null,numReferences:1}),this.models[r][g[b]].model=C}this.numModelsLoading[r]-=g.length,this.fire(new s.z("data",{dataType:"style"}))}).catch(v=>{this.fire(new s.y(new Error(`Could not load models: ${v.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,r,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,r):this.getModelByURL(this.modelUris[r][t]))}getModel(t,r){return this.models[r]||(this.models[r]={}),this.models[r][t]?this.models[r][t].model:void 0}getModelByURL(t){if(!t)return null;const r=this.modelByURL[t];return r?this.models[r.scope][r.modelId].model:null}hasModelBeenAdded(t,r){return this.models[r]&&this.models[r][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,r,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const p=this.requestManager.normalizeModelURL(r);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===p)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(p)){const{scope:_,modelId:g}=this.modelByURL[p];this.models[_][g].numReferences++}else this.modelUris[c][t]=p,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});const c=this.modelUris[r];for(const p in t)c[p]=this.requestManager.normalizeModelURL(t[p])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});const c={};for(const p of t)this.hasModel(p,r,{exactIdMatch:!0})||this.hasURLBeenRequested(p)?this.models[r][p].numReferences++:this.modelUris[r][p]&&!this.hasURLBeenRequested(p)?c[p]=this.modelUris[r][p]:!this.hasURLBeenRequested(p)&&s.df(p,!1)&&(this.modelUris[r][p]=this.requestManager.normalizeModelURL(p),c[p]=this.modelUris[r][p]);this.load(c,r)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,r,c=!1,p=!1){if(this.models[r]&&this.models[r][t]&&(this.models[r][t].numReferences--,this.models[r][t].numReferences===0||p)){const _=this.modelUris[r][t];c||delete this.modelUris[r][t],delete this.modelByURL[_];const g=this.models[r][t].model;if(!g)return;delete this.models[r][t],g.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const r of Object.keys(this.models[t])){const c=this.models[t][r].model;delete this.models[t][r],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,r){this.models[r]||(this.models[r]={});for(const c in this.models[r])this.models[r][c].model&&this.models[r][c].model.upload(t.context)}}const Df=s.a6.colorTheme,Xx=new s.a9({data:new s.aa(Df.data)});function Ug(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.o.devicePixelRatio,{left:r,top:c,width:p,height:_}=l.metadata.content_area,g=r*t,v=c*t;return[g,v,g+p*t,v+_*t]}function Gg(l){if(l)return l.map(([t,r])=>[t*s.o.devicePixelRatio,r*s.o.devicePixelRatio])}class kf{constructor(t,r,c){this.id=t,this.scope=r,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const r=this.sourceCache.getVisibleCoordinates();if(r.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof lo))return t;const p=r.map(g=>this.sourceCache.getTile(g)),_=c.getImages(p,Array.from(this.pendingRequests));for(const[g,v]of _)t.set(s.I.from({name:g,iconsetId:this.id}),v),this.pendingRequests.delete(g);for(const g of this.pendingRequests)this.missingRequests.add(g);return this.pendingRequests.clear(),t}}const sl=(l,t)=>J(l,t&&t.filter(r=>r.identifier!=="source.canvas")),$g=s.aH($i,["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"]),Hg=s.aH($i,["setCenter","setZoom","setBearing","setP
54itch"]),cd=new Set(["background","sky","slot","custom"]),al={version:8,layers:[],sources:{}},Fu={duration:300,delay:0};class ds extends s.E{constructor(t,r={}){super(),this.map=t,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=Object.assign({},Fu),this._buildingIndex=new Hx(this),this.crossTileSymbolIndex=new Ps,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=r.styleChanges||new rr,this._hasDataDrivenEmissive=!1,this.dispatcher=r.dispatcher?r.dispatcher:new s.D(s.dh(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new Go(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new s.di(t._requestManager,r.localFontFamily?s.dj.all:r.localIdeographFontFamily?s.dj.ideographs:s.dj.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new Wx(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._indoorDependentLayers=r.indoorDependentLayers?r.indoorDependentLayers:new Set,this._config=r.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:r.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",s.dk());const c=this;this._rtlTextPluginCallback=ds.registerForPluginStateChange(p=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL},(_,g)=>{if(s.dl(_),g&&g.every(v=>v))for(const v in c._sourceCaches){const b=c._sourceCaches[v],E=b.getSource().type;E!=="vector"&&E!=="geojson"||b.reload()}})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const _=this.getOwnSource(p.sourceId);if(_&&_.vectorLayerIds)for(const g in this._layers){const v=this._layers[g];v.source===_.id&&this._validateLayer(v)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.h(t))return t;const r=s.dm(t);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch{return r}return r}return`json://${s.dn(JSON.stringify(t))}`}_diffStyle(t,r,c){this.globalId=this._getGlobalId(t);const p=(_,g)=>{try{g(null,this.setState(_,c))}catch(v){g(v,!1)}};if(typeof t=="string"){const _=this.map._requestManager.normalizeStyleURL(t),g=this.map._requestManager.transformRequest(_,s.R.Style);s.m(g,(v,b)=>{v?this.fire(new s.y(v)):b&&p(b,r)})}else typeof t=="object"&&p(t,r)}loadURL(t,r={}){this.fire(new s.z("dataloading",{dataType:"style"}));const c=typeof r.validate=="boolean"?r.validate:!s.h(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,r.accessToken),this.resolvedImports.add(t);const p=this.importsCache.get(t);if(p)return this._load(p,c);const _=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.m(_,(g,v)=>{if(this._request=null,g)this.fire(new s.y(g));else if(v)return this.importsCache.set(t,v),this._load(v,c)})}loadJSON(t,r={}){this.fire(new s.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.o.frame(()=>{this._request=null,this._load(t,r.validate!==!1)})}loadEmpty(){this.fire(new s.z("dataloading",{dataType:"style"})),this._load(al,!1)}_loadImports(t,r,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const p=[];for(const _ of t){const g=this._createFragmentStyle(_),v=new Promise(C=>{g.once("style.import.load",C),g.once("error",C)}).then(()=>this.mergeAll());if(p.push(v),this.resolvedImports.has(_.url)){g.loadEmpty();continue}const b=_.data||this.importsCache.get(_.url);b?(g.loadJSON(b,{validate:r}),this._isInternalStyle(b)&&(g.globalId=null)):_.url?g.loadURL(_.url,{validate:r}):g.loadEmpty();const E={style:g,id:_.id,config:_.config};if(c){const C=this.fragments.findIndex(({id:z})=>z===c);this.fragments=this.fragments.slice(0,C).concat(E).concat(this.fragments.slice(C))}else this.fragments.push(E)}return Promise.allSettled(p)}getImportGlobalIds(t=this,r=new Set){for(const c of t.fragments)c.style.globalId&&r.add(c.style.globalId),this.getImportGlobalIds(c.style,r);return[...r.values()]}_createFragmentStyle(t){const r=this.scope?s.B(t.id,this.scope):t.id;let c;const p=this._initialConfig&&this._initialConfig[r];(t.config||p)&&(c=Object.assign({},t.config,p));const _=new ds(this.map,{scope:r,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indo
54orDependentLayers});return _.setEventedParent(this.map,{style:_}),_}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,r){if(this._isInternalStyle(t)){const _=Object.assign({},al,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(_,r)}if(this.updateConfig(this._config,t.schema),r&&sl(this,ko(t)))return;this._loaded=!0,this.stylesheet=s.dp(t);const c=()=>{for(const b in t.sources)this.addSource(b,t.sources[b],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const b in t.iconsets)this.addIconset(b,t.iconsets[b]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const _=Eu(this.stylesheet.layers);if(this._order=_.map(b=>b.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const b=this.stylesheet.lights[0];this.light=new ye(b.properties,b.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ye(this.stylesheet.light)),this._layers={};for(const b of _){const E=s.du(b,this.scope,this._styleColorTheme.lut,this.options);E.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(E.fqid),E.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(E.fqid),this._hasAppearances=this._hasAppearances||E.getAppearances().length!==0,E.setEventedParent(this,{layer:{id:E.id}}),this._layers[E.id]=E;const C=this.getOwnLayerSourceCache(E),z=!!this.directionalLight&&this.directionalLight.shadowsEnabled();C&&E.canCastShadows()&&z&&(C.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const g=this.stylesheet.terrain;g&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(g,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.z("data",{dataType:"style"}));const v=this.isRootStyle();t.imports?this._loadImports(t.imports,r).then(()=>{this._reloadImports(),this.fire(new s.z(v?"style.load":"style.import.load"))}).catch(b=>{this.fire(new s.y(new Error("Failed to load imports",b))),this.fire(new s.z(v?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.z(v?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const _=this._evaluateColorThemeData(p);this._loadColorTheme(_).then(()=>{c()}).catch(g=>{s.w(`Couldn't load color theme from the stylesheet: ${g}`),c()})}else this._styleColorTheme.lut=null,c()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,r,c,p,_,g,v,b,E,C;const z={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(R=>{if(R.stylesheet){if(R.light!=null&&(t=R.light),R.stylesheet.lights)for(const D of R.stylesheet.lights)D.type==="ambient"&&R.ambientLight!=null&&(r=R.ambientLight),D.type==="directional"&&R.directionalLight!=null&&(c=R.directionalLight);p=this._prioritizeTerrain(p,R.terrain,R.stylesheet.terrain),R.stylesheet.fog&&R.fog!=null&&(_=R.fog),R.stylesheet.snow&&R.snow!=null&&(g=R.snow),R.stylesheet.rain&&R.rain!=null&&(v=R.rain),R.stylesheet.camera!=null&&(C=R.stylesheet.camera),R.stylesheet.projection!=null&&(b=R.stylesheet.projection),R.stylesheet.transition!=null&&(E=R.stylesheet.transition),z[R.scope]=R._styleColorTheme}}),this.light=t,this.ambientLight=r,this.directionalLight=c,this.fog=_,this.snow=g,this.rain=v,this._styleColorThemeForScope=z,p===null?delete this.terrain:this.terrain=p,this.camera=C||{"camera-projection":"perspective"},this.projection=b||{name:"mercator"},this.transition=Object.assign({},Fu,E),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(t){const r=c=>{for(const p of c.fragments)r(p.style);t(c)};r(this)}_prioritizeTerrain(t,r,c){const p=t&&t.drapeRenderMode===0;return c===null?r&&r.drapeRenderMode===0?r:p?t:null:r!=null&&(!t||p||r&&r.drapeRenderMode===1)?r:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(r=>{t=this._prioritizeTerrain(t,r.terrain,r.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(r=>{r.stylesheet.projection!=null&&(t=r.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},r={},c={};this.forEachFragmentStyle(p=>{for(const _ in p._sourceCaches){const g=s.B(_,p.scope);t[g]=p._sourceCaches[_]}for(const _ in p._otherSourceCaches){const g=s.B(_,p.scope);r[g]=p._otherSourceCaches[_]}for(const _ in p._symbolSourceCaches){const g=s.B(_,p.scope);c[g]=p._symbolSourceCaches[_]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=c}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const r of Object.values(t.stylesheet.indoor)){const c=r,p=s.B(c.sourceId,t.scope);this._mergedIndoor[p]=new Set(c.sourceLayers||[])}})}mergeLayers(){const t={},r=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(g=>{for(const v of g._order){const b=g._layers[v];if(b.type==="slot"){const E=s.dq(v);if(t[E])continue;t[E]=[]}b.slot&&t[b.slot]?t[b.slot].push(b):r.push(b)}}),this._mergedOrder=[];let p=-1;const _=(g=[])=>{for(const v of g)if(v.type==="slot"){const b=s.dq(v.id);t[b]&&_(t[b]),this._mergedSlots.push(b)}else{const b=s.B(v.id,v.scope);this._mergedOrder.push(b),c[b]=v,v.is3D(!!this.terrain)&&(this._has3DLayers=!0,p=this._mergedOrder.length-1),v.type==="circle"&&(this._hasCircleLayers=!0),v.type==="symbol"&&(this._hasSymbolLayers=!0),v.type==="clip"&&(this._clipLayerPresent=!0)}};if(_(r),this._has3DLayers){const g={};for(let v=0;v<this._mergedOrder.length;++v){const b=this._mergedOrder[v];g[b]=v===p?1:v<p?c[b].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((v,b)=>g[v]-g[b])}this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(r,c,p,_){const g=Object.assign({},c);for(const b of Object.keys(Df))g[b]===void 0&&(g[b]=Df[b].default);const v=new s.a8(Xx,r,new Map(p));return v.setTransitionOrValue(g,p),v.untransitioned().possiblyEvaluate(new s.ac(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,p)=>{const _="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let g=t;g.startsWith(_)||(g=_+g);const v=s.I.from("mapbox-reserved-lut"),b=new Image;b.src=g,b.onerror=()=>{this._styleColorTheme.lutLoading=!1,p(new Error("Failed to load image data"))},b.onload=()=>
54{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void c();this._styleColorTheme.lutLoading=!1;const{width:E,height:C,data:z}=s.o.getImageData(b);if(C>32)return void p(new Error("The height of the image must be less than or equal to 32 pixels."));if(E!==C*C)return void p(new Error("The width of the image must be equal to the height squared."));this.getImage(v)&&this.removeImage(v),this.addImage(v,{data:new s.q({width:E,height:C},z),pixelRatio:1,sdf:!1,usvg:!1,version:0});const R=this.imageManager.getImage(v,this.scope);R?(this._styleColorTheme.lut={image:R.data,data:t},c()):p(new Error("Missing LUT image."))}})}getLut(t){const r=this._styleColorThemeForScope[t];return r?r.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(r,c,p){let _,g,v;const b=s.o.devicePixelRatio>1?"@2x":"";let E=s.m(c.transformRequest(c.normalizeSpriteURL(r,b,".json"),s.R.SpriteJSON),(R,D)=>{E=null,v||(v=R,_=D,z())}),C=s.n(c.transformRequest(c.normalizeSpriteURL(r,b,".png"),s.R.SpriteImage),(R,D)=>{C=null,v||(v=R,g=D,z())});function z(){if(v)p(v);else if(_&&g){const R=s.o.getImageData(g),D={};for(const B in _){const{width:O,height:G,x:U,y:Z,sdf:K,pixelRatio:W,stretchX:le,stretchY:ne,content:se}=_[B],ie=new s.q({width:O,height:G});s.q.copy(R,ie,{x:U,y:Z},{x:0,y:0},{width:O,height:G},null),D[B]={data:ie,pixelRatio:W!==void 0?W:1,sdf:K!==void 0&&K,stretchX:le,stretchY:ne,content:se,usvg:!1,version:0}}p(null,D)}}return{cancel(){E&&(E.cancel(),E=null),C&&(C.cancel(),C=null)}}}(t,this.map._requestManager,(r,c)=>{if(this._spriteRequest=null,r)this.fire(new s.y(r));else if(c){const p=new Map;for(const _ in c)p.set(s.I.from(_),c[_]);this.addImages(p)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))})}addIconset(t,r){if(r.type==="sprite")return void this._loadSprite(r.url);const c=this.getOwnSourceCache(r.source);if(!c)return void this.fire(new s.y(new Error(`Source "${r.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const p=c.getSource();if(p.type!=="raster-array")return void this.fire(new s.y(new Error(`Source "${r.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));p.partial=!1;const _=new kf(t,this.scope,c);this.imageManager.addImageProvider(_,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.h(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const r=this.map._spriteFormat==="auto";var c,p;this._spriteRequest=(p=(_,g)=>{if(this._spriteRequest=null,_)r?this._loadSprite(t):this.fire(new s.y(_));else if(g){const v=new Map;for(const b in g)v.set(s.I.from(b),g[b]);this.addImages(v)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))},s.bu((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),(_,g)=>{if(_)return void p(_);const v={},b=s.dg(new s.bt(g));for(const E of b.icons){const C={version:1,pixelRatio:s.o.devicePixelRatio,content:Ug(E),stretchX:E.metadata?Gg(E.metadata.stretch_x_areas):void 0,stretchY:E.metadata?Gg(E.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:E};v[E.name]=C}p(null,v)}))}_validateLayer(t){const r=this.getOwnSource(t.source);if(!r)return;const c=t.sourceLayer;c&&(r.type==="geojson"||r.vectorLayerIds&&r.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.y(new Error(`Source layer "${c}" does not exist on source "${r.id}" as specified by style layer "${t.id}"`)))}
54loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,r)=>{const c=this.fragments[r];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const r in this._sourceCaches){const c=this._sourceCaches[r].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const r=[];for(const c of t){const p=this._layers[c];p&&p.type!=="custom"&&r.push(p.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(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const r=this._mergedLayers[t];if(r._transitionablePaint&&r._transitionablePaint._values){const c=r._transitionablePaint._values["line-emissive-strength"];if(c&&c.value&&c.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const r=this.getOwnLayer(t);if(r)return r;this.fire(new s.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const r=this.getOwnSource(t);if(r)return r;this.fire(new s.y(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,r){const c=this.map.painter;if(c)for(let p=t.minzoom||0;p<(t.maxzoom||25.5);p++){const _=t.getProgramIds();if(_)for(const g of _){const v=t.getDefaultProgramParams(g,r.zoom,this._styleColorTheme.lut);v&&(c.style=this,this.fog&&(c._fogVisible=!0,v.overrideFog=!0,c.getOrCreateProgram(g,v)),c._fogVisible=!1,v.overrideFog=!1,c.getOrCreateProgram(g,v),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(v.overrideRtt=!0,c.getOrCreateProgram(g,v)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const r=this.calculateLightsBrightness();t.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let p=!1;if(this._changes.isDirty()){const v=this._changes.getLayerUpdatesByScope();for(const b in v){const{updatedIds:E,removedIds:C}=v[b];(E||C)&&(this._updateWorkerLayers(b,E,C),p=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const _={};for(const v in this._mergedSourceCaches){const b=this._mergedSourceCaches[v];_[v]=b.used,b.used=!1,b.tileCoverLift=0}for(const v of this._mergedOrder){const b=this._mergedLayers[v];if(b.visibility!=="none"&&b.recalculate(t,this._availableImages),!b.isHidden(t.zoom)){const E=this.getLayerSourceCache(b);E&&(E.used=!0,E.tileCoverLift=Math.max(E.tileCoverLift,b.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
54{this.precompilePrograms(b,t)}):this.precompilePrograms(b,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&p&&this.mergeLayers();const g=this.imageManager.getPendingImageProviders();for(const v of g)v.sourceCache.used=!0;for(const v in _){const b=this._mergedSourceCaches[v];_[v]!==b.used&&b.getSource().fire(new s.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const r of t){const c=r.resolvePendingRequests(),p=this.getFragmentStyle(r.scope);p&&p.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const r in this._mergedSourceCaches){const c=this._mergedSourceCaches[r].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[r].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const r in t)this._changes.resetUpdatedImages(r)}_updateWorkerLayers(t,r,c){const p=this.getFragmentStyle(t);p&&this.dispatcher.broadcast("updateLayers",{layers:r?p._serializeLayers(r):[],scope:t,removedIds:c||[],options:p.options})}setState(t,r){if(this._checkLoaded(),sl(this,ko(t)))return!1;(t=s.dp(t)).layers=Eu(t.layers);const c=function(g,v){if(!g)return[{command:$i.setStyle,args:[v]}];let b=[];
54try{if(!s.by(g.version,v.version))return[{command:$i.setStyle,args:[v]}];if(s.by(g.center,v.center)||b.push({command:$i.setCenter,args:[v.center]}),s.by(g.zoom,v.zoom)||b.push({command:$i.setZoom,args:[v.zoom]}),s.by(g.bearing,v.bearing)||b.push({command:$i.setBearing,args:[v.bearing]}),s.by(g.pitch,v.pitch)||b.push({command:$i.setPitch,args:[v.pitch]}),s.by(g.sprite,v.sprite)||b.push({command:$i.setSprite,args:[v.sprite]}),s.by(g.glyphs,v.glyphs)||b.push({command:$i.setGlyphs,args:[v.glyphs]}),s.by(g.imports,v.imports)||function(D=[],B=[],O){B=B||[];const G=(D=D||[]).map(Iu),U=B.map(Iu),Z=D.reduce(Au,{}),K=B.reduce(Au,{}),W=G.slice();let le,ne,se,ie;for(le=0,ne=0;le<G.length;le++)se=G[le],K.hasOwnProperty(se)?ne++:(O.push({command:$i.removeImport,args:[se]}),W.splice(W.indexOf(se,ne),1));for(le=0,ne=0;le<U.length;le++)se=U[U.length-1-le],W[W.length-1-le]!==se&&(Z.hasOwnProperty(se)?(O.push({command:$i.removeImport,args:[se]}),W.splice(W.lastIndexOf(se,W.length-ne),1)):ne++,ie=W[W.length-le],O.push({command:$i.addImport,args:[K[se],ie]}),W.splice(W.length-le,0,se));for(const Q of B){const ce=Z[Q.id];ce&&(delete ce.data,s.by(ce,Q)||O.push({command:$i.updateImport,args:[Q.id,Q]}))}}(g.imports,v.imports,b),s.by(g.transition,v.transition)||b.push({command:$i.setTransition,args:[v.transition]}),s.by(g.light,v.light)||b.push({command:$i.setLight,args:[v.light]}),s.by(g.fog,v.fog)||b.push({command:$i.setFog,args:[v.fog]}),s.by(g.snow,v.snow)||b.push({command:$i.setSnow,args:[v.snow]}),s.by(g.rain,v.rain)||b.push({command:$i.setRain,args:[v.rain]}),s.by(g.projection,v.projection)||b.push({command:$i.setProjection,args:[v.projection]}),s.by(g.lights,v.lights)||b.push({command:$i.setLights,args:[v.lights]}),s.by(g.camera,v.camera)||b.push({command:$i.setCamera,args:[v.camera]}),s.by(g.iconsets,v.iconsets)||function(D,B,O){let G;for(G in B=B||{},D=D||{})D.hasOwnProperty(G)&&(B.hasOwnProperty(G)||O.push({command:$i.removeIconset,args:[G]}));for(G in B){if(!B.hasOwnProperty(G))continue;const U=B[G];D.hasOwnProperty(G)?s.by(D[G],U)||(O.push({command:$i.removeIconset,args:[G]}),O.push({command:$i.addIconset,args:[G,U]})):O.push({command:$i.addIconset,args:[G,U]})}}(g.iconsets,v.iconsets,b),!s.by(g["color-theme"],v["color-theme"]))return[{command:$i.setStyle,args:[v]}];const E={},C=[];(function(D,B,O,G){let U;for(U in B=B||{},D=D||{})D.hasOwnProperty(U)&&(B.hasOwnProperty(U)||Ef(U,O,G));for(U in B){if(!B.hasOwnProperty(U))continue;const Z=B[U];D.hasOwnProperty(U)?s.by(D[U],Z)||(D[U].type==="geojson"&&Z.type==="geojson"&&Bg(D,B,U)?O.push({command:$i.setGeoJSONSourceData,args:[U,Z.data]}):Fg(U,B,O,G)):Jh(U,B,O)}})(g.sources,v.sources,C,E);const z=[];g.layers&&g.layers.forEach(D=>{D.source&&E[D.source]?b.push({command:$i.removeLayer,args:[D.id]}):z.push(D)});let R=g.terrain;R&&E[R.source]&&(b.push({command:$i.setTerrain,args:[void 0]}),R=void 0),b=b.concat(C),s.by(R,v.terrain)||b.push({command:$i.setTerrain,args:[v.terrain]}),function(D,B,O){B=B||[];const G=(D=D||[]).map(Iu),U=B.map(Iu),Z=D.reduce(Au,{}),K=B.reduce(Au,{}),W=G.slice(),le=Object.create(null);let ne,se,ie,Q,ce,ve,ge;for(ne=0,se=0;ne<G.length;ne++)ie=G[ne],K.hasOwnProperty(ie)?se++:(O.push({command:$i.removeLayer,args:[ie]}),W.splice(W.indexOf(ie,se),1));for(ne=0,se=0;ne<U.length;ne++)ie=U[U.length-1-ne],W[W.length-1-ne]!==ie&&(Z.hasOwnProperty(ie)?(O.push({command:$i.removeLayer,args:[ie]}),W.splice(W.lastIndexOf(ie,W.length-se),1)):se++,ve=W[W.length-ne],O.push({command:$i.addLayer,args:[K[ie],ve]}),W.splice(W.length-ne,0,ie),le[ie]=!0);for(ne=0;ne<U.length;ne++)if(ie=U[ne],Q=Z[ie],ce=K[ie],!le[ie]&&!s.by(Q,ce))if(s.by(Q.source,ce.source)&&s.by(Q["source-layer"],ce["source-layer"])&&s.by(Q.type,ce.type)){for(ge in tl(Q.layout,ce.layout,O,ie,null,$i.setLayoutProperty),tl(Q.paint,ce.paint,O,ie,null,$i.setPaintProperty),s.by(Q.slot,ce.slot)||O.push({command:$i.setSlot,args:[ie,ce.slot]}),s.by(Q.filter,ce.filter)||O.push({command:$i.setFilter,args:[ie,ce.filter]}),s.by(Q.minzoom,ce.minzoom)&&s.by(Q.maxzoom,ce.maxzoom)||O.push({command:$i.setLayerZoomRange,args:[ie,ce.minzoom,ce.maxzoom]}),Q)Q.hasOwnProperty(ge)&&ge!=="layout"&&ge!=="paint"&&ge!=="filter"&&ge!=="metadata"&&ge!=="minzoom"&&ge!=="maxzoom"&&ge!=="slot"&&(ge.indexOf("paint.")===0?tl(Q[ge],ce[ge],O,ie,ge.slice(6),$i.setPaintProperty):s.by(Q[ge],ce[ge])||O.push({command:$i.setLayerProperty,args:[ie,ge,ce[ge]]}));for(ge in ce)ce.hasOwnProperty(ge)&&!Q.hasOwnProperty(ge)&&ge!=="layout"&&ge!=="paint"&&ge!=="filter"&&ge!=="metadata"&&ge!=="minzoom"&&ge!=="maxzoom"&&ge!=="slot"&&(ge.indexOf("paint.")===0?tl(Q[ge],ce[ge],O,ie,ge.slice(6),$i.setPaintProperty):s.by(Q[ge],ce[ge])||O.push({command:$i.setLayerProperty,args:[ie,ge,ce[ge]]}))}else O.push({command:$i.removeLayer,args:[ie]}),ve=W[W.lastIndexOf(ie)+1],O.push({command:$i.addLayer,args:[ce,ve]})}(z,v.layers,b)}catch(E){console.warn("Unable to compute style diff:",E),b=[{command:$i.setStyle,args:[v]}]}return b}(this.serialize(),t).filter(g=>!(g.command in Hg));if(c.length===0)return!1;const p=c.filter(g=>!(g.command in $g));if(p.length>0)throw new Error(`Unimplemented: ${p.map(g=>g.command).join(", ")}.`);const _=[];
54return c.forEach(g=>{_.push(this[g.command](...g.args))}),r&&Promise.all(_).then(r).catch(r),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[r,c]of t.entries()){if(this.getImage(r))return this.fire(new s.y(new Error(`An image with the name "${r.name}" already exists.`)));this.imageManager.addImage(r,this.scope,c),this._changes.updateImage(r,this.scope)}return this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this}addImage(t,r){return this.getImage(t)?this.fire(new s.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,r),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this)}updateImage(t,r,c=!1){this.imageManager.updateImage(t,this.scope,r),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new s.z("data",{dataType:"style"})),this}addModel(t,r,c={}){return this._checkLoaded(),this._validate(j,`models.${t}`,r,null,c)||(this.modelManager.addModel(t,r,this.getActualScope()),this.fire(new s.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,r,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(Ic,`sources.${t}`,r,null,c))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const p=Mr(t,r,this.dispatcher,this);p.scope=this.scope,p.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(p.id),source:p.serialize(),sourceId:p.id}));const _=g=>{const v=(g?"symbol:":"other:")+p.id,b=s.B(v,this.scope),E=this._sourceCaches[v]=new Oo(b,p,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[p.id]=E,E.onAdd(this.map)};_(!1),r.type!=="vector"&&r.type!=="geojson"||_(!0),p.onAdd&&p.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const r=this.getOwnSource(t);if(!r)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const p=Object.entries(this.stylesheet.iconsets).find(([_,g])=>g.type==="source"&&g.source===t);if(p)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while iconset "${p[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);
vendor: 4,180 bytes, line 54
54for(const p of c){const _=s.dq(p.id);delete this._sourceCaches[_],this._changes.discardSourceCacheUpdate(p.id),p.fire(new s.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:p.getSource().id})),p.setEventedParent(null),p.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,r){this._checkLoaded(),this.getOwnSource(t).setData(r),this._changes.setDirty()}getOwnSource(t){const r=this.getOwnSourceCache(t);return r&&r.getSource()}getOwnSources(){const t=[];for(const r in this._otherSourceCaches){const c=this.getOwnSourceCache(r);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const r in t){const c=t[r]._tiles;for(const p in c){const _=c[p];if(_.state!=="loaded"&&_.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const r=this._getTransitionParameters();for(const _ of t){if(this._validate(Ta,"lights",_))return;switch(_.type){case"ambient":if(this.ambientLight){const g=this.ambientLight;g.set(_),g.updateTransitions(r)}else this.ambientLight=new Gi(_,lr||(lr=new s.a9({color:new s.aa(s.a6.properties_light_ambient.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const g=this.directionalLight;g.set(_),g.updateTransitions(r)}else this.directionalLight=new Gi(_,Zn||(Zn=new s.a9({direction:new s.ap(s.a6.properties_light_directional.direction),color:new s.aa(s.a6.properties_light_directional.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_directional.intensity),"cast-shadows":new s.aa(s.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new s.aa(s.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.aa(s.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(r,{worldview:this.map.getWorldview()}),p=new s.ac(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(p),this.directionalLight&&this.directionalLight.recalculate(p),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,r=this.ambientLight;if(!t||!r)return;const c=R=>.2126*(R[0]<=.03928?R[0]/12.92:Math.pow((R[0]+.055)/1.055,2.4))+.7152*(R[1]<=.03928?R[1]/12.92:Math.pow((R[1]+.055)/1.055,2.4))+.0722*(R[2]<=.03928?R[2]/12.92:Math.pow((R[2]+.055)/1.055,2.4)),p=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),_=t.properties.get("intensity"),g=t.properties.get("direction"),v=1-s.d4(g.x,g.y,g.z)[2]/90,b=c(p)*_*v,E=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),C=r.properties.get("intensity"),z=c(E)*C;return Number(((b+z)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(s.dr(t)){const r=s.ds(t),c=this.fragments.find(({id:_})=>_===r);if(!c)return;const p=s.dq(t);return c.style.getFragmentStyle(p)}{const r=this.fragments.find(({id:c})=>c===t);return r?r.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const r={},c=(p,_="")=>`${p}::${_}`;this._featuresetSelectors={};for(const p in t){const _=this._featuresetSelectors[p]=[];for(const g of t[p].selectors){if(g.featureNamespace){const b=this.getOwnLayer(g.layer);if(!b){s.w(`Layer is undefined for selector: ${g.layer}`);continue}const E=c(b.source,b.sourceLayer);if(E in r&&r[E]!==g.featureNamespace){s.w(`"featureNamespace ${g.featureNamespace} of featureset ${p}
54's selector is not associated to the same source, skip this selector`);continue}r[E]=g.featureNamespace}let v;if(g.properties)for(const b in g.properties){const E=s.U(g.properties[b]);E.result==="success"&&(v=v||{},v[b]=E.value)}_.push({layerId:g.layer,namespace:g.featureNamespace,properties:v,uniqueFeatureID:g._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const r=this.getFragmentStyle(t);if(!r||!r.stylesheet.featuresets)return[];const c=[];for(const p in r.stylesheet.featuresets)c.push({featuresetId:p,importId:r.scope?r.scope:void 0});return c}getFeaturesetLayers(t,r){const c=this.getFragmentStyle(r),p=c.stylesheet.featuresets;if(!p||!p[t])return this.fire(new s.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const _=[];for(const g of p[t].selectors){const v=c.getOwnLayer(g.layer);v&&_.push(v)}return _}getConfigProperty(t,r){const c=this.getFragmentStyle(t);if(!c)return null;const p=s.B(r,c.scope),_=c.options.get(p),g=_?_.value||_.default:null;return g?g.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,r){const c=s.B(t,r);return this._mergedIndoor[c]}setIndoorData(t,r){this.map.indoor.setIndoorData(r)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,r,c){const p=this.getFragmentStyle(t);if(!p)return;const _=p.stylesheet.schema;if(!_||!_[r])return;const g=s.U(c);if(g.result!=="success")return void sl(this,g.value);const v=g.value.expression,b=s.B(r,p.scope),E=p.options.get(b);if(!E)return;let C;const{minValue:z,maxValue:R,stepValue:D,type:B,values:O}=_[r],G=s.U(_[r].default);G.result==="success"&&(C=G.value.expression),C?(this.options.set(b,Object.assign({},E,{value:v,default:C,minValue:z,maxValue:R,stepValue:D,type:B,values:O})),this.updateConfigDependencies(r)):this.fire(new s.y(new Error(`No schema defined for the config option "${r}" in the "${t}" fragment.`)))}getConfig(t){const r=this.getFragmentStyle(t);if(!r)return null;const c=r.stylesheet.schema;if(!c)return null;const p={};for(const _ in c){const g=s.B(_,r.scope),v=r.options.get(g),b=v?v.value||v.default:null;p[_]=b?b.serialize():null}return p}setConfig(t,r){const c=this.getFragmentStyle(t);c&&(c.updateConfig(r,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const r=this.getFragmentStyle(t);return r?r.stylesheet.schema:null}setSchema(t,r){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=r,c.updateConfig(c._config,r),this.updateConfigDependencies())}updateConfig(t,r){if(this._config=t,t||r)if(r)for(const c in r){let p,_;const g=s.U(r[c].default);if(g.result==="success"&&(p=g.value.expression),t&&t[c]!==void 0){const R=s.U(t[c]);R.result==="success"&&(_=R.value.expression)}const{minValue:v,maxValue:b,stepValue:E,type:C,values:z}=r[c];if(p){const R=s.B(c,this.scope);this.options.set(R,{default:p,value:_,minValue:v,maxValue:b,stepValue:E,type:C,values:z})}else this.fire(new s.y(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,r=()=>!0){for(const c of t){const p=this.getLayer(c);p&&r(p)&&(p.possiblyEvaluateVisibility(),this._updateLayer(p),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,r=>!t||r.expressionDependencies.configDependencies.has(t)),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(r=>{const c=r._styleColorTheme.colorThemeOverride?r._styleColorTheme.colorThemeOverride:r._styleColorTheme.colorTheme;if(c){const p=r._evaluateColorThemeData(c);(!r._styleColorTheme.lut&&p!==""||r._styleColorTheme.lut&&p!==r._styleColorTheme.lut.data)&&r.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,r,c={}){this._checkLoaded();const p=t.id;if(this._layers[p])return void this.fire(new s.y(new Error(`Layer with i
54d "${p}" already exists on this map`)));let _;if(t.type==="custom"){if(sl(this,s.dt(t)))return;_=s.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(p,t.source),t=s.dp(t),t=Object.assign(t,{source:p})),this._validate(Sf,`layers.${p}`,t,{arrayIndex:-1},c))return;_=s.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(_),_.setEventedParent(this,{layer:{id:p}})}const g=s.B(_.source,_.scope);_.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(g),_.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(g);let v=this._order.length;if(r){const z=this._order.indexOf(r);if(z===-1)return void this.fire(new s.y(new Error(`Layer with id "${r}" does not exist on this map.`)));_.slot===this._layers[r].slot?v=z:s.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(v,0,p),this._layerOrderChanged=!0,this._layers[p]=_;const b=this.getOwnLayerSourceCache(_),E=!!this.directionalLight&&this.directionalLight.shadowsEnabled();b&&_.canCastShadows()&&E&&(b.castsShadows=!0);const C=this._changes.getRemovedLayer(_);if(C&&_.source&&b&&_.type!=="custom"){this._changes.discardLayerRemoval(_);const z=s.B(_.source,_.scope);C.type!==_.type?this._changes.updateSourceCache(z,"clear"):(this._changes.updateSourceCache(z,"reload"),b.pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map),_.scope=this.scope,this.mergeLayers()}moveLayer(t,r){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===r)return;const p=this._order.indexOf(t);this._order.splice(p,1);let _=this._order.length;if(r){const g=this._order.indexOf(r);
54if(g===-1)return void this.fire(new s.y(new Error(`Layer with id "${r}" does not exist on this map.`)));c.slot===this._layers[r].slot?_=g:s.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(_,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;r.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(r.fqid),this._indoorDependentLayers.delete(r.fqid),this._changes.removeLayer(r);const p=this.getOwnLayerSourceCache(r);if(p&&p.castsShadows){let _=!1;for(const g in this._layers)if(this._layers[g].source===r.source&&this._layers[g].canCastShadows()){_=!0;break}p.castsShadows=_}r.onRemove&&r.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const r in this._layers)if(this._layers[r].type===t)return!0;return!1}setLayerZoomRange(t,r,c){this._checkLoaded();const p=this._checkLayer(t);p&&(p.minzoom===r&&p.maxzoom===c||(r!=null&&(p.minzoom=r),c!=null&&(p.maxzoom=c),this._updateLayer(p)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,r){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==r&&(c.slot=r,this._updateLayer(c))}setFilter(t,r,c={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.by(p.filter,r))return r==null?(p.filter=void 0,void this._updateLayer(p)):void(this._validate(Dl,`layers.${p.id}.filter`,r,{layerType:p.type},c)||(p.filter=s.dp(r),this._updateLayer(p)))}getFilter(t){const r=this._checkLayer(t);if(r)return s.dp(r.filter)}setLayoutProperty(t,r,c,p={}){this._checkLoaded();const _=this._checkLayer(t);if(_&&!s.by(_.getLayoutProperty(r),c)){if(c!=null&&(!p||p.validate!==!1)&&sl(_,Te.call(ko,{key:`layers.${t}.layout.${r}`,layerType:_.type,objectKey:r,value:c,styleSpec:s.a6,style:{glyphs:!0,sprite:!0}})))return;_.setLayoutProperty(r,c),_.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(_.fqid),_.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(_.fqid),this._updateLayer(_)}}setLayerProperty(t,r,c,p={}){this._checkLoaded();const _=this._checkLayer(t);_&&(r==="appearances"?(_.setAppearances(c),this._changes.setDirty()):_.isPaintProperty(r)?this.setPaintProperty(t,r,c,p):this.setLayoutProperty(t,r,c,p))}getLayoutProperty(t,r){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(r)}setPaintProperty(t,r,c,p={}){this._checkLoaded();const _=this._checkLayer(t);if(!_||s.by(_.getPaintProperty(r),c)||c!=null&&(!p||p.validate!==!1)&&sl(_,bu.call(ko,{key:`layers.${t}.paint.${r}`,layerType:_.type,objectKey:r,value:c,styleSpec:s.a6})))return;const g=_.setPaintProperty(r,c);_.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(_.fqid),_.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(_.fqid),g&&this._updateLayer(_),this._changes.updatePaintProperties(_)}getPaintProperty(t,r){const c=this._checkLayer(t);if(c)return c.getPaintProperty(r)}setFeatureState(t,r){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:b,importId:E}=t.target,C=this.getFragmentStyle(E),z=C.getFeaturesetLayers(b);for(const{source:R,sourceLayer:D}of z)C.setFeatureState({id:t.id,source:R,sourceLayer:D},r)}else if("layerId"in t.target){const{layerId:b}=t.target,E=this.getLayer(b);this.setFeatureState({id:t.id,source:E.source,sourceLayer:E.sourceLayer},r)}return}const c=t.source,p=t.sourceLayer,_=this._checkSource(c);if(!_)return;const g=_.type;if(g==="geojson"&&p)return void this.fire(new s.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!p)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided.")));const v=this.getOwnSourceCaches(c);for(const b of v)b.setFeatureState(p,t.id,r)}removeFeatureState(t,r){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:b,importId:E}=t.target,C=this.getFragmentStyle(E),z=C.getFeaturesetLayers(b);for(const{source:R,sourceLayer:D}of z)C.removeFeatureState({id:t.id,source:R,sourceLayer:D},r)}else if("layerId"in t.target){const{layerId:b}=t.target,E=this.getLayer(b);this.removeFeatureState({id:t.id,source:E.source,sourceLayer:E.sourceLayer},r)}return}const c=t.source,p=this._checkSource(c);if(!p)return;const _=p.type,g=_==="vector"?t.sourceLayer:void 0;if(_==="vector"&&!g)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.y(new Error("A feature id is required to remove its specific state property.")));const v=this.getOwnSourceCaches(c);for(const b of v)b.removeFeatureState(g,t.id,r)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let _;if("featuresetId"in t.target){const{featuresetId:g,importId:v}=t.target,b=this.getFragmentStyle(v),E=b.getFeaturesetLayers(g);for(const{source:C,sourceLayer:z}of E){const R=b.getFeatureState({id:t.id,source:C,sourceLayer:z});if(R&&!_)_=R;else if(!s.by(_,R))return void this.fire(new s.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:g}=t.target,v=this.getLayer(g);_=this.getFeatureState({id:t.id,source:v.source,sourceLayer:v.sourceLayer})}return _}const r=t.source,c=t.sourceLayer,p=this._checkSource(r);if(p){if(p.type!=="vector"||c)return t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(r)[0].getFeatureState(c,t.id);this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),r=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const r of Object.values(this._mergedLayers))t(r)&&this._updateLayer(r)}_updateLayer(t){this._changes.updateLayer(t);const r=this.getLayerSourceCache(t),c=s.B(t.source,t.scope),p=this._changes.getUpd
vendor: 4,215 bytes, line 54
54atedSourceCaches();t.source&&!p[c]&&r&&r.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),r.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const r=v=>this._mergedLayers[v].is3D(!!this.terrain),c=this.order,p={},_=[];for(let v=c.length-1;v>=0;v--){const b=c[v];if(r(b)){p[b]=v;for(const E of t){const C=E[b];if(C)for(const z of C)_.push(z)}}}_.sort((v,b)=>b.intersectionZ-v.intersectionZ);const g=[];for(let v=c.length-1;v>=0;v--){const b=c[v];if(r(b))for(let E=_.length-1;E>=0;E--){const C=_[E].feature;if(C.layer&&p[C.layer.id]<v)break;g.push(C),_.pop()}else for(const E of t){const C=E[b];if(C)for(const z of C)g.push(z.feature)}}return g}queryRasterValue(t,r,c){const p=this.getOwnSource(t);return p?p.type!=="raster-array"?(this.fire(new s.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):p.queryRasterArrayValue(r,c):(this.fire(new s.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,r,c){let p;r&&!Array.isArray(r)&&r.filter&&(this._validate(Dl,"queryRenderedFeatures.filter",r.filter,null,r),p=s.b6(r.filter));const _={},g=C=>{if(cd.has(C.type))return;const z=this.getOwnLayerSourceCache(C),R=_[z.id]=_[z.id]||{sourceCache:z,layers:{},has3DLayers:!1};C.is3D(!!this.terrain)&&(R.has3DLayers=!0),R.layers[C.fqid]=R.layers[C.fqid]||{styleLayer:C,targets:[]},R.layers[C.fqid].targets.push({filter:p})};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new s.y(new Error("parameters.layers must be an Array."))),[];for(const C of r.layers){const z=this._layers[C];if(!z)return this.fire(new s.y(new Error(`The layer '${C}' does not exist in the map's style and cannot be queried for features.`))),[];g(z)}}else for(const C in this._layers)g(this._layers[C]);const v=this._queryRenderedFeatures(t,_,c),b=this._flattenAndSortRenderedFeatures(v),E=[];for(const C of b)s.dw(C.layer.id)===this.scope&&E.push(C);return E}queryRenderedFeatureset(t,r,c){let p;r&&!Array.isArray(r)&&r.filter&&(this._validate(Dl,"queryRenderedFeatures.filter",r.filter,null,r),p=s.b6(r.filter));const _="mock",g=[];if(r&&r.target)g.push(Object.assign({},r,{targetId:_,filter:p}));else{const C=this.getFeaturesetDescriptors();for(const z of C)g.push({targetId:_,filter:p,target:z});for(const{style:z}of this.fragments){const R=z.getFeaturesetDescriptors();for(const D of R)g.push({targetId:_,filter:p,target:D})}}const v=this.queryRenderedTargets(t,g,c),b=[],E=new Set;for(const C of v)for(const z of C.variants[_])Ac(z,C,E)||b.push(new s.dx(C,z));return b}queryRenderedTargets(t,r,c){const p={},_=(v,b,E,C)=>{const z=p[b.id]=p[b.id]||{sourceCache:b,layers:{},has3DLayers:!1};if(z.layers[v.fqid]=z.layers[v.fqid]||{styleLayer:v,targets:[]},v.is3D(!!this.terrain)&&(z.has3DLayers=!0),!C)return E.uniqueFeatureID=!1,void z.layers[v.fqid].targets.push(E);z.layers[v.fqid].targets.push(Object.assign({},E,{namespace:C.namespace,properties:C.properties,uniqueFeatureID:C.uniqueFeatureID}))};for(const v of r)if("featuresetId"in v.target){const{featuresetId:b,importId:E}=v.target,C=this.getFragmentStyle(E);if(!C||!C._featuresetSelectors)continue;const z=C._featuresetSelectors[b];if(!z){this.fire(new s.y(new Error(`The featureset '${b}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const R of z){const D=C.getOwnLayer(R.layerId);D&&!cd.has(D.type)&&_(D,C.getOwnLayerSourceCache(D),v,R)}}else if("layerId"in v.target){const{layerId:b}=v.target,E=this.getLayer(b);if(!E||cd.has(E.type))continue;_(E,this.getLayerSourceCache(E),v)}const g=this._queryRenderedFeatures(t,p,c);return this._flattenAndSortRenderedFeatures(g)}_queryRenderedFeatures(t,r,c){const p=[],_=!!this.map._showQueryGeometry,g=Bn.createFromScreenPoints(t,c);for(const v in r){const b=qh(g,r[v],this._availableImages,c,_);Object.keys(b).length&&p.push(b)}if(this.placement)for(const v in r){if(!r[v].sourceCache._onlySymbols)continue;const b=Zh(g.screenGeometry,r[v],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(b).length&&p.push(b)}return p}querySourceFeatures(t,r){const c=r&&r.filter;
54c&&this._validate(Dl,"querySourceFeatures.filter",c,null,r);let p=[];const _=this.getOwnSourceCaches(t);for(const g of _)p=p.concat(Wh(g,r));return p}addSourceType(t,r,c){return ds.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(ds.setSourceType(t,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:r.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,r,c={}){this._checkLoaded();const p=this.light.getLight();let _=!1;for(const v in t)if(!s.by(t[v],p[v])){_=!0;break}if(!_)return;const g=this._getTransitionParameters();this.light.setLight(t,r,c),this.light.updateTransitions(g)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,r=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),r===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const p=!("source"in t)||t.source==null;if(r===1){if(this.disableElevatedTerrain)return;if("source"in c&&typeof c.source=="object"){const v="terrain-dem-src";this.addSource(v,c.source),c=s.dp(c),c=Object.assign(c,{source:v})}const _=Object.assign({},c),g={};if(this.terrain&&p){_.source=this.terrain.get().source;const v=this.terrain?this.getFragmentStyle(this.terrain.scope):null;v&&(g.style=v.serialize())}if(this._validate(Tf,"terrain",_,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!p||this.terrain&&r!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,r),this.fire(new s.z("data",{dataType:"style"}))}else{const _=this.terrain,g=_.get();for(const v of Object.keys(s.a6.terrain))!c.hasOwnProperty(v)&&s.a6.terrain[v].default&&(c[v]=s.a6.terrain[v].default);for(const v in t)if(!s.by(t[v],g[v])){_.set(t,this.options),this.stylesheet.terrain=t;const b=this._getTransitionParameters({duration:0});_.updateTransitions(b),this.fire(new s.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const r=this.fog=new hi(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_createSnow(t){const r=this.snow=new dr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_createRain(t){const r=this.rain=new Fn(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const r=this.fog;if(!s.by(r.get(),t)){r.set(t,this.options),this.stylesheet.fog=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const r=this.snow;if(!s.by(r.get(),t)){r.set(t,this.options),this.stylesheet.snow=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const r=this.rain;if(!s.by(r.get(),t)){r.set(t,this.options),this.stylesheet.rain=r.get();const c=this._getTransitionParameters({duration:0});r.updateTransitions(c)}}else this._createRain(t);
54this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const p in this._layers)this._layers[p].lut=this._styleColorTheme.lut;for(const p in this._sourceCaches)this._sourceCaches[p].clearTiles()},r=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!r)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(r);this._loadColorTheme(c).then(()=>{this.fire(new s.z("colorthemeset")),t()}).catch(p=>{s.w(`Couldn't set color theme: ${p}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,r){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=r,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],r=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):r.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...r)}_createTerrain(t,r){const c=this.terrain=new we(t,r,this.scope,this.options,this.map.getWorldview());r===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const p=this._getTransitionParameters({duration:0});c.updateTransitions(p)}_force3DLayerUpdate(){for(const t in this._layers){const r=this._layers[t];r.type==="fill-extrusion"&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const r=this._layers[t];r.type==="symbol"&&this._updateLayer(r)}}_validate(t,r,c,p,_={}){if(_&&_.validate===!1)return!1;const g=Object.assign({},this.serialize());return sl(this,t.call(ko,Object.assign({key:r,style:g,value:c,styleSpec:s.a6},p)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const r=this.getSourceCaches(t);for(const c of r)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const r=this._mergedLayers[t];r._clear&&r._clear()}}reloadSource(t){const r=this.getSourceCaches(t);for(const c of r)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let r;this.directionalLight&&(r=Ou(this.directionalLight));const c=new Set,p=new Set;for(const _ in this._mergedLayers){const g=this._mergedLayers[_];
54g.type==="building"&&c.add(g.source),g.hasElevation()&&!p.has(g.source)&&p.add(g.source)}for(const _ in this._mergedSourceCaches){const g=this._mergedSourceCaches[_],v=p.has(g._source.id);c.has(g._source.id)&&(g._source.reparseOverscaled=!1),g.update(t,void 0,void 0,r,v)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const r=this._sourceCaches[t];r.resume(),r.reload()}}_updatePlacement(t,r,c,p,_,g,v=!1){let b=!1,E=!1;const C={},z={};for(const O of this._mergedOrder){const G=this._mergedLayers[O];if(G.type!=="symbol")continue;const U=s.B(G.source,G.scope);let Z=C[U];if(!Z){const W=this.getLayerSourceCache(G);if(!W)continue;const le=W.getRenderableIds(!0).map(ne=>W.getTileByID(ne));z[U]=le.slice(),Z=C[U]=le.sort((ne,se)=>se.tileID.overscaledZ-ne.tileID.overscaledZ||(ne.tileID.isLessThan(se.tileID)?-1:1))}const K=this.crossTileSymbolIndex.addLayer(G,Z,r.center.lng,r.projection);b=b||K}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),v=v||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new s.z("neworder"));const R=!!(this.placement&&!r.equals(this.placement.transform)),D=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!g||this.placement.lastReplacementSourceUpdateTime!==g.updateTime)),B=(R||D||b||this.placement&&this.placement.isStale())&&p===0;if((v||!this.pauseablePlacement||B||p!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.o.now(),r.zoom))&&(this.pauseablePlacement=new Pr(r,this._mergedOrder,v||p===0,c,p,_,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,C,z,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.o.now()),E=!0),b&&this.pauseablePlacement.placement.setStale()),E||b){this._buildingIndex.onNewFrame(r.zoom);for(let O=0;O<this._mergedOrder.length;O++){const G=this._mergedLayers[this._mergedOrder[O]];if(G.type!=="symbol"||G.visibility==="none")continue;const U=this.isLayerClipped(G);this.placement.updateLayerOpacities(G,C[s.B(G.source,G.scope)],O,U?g:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.o.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,r){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:_})=>_===t.id)!==-1)return void this.fire(new s.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!r)return c.push(t),this._loadImports([t],!0);const p=c.findIndex(({id:_})=>_===r);return p===-1&&this.fire(new s.y(new Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,p).concat(t).concat(c.slice(p)),this._loadImports([t],!0,r)}updateImport(t,r){this._checkLoaded();const c=this.stylesheet.imports||[],p=this.getImportIndex(t);return p===-1?this:typeof r=="string"?(this.setImportUrl(t,r),this):(r.url&&r.url!==c[p].url&&this.setImportUrl(t,r.url),s.by(r.config,c[p].config)||this.setImportConfig(t,r.config,r.data.schema),s.by(r.data,c[p].data)||this.setImportData(t,r.data),this)}moveImport(t,r){this._checkLoaded();let c=this.stylesheet.imports||[];const p=this.getImportIndex(t);if(p===-1)return this;const _=this.getImportIndex(r);if(_===-1)return this;const g=c[p],v=this.fragments[p];return c=c.filter(({id:b})=>b!==t),this.fragments=this.fragments.filter(({id:b})=>b!==t),this.stylesheet.imports=c.slice(0,_).concat(g).concat(c.slice(_)),this.fragments=this.fragments.slice(0,_).concat(v).concat(this.fragments.slice(_)),this.mergeLayers(),this}setImportUrl(t,r){this._checkLoaded();const c=this.stylesheet.imports||[],p=this.getImportIndex(t);if(p===-1)return this;c[p].url=r;const _=this.fragments[p];return _.style=this._createFragmentStyle(c[p]),_.style.on("style.import.load",()=>this.mergeAll()),_.style.loadURL(r),this}setImportData(t,r){this._checkLoaded();const c=this.getImportIndex(t),p=this.stylesheet.imports||[];return c===-1?this:r?(this.fragments[c].style.setState(r),this._reloadImports(),this):(delete p[c].data,this.setImportUrl(t,p[c].url))}setImportConfig(t,r,c){this._checkLoaded();const p=this.getImportIndex(t),_=this.stylesheet.imports||[];if(p===-1)return this;r?_[p].config=r:delete _[p].config;const g=this.fragments[p];c&&g.style.stylesheet&&(g.style.stylesheet.schema=c);const v=g.style.stylesheet&&g.style.stylesheet.schema;return g.config=r,g.style.updateConfig(r,v),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const r=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(r.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const r=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return r===-1&&this.fire(new s.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),r}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const r in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[r];c&&t.push(c.getSource())}return t}getSource(t,r){const c=this.getSourceCache(t,r);return c&&c.getSource()}getLayerSource(t){const r=this.getLayerSourceCache(t);return r&&r.getSource()}getSourceCache(t,r){const c=s.B(t,r);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const r=s.B(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const r=[];return this._mergedOtherSourceCaches[t]&&r.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&r.push(this._mergedSymbolSourceCaches[t]),r}
54updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const r in t){const c=t[r];c==="reload"?this.reloadSource(r):c==="clear"&&this.clearSource(r)}}updateLayers(t){const r=this._changes.getUpdatedPaintProperties();for(const c of r){const p=this.getLayer(c);p&&p.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,r,c){this.imageManager.getImages(r.images,r.scope,c),this._updateTilesForChangedImages();const p=g=>{if(g){const v=r.images.map(b=>s.I.toString(b));g.setDependencies(r.tileID.key,r.type,v)}},_=s.B(r.source,r.scope);p(this._mergedOtherSourceCaches[_]),p(this._mergedSymbolSourceCaches[_]),r.images.some(g=>g.iconsetId)&&this.fire(new s.z("data",{dataType:"style"}))}rasterizeImages(t,r,c){this.imageManager.rasterizeImages(r,c)}getGlyphs(t,r,c){this.glyphManager.getGlyphs(r.stacks,c)}getResource(t,r,c){return s.dz(r,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const r=[];return this._otherSourceCaches[t]&&r.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&r.push(this._symbolSourceCaches[t]),r}_isSourceCacheLoaded(t){const r=this.getOwnSourceCaches(t);return r.length===0?(this.fire(new s.y(new Error(`There is no source with ID '${t}'`))),!1):r.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,r){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),p=t.type==="building";if(t.is3D(!!this.terrain)){if(c||p||r&&r.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}ds.getSourceType=function(l){return Ys[l]},ds.setSourceType=function(l,t){Ys[l]=t},ds.registerForPluginStateChange=s.dA;class qg extends s.E{constructor(t){super(),this._style=t,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},s.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(t){t===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=t,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(t){this._activeFloorsVisible=t,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(t){for(const[r,c]of Object.entries(t.buildings))if(this._buildings[r])for(const p of c.floorIds)this._buildings[r].floors[p]||(this._buildings[r].floors[p]=c.floors[p]);else this._buildings[r]=c;for(const r of t.activeFloors)this._activeFloors.add(r);this._updateIndoorSelector()}getIndoorTileOptions(t,r){const c=this._style.getIndoorSourceLayers(t,r);return c&&this._indoorState?{sourceLayers:c,indoorState:this._indoorState}:null}_updateUI(t,r,c){const p=function(_,g,v,b){let E=null,C=Number.MAX_SAFE_INTEGER;if(b<16)return null;for(const[z,R]of Object.entries(_)){const D=R.center;if(D){const B=g.distanceTo(s.aT.convert(D));B<C&&v.contains(D)&&(C=B,E=z)}}return E}(this._buildings,r,c,t);p!==this._closestBuildingId&&(this._closestBuildingId=p,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,r=this._closestBuildingId,c=r&&t?t[r]:void 0;if(!c)return void this.fire(new s.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));let p=null;for(const g of c.floorIds)if(this._activeFloors&&this._activeFloors.has(g)){p=g;break}const _=Array.from(c.floorIds).map(g=>({id:g,name:c.floors[g].name,zIndex:c.floors[g].zIndex})).sort((g,v)=>v.zIndex-g.zIndex);this.fire(new s.z("selector-update",{selectedFloorId:p,activeFloorsVisible:this._activeFloorsVisible,floors:_}))}_updateActiveFloors(){const t=this._activeFloors;
54this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:t,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Lc=`
55#define EPSILON 0.0000001
56#define PI 3.141592653589793
57#ifdef RENDER_CUTOFF
58float 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);}
59#endif`,zc=`
60#ifdef DUAL_SOURCE_BLENDING
61layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
62#else
63layout(location=0) out vec4 glFragColor;
64#endif
65#ifdef USE_MRT1
66layout(location=1) out vec4 out_Target1;
67#endif
68highp float unpack_depth(highp vec4 rgba_depth)
69{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;}
70#ifdef INDICATOR_CUTOUT
71uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
72#endif
73vec4 applyCutout(vec4 color,float height) {
74#ifdef INDICATOR_CUTOUT
75float 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);
76#else
77return color;
78#endif
79}
80#ifdef DEBUG_WIREFRAME
81#define HANDLE_WIREFRAME_DEBUG \\
82glFragColor=vec4(0.7,0.0,0.0,0.7); \\
83gl_FragDepth=gl_FragCoord.z-0.0001;
84#else
85#define HANDLE_WIREFRAME_DEBUG
86#endif
87#ifdef RENDER_CUTOFF
88uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
89#endif
90vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,Of=`
91#define EXTENT 8192.0
92#define RAD_TO_DEG 180.0/PI
93#define DEG_TO_RAD PI/180.0
94#define GLOBE_RADIUS EXTENT/PI/2.0
95float 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;}
96#ifdef PROJECTION_GLOBE_VIEW
97vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
98#ifndef PROJECTED_POS_ON_VIEWPORT
99float 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;
100#else
101return vec3(0.0);
102#endif
103}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);}
104#endif
105vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
106unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
107);}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);
107return (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);}
108#ifdef RENDER_CUTOFF
109uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
110#endif
111const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
112{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
113#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
114#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
115#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
116#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
117#define DECLARE_MATERIAL_TABLE_INFO
118#endif`,ud="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;}",Zo=`
119#define ELEVATION_SCALE 7.0
120#define ELEVATION_OFFSET 450.0
121#ifdef PROJECTION_GLOBE_VIEW
122uniform 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(
123mix(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;}
124#else
125vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
126#endif
127#ifdef TERRAIN
128uniform 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) {
129#ifdef TERRAIN_DEM_FLOAT_FORMAT
130vec2 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;
131#else
132float 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);
133#endif
134}float prevElevation(vec2 apos) {
135#ifdef TERRAIN_DEM_FLOAT_FORMAT
136vec2 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;
137#else
138float 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);
139#endif
140}
141#ifdef TERRAIN_VERTEX_MORPHING
142float elevation(vec2 apos) {
143#ifdef ZERO_EXAGGERATION
144return 0.0;
145#endif
146float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
147#else
148float elevation(vec2 apos) {
149#ifdef ZERO_EXAGGERATION
150return 0.0;
151#endif
152return currentElevation(apos);}
153#endif
154vec4 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);}
155#else
156float elevation(vec2 pos) { return 0.0; }
157#endif
158#ifdef DEPTH_OCCLUSION
159uniform 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;
160#ifdef DEPTH_D24
161float 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);}
162#else
163highp float unpack_depth_rgba(vec4 rgba_depth)
164{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;}
165#endif
166bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
167#ifdef CLIP_ZERO_TO_ONE
168coord.z=-1.0+2.0*coord.z; 
169#endif
170#ifdef DEPTH_D24
171float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
172#else
173float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
174#endif
175return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
175size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
176#ifdef DEPTH_D24
177highp vec4 depth=vec4(
178texture(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
179);depth=unpack_depth4(depth);
180#else
181highp vec4 depth=vec4(
182unpack_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))
183);
184#endif
185return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
186#ifdef CLIP_ZERO_TO_ONE
187coord.z=-1.0+2.0*coord.z; 
188#endif
189int 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) {
190#ifdef DEPTH_D24
191highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
192#else
193highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
194#endif
195res+=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;
196#ifdef CLIP_ZERO_TO_ONE
197coord.z=-1.0+2.0*coord.z; 
198#endif
199highp 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));}
200#else
201bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
202#endif`,hd=`#ifdef FOG
203uniform 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);}
204#endif`,ht=`#ifdef FOG
205uniform 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;
206#ifdef FLIP_Y
207uv.y=1.0-uv.y;
208#endif
209highp vec3 ray_dir=mix(
210mix(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;}
210vec3 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);}
211#endif`,Ff=`#ifdef RASTER_ARRAY
212uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
213);}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)
214);}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);}
215#endif`,dd=`#ifdef RASTER_ARRAY
216uniform 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;}
217#endif
218uniform 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;}`,pd=`#ifdef RENDER_SHADOWS
219uniform 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];}
220#endif`,Bf=`#ifdef RENDER_SHADOWS
221precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
221p float bias) {
222#ifdef CLIP_ZERO_TO_ONE
223highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
224#else
225highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
226#endif
227return 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;
228#ifdef SHADOWS_SINGLE_CASCADE
229vec2 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);
230#else
231light_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);
232#endif
233}highp float calculate_shadow_bias(float NDotL) {
234#ifdef NORMAL_OFFSET
235return 0.5*u_shadow_bias.x;
236#else
237return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
238#endif
239}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)
240{highp vec2 biasUV=vec2(
241pos_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);}
242#endif`;const Bu=/#include\s+"([^"]+)"/g,na=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,Nf=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Ul=new Set(["ifdef","ifndef","elif","if","defined"]),Gl=new Set;cl(Lc,Gl),cl(Of,Gl),cl(zc,Gl);const ll={"_prelude_fog.vertex.glsl":hd,"_prelude_terrain.vertex.glsl":Zo,"_prelude_shadow.vertex.glsl":pd,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
243#define MATERIAL_TABLE_DEBUG 0
244uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
245#if MATERIAL_TABLE_DEBUG
246vec4 colorDebug;
247#endif
248};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);}
248float 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++) { 
249if (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; 
250}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 { 
251iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
252#if MATERIAL_TABLE_DEBUG
253const 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;
254#endif
255uint offset=0u;
256#if MATERIAL_TABLE_DEBUG
257bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
258#endif
259offset++;
260#if MATERIAL_TABLE_DEBUG
261uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
262#endif
263offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
264#if MATERIAL_TABLE_DEBUG
265if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
266#endif
267uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
268#if MATERIAL_TABLE_DEBUG
269if(keepFinding)
270{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;}}}
271#endif
272offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
273#if MATERIAL_TABLE_DEBUG
274if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
275#endif
276info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
277{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);}
278#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
279#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
280#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
281#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
282#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
283#endif`,"_prelude_fog.fragment.glsl":ht,"_prelude_shadow.fragment.glsl":Bf,"_prelude_lighting.glsl":`
284#ifdef LIGHTING_3D_MODE
285uniform 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
285));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);}
286#endif`,"_prelude_raster_array.glsl":Ff,"_prelude_raster_particle.glsl":dd},fd={};Bi("",Zo),Bi(ht,hd),Bi(Bf,pd),Bi(Ff,""),Bi(dd,"");const Zg=Bi(zc,Of),md=Lc,Yx=[`
287#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
288#extension GL_EXT_blend_func_extended : require
289#endif`,"precision mediump float;",md,Zg.fragmentSource].join(`
290`),Wg=["precision highp float;",md,Zg.vertexSource].join(`
291`);var Vf={background:Bi(`#include "_prelude_fog.fragment.glsl"
292#include "_prelude_lighting.glsl"
293uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
294#ifdef LIGHTING_3D_MODE
295in vec4 v_color;
296#endif
297void main() {vec4 out_color;
298#ifdef LIGHTING_3D_MODE
299out_color=v_color;
300#else
301out_color=u_color;
302#endif
303#ifdef FOG
304out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
305#endif
306glFragColor=out_color*u_opacity;
307#ifdef USE_MRT1
308out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
309#endif
310#ifdef OVERDRAW_INSPECTOR
311glFragColor=vec4(1.0);
312#endif
313HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
314#include "_prelude_lighting.glsl"
315in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
316#ifdef LIGHTING_3D_MODE
317uniform mediump vec4 u_color;out vec4 v_color;
318#endif
319void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
320#ifdef LIGHTING_3D_MODE
321v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
322#endif
323#ifdef FOG
324v_fog_pos=fog_position(a_pos);
325#endif
326}`),backgroundPattern:Bi(`#include "_prelude_fog.fragment.glsl"
327#include "_prelude_lighting.glsl"
328uniform 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);
329#ifdef LIGHTING_3D_MODE
330out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
331#endif
332#ifdef FOG
333out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
334#endif
335glFragColor=out_color*u_opacity;
336#ifdef USE_MRT1
337out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
338#endif
339#ifdef OVERDRAW_INSPECTOR
340glFragColor=vec4(1.0);
341#endif
342HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
343uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
344#ifdef FOG
345v_fog_pos=fog_position(a_pos);
346#endif
347}`),building:Bi(`#include "_prelude_fog.fragment.glsl"
348#include "_prelude_shadow.fragment.glsl"
349#include "_prelude_lighting.glsl"
350const 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;
351#ifdef BUILDING_FAUX_FACADE
352in 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;
353#endif
354#ifdef RENDER_SHADOWS
355in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
356#endif
357#ifdef FLOOD_LIGHT
358in highp float v_flood_radius;in float v_has_flood_light;
359#endif
360uniform 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));}
361#ifdef BUILDING_FAUX_FACADE
362float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}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 vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
363#if 0
364if (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;
365#else
366if (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;
367#endif
368return out_color;}
369#endif
370vec3 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;
371#ifdef BUILDING_FAUX_FACADE
372if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
373#endif
374vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
375#ifdef RENDER_SHADOWS
376#ifdef RENDER_CUTOFF
377shadowed_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;}
378#else
379shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
380#endif
381#else
382shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir);
383#endif
384color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
385#ifdef FLOOD_LIGHT
386float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);
387#endif
388color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
389#ifdef FOG
390color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
391#endif
392color*=u_opacity;
393#ifdef INDICATOR_CUTOUT
394color=applyCutout(color,v_pos.z);
395#endif
396#ifdef FEATURE_CUTOUT
397color=apply_feature_cutout(color,gl_FragCoord);
398#endif
399glFragColor=color; 
400#ifdef DEBUG_SHOW_NORMALS
401color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
402#endif
403#ifdef OVERDRAW_INSPECTOR
404glFragColor=vec4(1.0);
405#endif
406HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
407#include "_prelude_shadow.vertex.glsl"
408in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
409#ifdef BUILDING_FAUX_FACADE
410out 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;
411#endif
412#ifdef RENDER_SHADOWS
413uniform 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;
414#endif
415#ifdef FLOOD_LIGHT
416out highp float v_flood_radius;out float v_has_flood_light;
417#endif
418const 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));}
419#ifdef BUILDING_FAUX_FACADE
420mat3 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);}
421#endif
422#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
423#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
424void main() {
425#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
426#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
427#ifdef FLOOD_LIGHT
428v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
429#endif
430vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;
431#ifdef BUILDING_FAUX_FACADE
432v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;}
433#endif
434v_pos=a_pos_3f;
435#ifdef RENDER_CUTOFF
436vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
437#endif
438#ifdef RENDER_SHADOWS
439vec3 shadow_pos=v_pos;
440#ifdef NORMAL_OFFSET
441vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
442#endif
443v_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);
444#endif
445#ifdef FOG
446v_fog_pos=fog_position(v_pos);
447#endif
448gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Bi(`in vec4 v_color_emissive;
449#pragma mapbox: define-attribute highp vec4 bloom_attenuation
450#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
451float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
452#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
453float 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));
453opacity*=saturate(1.0-distance*distance);
454#endif
455#ifdef RENDER_CUTOFF
456opacity*=v_cutoff_opacity;
457#endif
458glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
459#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
460#pragma mapbox: define-attribute highp vec4 bloom_attenuation
461out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
462#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
463#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
464#ifdef HAS_ATTRIBUTE_a_part_color_emissive
465vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
466#else
467v_color_emissive=vec4(1.0);
468#endif
469gl_Position=u_matrix*vec4(a_pos_3f,1.0);
470#ifdef RENDER_CUTOFF
471v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
472#endif
473}`),buildingDepth:Bi(`in highp float v_depth;void main() {
474#ifndef DEPTH_TEXTURE
475glFragColor=pack_depth(v_depth);
476#endif
477}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Bi(`#include "_prelude_fog.fragment.glsl"
478#include "_prelude_lighting.glsl"
479in vec3 v_data;in float v_visibility;
480#pragma mapbox: define highp vec4 color
481#pragma mapbox: define mediump float radius
482#pragma mapbox: define lowp float blur
483#pragma mapbox: define lowp float opacity
484#pragma mapbox: define highp vec4 stroke_color
485#pragma mapbox: define mediump float stroke_width
486#pragma mapbox: define lowp float stroke_opacity
487uniform float u_emissive_strength;void main() {
488#pragma mapbox: initialize highp vec4 color
489#pragma mapbox: initialize mediump float radius
490#pragma mapbox: initialize lowp float blur
491#pragma mapbox: initialize lowp float opacity
492#pragma mapbox: initialize highp vec4 stroke_color
493#pragma mapbox: initialize mediump float stroke_width
494#pragma mapbox: initialize lowp float stroke_opacity
495vec2 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 ? 
496smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
497smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
498antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
499);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
500#ifdef LIGHTING_3D_MODE
501out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
502#endif
503#ifdef FOG
504out_color=fog_apply_premultiplied(out_color,v_fog_pos);
505#endif
506glFragColor=out_color*(v_visibility*opacity_t);
507#ifdef OVERDRAW_INSPECTOR
508glFragColor=vec4(1.0);
509#endif
510}`,`#include "_prelude_fog.vertex.glsl"
511#include "_prelude_terrain.vertex.glsl"
512#define NUM_VISIBILITY_RINGS 2
513#define INV_SQRT2 0.70710678
514#define ELEVATION_BIAS 0.0001
515#define NUM_SAMPLES_PER_RING 16
516uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
517#ifdef PROJECTION_GLOBE_VIEW
518in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
519#endif
520#ifdef ELEVATED_ROADS
521in float a_circle_z_offset;
522#endif
523out vec3 v_data;out float v_visibility;
524#pragma mapbox: define highp vec4 color
525#pragma mapbox: define mediump float radius
526#pragma mapbox: define lowp float blur
527#pragma mapbox: define lowp float opacity
528#pragma mapbox: define highp vec4 stroke_color
529#pragma mapbox: define mediump float stroke_width
530#pragma mapbox: define lowp float stroke_opacity
531vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
531iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
532#if defined(TERRAIN)
533return elevation(pos)+ELEVATION_BIAS;
534#else
535return 0.0;
536#endif
537}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);
538#ifdef PITCH_WITH_MAP
539#ifdef PROJECTION_GLOBE_VIEW
540return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
541#else
542return u_matrix*( world_center+vec4(sample_offset,0,0) );
543#endif
544#else
545return projected_center+vec4(sample_offset,0,0);
546#endif
547}float get_sample_step() {
548#ifdef PITCH_WITH_MAP
549return 2.0*PI/float(NUM_SAMPLES_PER_RING);
550#else
551return PI/float(NUM_SAMPLES_PER_RING);
552#endif
553}void main() {
554#pragma mapbox: initialize highp vec4 color
555#pragma mapbox: initialize mediump float radius
556#pragma mapbox: initialize lowp float blur
557#pragma mapbox: initialize lowp float opacity
558#pragma mapbox: initialize highp vec4 stroke_color
559#pragma mapbox: initialize mediump float stroke_width
560#pragma mapbox: initialize lowp float stroke_opacity
561vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
562#ifdef PROJECTION_GLOBE_VIEW
563vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
564#else 
565surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
566#endif
567#ifdef ELEVATED_ROADS
568world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
569#endif
570vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
571#ifdef PITCH_WITH_MAP
572#ifdef SCALE_WITH_MAP
573view_scale=1.0;
574#else
575view_scale=projected_center.w/u_camera_to_center_distance;
576#endif
577#else
578#ifdef SCALE_WITH_MAP
579view_scale=u_camera_to_center_distance;
580#else
581view_scale=projected_center.w;
582#endif
583#endif
584gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
585#ifdef TERRAIN
586float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
587#ifdef PITCH_WITH_MAP
588float 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;
589#else
590occlusion_world_center=world_center;occlusion_projected_center=projected_center;
591#endif
592for(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);
593#else
594visibility=1.0;
595#endif
596#ifdef PROJECTION_GLOBE_VIEW
597visibility=1.0;
598#endif
599v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
600#ifdef FOG
601v_fog_pos=fog_position(world_center.xyz);
602#endif
603}`),clippingMask:Bi("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Bi(`#include "_prelude_fog.fragment.glsl"
604uniform highp float u_intensity;in vec2 v_extrude;
605#pragma mapbox: define highp float weight
606#define GAUSS_COEF 0.3989422804014327
607void main() {
608#pragma mapbox: initialize highp float weight
609float 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);
610#ifdef FOG
611if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
612#endif
613#ifdef OVERDRAW_INSPECTOR
614glFragColor=vec4(1.0);
615#endif
616HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
617#include "_prelude_fog.vertex.glsl"
618uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
619#ifdef PROJECTION_GLOBE_VIEW
620in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
621#endif
622out vec2 v_extrude;
623#pragma mapbox: define highp float weight
624#pragma mapbox: define mediump float radius
625const highp float ZERO=1.0/255.0/16.0;
626#define GAUSS_COEF 0.3989422804014327
627void main() {
628#pragma mapbox: initialize highp float weight
629#pragma mapbox: initialize mediump float radius
630vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
631#ifdef PROJECTION_GLOBE_VIEW
632vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
633#else
634pos=vec3(tilePos+extrude,elevation(tilePos));
635#endif
636gl_Position=u_matrix*vec4(pos,1);
637#ifdef FOG
638v_fog_pos=fog_position(pos);
639#endif
640}`),heatmapTexture:Bi(`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;
641#ifdef OVERDRAW_INSPECTOR
642glFragColor=vec4(0.0);
643#endif
644HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Bi("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"
645in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
646#ifdef PROJECTION_GLOBE_VIEW
647uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
648#endif
649out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
650#ifdef PROJECTION_GLOBE_VIEW
651#ifndef PROJECTED_POS_ON_VIEWPORT
652vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
653#endif
654#endif
655vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
6560.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Bi("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
657mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
6580.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Bi("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"
659in vec2 a_pos;
660#ifdef PROJECTION_GLOBE_VIEW
661in vec3 a_pos_3;
662#endif
663out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
664#ifdef PROJECTION_GLOBE_VIEW
665gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
666#else
667gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
668#endif
669}`),elevatedStructuresDepth:Bi(`void main() {
670#ifndef DEPTH_TEXTURE
671glFragColor=vec4(0.);
672#endif
673}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Bi(`#ifdef DEPTH_RECONSTRUCTION
674in float v_height;
675#endif
676void main() {
677#ifdef DEPTH_RECONSTRUCTION
678if (v_height >=0.0)
679discard;
680#else
681#ifdef FEATURE_CUTOUT
682apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord);
683#endif
684#endif
685glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
686#ifdef DEPTH_RECONSTRUCTION
687out float v_height;
688#endif
689void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
690#ifdef DEPTH_RECONSTRUCTION
691if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
692#endif
693gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Bi(`#include "_prelude_fog.fragment.glsl"
694#include "_prelude_lighting.glsl"
695#include "_prelude_shadow.fragment.glsl"
696in vec3 v_normal;in float v_height;
697#ifdef RENDER_SHADOWS
698in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
699#endif
700vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
700vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
701{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;
702#pragma mapbox: define highp vec4 structure_color
703void main() {
704#pragma mapbox: initialize highp vec4 structure_color
705vec3 color=structure_color.xyz;
706#ifdef LIGHTING_3D_MODE
707vec3 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);
708#ifdef RENDER_SHADOWS
709float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
710#else
711color=apply_lighting(color,transformed_normal);
712#endif
713color=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);}
714#endif
715#ifdef FOG
716color=fog_apply(color,v_fog_pos);
717#endif
718vec4 out_color=vec4(color,1.0);
719#ifdef INDICATOR_CUTOUT
720out_color=applyCutout(out_color,v_height);
721#endif
722#ifdef FEATURE_CUTOUT
723out_color=apply_feature_cutout(out_color,gl_FragCoord);
724#endif
725glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
726#include "_prelude_shadow.vertex.glsl"
727in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
728#ifdef RENDER_SHADOWS
729uniform 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;
730#endif
731#pragma mapbox: define highp vec4 structure_color
732void main() {
733#pragma mapbox: initialize highp vec4 structure_color
734v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
735#ifdef RENDER_SHADOWS
736vec3 shd_pos0=pos;vec3 shd_pos1=pos;
737#ifdef NORMAL_OFFSET
738vec3 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();
739#endif
740v_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;
741#endif
742#ifdef FOG
743v_fog_pos=fog_position(a_pos);
744#endif
745}`),fill:Bi(`#include "_prelude_fog.fragment.glsl"
746#include "_prelude_lighting.glsl"
747#include "_prelude_shadow.fragment.glsl"
748#pragma mapbox: define highp vec4 color
749#pragma mapbox: define lowp float opacity
750uniform float u_emissive_strength;
751#ifdef RENDER_SHADOWS
752uniform 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;
753#endif
754#ifdef ELEVATED_ROADS
755in highp float v_road_z_offset;
756#endif
757#ifdef INDICATOR_CUTOUT
758in highp float v_z_offset;
759#endif
760void main() {
761#pragma mapbox: initialize highp vec4 color
762#pragma mapbox: initialize lowp float opacity
763vec4 out_color=color;
764#ifdef LIGHTING_3D_MODE
765out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
766#ifdef RENDER_SHADOWS
767float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
768#endif
769#endif
770#ifdef FOG
771out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
772#endif
773out_color*=opacity;
774#ifdef INDICATOR_CUTOUT
775if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
776#endif
777#ifdef FEATURE_CUTOUT
778out_color=apply_feature_cutout(out_color,gl_FragCoord);
779#endif
780glFragColor=out_color;
781#ifdef USE_MRT1
782out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
783#endif
784#ifdef OVERDRAW_INSPECTOR
785glFragColor=vec4(1.0);
786#endif
787HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
788#include "_prelude_shadow.vertex.glsl"
789in vec2 a_pos;
790#ifdef ELEVATED_ROADS
791in float a_road_z_offset;out highp float v_road_z_offset;
792#endif
793#ifdef RENDER_SHADOWS
794uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
795#endif
796#ifdef INDICATOR_CUTOUT
797out highp float v_z_offset;
798#endif
799uniform mat4 u_matrix;
800#pragma mapbox: define highp vec4 color
801#pragma mapbox: define lowp float opacity
802#pragma mapbox: define highp float z_offset
803void main() {
804#pragma mapbox: initialize highp vec4 color
805#pragma mapbox: initialize lowp float opacity
806#pragma mapbox: initialize highp float z_offset
807#ifdef ELEVATED_ROADS
808z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
809#endif
810float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
811#ifdef RENDER_SHADOWS
812vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
813#ifdef NORMAL_OFFSET
814vec3 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();
815#endif
816v_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;
817#endif
818#ifdef FOG
819v_fog_pos=fog_position(a_pos);
820#endif
821#ifdef INDICATOR_CUTOUT
822v_z_offset=z_offset;
823#endif
824}`),fillOutline:Bi(`#include "_prelude_fog.fragment.glsl"
825#include "_prelude_lighting.glsl"
826#include "_prelude_shadow.fragment.glsl"
827in highp vec2 v_pos;uniform float u_emissive_strength;
828#ifdef RENDER_SHADOWS
829uniform 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;
830#endif
831#pragma mapbox: define highp vec4 outline_color
832#pragma mapbox: define lowp float opacity
833void main() {
834#pragma mapbox: initialize highp vec4 outline_color
835#pragma mapbox: initialize lowp float opacity
836float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
837#ifdef LIGHTING_3D_MODE
838out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
839#ifdef RENDER_SHADOWS
840float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
841#endif
842#endif
843#ifdef FOG
844out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
845#endif
846#ifdef FEATURE_CUTOUT
847out_color=apply_feature_cutout(out_color,gl_FragCoord);
848#endif
849glFragColor=out_color*(alpha*opacity);
850#ifdef USE_MRT1
851out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
852#endif
853#ifdef OVERDRAW_INSPECTOR
854glFragColor=vec4(1.0);
855#endif
856HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
857#include "_prelude_shadow.vertex.glsl"
858in vec2 a_pos;
859#ifdef ELEVATED_ROADS
860in float a_road_z_offset;
861#endif
862#ifdef RENDER_SHADOWS
863uniform 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;
864#endif
865uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
866#pragma mapbox: define highp vec4 outline_color
867#pragma mapbox: define lowp float opacity
868#pragma mapbox: define highp float z_offset
869void main() {
870#pragma mapbox: initialize highp vec4 outline_color
871#pragma mapbox: initialize lowp float opacity
872#pragma mapbox: initialize highp float z_offset
873#ifdef ELEVATED_ROADS
874z_offset+=a_road_z_offset;
875#endif
876float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
877#ifdef FLIP_Y
878v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
879#else
880v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
881#endif
882#ifdef RENDER_SHADOWS
883vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
884#ifdef NORMAL_OFFSET
885vec3 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();
886#endif
887v_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;
888#endif
889#ifdef FOG
890v_fog_pos=fog_position(a_pos);
891#endif
892}`),fillOutlinePattern:Bi(`#include "_prelude_fog.fragment.glsl"
893#include "_prelude_lighting.glsl"
894#include "_prelude_shadow.fragment.glsl"
895uniform vec2 u_texsize;uniform sampler2D u_image;
896#ifdef FILL_PATTERN_TRANSITION
897uniform float u_pattern_transition;
898#endif
899uniform float u_emissive_strength;
900#ifdef APPLY_LUT_ON_GPU
901uniform highp sampler3D u_lutTexture;
902#endif
903#ifdef RENDER_SHADOWS
904uniform 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;
905#endif
906in highp vec2 v_pos;in highp vec2 v_pos_world;
907#pragma mapbox: define lowp float opacity
908#pragma mapbox: define lowp vec4 pattern
909#ifdef FILL_PATTERN_TRANSITION
910#pragma mapbox: define mediump vec4 pattern_b
911#endif
912void main() {
913#pragma mapbox: initialize lowp float opacity
914#pragma mapbox: initialize mediump vec4 pattern
915#ifdef FILL_PATTERN_TRANSITION
916#pragma mapbox: initialize mediump vec4 pattern_b
917#endif
918vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
919#ifdef APPLY_LUT_ON_GPU
920out_color=applyLUT(u_lutTexture,out_color);
921#endif
922#ifdef FILL_PATTERN_TRANSITION
923vec2 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;
924#endif
925#ifdef LIGHTING_3D_MODE
926out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
927#ifdef RENDER_SHADOWS
928float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
929#endif
930#endif
931#ifdef FEATURE_CUTOUT
932out_color=apply_feature_cutout(out_color,gl_FragCoord);
933#endif
934#ifdef FOG
935out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
936#endif
937glFragColor=out_color*(alpha*opacity);
938#ifdef USE_MRT1
939out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
940#endif
941#ifdef OVERDRAW_INSPECTOR
942glFragColor=vec4(1.0);
943#endif
944HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
945#include "_prelude_shadow.vertex.glsl"
946uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
947#ifdef ELEVATED_ROADS
948in float a_road_z_offset;
949#endif
950#ifdef RENDER_SHADOWS
951uniform 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;
952#endif
953out highp vec2 v_pos;out highp vec2 v_pos_world;
954#pragma mapbox: define lowp float opacity
955#pragma mapbox: define lowp vec4 pattern
956#ifdef FILL_PATTERN_TRANSITION
957#pragma mapbox: define mediump vec4 pattern_b
958#endif
959#pragma mapbox: define lowp float pixel_ratio
960#pragma mapbox: define highp float z_offset
961void main() {
962#pragma mapbox: initialize lowp float opacity
963#pragma mapbox: initialize mediump vec4 pattern
964#ifdef FILL_PATTERN_TRANSITION
965#pragma mapbox: initialize mediump vec4 pattern_b
966#endif
967#pragma mapbox: initialize lowp float pixel_ratio
968#pragma mapbox: initialize highp float z_offset
969vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
970#ifdef ELEVATED_ROADS
971z_offset+=a_road_z_offset;
972#endif
973float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
974#ifdef FLIP_Y
975v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
976#else
977v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
978#endif
979#ifdef RENDER_SHADOWS
980vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
981#ifdef NORMAL_OFFSET
982vec3 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();
983#endif
984v_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;
985#endif
986#ifdef FOG
987v_fog_pos=fog_position(a_pos);
988#endif
989}`),fillPattern:Bi(`#include "_prelude_fog.fragment.glsl"
990#include "_prelude_lighting.glsl"
991#include "_prelude_shadow.fragment.glsl"
992uniform vec2 u_texsize;uniform sampler2D u_image;
993#ifdef FILL_PATTERN_TRANSITION
994uniform float u_pattern_transition;
995#endif
996in highp vec2 v_pos;uniform float u_emissive_strength;
997#ifdef RENDER_SHADOWS
998uniform 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;
999#endif
1000#ifdef ELEVATED_ROADS
1001in highp float v_road_z_offset;
1002#endif
1003#ifdef APPLY_LUT_ON_GPU
1004uniform highp sampler3D u_lutTexture;
1005#endif
1006#pragma mapbox: define lowp float opacity
1007#pragma mapbox: define lowp vec4 pattern
1008#ifdef FILL_PATTERN_TRANSITION
1009#pragma mapbox: define mediump vec4 pattern_b
1010#endif
1011void main() {
1012#pragma mapbox: initialize lowp float opacity
1013#pragma mapbox: initialize mediump vec4 pattern
1014#ifdef FILL_PATTERN_TRANSITION
1015#pragma mapbox: initialize mediump vec4 pattern_b
1016#endif
1017vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1018#ifdef APPLY_LUT_ON_GPU
1019out_color=applyLUT(u_lutTexture,out_color);
1020#endif
1021#ifdef FILL_PATTERN_TRANSITION
1022vec2 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;
1023#endif
1024#ifdef LIGHTING_3D_MODE
1025out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1026#ifdef RENDER_SHADOWS
1027float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1028#ifdef ELEVATED_ROADS
1029out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1030#else
1031out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1032#endif
1033#endif
1034#endif
1035#ifdef FEATURE_CUTOUT
1036out_color=apply_feature_cutout(out_color,gl_FragCoord);
1037#endif
1038#ifdef FOG
1039out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1040#endif
1041glFragColor=out_color*opacity;
1042#ifdef USE_MRT1
1043out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1044#endif
1045#ifdef OVERDRAW_INSPECTOR
1046glFragColor=vec4(1.0);
1047#endif
1048HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1049#include "_prelude_shadow.vertex.glsl"
1050uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
1051#ifdef ELEVATED_ROADS
1052in float a_road_z_offset;out highp float v_road_z_offset;
1053#endif
1054#ifdef RENDER_SHADOWS
1055uniform 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;
1056#endif
1057out highp vec2 v_pos;
1058#pragma mapbox: define lowp float opacity
1059#pragma mapbox: define lowp vec4 pattern
1060#ifdef FILL_PATTERN_TRANSITION
1061#pragma mapbox: define mediump vec4 pattern_b
1062#endif
1063#pragma mapbox: define lowp float pixel_ratio
1064#pragma mapbox: define highp float z_offset
1065void main() {
1066#pragma mapbox: initialize lowp float opacity
1067#pragma mapbox: initialize mediump vec4 pattern
1068#pragma mapbox: initialize lowp float pixel_ratio
1069#pragma mapbox: initialize highp float z_offset
1070#ifdef FILL_PATTERN_TRANSITION
1071#pragma mapbox: initialize mediump vec4 pattern_b
1072#endif
1073vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
1074#ifdef ELEVATED_ROADS
1075z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
1076#endif
1077float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pa
1077ttern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
1078#ifdef RENDER_SHADOWS
1079vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
1080#ifdef NORMAL_OFFSET
1081vec3 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();
1082#endif
1083v_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;
1084#endif
1085#ifdef FOG
1086v_fog_pos=fog_position(a_pos);
1087#endif
1088}`),fillExtrusion:Bi(`#include "_prelude_fog.fragment.glsl"
1089#include "_prelude_shadow.fragment.glsl"
1090#include "_prelude_lighting.glsl"
1091in vec4 v_color;in vec4 v_flat;
1092#ifdef RENDER_SHADOWS
1093in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
1094#endif
1095uniform lowp float u_opacity;
1096#ifdef FAUX_AO
1097uniform lowp vec2 u_ao;in vec2 v_ao;
1098#endif
1099#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1100in vec4 v_roof_color;
1101#endif
1102#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1103in highp vec3 v_normal;
1104#endif
1105uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
1106#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1107in float v_flood_radius;in float v_has_floodlight;
1108#endif
1109in float v_height;
1110#pragma mapbox: define highp float emissive_strength
1111void main() {
1112#pragma mapbox: initialize highp float emissive_strength
1113#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1114vec3 normal=normalize(v_normal);
1115#endif
1116float z;vec4 color=v_color;
1117#ifdef ZERO_ROOF_RADIUS
1118z=float(normal.z > 0.00001);
1119#ifdef LIGHTING_3D_MODE
1120normal=mix(normal,vec3(0.0,0.0,1.0),z);
1121#else
1122color=mix(v_color,v_roof_color,z);
1123#endif
1124#endif
1125float h=max(0.0,v_height);float ao_shade=1.0;
1126#ifdef FAUX_AO
1127float 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;
1128#ifdef ZERO_ROOF_RADIUS
1129concave*=(1.0-z);
1130#endif
1131float 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);
1132#ifdef LIGHTING_3D_MODE
1133#ifdef FLOOD_LIGHT
1134color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
1135#else
1136color.rgb*=ao_shade;
1137#endif
1138#else
1139color.rgb*=ao_shade;
1140#endif
1141#endif
1142#ifdef LIGHTING_3D_MODE
1143float flood_radiance=0.0;
1144#ifdef FLOOD_LIGHT
1145flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
1146#endif
1147#ifdef RENDER_SHADOWS
1148#ifdef FLOOD_LIGHT
1149float 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);
1150#else
1151float shadowed_lighting_factor;
1152#ifdef RENDER_CUTOFF
1153shadowed_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;}
1154#else
1155shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
1156#endif
1157color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
1158#endif
1159#else
1160color.rgb=apply_lighting(color.rgb,normal);
1161#ifdef FLOOD_LIGHT
1162color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
1163#endif
1164#endif
1165color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1166#endif
1167#ifdef FOG
1168color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1169#endif
1170#ifdef INDICATOR_CUTOUT
1171color=applyCutout(color,h);
1172#endif
1173#ifdef FEATURE_CUTOUT
1174color=apply_feature_cutout(color,gl_FragCoord);
1175#endif
1176glFragColor=color;
1177#ifdef OVERDRAW_INSPECTOR
1178glFragColor=vec4(1.0);
1179#endif
1180HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1181#include "_prelude_terrain.vertex.glsl"
1182#include "_prelude_shadow.vertex.glsl"
1183#include "_prelude_lighting.glsl"
1184#include "_prelude_material_table.vertex.glsl"
1185uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1186#ifdef RENDER_WALL_MODE
1187in vec3 a_join_normal_inside;
1188#endif
1189#ifdef PROJECTION_GLOBE_VIEW
1190in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1191#endif
1192#ifdef TERRAIN
1193uniform int u_height_type;uniform int u_base_type;
1194#endif
1195uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1196#ifdef RENDER_SHADOWS
1197uniform 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;
1198#endif
1199#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1200out vec4 v_roof_color;
1201#endif
1202#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1203out highp vec3 v_normal;
1204#endif
1205#ifdef FAUX_AO
1206uniform lowp vec2 u_ao;out vec2 v_ao;
1207#endif
1208#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1209out float v_flood_radius;out float v_has_floodlight;
1210#endif
1211out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1212#pragma mapbox: define highp float base
1213#pragma mapbox: define highp float height
1214#pragma mapbox: define highp vec4 color
1215#pragma mapbox: define highp float flood_light_wall_radius
1216#pragma mapbox: define highp float line_width
1217#pragma mapbox: define highp float emissive_strength
1218void main() {DECLARE_MATERIAL_TABLE_INFO
1219#pragma mapbox: initialize highp float base
1220#pragma mapbox: initialize highp float height
1221#pragma mapbox: initialize highp vec4 color
1222#pragma mapbox: initialize highp float flood_light_wall_radius
1223#pragma mapbox: initialize highp float line_width
1224#pragma mapbox: initialize highp float emissive_strength
1225base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1226#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1227v_normal=normal;
1228#endif
1229base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1230#if defined(HAS_CENTROID) || defined(TERRAIN)
1231centroid_pos=a_centroid_pos;
1232#endif
1233float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1234#ifdef TERRAIN
1235bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1236#else
1237h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1238#endif
1239#ifdef PROJECTION_GLOBE_VIEW
1240float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1241#endif
1242float cutoff=1.0;vec3 scaled_pos=pos;
1243#ifdef RENDER_CUTOFF
1244vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1245#ifdef CLIP_ZERO_TO_ONE
1246cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1247#else
1248cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1249#endif
1250if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
1251#endif
1252float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1253#ifdef RENDER_WALL_MODE
1254vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1255#endif
1256gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1257#ifdef RENDER_SHADOWS
1258vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1259#ifdef NORMAL_OFFSET
1260vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1261#endif
1262v_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);
1263#endif
1264float NdotL=0.0;float colorvalue=0.0;
1265#ifndef LIGHTING_3D_MODE
1266colorvalue=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*=(
1267(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1268#endif
1269#ifdef FAUX_AO
1270float 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;
1271#ifdef TERRAIN
1272top_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);
1273#endif
1274v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1275#ifdef PROJECTION_GLOBE_VIEW
1276top_height+=u_height_lift;
1277#endif
1278gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1279#endif
1280#ifdef LIGHTING_3D_MODE
1281#ifdef FLOOD_LIGHT
1282float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
1283#endif
1284v_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);
1285#else
1286v_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;
1287#endif
1288#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1289float 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;
1290#endif
1291#ifdef FOG
1292v_fog_pos=fog_position(pos);
1293#endif
1294}`),fillExtrusionDepth:Bi(`in highp float v_depth;void main() {
1295#ifndef DEPTH_TEXTURE
1296glFragColor=pack_depth(v_depth);
1297#endif
1298}`,`#include "_prelude_terrain.vertex.glsl"
1299#include "_prelude_material_table.vertex.glsl"
1300uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1301#ifdef TERRAIN
1302uniform int u_height_type;uniform int u_base_type;
1303#endif
1304in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1305#ifdef RENDER_WALL_MODE
1306in vec3 a_join_normal_inside;
1307#endif
1308#pragma mapbox: define highp float base
1309#pragma mapbox: define highp float height
1310#pragma mapbox: define highp float line_width
1311#pragma mapbox: define highp vec4 color
1312out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO
1313#pragma mapbox: initialize highp float base
1314#pragma mapbox: initialize highp float height
1315#pragma mapbox: initialize highp float line_width
1316#pragma mapbox: initialize highp vec4 color
1317base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1318#if defined(HAS_CENTROID) || defined(TERRAIN)
1319centroid_pos=a_centroid_pos;
1320#endif
1321vec3 pos;
1322#ifdef TERRAIN
1323bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1324#else
1325pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1326#endif
1327#ifdef RENDER_WALL_MODE
1328vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1329#endif
1330float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Bi(`#include "_prelude_fog.fragment.glsl"
1331#include "_prelude_lighting.glsl"
1332uniform vec2 u_texsize;uniform sampler2D u_image;
1333#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1334uniform float u_pattern_transition;
1335#endif
1336#ifdef FAUX_AO
1337uniform lowp vec2 u_ao;in vec3 v_ao;
1338#endif
1339#ifdef LIGHTING_3D_MODE
1340in vec3 v_normal;
1341#endif
1342#ifdef APPLY_LUT_ON_GPU
1343uniform highp sampler3D u_lutTexture;
1344#endif
1345in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1346#pragma mapbox: define highp float base
1347#pragma mapbox: define highp float height
1348#pragma mapbox: define mediump vec4 pattern
1349#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1350#pragma mapbox: define mediump vec4 pattern_b
1351#endif
1352#pragma mapbox: define highp float pixel_ratio
1353void main() {
1354#pragma mapbox: initialize highp float base
1355#pragma mapbox: initialize highp float height
1356#pragma mapbox: initialize mediump vec4 pattern
1357#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1358#pragma mapbox: initialize mediump vec4 pattern_b
1359#endif
1360#pragma mapbox: initialize highp float pixel_ratio
1361vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1362#ifdef APPLY_LUT_ON_GPU
1363out_color=applyLUT(u_lutTexture,out_color);
1364#endif
1365#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1366vec2 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;
1367#endif
1368#ifdef LIGHTING_3D_MODE
1369out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1370#else
1371out_color=out_color*v_lighting;
1372#endif
1373#ifdef FAUX_AO
1374float 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
1374),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;
1375#endif
1376#ifdef FOG
1377out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1378#endif
1379#ifdef INDICATOR_CUTOUT
1380out_color=applyCutout(out_color,height);
1381#endif
1382glFragColor=out_color;
1383#ifdef OVERDRAW_INSPECTOR
1384glFragColor=vec4(1.0);
1385#endif
1386HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1387#include "_prelude_terrain.vertex.glsl"
1388#include "_prelude_lighting.glsl"
1389#include "_prelude_material_table.vertex.glsl"
1390uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1391#ifdef RENDER_WALL_MODE
1392in vec3 a_join_normal_inside;
1393#endif
1394#ifdef PROJECTION_GLOBE_VIEW
1395in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1396#endif
1397#ifdef TERRAIN
1398uniform int u_height_type;uniform int u_base_type;
1399#endif
1400out highp vec2 v_pos;out vec4 v_lighting;
1401#ifdef FAUX_AO
1402uniform lowp vec2 u_ao;out vec3 v_ao;
1403#endif
1404#ifdef LIGHTING_3D_MODE
1405out vec3 v_normal;
1406#endif
1407#pragma mapbox: define highp float base
1408#pragma mapbox: define highp float height
1409#pragma mapbox: define highp vec4 color
1410#pragma mapbox: define mediump vec4 pattern
1411#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1412#pragma mapbox: define mediump vec4 pattern_b
1413#endif
1414#pragma mapbox: define highp float pixel_ratio
1415#pragma mapbox: define highp float line_width
1416void main() {DECLARE_MATERIAL_TABLE_INFO
1417#pragma mapbox: initialize highp float base
1418#pragma mapbox: initialize highp float height
1419#pragma mapbox: initialize highp vec4 color
1420#pragma mapbox: initialize mediump vec4 pattern
1421#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1422#pragma mapbox: initialize mediump vec4 pattern_b
1423#endif
1424#pragma mapbox: initialize highp float pixel_ratio
1425#pragma mapbox: initialize highp float line_width
1426vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1427#if defined(HAS_CENTROID) || defined(TERRAIN)
1428centroid_pos=a_centroid_pos;
1429#endif
1430float ele=0.0;float h=z;vec3 p;float c_ele;
1431#ifdef TERRAIN
1432bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
1433#else
1434p=vec3(pos_nx.xy,z);
1435#endif
1436#ifdef PROJECTION_GLOBE_VIEW
1437float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1438#endif
1439#ifdef RENDER_WALL_MODE
1440vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1441#endif
1442float 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
1443? pos_nx.xy
1444: 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;
1445#ifdef LIGHTING_3D_MODE
1446NdotL=calculate_NdotL(normal);
1447#else
1448NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1449#endif
1450if (normal.y !=0.0) {float r=0.84;
1451#ifndef LIGHTING_3D_MODE
1452r=mix(0.7,0.98,1.0-u_lightintensity);
1453#endif
1454NdotL*=(
1455(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1456#ifdef FAUX_AO
1457float 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;
1458#ifdef TERRAIN
1459top_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);
1460#endif
1461v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1462#ifdef PROJECTION_GLOBE_VIEW
1463top_height+=u_height_lift;
1464#endif
1465gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1466#endif
1467#ifdef LIGHTING_3D_MODE
1468v_normal=normal;
1469#else
1470v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1471#endif
1472#ifdef FOG
1473v_fog_pos=fog_position(p);
1474#endif
1475}`),groundShadow:Bi(`#include "_prelude_shadow.fragment.glsl"
1476precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1477#ifdef FOG
1478in float v_fog_opacity;
1479#endif
1480void 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);
1481#ifdef RENDER_CUTOFF
1482shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1483#endif
1484#ifdef FOG
1485shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1486#endif
1487#ifdef INDICATOR_CUTOUT
1488shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1489#endif
1490glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1491uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1492#ifdef FOG
1493out float v_fog_opacity;
1494#endif
1495void 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);
1496#ifdef FOG
1497v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1498#endif
1499}`),fillExtrusionGroundEffect:Bi(`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;
1500#ifdef SDF_SUBPASS
1501in 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);}
1502#ifdef FOG
1503in highp float v_fog;
1504#endif
1505#endif
1506void main() {
1507#ifdef CLEAR_SUBPASS
1508vec4 color=vec4(1.0);
1509#ifdef CLEAR_FROM_TEXTURE
1510color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1511#endif
1512glFragColor=color;
1513#else
1514#ifdef SDF_SUBPASS
1515highp 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;
1516#ifdef FOG
1517fog=v_fog;
1518#endif
1519#ifdef RENDER_CUTOFF
1520fog*=v_cutoff_opacity;
1521#endif
1522glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1523#else
1524#ifdef USE_MRT1
1525out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
1526#else
1527vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1528#ifdef OVERDRAW_INSPECTOR
1529color=vec4(1.0);
1530#endif
1531glFragColor=color;
1532#endif
1533#endif
1534HANDLE_WIREFRAME_DEBUG;
1535#endif
1536}`,`#include "_prelude_fog.vertex.glsl"
1537in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1538#ifdef SDF_SUBPASS
1539out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1540#ifdef FOG
1541out highp float v_fog;
1542#endif
1543#endif
1544uniform 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;
1545#pragma mapbox: define highp float flood_light_ground_radius
1546const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1547#pragma mapbox: initialize highp float flood_light_ground_radius
1548vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
1549#ifdef SDF_SUBPASS
1550v_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);
1551#ifdef FOG
1552v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1553#endif
1554#endif
1555float hidden_by_landmark=0.0;
1556#ifdef HAS_CENTROID
1557hidden_by_landmark=a_hidden_by_landmark;
1558#endif
1559float 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));
1560#ifdef RENDER_CUTOFF
1561v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1562#endif
1563}`),hillshadePrepare:Bi(`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(
1564(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1565)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1566deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Bi(`#include "_prelude_fog.fragment.glsl"
1567#include "_prelude_lighting.glsl"
1568uniform 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;
1569#ifdef LIGHTING_3D_MODE
1570glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1571#endif
1572#ifdef FOG
1573glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1574#endif
1575#ifdef USE_MRT1
1576out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1577#endif
1578#ifdef OVERDRAW_INSPECTOR
1579glFragColor=vec4(1.0);
1580#endif
1581HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1582uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1583#ifdef FOG
1584v_fog_pos=fog_position(a_pos);
1585#endif
1586}`),line:Bi(`#include "_prelude_fog.fragment.glsl"
1587#include "_prelude_lighting.glsl"
1588#include "_prelude_shadow.fragment.glsl"
1589uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1589uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1590#ifdef ELEVATED_ROADS
1591in highp float v_road_z_offset;
1592#endif
1593#ifdef RENDER_LINE_DASH
1594uniform sampler2D u_dash_image;in vec2 v_tex;
1595#endif
1596#ifdef RENDER_LINE_GRADIENT
1597uniform sampler2D u_gradient_image;
1598#endif
1599#ifdef INDICATOR_CUTOUT
1600in highp float v_z_offset;
1601#endif
1602#ifdef RENDER_SHADOWS
1603uniform 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;
1604#endif
1605float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
1606#pragma mapbox: define highp vec4 color
1607#pragma mapbox: define lowp float floorwidth
1608#pragma mapbox: define lowp vec4 dash
1609#pragma mapbox: define lowp float blur
1610#pragma mapbox: define lowp float opacity
1611#pragma mapbox: define mediump float side_z_offset
1612#pragma mapbox: define lowp float border_width
1613#pragma mapbox: define lowp vec4 border_color
1614#pragma mapbox: define lowp float emissive_strength
1615float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1616#pragma mapbox: initialize highp vec4 color
1617#pragma mapbox: initialize lowp float floorwidth
1618#pragma mapbox: initialize lowp vec4 dash
1619#pragma mapbox: initialize lowp float blur
1620#pragma mapbox: initialize lowp float opacity
1621#pragma mapbox: initialize mediump float side_z_offset
1622#pragma mapbox: initialize lowp float border_width
1623#pragma mapbox: initialize lowp vec4 border_color
1624#pragma mapbox: initialize lowp float emissive_strength
1625float 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);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;
1626#ifdef RENDER_LINE_DASH
1627float sdfdist=texture(u_dash_image,v_tex).r;
1627float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1628#endif
1629highp vec4 out_color;
1630#ifdef RENDER_LINE_GRADIENT
1631out_color=texture(u_gradient_image,v_uv.xy);
1632#ifdef MULTIPLY_LINE_GRADIENT_COLOR
1633out_color*=color;
1634#endif
1635#else
1636out_color=color;
1637#endif
1638float trim_alpha=1.0;
1639#ifdef RENDER_LINE_TRIM_OFFSET
1640highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1641#endif
1642if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1643#ifdef RENDER_LINE_BORDER
1644float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1645#endif
1646#ifdef LIGHTING_3D_MODE
1647out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1648#ifdef RENDER_SHADOWS
1649float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1650#ifdef ELEVATED_ROADS
1651out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1652#else
1653out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1654#endif
1655#endif
1656#endif
1657#ifdef FOG
1658out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1659#endif
1660out_color*=(alpha*opacity);
1661#ifdef INDICATOR_CUTOUT
1662out_color=applyCutout(out_color,v_z_offset);
1663#endif
1664#ifdef FEATURE_CUTOUT
1665out_color=apply_feature_cutout(out_color,gl_FragCoord);
1666#endif
1667glFragColor=out_color;
1668#ifdef DUAL_SOURCE_BLENDING
1669glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1670#else
1671#ifdef USE_MRT1
1672out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1673#endif
1674#endif
1675#ifdef OVERDRAW_INSPECTOR
1676glFragColor=vec4(1.0);
1677#endif
1678HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1679#include "_prelude_shadow.vertex.glsl"
1680#include "_prelude_terrain.vertex.glsl"
1681#define EXTRUDE_SCALE 0.015873016
1682in vec2 a_pos_normal;in vec4 a_data;
1683#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1684in vec3 a_z_offset_width;
1685#endif
1686#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1687in highp vec3 a_packed;
1688#endif
1689#ifdef RENDER_LINE_DASH
1690in float a_linesofar;
1691#endif
1692uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1693#ifdef ELEVATED
1694uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1695#ifdef ELEVATION_REFERENCE_SEA
1696return 0.0;
1697#else
1698return elevation(apos);
1699#endif
1700}
1701#endif
1702out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1703#ifdef ELEVATED_ROADS
1704out highp float v_road_z_offset;
1705#endif
1706#ifdef RENDER_LINE_DASH
1707uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1708#endif
1709#ifdef RENDER_LINE_GRADIENT
1710uniform float u_image_height;
1711#endif
1712#ifdef INDICATOR_CUTOUT
1713out highp float v_z_offset;
1714#endif
1715#ifdef RENDER_SHADOWS
1716uniform 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;
1717#endif
1718#pragma mapbox: define highp vec4 color
1719#pragma mapbox: define lowp float floorwidth
1720#pragma mapbox: define lowp vec4 dash
1721#pragma mapbox: define lowp float blur
1722#pragma mapbox: define lowp float opacity
1723#pragma mapbox: define mediump float gapwidth
1724#pragma mapbox: define lowp float offset
1725#pragma mapbox: define mediump float width
1726#pragma mapbox: define mediump float side_z_offset
1727#pragma mapbox: define lowp float border_width
1728#pragma mapbox: define lowp vec4 border_color
1729#pragma mapbox: define lowp float emissive_strength
1730void main() {
1731#pragma mapbox: initialize highp vec4 color
1732#pragma mapbox: initialize lowp float floorwidth
1733#pragma mapbox: initialize lowp vec4 dash
1734#pragma mapbox: initialize lowp float blur
1735#pragma mapbox: initialize lowp float opacity
1736#pragma mapbox: initialize mediump float gapwidth
1737#pragma mapbox: initialize lowp float offset
1738#pragma mapbox: initialize mediump float width
1739#pragma mapbox: initialize mediump float side_z_offset
1740#pragma mapbox: initialize lowp float border_width
1741#pragma mapbox: initialize lowp vec4 border_color
1742#pragma mapbox: initialize lowp float emissive_strength
1743float a_z_offset;
1744#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1745a_z_offset=a_z_offset_width.x;
1746#endif
1747float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;
1748#ifdef VARIABLE_LINE_WIDTH
1749bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;
1750#else
1751halfwidth=(u_width_scale*width)/2.0;
1752#endif
1753offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1753vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1754#ifdef ELEVATED_ROADS
1755v_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;
1756#else
1757#ifdef ELEVATED
1758vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1759#ifdef CROSS_SLOPE_VERTICAL
1760float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1761#else
1762#ifdef CROSS_SLOPE_HORIZONTAL
1763float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1764#else
1765float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1766#endif
1767#endif
1768gl_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);
1769#else
1770gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1771#endif
1772#endif
1773#ifdef ELEVATED_ROADS
1774#ifdef RENDER_SHADOWS
1775vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1776#ifdef NORMAL_OFFSET
1777vec3 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();
1778#endif
1779v_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;
1780#endif
1781#endif
1782#ifndef RENDER_TO_TEXTURE
1783float 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));
1784#else
1785v_gamma_scale=1.0;
1786#endif
1787#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1788highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1789#ifdef RENDER_LINE_GRADIENT
1790highp 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);
1791#else
1792v_uv=vec3(a_uv_x,0.0,line_progress);
1793#endif
1794#endif
1795#ifdef RENDER_LINE_DASH
1796float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1797#endif
1798v_width2=vec2(outset,inset);
1799#ifdef FOG
1800v_fog_pos=fog_position(pos);
1801#endif
1802#ifdef INDICATOR_CUTOUT
1803v_z_offset=a_z_offset;
1804#endif
1805}`),linePattern:Bi(`#include "_prelude_fog.fragment.glsl"
1806#include "_prelude_lighting.glsl"
1807#include "_prelude_shadow.fragment.glsl"
1808uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1809#ifdef APPLY_LUT_ON_GPU
1810uniform highp sampler3D u_lutTexture;
1811#endif
1812#ifdef LINE_PATTERN_TRANSITION
1813uniform float u_pattern_transition;
1814#endif
1815in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1816#ifdef RENDER_LINE_TRIM_OFFSET
1817in highp vec3 v_uv;
1818#endif
1819#ifdef ELEVATED_ROADS
1820in highp float v_road_z_offset;
1821#endif
1822#ifdef LINE_JOIN_NONE
1823in vec2 v_pattern_data;
1824#endif
1825#ifdef INDICATOR_CUTOUT
1826in highp float v_z_offset;
1827#endif
1828#ifdef RENDER_SHADOWS
1829uniform 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;
1830#endif
1831#pragma mapbox: define mediump vec4 pattern
1832#ifdef LINE_PATTERN_TRANSITION
1833#pragma mapbox: define mediump vec4 pattern_b
1834#endif
1835#pragma mapbox: define mediump float pixel_ratio
1836#pragma mapbox: define mediump float blur
1837#pragma mapbox: define mediump float opacity
1838#pragma mapbox: define lowp float emissive_strength
1839void main() {
1840#pragma mapbox: initialize mediump vec4 pattern
1841#ifdef LINE_PATTERN_TRANSITION
1842#pragma mapbox: initialize mediump vec4 pattern_b
1843#endif
1844#pragma mapbox: initialize mediump float pixel_ratio
1845#pragma mapbox: initialize mediump float blur
1846#pragma mapbox: initialize mediump float opacity
1847#pragma mapbox: initialize lowp float emissive_strength
1848vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
1849#ifdef APPLY_LUT_ON_GPU
1850color=applyLUT(u_lutTexture,color);
1851#endif
1852#ifdef LINE_PATTERN_TRANSITION
1853vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1854#endif
1855#ifdef RENDER_LINE_TRIM_OFFSET
1856highp 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);}
1857#endif
1858#ifdef LINE_JOIN_NONE
1859highp 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);}
1860#endif
1861#ifdef LIGHTING_3D_MODE
1862color=apply_lighting_with_emission_ground(color,emissive_strength);
1863#ifdef RENDER_SHADOWS
1864float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1865#ifdef ELEVATED_ROADS
1866color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1867#else
1868color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1869#endif
1870#endif
1871#endif
1872#ifdef FOG
1873color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1874#endif
1875color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1876#ifdef INDICATOR_CUTOUT
1877color=applyCutout(color,v_z_offset);
1878#endif
1879glFragColor=color;
1880#ifdef DUAL_SOURCE_BLENDING
1881glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1882#else
1883#ifdef USE_MRT1
1884out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1885#endif
1886#endif
1887#ifdef OVERDRAW_INSPECTOR
1888glFragColor=vec4(1.0);
1889#endif
1890HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1891#include "_prelude_shadow.vertex.glsl"
1892#include "_prelude_terrain.vertex.glsl"
1893#define scale 0.015873016
1894in vec2 a_pos_normal;in vec4 a_data;
1895#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1896in vec3 a_z_offset_width;
1897#endif
1898#ifdef RENDER_LINE_TRIM_OFFSET
1899in highp vec3 a_packed;
1900#endif
1901in highp float a_linesofar;
1902#ifdef LINE_JOIN_NONE
1903in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1904#endif
1905#ifdef INDICATOR_CUTOUT
1906out highp float v_z_offset;
1907#endif
1908uniform 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;
1909#ifdef ELEVATED
1910uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1911#ifdef ELEVATION_REFERENCE_SEA
1912return 0.0;
1913#else
1914return elevation(apos);
1915#endif
1916}
1917#endif
1918out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1919#ifdef RENDER_LINE_TRIM_OFFSET
1920out highp vec3 v_uv;
1921#endif
1922#ifdef ELEVATED_ROADS
1923out highp float v_road_z_offset;
1924#endif
1925#ifdef RENDER_SHADOWS
1926uniform 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;
1927#endif
1928#pragma mapbox: define mediump float blur
1929#pragma mapbox: define mediump float opacity
1930#pragma mapbox: define mediump float offset
1931#pragma mapbox: define mediump float gapwidth
1932#pragma mapbox: define mediump float width
1933#pragma mapbox: define mediump float floorwidth
1934#pragma mapbox: define mediump vec4 pattern
1935#ifdef LINE_PATTERN_TRANSITION
1936#pragma mapbox: define mediump vec4 pattern_b
1937#endif
1938#pragma mapbox: define mediump float pixel_ratio
1939#pragma mapbox: define lowp float emissive_strength
1940void main() {
1941#pragma mapbox: initialize mediump float blur
1942#pragma mapbox: initialize mediump float opacity
1943#pragma mapbox: initialize mediump float offset
1944#pragma mapbox: initialize mediump float gapwidth
1945#pragma mapbox: initialize mediump float width
1946#pragma mapbox: initialize mediump float floorwidth
1947#pragma mapbox: initialize mediump vec4 pattern
1948#ifdef LINE_PATTERN_TRANSITION
1949#pragma mapbox: initialize mediump vec4 pattern_b
1950#endif
1951#pragma mapbox: initialize mediump float pixel_ratio
1952#pragma mapbox: initialize lowp float emissive_strength
1953float a_z_offset;
1954#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1955a_z_offset=a_z_offset_width.x;
1956#endif
1957float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1957vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1958#ifdef ELEVATED_ROADS
1959v_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;
1960#else
1961#ifdef ELEVATED
1962vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1963#ifdef CROSS_SLOPE_VERTICAL
1964float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1965#else
1966#ifdef CROSS_SLOPE_HORIZONTAL
1967float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1968#else
1969float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1970#endif
1971#endif
1972gl_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);
1973#else
1974gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1975#endif
1976#endif
1977#ifdef ELEVATED_ROADS
1978#ifdef RENDER_SHADOWS
1979vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1980#ifdef NORMAL_OFFSET
1981vec3 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();
1982#endif
1983v_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;
1984#endif
1985#endif
1986#ifndef RENDER_TO_TEXTURE
1987float 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));
1988#else
1989v_gamma_scale=1.0;
1990#endif
1991#ifdef RENDER_LINE_TRIM_OFFSET
1992highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1993#endif
1994v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1995#ifdef LINE_JOIN_NONE
1996v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
1997#endif
1998#ifdef FOG
1999v_fog_pos=fog_position(pos);
2000#endif
2001#ifdef INDICATOR_CUTOUT
2002v_z_offset=a_z_offset;
2003#endif
2004}`),raster:Bi(`#include "_prelude_fog.fragment.glsl"
2005#include "_prelude_lighting.glsl"
2006#include "_prelude_raster_array.glsl"
2007uniform 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;
2008#ifdef PROJECTION_GLOBE_VIEW
2009in float v_split_fade;
2010#endif
2011uniform 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;
2012#ifndef RASTER_ARRAY
2013uniform highp sampler2D u_image0;uniform sampler2D u_image1;
2014#endif
2015#ifdef RASTER_COLOR
2016uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
2017#endif
2018void main() {vec4 color0,color1,color;vec2 value;
2019#ifdef RASTER_COLOR
2020#ifdef RASTER_ARRAY
2021#ifdef RASTER_ARRAY_LINEAR
2022value=mix(
2023raTexture2D_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
2024);
2025#else
2026value=mix(
2027raTexture2D_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
2028);
2029#endif
2030if (value.y > 0.0) value.x/=value.y;
2031#else
2032color=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);
2033#endif
2034color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
2035#else
2036color0=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);
2037#endif
2038color.a*=u_opacity;
2039#ifdef GLOBE_POLES
2040color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
2041#endif
2042vec3 rgb=color.rgb;rgb=vec3(
2043dot(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);
2044#ifdef LIGHTING_3D_MODE
2045out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
2046#endif
2047#ifdef FOG
2048highp 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));
2049#endif
2050glFragColor=vec4(out_color*color.a,color.a);
2051#ifdef PROJECTION_GLOBE_VIEW
2052glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
2053#endif
2054#ifdef RENDER_CUTOFF
2055glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
2056#endif
2057#ifdef OVERDRAW_INSPECTOR
2058glFragColor=vec4(1.0);
2059#endif
2060#ifdef USE_MRT1
2061out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2062#endif
2063HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2064uniform 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;
2065#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2066#ifdef GLOBE_POLES
2067in vec3 a_globe_pos;in vec2 a_uv;
2068#else
2069in vec2 a_pos;in vec2 a_texture_pos;
2070#endif
2071out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
2072#ifdef PROJECTION_GLOBE_VIEW
2073out float v_split_fade;
2074#endif
2075void main() {vec2 uv;
2076#ifdef GLOBE_POLES
2077vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
2078#ifdef FOG
2079v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
2080#endif
2081#else
2082float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
2083#ifdef PROJECTION_GLOBE_VIEW
2084vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
2085v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
2085if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
2086#ifdef FOG
2087v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2088#endif
2089#else
2090gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2091#ifdef FOG
2092v_fog_pos=fog_position(a_pos);
2093#endif
2094#endif
2095#endif
2096v_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;
2097#ifdef RENDER_CUTOFF
2098v_depth=gl_Position.z;
2099#endif
2100}`),rasterParticle:Bi(`#include "_prelude_fog.fragment.glsl"
2101#include "_prelude_lighting.glsl"
2102uniform 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;
2103#ifdef LIGHTING_3D_MODE
2104out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
2105#endif
2106#ifdef FOG
2107highp 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));
2108#endif
2109glFragColor=vec4(out_color*color.a,color.a);
2110#ifdef OVERDRAW_INSPECTOR
2111glFragColor=vec4(1.0);
2112#endif
2113HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2114uniform 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;
2115#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2116in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
2117#ifdef PROJECTION_GLOBE_VIEW
2118vec3 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;
2119#ifdef FOG
2120v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2121#endif
2122#else
2123uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2124#ifdef FOG
2125v_fog_pos=fog_position(a_pos);
2126#endif
2127#endif
2128v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Bi("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"
2129in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
2130mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Bi("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Bi(`#include "_prelude_raster_particle.glsl"
2131uniform 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;
2131vec2 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(
2132linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
2133);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Bi(`#include "_prelude_lighting.glsl"
2134#include "_prelude_shadow.fragment.glsl"
2135#define SDF_PX 8.0
2136#define SDF 1.0
2137#define ICON 0.0
2138uniform 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;
2139#ifdef ICON_TRANSITION
2140uniform float u_icon_transition;
2141#endif
2142#ifdef COLOR_ADJUSTMENT
2143uniform mat4 u_color_adj_mat;
2144#endif
2145#ifdef INDICATOR_CUTOUT
2146in highp float v_z_offset;
2147#else
2148#ifdef RENDER_SHADOWS
2149in highp float v_z_offset;
2150#endif
2151#endif
2152in vec2 v_tex_a;
2153#ifdef ICON_TRANSITION
2154in vec2 v_tex_b;
2155#endif
2156in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
2157#ifdef RENDER_TEXT_AND_SYMBOL
2158in float is_sdf;in vec2 v_tex_a_icon;
2159#endif
2160#ifdef RENDER_SHADOWS
2161uniform 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;
2162#endif
2163#ifdef APPLY_LUT_ON_GPU
2164uniform highp sampler3D u_lutTexture;
2165#endif
2166#pragma mapbox: define highp vec4 fill_color
2167#pragma mapbox: define highp vec4 halo_color
2168#pragma mapbox: define lowp float opacity
2169#pragma mapbox: define lowp float halo_width
2170#pragma mapbox: define lowp float halo_blur
2171#pragma mapbox: define lowp float emissive_strength
2172void main() {
2173#pragma mapbox: initialize highp vec4 fill_color
2174#pragma mapbox: initialize highp vec4 halo_color
2175#pragma mapbox: initialize lowp float opacity
2176#pragma mapbox: initialize lowp float halo_width
2177#pragma mapbox: initialize lowp float halo_blur
2178#pragma mapbox: initialize lowp float emissive_strength
2179vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2180#ifdef RENDER_TEXT_AND_SYMBOL
2181if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2182#ifdef OVERDRAW_INSPECTOR
2183glFragColor=vec4(1.0);
2184#endif
2185return;}
2186#endif
2187#ifdef RENDER_SDF
2188float 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;
2189#else
2190#ifdef ICON_TRANSITION
2191vec4 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);
2192#else
2193out_color=texture(u_texture,v_tex_a);
2194#endif
2195#ifdef APPLY_LUT_ON_GPU
2196out_color=applyLUT(u_lutTexture,out_color);
2197#endif
2198#ifdef COLOR_ADJUSTMENT
2199out_color=u_color_adj_mat*out_color;
2200#endif
2201#endif
2202out_color*=opacity*fade_opacity;
2203#ifdef LIGHTING_3D_MODE
2204out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2205#ifdef RENDER_SHADOWS
2206float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2207#ifdef TERRAIN
2208out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2209#else
2210out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2211#endif
2212#endif
2213#endif
2214#ifdef INDICATOR_CUTOUT
2215out_color=applyCutout(out_color,v_z_offset);
2216#endif
2217#ifdef FEATURE_CUTOUT
2218out_color=apply_feature_cutout(out_color,gl_FragCoord);
2219#endif
2220glFragColor=out_color;
2221#ifdef OVERDRAW_INSPECTOR
2222glFragColor=vec4(1.0);
2223#endif
2224HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2225#include "_prelude_shadow.vertex.glsl"
2226#define APPEARANCE_ICON 1.0
2227in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
2228#ifdef Z_OFFSET
2229in float a_auto_z_offset;
2230#endif
2231#ifdef PROJECTION_GLOBE_VIEW
2232in vec3 a_globe_anchor;in vec3 a_globe_normal;
2233#endif
2234#ifdef ICON_TRANSITION
2235in vec2 a_texb;
2236#endif
2237#ifdef OCCLUSION_QUERIES
2238in float a_occlusion_query_opacity;
2239#endif
2240#ifdef ELEVATED_ROADS
2241in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2242#endif
2243#ifdef INDICATOR_CUTOUT
2244out highp float v_z_offset;
2245#else
2246#ifdef RENDER_SHADOWS
2247out highp float v_z_offset;
2248#endif
2249#endif
2250uniform 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;
2251#ifdef PROJECTION_GLOBE_VIEW
2252uniform 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;
2253#endif
2254out vec2 v_tex_a;
2255#ifdef ICON_TRANSITION
2256out vec2 v_tex_b;
2257#endif
2258out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2259#ifdef RENDER_TEXT_AND_SYMBOL
2260out float is_sdf;out vec2 v_tex_a_icon;
2261#endif
2262#ifdef RENDER_SHADOWS
2263uniform 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;
2264#endif
2265#pragma mapbox: define highp vec4 fill_color
2266#pragma mapbox: define highp vec4 halo_color
2267#pragma mapbox: define lowp float opacity
2268#pragma mapbox: define lowp float halo_width
2269#pragma mapbox: define lowp float halo_blur
2270#pragma mapbox: define lowp float emissive_strength
2271#pragma mapbox: define lowp float occlusion_opacity
2272#pragma mapbox: define lowp float z_offset
2273void main() {
2274#pragma mapbox: initialize highp vec4 fill_color
2275#pragma mapbox: initialize highp vec4 halo_color
2276#pragma mapbox: initialize lowp float opacity
2277#pragma mapbox: initialize lowp float halo_width
2278#pragma mapbox: initialize lowp float halo_blur
2279#pragma mapbox: initialize lowp float emissive_strength
2280#pragma mapbox: initialize lowp float occlusion_opacity
2281#pragma mapbox: initialize lowp float z_offset
2282vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {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);
2283#ifdef Z_OFFSET
2284e+=a_auto_z_offset;
2285#endif
2286vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2287#ifdef PROJECTION_GLOBE_VIEW
2288mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
2289#else
2290world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2291#endif
2292vec4 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 ?
2293camera_to_anchor_distance/u_camera_to_center_distance :
2294u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
22950.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;
2296#ifdef PROJECTION_GLOBE_VIEW
2297vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
2298#else
2299offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2300#endif
2301vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2302#ifdef PROJECTION_GLOBE_VIEW
2303#ifdef PROJECTED_POS_ON_VIEWPORT
2304projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2305#else
2306vec3 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);    
2307#endif
2308#else
2309projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2310#endif
2311highp 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);
2312#ifdef TERRAIN
2313#ifdef PITCH_WITH_MAP_TERRAIN
2314vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2315#endif
2316#endif
2317#ifdef Z_OFFSET
2318z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2319#else
2320z+=u_pitch_with_map ? z_offset : 0.0;
2321#endif
2322float 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));
2323#ifdef DEPTH_OCCLUSION
2324float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2325#endif
2326#ifdef OCCLUSION_QUERIES
2327float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2328#endif
2329#ifdef Z_TEST_OCCLUSION
2330out_fade_opacity*=occlusion_opacity;
2331#endif
2332float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2333#ifdef PROJECTION_GLOBE_VIEW
2334vec3 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;
2335#else
2336#ifdef ELEVATED_ROADS
2337vec3 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;
2338#else
2339pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2340#endif
2341#endif
2342gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
2343#ifdef RENDER_TEXT_AND_SYMBOL
2344is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2345#endif
2346#ifdef ICON_TRANSITION
2347v_tex_b=a_texb/u_texsize;
2348#endif
2349#ifdef RENDER_SHADOWS
2350vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2351#ifdef NORMAL_OFFSET
2352vec3 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();
2353#endif
2354v_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;
2355#endif
2356#ifdef INDICATOR_CUTOUT
2357v_z_offset=e;
2358#else
2359#ifdef RENDER_SHADOWS
2360v_z_offset=e;
2361#endif
2362#endif
2363}`),terrainRaster:Bi(`#include "_prelude_fog.fragment.glsl"
2364#include "_prelude_shadow.fragment.glsl"
2365#include "_prelude_lighting.glsl"
2366uniform sampler2D u_image0;
2367#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2368uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2369#endif
2370in vec2 v_pos0;
2371#ifdef FOG
2372in float v_fog_opacity;
2373#endif
2374#ifdef RENDER_SHADOWS
2375in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2376#endif
2377uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2378#ifdef LIGHTING_3D_MODE
2379const vec3 normal=vec3(0.0,0.0,1.0);
2380#ifdef RENDER_SHADOWS
2381float cutoffOpacity=1.0;
2382#ifdef RENDER_CUTOFF
2383cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2384#endif
2385#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2386float 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;
2387#else
2388float 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));
2389#endif
2390#else
2391float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2392#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2393float 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;
2394#endif
2395#endif
2396#else
2397color=image_color;
2398#endif
2399#ifdef FOG
2400#ifdef ZERO_EXAGGERATION
2401color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2402#else
2403color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2404#endif
2405#endif
2406glFragColor=color;
2407#ifdef OVERDRAW_INSPECTOR
2408glFragColor=vec4(1.0);
2409#endif
2410HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2411#include "_prelude_terrain.vertex.glsl"
2412uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2413#ifdef FOG
2414out float v_fog_opacity;
2415#endif
2416#ifdef RENDER_SHADOWS
2417uniform 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;
2418#endif
2419void 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);
2420#ifdef FOG
2421#ifdef ZERO_EXAGGERATION
2422v_fog_pos=fog_position(decodedPos);
2423#else
2424v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2425#endif
2426#endif
2427#ifdef RENDER_SHADOWS
2428vec3 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.);
2429#endif
2430}`),terrainDepth:Bi("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2431uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Bi(`#include "_prelude_fog.fragment.glsl"
2432in 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(
2433cos_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
2433nd-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;
2434#ifdef FOG
2435sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2436#endif
2437sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2438#ifdef OVERDRAW_INSPECTOR
2439glFragColor=vec4(1.0);
2440#endif
2441}`,ud),skyboxGradient:Bi(`#include "_prelude_fog.fragment.glsl"
2442in 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));
2443#ifdef FOG
2444color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2445#endif
2446color*=u_opacity;glFragColor=color;
2447#ifdef OVERDRAW_INSPECTOR
2448glFragColor=vec4(1.0);
2449#endif
2450}`,ud),skyboxCapture:Bi(`
2451in 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;
2452#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2453#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2454#define MIE_G                   0.76
2455#define DENSITY_HEIGHT_SCALE_R  8000.0
2456#define DENSITY_HEIGHT_SCALE_M  1200.0
2457#define PLANET_RADIUS           6360e3
2458#define ATMOSPHERE_RADIUS       6420e3
2459#define SAMPLE_STEPS            10
2460#define DENSITY_STEPS           4
2461float 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);}
2461float 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))/(e
2461nd-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Bi(`#include "_prelude_fog.fragment.glsl"
2462#include "_prelude_lighting.glsl"
2463uniform sampler2D u_image0;
2464#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2465uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2466#endif
2467uniform float u_far_z_cutoff;in vec2 v_pos0;
2468#ifndef FOG
2469uniform 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;
2470#endif
2471void main() {vec4 color;
2472#ifdef CUSTOM_ANTIALIASING
2473highp vec2 uv=gl_FragCoord.xy/u_viewport;
2474#ifdef FLIP_Y
2475uv.y=1.0-uv.y;
2476#endif
2477highp vec3 ray_dir=mix(
2478mix(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);
2479#ifdef LIGHTING_3D_MODE
2480#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2481float 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);
2482#else
2483raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2484#endif
2485#else
2486color=vec4(raster.rgb*antialias,raster.a*antialias);
2487#endif
2488#else
2489color=texture(u_image0,v_pos0);
2490#ifdef LIGHTING_3D_MODE
2491#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2492float 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;
2493#else
2494color=apply_lighting_ground(color);
2495#endif
2496#endif
2497#endif
2498#ifdef FOG
2499color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2500#endif
2501color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2502#ifdef OVERDRAW_INSPECTOR
2503glFragColor=vec4(1.0);
2504#endif
2505HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2506#include "_prelude_terrain.vertex.glsl"
2507uniform 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;
2508#ifdef GLOBE_POLES
2509in vec3 a_globe_pos;in vec2 a_uv;
2510#else
2511in vec2 a_pos;
2512#endif
2513out vec2 v_pos0;void main() {
2514#ifdef GLOBE_POLES
2515vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2516#else
2517float 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);
2518#endif
2519v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2520#ifdef GLOBE_POLES
2521vec3 up_vector=globe_derived_up_vector;
2522#else
2523vec3 up_vector=elevationVector(tile_pos);
2524#endif
2525float height=elevation(tile_pos);globe_pos+=up_vector*height;
2526#ifndef GLOBE_POLES
2527globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2528#endif
2529#ifdef GLOBE_POLES
2530vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2531#else
2532vec4 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);
2533#endif
2534gl_Position=u_proj_matrix*interpolated_pos;
2535#ifdef FOG
2536v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2537#endif
2538}`),globeAtmosphere:Bi(`#include "_prelude_fog.fragment.glsl"
2539uniform 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;
2540#ifdef PROJECTION_GLOBE_VIEW
2541globe_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) {
2542#ifdef ALPHA_PASS
2543glFragColor=vec4(0,0,0,0);return;
2544#else
2545#ifdef NATIVE
2546glFragColor=vec4(1,1,1,1);
2547#else
2548glFragColor=vec4(0,0,0,1);
2549#endif
2550return;
2551#endif
2552}
2553#endif
2554highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
25550.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2556#ifdef PROJECTION_GLOBE_VIEW
2557highp 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 ?
2558PI-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);
2559#else
2560horizon_angle=horizon_angle_mercator;
2561#endif
2562horizon_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;
2562vec3 color_stop_2=u_space_color.rgb;
2563#ifdef ALPHA_PASS
2564float 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);
2565#else
2566vec3 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);
2567#endif
2568}`,`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(
2569mix(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(
2570mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Bi(`#include "_prelude_fog.fragment.glsl"
2571#include "_prelude_shadow.fragment.glsl"
2572#include "_prelude_lighting.glsl"
2573uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2574#ifdef RENDER_SHADOWS
2575in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2576#endif
2577#ifdef OCCLUSION_TEXTURE_TRANSFORM
2578uniform vec4 u_occlusionTextureTransform;
2579#endif
2580#pragma mapbox: define-attribute highp vec3 normal_3f
2581#pragma mapbox: define-attribute highp vec3 color_3f
2582#pragma mapbox: define-attribute highp vec4 color_4f
2583#pragma mapbox: define-attribute highp vec2 uv_2f
2584#pragma mapbox: initialize-attribute highp vec3 normal_3f
2585#pragma mapbox: initialize-attribute highp vec3 color_3f
2586#pragma mapbox: initialize-attribute highp vec4 color_4f
2587#pragma mapbox: initialize-attribute highp vec2 uv_2f
2588#ifdef HAS_ATTRIBUTE_a_pbr
2589in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2590#endif
2591#ifdef HAS_TEXTURE_u_baseColorTexture
2592uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2593#endif
2594#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2595uniform sampler2D u_metallicRoughnessTexture;
2596#endif
2597#ifdef HAS_TEXTURE_u_occlusionTexture
2598uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2599#endif
2600#ifdef HAS_TEXTURE_u_normalTexture
2601uniform sampler2D u_normalTexture;
2602#endif
2603#ifdef HAS_TEXTURE_u_emissionTexture
2604uniform sampler2D u_emissionTexture;
2605#endif
2606#ifdef APPLY_LUT_ON_GPU
2607uniform highp sampler3D u_lutTexture;
2608#endif
2609#ifdef TERRAIN_FRAGMENT_OCCLUSION
2610in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2611#ifdef DEPTH_D24
2612highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2613#else
2614highp float unpack_depth_rgba(highp vec4 rgba_depth)
2615{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;}
2616#endif
2617bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2618#ifdef FLIP_Y
2619coord.y=1.0-coord.y;
2620#endif
2621#ifdef DEPTH_D24
2622highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2623#else
2624highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2625#endif
2626return v_depth > depth+0.0005;}
2627#endif
2628#define saturate(_x) clamp(_x,0.,1.)
2629vec3 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)
2630{
2631#ifdef LIGHTING_3D_MODE
2632vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2633#ifdef RENDER_SHADOWS
2634lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2635#else
2636lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2637#endif
2638return apply_lighting(albedo,transformed_normal,lighting_factor);
2639#else
2640vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2640Color),vec3(1.0));return c3;
2641#endif
2642}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2643#ifdef HAS_ATTRIBUTE_a_color_3f
2644albedo*=vec4(color_3f,1.0);
2645#endif
2646#ifdef HAS_ATTRIBUTE_a_pbr
2647#else
2648#ifdef HAS_ATTRIBUTE_a_color_4f
2649albedo*=color_4f;
2650#endif
2651#endif
2652#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2653vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2654#ifdef UNPREMULT_TEXTURE_IN_SHADER
2655if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2656#endif
2657if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2658#endif
2659vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2660#ifdef APPLY_LUT_ON_GPU
2661color=applyLUT(u_lutTexture,color);
2662#endif
2663return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2664#ifdef HAS_TEXTURE_u_normalTexture
2665highp 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;
2666#ifdef FLIP_Y
2667T=-T;B=-B;
2668#endif
2669highp 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;
2670#else
2671return mat3(1.0);
2672#endif
2673}highp vec3 getNormal(){highp vec3 n;
2674#ifdef HAS_ATTRIBUTE_a_normal_3f
2675n=normalize(normal_3f);
2676#else
2677highp 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));
2678#ifdef FLIP_Y
2679n=normalize(cross(fdx,fdy));
2680#else
2681n=normalize(cross(fdx,fdy))*-1.0;
2682#endif
2683#endif
2684#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2685vec3 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);
2686#endif
2687return 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;
2688#ifdef HAS_ATTRIBUTE_a_pbr
2689mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2690#endif
2691#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2692vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2693#endif
2694const 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)
2695{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)
2696{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2697{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)
2698{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)
2699{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)
2700{
2701#ifdef LIGHTING_3D_MODE
2702return mat.diffuseColor;
2703#else
2704return mat.diffuseColor/PI;
2705#endif
2706}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2707{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)
2708{vec3 env_light=vec3(0.65,0.65,0.65);
2709#ifdef LIGHTING_3D_MODE
2710float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2711#endif
2712vec3 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)
2713{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;
2714#ifdef RENDER_SHADOWS
2715lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2716#else
2717lighting_factor=NdotL;
2718#endif
2719vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2719Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2720#if !defined(LIGHTING_3D_MODE)
2721const 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);
2722#endif
2723color*=intensityFactor;return color;}void main() {
2724#ifdef TERRAIN_FRAGMENT_OCCLUSION
2725if (isOccluded()) {discard;}
2726#endif
2727vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2728#ifdef LIGHTING_3D_MODE
2729lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2730#endif
2731vec4 finalColor;
2732#ifdef DIFFUSE_SHADED
2733vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2734#ifdef HAS_TEXTURE_u_occlusionTexture
2735float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2736#endif
2737finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2738#else
2739Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2740#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2741#ifdef OCCLUSION_TEXTURE_TRANSFORM
2742vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2743#else
2744vec2 uv=uv_2f;
2745#endif
2746ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2747#endif
2748vec4 emissive=u_emissiveFactor;
2749#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2750emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2751#endif
2752#ifdef APPLY_LUT_ON_GPU
2753float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2754#endif
2755color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2756#ifdef HAS_ATTRIBUTE_a_pbr
2757float 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;
2758#ifdef APPLY_LUT_ON_GPU
2759color_mix=applyLUT(u_lutTexture,color_mix);
2760#endif
2761color=mix(color,color_mix,min(1.0,resEmission));
2762#ifdef HAS_ATTRIBUTE_a_color_4f
2763float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2763y));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);
2764#endif
2765#endif
2766vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2767#endif
2768#ifdef FOG
2769finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2770#endif
2771#ifdef RENDER_CUTOFF
2772finalColor*=v_cutoff_opacity;
2773#endif
2774#ifdef INDICATOR_CUTOUT
2775finalColor=applyCutout(finalColor,v_position_height.w);
2776#endif
2777#ifdef FEATURE_CUTOUT
2778finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2779#endif
2780glFragColor=finalColor;
2781#ifdef OVERDRAW_INSPECTOR
2782glFragColor=vec4(1.0);
2783#endif
2784HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2785#include "_prelude_shadow.vertex.glsl"
2786in vec3 a_pos_3f;
2787#pragma mapbox: define-attribute highp vec3 normal_3f
2788#pragma mapbox: define-attribute highp vec2 uv_2f
2789#pragma mapbox: define-attribute highp vec3 color_3f
2790#pragma mapbox: define-attribute highp vec4 color_4f
2791#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2792#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2793uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2794#ifdef INSTANCED_ARRAYS
2795in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2796#else
2797uniform highp mat4 u_normal_matrix;
2798#endif
2799#ifdef RENDER_SHADOWS
2800uniform 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;
2801#endif
2802out vec4 v_position_height;out lowp vec4 v_color_mix;
2803#ifdef TERRAIN_FRAGMENT_OCCLUSION
2804out highp float v_depth;
2805#endif
2806#ifdef HAS_ATTRIBUTE_a_pbr
2807out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2808#endif
2809vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2810#pragma mapbox: initialize-attribute highp vec3 normal_3f
2811#pragma mapbox: initialize-attribute highp vec2 uv_2f
2812#pragma mapbox: initialize-attribute highp vec3 color_3f
2813#pragma mapbox: initialize-attribute highp vec4 color_4f
2814#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2815#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2816highp mat4 normal_matrix;
2817#ifdef INSTANCED_ARRAYS
2818normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2819#else
2820normal_matrix=u_normal_matrix;
2821#endif
2822vec3 local_pos;mat3 rs;
2823#ifdef MODEL_POSITION_ON_GPU
2824vec3 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;
2825#else
2826local_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);
2827#endif
2828v_position_height.w=a_pos_3f.z;
2829#ifdef HAS_ATTRIBUTE_a_pbr
2830vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
2831#endif
2832#ifdef FOG
2833v_fog_pos=fog_position(local_pos);
2834#endif
2835#ifdef RENDER_CUTOFF
2836v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2837#endif
2838#ifdef TERRAIN_FRAGMENT_OCCLUSION
2839v_depth=gl_Position.z/gl_Position.w;
2840#ifdef CLIP_ZERO_TO_ONE
2841v_depth=-1.0+2.0*v_depth; 
2842#endif
2843#endif
2844#ifdef HAS_ATTRIBUTE_a_normal_3f
2845#ifdef MODEL_POSITION_ON_GPU
2846float 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);
2847#else
2848normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2849#endif
2850#endif
2851#ifdef HAS_ATTRIBUTE_a_pbr
2852#ifdef HAS_ATTRIBUTE_a_color_4f
2853v_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);
2854#endif
2855#endif
2856#ifdef RENDER_SHADOWS
2857vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2858#ifdef NORMAL_OFFSET
2859#ifdef HAS_ATTRIBUTE_a_normal_3f
2860#ifdef MODEL_POSITION_ON_GPU
2861vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2862#else
2863vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2864#endif
2865#endif
2866#endif
2867v_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;
2868#endif
2869}`),modelDepth:Bi(`in highp float v_depth;void main() {
2870#ifndef DEPTH_TEXTURE
2871glFragColor=pack_depth(v_depth);
2872#endif
2873}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2874#ifdef MODEL_POSITION_ON_GPU
2875#ifdef INSTANCED_ARRAYS
2876in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2877#else
2878uniform highp mat4 u_instance;
2879#endif
2880uniform highp mat4 u_node_matrix;
2881#endif
2882void main() {
2883#ifdef MODEL_POSITION_ON_GPU
2884highp mat4 instance;
2885#ifdef INSTANCED_ARRAYS
2886instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2887#else
2888instance=u_instance;
2889#endif
2890vec3 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;
2890rs[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);
2891#else
2892gl_Position=u_matrix*vec4(a_pos_3f,1);
2893#endif
2894v_depth=gl_Position.z/gl_Position.w;}`),stars:Bi(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2895{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;}`,`
2896in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Bi("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;}",`
2897in 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; 
2898uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
2899uniform float u_horizontalOscillationRate; 
2900uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
2901localY*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:Bi("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;}",`
2902in 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; 
2903uniform float u_velocity; 
2904uniform 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;
2904pos*=halfBoxSize; 
2905pos+=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+
2906localY*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:Bi("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Bi("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2907in 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;
2908#ifdef TERRAIN
2909float e=elevation(world_pos.xy);world_pos.z+=e;
2910#endif
2911vec4 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 cl(l,t){const r=l.split(`
2912`);for(let c of r){if(c=c.trimStart(),c[0]!=="#"||!c.includes("if")||c.startsWith("#endif"))continue;const p=c.match(Nf);if(p)for(const _ of p)Ul.has(_)||t.add(_)}}function Bi(l,t){const r=new Set,c=[],p=[];l=l.replace(Bu,(g,v)=>(p.push(v),"")),t=t.replace(Bu,(g,v)=>(c.push(v),""));let _=new Set(Gl);cl(l,_),cl(t,_);for(const g of[...c,...p])fd[g]||(fd[g]=new Set,cl(ll[g],fd[g])),_=new Set([..._,...fd[g]]);return{fragmentSource:l=l.replace(na,(g,v,b,E,C)=>(r.add(C),v==="define"?`
2913#ifndef HAS_UNIFORM_u_${C}
2914in ${b} ${E} ${C};
2915#else
2916uniform ${b} ${E} u_${C};
2917#endif
2918`:v==="initialize"?`
2919#ifdef HAS_UNIFORM_u_${C}
2920    ${b} ${E} ${C} = u_${C};
2921#endif
2922`:v==="define-attribute"?`
2923#ifdef HAS_ATTRIBUTE_a_${C}
2924    in ${b} ${E} ${C};
2925#endif
2926`:v==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(na,(g,v,b,E,C)=>{const z=`MATERIAL_ATTRIBUTE_OFFSET_${C}`,R=E==="float"?"vec2":E,D=`GET_ATTRIBUTE_${R}(a_${C}, materialInfo, ${z})`,B=C.match(/color/)?"color":R;return v==="define-attribute-vertex-shader-only"?`
2927#ifdef HAS_ATTRIBUTE_a_${C}
2928in ${b} ${E} a_${C};
2929#endif
2930`:r.has(C)?v==="define"?`
2931#ifndef HAS_UNIFORM_u_${C}
2932uniform lowp float u_${C}_t;
2933    #if !defined(${z})
2934        in ${b} ${R} a_${C};
2935    #endif
2936out ${b} ${E} ${C};
2937#else
2938uniform ${b} ${E} u_${C};
2939#endif
2940`:v==="initialize"?B==="vec4"?`
2941#ifndef HAS_UNIFORM_u_${C}
2942    ${C} = a_${C};
2943#else
2944    ${b} ${E} ${C} = u_${C};
2945#endif
2946`:`
2947#if !defined(HAS_UNIFORM_u_${C})
2948    #ifdef ${z}
2949        ${C} = unpack_mix_${B}(${D}, u_${C}_t);
2950    #else
2951        ${C} = unpack_mix_${B}(a_${C}, u_${C}_t);
2952    #endif
2953#else
2954    ${b} ${E} ${C} = u_${C};
2955#endif
2956`:v==="define-attribute"?`
2957#ifdef HAS_ATTRIBUTE_a_${C}
2958    in ${b} ${E} a_${C};
2959    out ${b} ${E} ${C};
2960#endif
2961`:v==="initialize-attribute"?`
2962#ifdef HAS_ATTRIBUTE_a_${C}
2963    ${C} = a_${C};
2964#endif
2965`:void 0:v==="define"?`
2966#ifndef HAS_UNIFORM_u_${C}
2967uniform lowp float u_${C}_t;
2968    #if !defined(${z})
2969        in ${b} ${R} a_${C};
2970    #endif
2971#else
2972uniform ${b} ${E} u_${C};
2973#endif
2974`:v==="define-instanced"?B==="mat4"?`
2975#ifdef INSTANCED_ARRAYS
2976in vec4 a_${C}0;
2977in vec4 a_${C}1;
2978in vec4 a_${C}2;
2979in vec4 a_${C}3;
2980#else
2981uniform ${b} ${E} u_${C};
2982#endif
2983`:`
2984#ifdef INSTANCED_ARRAYS
2985in ${b} ${R} a_${C};
2986#else
2987uniform ${b} ${E} u_${C};
2988#endif
2989`:v==="initialize-attribute-custom"?`
2990#ifdef HAS_ATTRIBUTE_a_${C}
2991    ${b} ${E} ${C} = a_${C};
2992#endif
2993`:B==="vec4"?`
2994#ifndef HAS_UNIFORM_u_${C}
2995    #ifdef ${z}
2996        ${b} ${E} ${C} = ${D};
2997    #else
2998        ${b} ${E} ${C} = a_${C};
2999    #endif
3000#else
3001    ${b} ${E} ${C} = u_${C};
3002#endif
3003`:`
3004#ifndef HAS_UNIFORM_u_${C}
3005    #ifdef ${z}
3006        ${b} ${E} ${C} = unpack_mix_${B}(${D}, u_${C}_t);
3007    #else
3008        ${b} ${E} ${C} = unpack_mix_${B}(a_${C}, u_${C}_t);
3009    #endif
3010#else
3011    ${b} ${E} ${C} = u_${C};
3012#endif
3013`}),usedDefines:_,vertexIncludes:c,fragmentIncludes:p}}class Kx{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,r,c,p,_,g,v,b){this.context=t;let E=this.boundPaintVertexBuffers.length!==p.length;for(let z=0;!E&&z<p.length;z++)this.boundPaintVertexBuffers[z]!==p[z]&&(E=!0);let C=this.boundDynamicVertexBuffers.length!==v.length;for(let z=0;!C&&z<v.length;z++)this.boundDynamicVertexBuffers[z]!==v[z]&&(C=!0);if(!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==c||E||C||this.boundIndexBuffer!==_||this.boundVertexOffset!==g)this.freshBind(r,c,p,_,g,v,b);else{t.bindVertexArrayOES.set(this.vao);for(const z of v)z&&(z.bind(),b&&z.instanceCount&&z.setVertexAttribDivisor(t.gl,r,b));_&&_.dynamicDraw&&_.bind()}}freshBind(t,r,c,p,_,g,v){const b=this.context,E=b.gl;this.vao&&this.destroy(),this.vao=b.gl.createVertexArray(),b.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=p,this.boundVertexOffset=_,this.boundDynamicVertexBuffers=g,r.enableAttributes(E,t),r.bind(),r.setVertexAttribPointers(E,t,_);for(const C of c)C.enableAttributes(E,t),C.bind(),C.setVertexAttribPointers(E,t,_);for(const C of g)C&&(C.enableAttributes(E,t),C.bind(),C.setVertexAttribPointers(E,t,_),v&&C.instanceCount&&C.setVertexAttribDivisor(E,t,v));p&&p.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Jx(l,t){const r=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ae(0,c/r).toLngLat().lat,new s.ae(0,(c+1)/r).toLngLat().lat]}function Qx(l,t,r,c,p,_,g){const v=l.context,b=v.gl,E=r.hillshadeFBO;if(!E)return;l.prepareDrawTile();const C=l.isTileAffectedByFog(t),z=[];l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&z.pu
vendor: 10,557 bytes, line 3013
3013sh("USE_MRT1");const R=l.getOrCreateProgram("hillshade",{overrideFog:C,defines:z});v.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,E.colorAttachment0.get());const D=((U,Z,K,W)=>{const le=K.paint.get("hillshade-shadow-color"),ne=K.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",se=K.paint.get("hillshade-highlight-color"),ie=K.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",Q=K.paint.get("hillshade-accent-color"),ce=K.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ve=K.paint.get("hillshade-emissive-strength");let ge=s.an(K.paint.get("hillshade-illumination-direction"));if(K.paint.get("hillshade-illumination-anchor")==="viewport")ge-=U.transform.angle;else if(U.style&&U.style.enable3dLights()&&U.style.directionalLight){const ze=U.style.directionalLight.properties.get("direction"),je=s.d4(ze.x,ze.y,ze.z);ge=s.an(je[1])}const Le=!U.options.moving;return{u_matrix:W||U.transform.calculateProjMatrix(Z.tileID.toUnwrapped(),Le),u_image:0,u_latrange:Jx(0,Z.tileID),u_light:[K.paint.get("hillshade-exaggeration"),ge],u_shadow:le.toPremultipliedRenderColor(ne?null:K.lut),u_highlight:se.toPremultipliedRenderColor(ie?null:K.lut),u_emissive_strength:ve,u_accent:Q.toPremultipliedRenderColor(ce?null:K.lut)}})(l,r,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(v,R,t.toUnwrapped());const{tileBoundsBuffer:B,tileBoundsIndexBuffer:O,tileBoundsSegments:G}=l.getTileBoundsBuffers(r);R.draw(l,b.TRIANGLES,p,_,g,ei.disabled,D,c.id,B,O,G)}function jf(l,t,r){if(!t.needsDEMTextureUpload)return;const c=l.context,p=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(r.stride);const _=r.getPixels();t.demTexture?t.demTexture.update(_,{premultiply:!1}):t.demTexture=new s.T(c,_,p.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function e1(l,t,r){const c=l.context,p=c.gl;if(!t.dem)return;const _=t.dem;if(c.activeTexture.set(p.TEXTURE1),jf(l,t,_),!t.demTexture)return;t.demTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE);const g=_.dim;c.activeTexture.set(p.TEXTURE0);let v=t.hillshadeFBO;if(!v){const R=new s.T(c,{width:g,height:g,data:null},p.RGBA8);R.bind(p.LINEAR,p.CLAMP_TO_EDGE),v=t.hillshadeFBO=c.createFramebuffer(g,g,1,"renderbuffer"),v.colorAttachment0.set(R.texture)}c.bindFramebuffer.set(v.framebuffer),c.viewport.set([0,0,g,g]);const{tileBoundsBuffer:b,tileBoundsIndexBuffer:E,tileBoundsSegments:C}=l.getMercatorTileBoundsBuffers(),z=[];l.linearFloatFilteringSupported()&&z.push("TERRAIN_DEM_FLOAT_FORMAT"),l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&z.push("USE_MRT1"),l.getOrCreateProgram("hillshadePrepare",{defines:z}).draw(l,p.TRIANGLES,kt.disabled,ii.disabled,fi.unblended,ei.disabled,((R,D)=>{const B=D.stride,O=s.bC();return s.ce(O,0,s.al,-s.al,0,0,1),s.br(O,O,[0,-s.al,0]),{u_matrix:O,u_image:1,u_dimension:[B,B],u_zoom:R.overscaledZ}})(t.tileID,_),r.id,b,E,C),t.needsHillshadePrepare=!1}class Rn{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class t1 extends Rn{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Xg extends Rn{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Uf extends Rn{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class _d extends Rn{getDefault(){return[!0,!0,!0,!0]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Gf extends Rn{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class $l extends Rn{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Dc extends Rn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const r=this.current;(t.func!==r.func||t.ref!==r.ref||t.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Nu extends Rn{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class kc extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=t,this.dirty=!1}}class Yg extends Rn{getDefault(){return[0,1]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class $f extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=t,this.dirty=!1}}class Kg extends Rn{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Oc extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.BLEND):r.disable(r.BLEND),this.current=t,this.dirty=!1}}class gd extends Rn{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class yd extends Rn{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Hf extends Rn{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class vd extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;t?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=t,this.dirty=!1}}class Vu extends Rn{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Jg extends Rn{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Qg=class extends Rn{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class ey extends Rn{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Fc extends Rn{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ty extends Rn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class i1 extends Rn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class n1 extends Rn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindTexture(r.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class r1 extends Rn{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class qf extends Rn{getDefault(){return null}set(t){const r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Zf extends Rn{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Wf extends Rn{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Xf extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class iy extends Rn{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class xd extends Rn{constructor(t,r){super(t),this.context=t,this.parent=r}getDefault(){return null}}class wd extends xd{constructor(t,r,c=0){super(t,r),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+c}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachmentPoint,r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Bc extends xd{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ju extends xd{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachment(),r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ny extends Bc{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Wo=(l,t,r,c)=>({u_matrix:l,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:r,u_emissive_texture_available:c}),bd=(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:r,u_zoom_transition:p,u_merc_center:_,u_image0:0,u_image1:1,u_frustum_tl:g,u_frustum_tr:v,u_frustum_br:b,u_frustum_bl:E,u_globe_pos:C,u_globe_radius:z,u_viewport:R,u_grid_matrix:G?Float32Array.from(G):new Float32Array(9),u_skirt_height:D,u_far_z_cutoff:B,u_emissive_texture_available:O});function Uu(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const Ca=new class{constructor(){this.operations={}}
3013newMorphing(l,t,r,c,p){if(l in this.operations){const _=this.operations[l];_.to.tileID.key!==r.tileID.key&&(_.queued=r)}else this.operations[l]={startTime:c,phase:0,duration:p,from:t,to:r,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const r=this.operations[t];for(r.phase=(l-r.startTime)/r.duration;r.phase>=1||!this._validOp(r);)if(!this._nextOp(r,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},Td={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Sd(l,t,r){if(t===0)return 0;const c=t<1&&r===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function Yf(l,t){const r=1<<l.z;return!t&&(l.x===0||l.x===r-1)||l.y===0||l.y===r-1}function Nc(l,t){if(!l.style||!l.style.enable3dLights())return;const r=l.context,c=r.gl;r.activeTexture.set(c.TEXTURE1),t?t.bind(c.LINEAR,c.CLAMP_TO_EDGE):l.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)}const Gu=l=>({u_matrix:l});function $u(l,t,r,c,p){if(p>0){const _=s.o.now(),g=(_-l.timeAdded)/p,v=t?(_-t.timeAdded)/p:-1,b=r.getSource(),E=c.coveringZoomLevel({tileSize:b.tileSize,roundZoom:b.roundZoom}),C=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(l.tileID.overscaledZ-E),z=C&&l.refreshedUponExpiration?1:s.aA(C?g:1-v,0,1);return t?{opacity:1,mix:1-z,isFading:g<1}:{opacity:z,mix:0,isFading:g<1}}return{opacity:1,mix:0,isFading:!1}}class Ed extends Oo{constructor(t){const r=Mr("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,r){t.state="loaded",r(null)}}class Kf extends Oo{constructor(t){const r=Mr("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,r,c){if(t.freezeTileCoverage)return;this.transform=t;const p=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((_,g)=>{if(_[g.key]="",!this._tiles[g.key]){const v=new Bl(g,this._source.tileSize*g.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);v.state="loaded",this._tiles[g.key]=v}return _},{});for(const _ in this._tiles)_ in p||(this.freeFBO(_),this._tiles[_].unloadVectorData(),delete this._tiles[_])}freeFBO(t){const r=this.proxyCachedFBO[t];if(r!==void 0){const c=Object.values(r);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Jf extends s.aQ{constructor(t,r,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=r,this.projMatrix=c}}class Qf extends s.bV{constructor(t,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,p,_]=function(b){const E=new s.bd,C=new s.b0,z=131;E.reserve(17161),C.reserve(33800);const R=s.al/128,D=s.al+R/2,B=D+R;for(let G=-R;
3013G<B;G+=R)for(let U=-R;U<B;U+=R){const Z=U<0||U>D||G<0||G>D?24575:0,K=s.aA(Math.round(U),0,s.al),W=s.aA(Math.round(G),0,s.al);E.emplaceBack(K+Z,W)}const O=(G,U)=>{const Z=U*z+G;C.emplaceBack(Z+1,Z,Z+z),C.emplaceBack(Z+z,Z+z+1,Z+1)};for(let G=1;G<129;G++)for(let U=1;U<129;U++)O(U,G);return[0,129].forEach(G=>{for(let U=0;U<130;U++)O(U,G),O(G,U)}),[E,C,32768]}(),g=t.context;this.gridBuffer=g.createVertexBuffer(c,s.bf.members),this.gridIndexBuffer=g.createIndexBuffer(p),this.gridSegments=s.bg.simpleSegment(0,0,c.length,p.length),this.gridNoSkirtSegments=s.bg.simpleSegment(0,0,c.length,_),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Kf(r.map),this.orthoMatrix=s.bC(),s.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.al,0,s.al,0,1);const v=g.gl;this._overlapStencilMode=new ii({func:v.GEQUAL,mask:255},0,255,v.KEEP,v.KEEP,v.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ed(r.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,r,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const p=t.terrain.properties,_=t.terrain.drapeRenderMode===0,g=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.o.now();const v=t.terrain&&t.terrain.scope,b=p.get("source"),E=_?this._mockSourceCache:t.getSourceCache(b,v);if(!E)return void s.w(`Couldn't find terrain source "${b}".`);if(this.sourceCache=E,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=g?this.calculateExaggeration(r):p.get("exaggeration"),!r.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const C=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
3014This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const z=this.getScaledDemTileSize();this.sourceCache.update(r,z,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,C(),this._initializing=!0),C(),r.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const r=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const p=r!=null?c-r:Number.MAX_VALUE;if(Math.abs(p)<2)return this._exaggeration;const _=t.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(_);let v=_-this._previousZoom;const b=this._previousUpdateTimestamp;let E=_;this._evaluationZoom!=null&&(E=this._evaluationZoom,Math.abs(_-E)>.5&&(v=.5*(_-E+v)),v*p<0&&(E+=v)),this._evaluationZoom=E;const C=g.getExaggeration(E),z=C===g.getExaggeration(Math.max(0,E-.1));if(z&&Math.abs(C-this._exaggeration)<.01)return C;let R=Math.min(.1,.00375*(this._updateTimestamp-b));return(z||C<.1||Math.abs(v)<1e-4)&&(R=Math.min(.2,4*R)),s.ak(this._exaggeration,C,R)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const r=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ae.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const p=this.proxyCoords=r.getIds().map(b=>{const E=r.getTileByID(b).tileID;return E.projMatrix=c.calculateProjMatrix(E.toUnwrapped()),E});(function(b,E){const C=E.transform.pointCoordinate(E.transform.getCameraPoint()),z=new s.P(C.x,C.y);b.sort((R,D)=>
vendor: 4,736 bytes, line 3014
3014{if(D.overscaledZ-R.overscaledZ)return D.overscaledZ-R.overscaledZ;const B=new s.P(R.canonical.x+(1<<R.canonical.z)*R.wrap,R.canonical.y),O=new s.P(D.canonical.x+(1<<D.canonical.z)*D.wrap,D.canonical.y),G=z.mult(1<<R.canonical.z);return G.x-=.5,G.y-=.5,G.distSqr(B)-G.distSqr(O)})})(p,this.painter);const _=this.proxyToSource||{};this.proxyToSource={},p.forEach(b=>{this.proxyToSource[b.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const b in g){const E=g[b];if(!E.used||(E!==this.sourceCache&&this.resetTileLookupCache(E.id),this._setupProxiedCoordsForOrtho(E,t[b],_),E.usedForTerrain))continue;const C=t[b];E.getSource().reparseOverscaled&&this._assignTerrainTiles(C)}this.proxiedCoords[r.id]=p.map(b=>new Jf(b,b.key,this.orthoMatrix)),this._assignTerrainTiles(p),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(_),this.renderingToTexture=!1;const v={};this._visibleDemTiles=[];for(const b of this.proxyCoords){const E=this.terrainTileForTile[b.key];if(!E)continue;const C=E.tileID.key;C in v||(this._visibleDemTiles.push(E),v[C]=C)}}_assignTerrainTiles(t){this._initializing||t.forEach(r=>{if(this.terrainTileForTile[r.key])return;const c=this._findTileCoveringTileID(r,this.sourceCache);c&&(this.terrainTileForTile[r.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,r=t.gl;for(const c in this.terrainTileForTile){const p=this.terrainTileForTile[c],_=p.dem;!_||p.demTexture&&!p.needsDEMTextureUpload||(t.activeTexture.set(r.TEXTURE1),jf(this.painter,p,_))}}_prepareDemTileUniforms(t,r,c,p){if(!r||r.demTexture==null)return!1;const _=t.tileID.canonical,g=Math.pow(2,r.tileID.canonical.z-_.z),v=p||"";return c[`u_dem_tl${v}`]=[_.x*g%1,_.y*g%1],c[`u_dem_scale${v}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const r=this._visibleDemTiles.reduce((c,p)=>{if(!p.dem)return c;const _=p.dem.tree.minimums[0];return _>0&&t++,c+_},0);return t?r/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,r=t.gl;t.activeTexture.set(r.TEXTURE2);const c=this._getLoadedAreaMinimum(),p=new s.dL({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let _=this._emptyDEMTexture;return _?_.update(p,{premultiply:!1}):_=this._emptyDEMTexture=new s.T(t,p,r.R32F,{premultiply:!1}),_}setupElevationDraw(t,r,c){const p=this.painter.context,_=p.gl,g={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};g.u_exaggeration=this.exaggeration();let v=null,b=null,E=1;if(c&&c.morphing&&this._useVertexMorphing){const D=c.morphing.srcDemTile,B=c.morphing.dstDemTile;E=c.morphing.phase,D&&B&&(this._prepareDemTileUniforms(t,D,g,"_prev")&&(b=D),this._prepareDemTileUniforms(t,B,g)&&(v=B))}const C=D=>D&&D.demTexture&&this.painter.linearFloatFilteringSupported()?_.LINEAR:_.NEAREST;let z=null;var R;if(this.enabled?b&&v?(z=v.demTexture,p.activeTexture.set(_.TEXTURE4),b.demTexture.bind(C(b),_.CLAMP_TO_EDGE),g.u_dem_lerp=E):(v=this.terrainTileForTile[t.tileID.key],z=this._prepareDemTileUniforms(t,v,g)?v.demTexture:this.emptyDEMTexture):z=this.emptyDEMTexture,p.activeTexture.set(_.TEXTURE2),z&&(g.u_dem_size=(R=z).size[0]===1?1:R.size[0]-2,z.bind(C(v),_.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,r,g),c&&c.useMeterToDem&&v){const D=(1<<v.tileID.canonical.z)*s.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;g.u_meter_to_dem=D}if(c&&c.labelPlaneMatrixInv&&(g.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),r.setTerrainUniformValues(p,g),this.painter.transform.projection.name==="globe"){const D=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);r.setGlobeUniformValues(p,D)}}globeUniformValues(t,r,c){const p=t.projection;return{u_tile_tl_up:p.upVector(r,0,0),u_tile_tr_up:p.upVector(r,s.al,0),u_tile_br_up:p.upVector(r,s.al,s.al),u_tile_bl_up:p.upVector(r,0,s.al),u_tile_up_scale:c?s.dM(1):p.upVectorScale(r,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const r=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(p,_,g,v,b){if(p.transform.projection.name==="globe")(function(E,C,z,R,D){const B=E.context,O=B.gl;let G,U;const Z=E.transform,K=s.dE(E,B,Z),W=(Le,ze)=>{if(U===ze)return;const je=[Td[ze],"PROJECTION_GLOBE_VIEW"];
vendor: 1,522 bytes, line 3014
3014K&&je.push("CUSTOM_ANTIALIASING");const nt=E.isTileAffectedByFog(Le);G=E.getOrCreateProgram("globeRaster",{defines:je,overrideFog:nt}),U=ze},le=E.colorModeForRenderPass(),ne=new kt(O.LEQUAL,kt.ReadWrite,E.depthRangeFor3D);Ca.update(D);const se=s.dF(Z),ie=[s.aF(Z.center.lng),s.aJ(Z.center.lat)],Q=E.globeSharedBuffers,ce=[Z.width*s.o.devicePixelRatio,Z.height*s.o.devicePixelRatio],ve=Float32Array.from(Z.globeMatrix),ge={useDenormalizedUpVectorScale:!0};{const Le=E.transform,ze=Sd(Le.zoom,C.exaggeration(),C.sourceCache._source.tileSize);U=-1;const je=O.TRIANGLES;for(const nt of R){const Ae=z.getTile(nt),fe=ii.disabled,Oe=C.prevTerrainTileForTile[nt.key],Me=C.terrainTileForTile[nt.key];Uu(Oe,Me)&&Ca.newMorphing(nt.key,Oe,Me,D,250),Nc(E,Ae.emissiveTexture),B.activeTexture.set(O.TEXTURE0),Ae.texture&&Ae.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE);const Ze=Ca.getMorphValuesForProxy(nt.key),ft=Ze?1:0;Ze&&Object.assign(ge,{morphing:{srcDemTile:Ze.from,dstDemTile:Ze.to,phase:s.dD(Ze.phase)}});const bt=s.dG(nt.canonical),ut=s.dH(bt.getCenter().lat),rt=s.dI(nt.canonical,bt,ut,Le.worldSize/Le._pixelsPerMercatorPixel),Lt=s.bk(s.dJ(nt.canonical)),Mt=E.emissiveMode==="mrt-fallback"?1:0,xt=bd(Le.expandedFarZProjMatrix,ve,se,Lt,s.aj(Le.zoom),ie,Le.frustumCorners.TL,Le.frustumCorners.TR,Le.frustumCorners.BR,Le.frustumCorners.BL,Le.globeCenterInViewSpace,Le.globeRadius,ce,ze,Le._farZ,Mt,rt);if(W(nt,ft),G&&(C.setupElevationDraw(Ae,G,ge),E.uploadCommonUniforms(B,G,nt.toUnwrapped()),Q)){const[St,Ht,ci]=Q.getGridBuffers(ut,ze
3014!==0);G.draw(E,je,ne,fe,le,ei.backCCW,xt,"globe_raster",St,Ht,ci)}}}if(Q&&(E.renderDefaultNorthPole||E.renderDefaultSouthPole)){const Le=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];K&&Le.push("CUSTOM_ANTIALIASING"),G=E.getOrCreateProgram("globeRaster",{defines:Le});for(const ze of R){const{x:je,y:nt,z:Ae}=ze.canonical,fe=nt===0,Oe=nt===(1<<Ae)-1,[Me,Ze,ft,bt]=Q.getPoleBuffers(Ae,!1);if(bt&&(fe||Oe)){const ut=z.getTile(ze);Nc(E,ut.emissiveTexture),B.activeTexture.set(O.TEXTURE0),ut.texture&&ut.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE);let rt=s.dK(Ae,je,Z);const Lt=s.bk(s.dJ(ze.canonical)),Mt=E.emissiveMode==="mrt-fallback"?1:0,xt=(St,Ht)=>St.draw(E,O.TRIANGLES,ne,ii.disabled,le,ei.disabled,bd(Z.expandedFarZProjMatrix,rt,rt,Lt,0,ie,Z.frustumCorners.TL,Z.frustumCorners.TR,Z.frustumCorners.BR,Z.frustumCorners.BL,Z.globeCenterInViewSpace,Z.globeRadius,ce,0,Z._farZ,Mt),"globe_pole_raster",Ht,ft,bt);C.setupElevationDraw(ut,G,ge),E.uploadCommonUniforms(B,G,ze.toUnwrapped()),fe&&E.renderDefaultNorthPole&&xt(G,Me),Oe&&E.renderDefaultSouthPole&&(rt=s.cS(s.bC(),rt,[1,-1,1]),xt(G,Ze))}}}})(p,_,g,v,b);else{const E=p.context,C=E.gl;let z,R;const D=p.shadowRenderer,B=rl(p,p.longestCutoffRange),O=le=>{if(R===le)return;const ne=[];ne.push(Td[le]),B.shouldRenderCutoff&&ne.push("RENDER_CUTOFF"),D&&(ne.push("RENDER_SHADOWS","DEPTH_TEXTURE"),D.useNormalOffset&&ne.push("NORMAL_OFFSET")),z=p.getOrCreateProgram("terrainRaster",{defines:ne}),R=le},G=p.colorModeForRenderPass(),U=new kt(C.LEQUAL,kt.ReadWrite,p.depthRangeFor3D);Ca.update(b);const Z=p.transform,K=Sd(Z.zoom,_.exaggeration(),_.sourceCache._source.tileSize);let W=[0,0,0];if(D){const le=p.style.directionalLight,ne=p.style.ambientLight;le&&ne&&(W=Aa(p.style,le,ne))}{R=-1;const le=C.TRIANGLES,[ne,se]=[_.gridIndexBuffer,_.gridSegments];for(const ie of v){const Q=g.getTile(ie),ce=ii.disabled,ve=_.prevTerrainTileForTile[ie.key],ge=_.terrainTileForTile[ie.key];Uu(ve,ge)&&Ca.newMorphing(ie.key,ve,ge,b,250),Nc(p,Q.emissiveTexture),E.activeTexture.set(C.TEXTURE0),Q.texture&&Q.texture.bind(C.LINEAR,C.CLAMP_TO_EDGE);const Le=Ca.getMorphValuesForProxy(ie.key),ze=Le?1:0;let je;Le&&(je={morphing:{srcDemTile:Le.from,dstDemTile:Le.to,phase:s.dD(Le.phase)}});const nt=p.emissiveMode==="mrt-fallback"?1:0,Ae=Wo(ie.projMatrix,Yf(ie.canonical,Z.renderWorldCopies)?K/10:K,W,nt);if(O(ze),!z)continue;_.setupElevationDraw(Q,z,je);const fe=ie.toUnwrapped();D&&D.setupShadows(fe,z),p.uploadCommonUniforms(E,z,fe,null,B),z.draw(p,le,U,ce,G,ei.backCCW,Ae,"terrain_raster",_.gridBuffer,ne,se)}}}}(r,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const r=this.painter,c=this.painter.context,p=this.proxySourceCache,_=this.proxiedCoords[p.id],g=this._drapedRenderBatches.shift(),v=r.style.order,b=[];this._updateFBOs(r.emissiveMode==="mrt-fallback");let E=0;for(const C of _){const z=p.getTileByID(C.proxyTileKey),R=p.proxyCachedFBO[C.key]?p.proxyCachedFBO[C.key][t]:void 0,D=R!==void 0?p.renderCache[R]:this.pool[E++],B=R!==void 0;if(z.texture=D.tex,z.emissiveTexture=D.emissiveTex,B&&!D.dirty){b.push(z.tileID);continue}c.bindFramebuffer.set(D.fb.framebuffer);const O=c.gl;let G;O.drawBuffers(r.emissiveMode==="mrt-fallback"?[O.COLOR_ATTACHMENT0,O.COLOR_ATTACHMENT1]:[O.COLOR_ATTACHMENT0]),this.renderedToTile=!1,D.dirty&&(c.clear({color:s.ao.transparent,stencil:0}),D.dirty=!1);for(let U=g.start;U<=g.end;++U){const Z=r.style._mergedLayers[v[U]];if(Z.isHidden(r.transform.zoom))continue;const K=r.style.getLayerSourceCache(Z),W=K?this.proxyToSource[C.key][K.id]:[C];if(!W)continue;const le=W;c.viewport.set([0,0,D.fb.width,D.fb.height]),G!==(K?K.id:null)&&(this._setupStencil(D,W,Z,K),G=K?K.id:null),r.renderLayer(r,K,Z,le)}if(O.drawBuffers([O.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const U of this._pendingGroundEffectLayers){const Z=r.style._mergedLayers[v[U]];if(Z.isHidden(r.transform.zoom))continue;const K=r.style.getLayerSourceCache(Z),W=K?this.proxyToSource[C.key][K.id]:[C];if(!W)continue;const le=W;c.viewport.set([0,0,D.fb.width,D.fb.height]),G!==(K?K.id:null)&&(this._setupStencil(D,W,Z,K),G=K?K.id:null),r.renderLayer(r,K,Z,le)}this.renderedToTile?(D.dirty=!0,b.push(z.tileID)):B||--E,E===5&&(E=0,this.renderToBackBuffer(b))}return this.renderToBackBuffer(b),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,r.width,r.height]),g.end+1}postRender(){}isLayerOrderingCorrect(t){const r=t.order.length;let c=-1,p=r;for(let _=0;_<r;++_)this._style.isLayerDraped(t._mergedLayers[t.order[_]])?c=Math.max(c,_):p=Math.min(p,_);return p>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(r=>r.dem).forEach(r=>{t=Math.min(t,r.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,r,c){if(!this._visibleDemTiles)return null;const p=this._visibleDemTiles.filter(_=>_.dem).map(_=>{const g=_.tileID,v=1<<g.overscaledZ,{x:b,y:E}=g.canonical,C=b/v,z=(b+1)/v,R=E/v,D=(E+1)/v;return{minx:C,miny:R,maxx:z,maxy:D,t:_.dem.tree.raycastRoot(C,R,z,D,t,r,c),tile:_}});p.sort((_,g)=>(_.t!==null?_.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const _ of p){if(_.t==null)return null;const g=_.tile.dem.tree.raycast(_.minx,_.miny,_.maxx,_.maxy,t,r,c);if(g!=null)return g}return null}_createFBO(){const t=this.painter.context,r=t.gl,c=this.drapeBufferSize;t.activeTexture.set(r.TEXTURE0);const p=new s.T(t,{width:c[0],height:c[1],data:null},r.RGBA8);p.bind(r.LINEAR,r.CLAMP_TO_EDGE);const _=t.createFramebuffer(c[0],c[1],1,null);let g;return _.colorAttachment0.set(p.texture),this._emissiveTexture&&(g=new s.T(t,{width:c[0],height:c[1],data:null},r.R8),g.bind(r.LINEAR,r.CLAMP_TO_EDGE),_.createColorAttachment(t,1),_.colorAttachment1.set(g.texture)),_.depthAttachment=ne
3014w ny(t,_.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,_.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):_.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:_,tex:p,emissiveTex:g,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const r of this.pool)this._updateFBO(r,t);for(const r of this.proxySourceCache.renderCache)this._updateFBO(r,t);this._emissiveTexture=t}}_updateFBO(t,r){const c=t.fb,p=this.painter.context,_=p.gl,g=this.drapeBufferSize;if(r){const v=new s.T(p,{width:g[0],height:g[1],data:null},_.R8);v.bind(_.LINEAR,_.CLAMP_TO_EDGE),t.emissiveTex=v,c.createColorAttachment(p,1),c.colorAttachment1.set(v.texture)}else t.emissiveTex=void 0,c.removeColorAttachment(p,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const r=this._style._mergedLayers[t],c=r.isHidden(this.painter.transform.zoom);return r.type==="hillshade"||r.type==="custom"?!c&&r.shouldRedrape():!c&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof kl){t=!0;break}if(!t)return;const r={};for(let c=0;c<this._style.order.length;++c){const p=this._style._mergedLayers[this._style.order[c]],_=this._style.getLayerSourceCache(p);if(!_||r[_.id]||p.isHidden(this.painter.transform.zoom)||p.type!=="line")continue;const g=p.widthExpression(),v=p.emissiveStrengthExpression();if(g instanceof s.ad||v instanceof s.ad){r[_.id]=!0;for(const b of this.proxyCoords){const E=this.proxyToSource[b.key][_.id];if(E)for(const C of E)this._clearRenderCacheForTile(_.id,C)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Fr){t=!0;break}if(!t)return;const r={};for(let c=0;c<this._style.order.length;++c){const p=this._style._mergedLayers[this._style.order[c]],_=this._style.getLayerSourceCache(p);if(!_||r[_.id]||p.isHidden(this.painter.transform.zoom)||p.type!=="raster")continue;const g=p.paint.get("raster-fade-duration");for(const v of this.proxyCoords){const b=this.proxyToSource[v.key][_.id];if(b)for(const E of b){const C=$u(_.getTile(E),_.findLoadedParent(E,0),_,this.painter.transform,g);(C.opacity!==1||C.mix!==0)&&this._clearRenderCacheForTile(_.id,E)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,r=t.length;if(r===0)return;const c=[];this._pendingGroundEffectLayers=[];let p,_=0,g=this._style._mergedLayers[t[_]];for(;!this._style.isLayerDraped(g)&&g.isHidden(this.painter.transform.zoom)&&++_<r;)g=this._style._mergedLayers[t[_]];for(;_<r;++_){const v=this._style._mergedLayers[t[_]];v.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(v)?p===void 0&&(p=_):(v.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(_),p!==void 0&&(c.push({start:p,end:_-1}),p=void 0)))}if(p!==void 0&&c.push({start:p,end:_-1}),c.length!==0){const v=c[c.length-1];this._pendingGroundEffectLayers.every(b=>b>v.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){const g=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let v=0;v<g.length;++v){const b=Object.values(g[v]);r.renderCachePool.push(...b)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,p=this._tilesDirty;for(let g=c.length-1;g>=0;g--){const v=c[g];if(r.getTileByID(v.key),r.proxyCachedFBO[v.key]!==void 0){const b=t[v.key],E=this.proxyToSource[v.key];let C=0;for(const z in E){const R=E[z],D=b[z];if(!D||D.length!==R.length||R.some((B,O)=>B!==D[O]||p[z]&&p[z].hasOwnProperty(B.key))){C=-1;break}++C}for(const z in r.proxyCachedFBO[v.key])r.renderCache[r.proxyCachedFBO[v.key][z]].dirty=C<0||C!==Object.values(b).length}}const _=[...this._drapedRenderBatches];_.sort((g,v)=>v.end-v.start-(g.end-g.start));for(const g of _)for(const v of c){if(r.proxyCachedFBO[v.key])continue;let b=r.renderCachePool.pop();b===void 0&&r.renderCache.length<50&&(b=r.renderCache.length,r.renderCache.push(this._createFBO())),b!==void 0&&(r.proxyCachedFBO[v.key]={},r.proxyCachedFBO[v.key][g.start]=b,r.renderCache[b].dirty=!0)}this._tilesDirty={}}
vendor: 5,256 bytes, line 3014
3014_setupStencil(t,r,c,p){if(!p||!this._sourceTilesOverlap[p.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const _=this.painter.context,g=_.gl;if(r.length<=1)return void(this._overlapStencilType=!1);let v;if(c.isTileClipped())v=r.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);v=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+v>255&&(_.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=v,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):ii.disabled}_renderTileClippingMasks(t,r){const c=this.painter,p=this.painter.context,_=p.gl;c._tileClippingMaskIDs={},p.setColorMode(fi.disabled),p.setDepthMode(kt.disabled);const g=c.getOrCreateProgram("clippingMask");for(const v of t){const b=c._tileClippingMaskIDs[v.key]=--r;g.draw(c,_.TRIANGLES,kt.disabled,new ii({func:_.ALWAYS,mask:0},b,255,_.KEEP,_.KEEP,_.REPLACE),fi.disabled,ei.disabled,Gu(v.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const r=this.painter.transform;if(t.x<0||t.x>r.width||t.y<0||t.y>r.height)return null;const c=[t.x,t.y,1,1];s.aC(c,c,r.pixelMatrixInverse),s.cK(c,c,1/c[3]),c[0]/=r.worldSize,c[1]/=r.worldSize;const p=r._camera.position,_=s.cf(1,r.center.lat),g=[p[0],p[1],p[2]/_,0],v=s.da([],c.slice(0,3),g);s.aw(v,v);const b=this.raycast(g,v,this._exaggeration);return b!==null&&b?(s.bH(g,g,v,b),g[3]=g[2],g[2]*=_,g):null}_setupProxiedCoordsForOrtho(t,r,c){if(t.getSource()instanceof s.aU)return this._setupProxiedCoordsForImageSource(t,r,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const p=this.proxiedCoords[t.id]=[],_=this.proxyCoords;for(let b=0;b<_.length;b++){const E=_[b],C=this._findTileCoveringTileID(E,t);if(C){const z=this._createProxiedId(E,C,c[E.key]&&c[E.key][t.id]);p.push(z),this.proxyToSource[E.key][t.id]=[z]}}let g=!1;const v=new Set;for(let b=0;b<r.length;b++){const E=t.getTile(r[b]);if(!E||!E.hasData())continue;const C=this._findTileCoveringTileID(E.tileID,this.proxySourceCache);if(C&&C.tileID.canonical.z!==E.tileID.canonical.z){const z=this.proxyToSource[C.tileID.key][t.id],R=this._createProxiedId(C.tileID,E,c[C.tileID.key]&&c[C.tileID.key][t.id]);z?z.splice(z.length-1,0,R):this.proxyToSource[C.tileID.key][t.id]=[R];const D=this.proxyToSource[C.tileID.key][t.id];v.has(D)||v.add(D),p.push(R),g=!0}}if(this._sourceTilesOverlap[t.id]=g,g&&this._debugParams.sortTilesHiZFirst)for(const b of v)b.sort((E,C)=>C.overscaledZ-E.overscaledZ)}_setupProxiedCoordsForImageSource(t,r,c){if(!t.getSource().loaded())return;const p=this.proxiedCoords[t.id]=[],_=this.proxyCoords,g=t.getSource(),v=g.tileID;if(!v)return;const b=new s.P(v.x,v.y)._div(1<<v.z),E=g.coordinates.map(s.ae.fromLngLat).reduce((z,R)=>(z.min.x=Math.min(z.min.x,R.x-b.x),z.min.y=Math.min(z.min.y,R.y-b.y),z.max.x=Math.max(z.max.x,R.x-b.x),z.max.y=Math.max(z.max.y,R.y-b.y),z),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),C=(z,R)=>{const D=z.wrap+z.canonical.x/(1<<z.canonical.z),B=z.canonical.y/(1<<z.canonical.z),O=s.al/(1<<z.canonical.z),G=R.wrap+R.canonical.x/(1<<R.canonical.z),U=R.canonical.y/(1<<R.canonical.z);return D+O<G+E.min.x||D>G+E.max.x||B+O<U+E.min.y||B>U+E.max.y};for(let z=0;z<_.length;z++){const R=_[z];for(let D=0;D<r.length;D++){const B=t.getTile(r[D]);if(!B||!B.hasData()||C(R,B.tileID))continue;const O=this._createProxiedId(R,B,c[R.key]&&c[R.key][t.id]),G=this.proxyToSource[R.key][t.id];G?G.push(O):this.proxyToSource[R.key][t.id]=[O],p.push(O)}}}_createProxiedId(t,r,c){let p=this.orthoMatrix;if(c){const _=c.find(g=>g.key===r.tileID.key);if(_)return _}if(r.tileID.key!==t.key){const _=t.canonical.z-r.tileID.canonical.z;let g,v,b;p=s.bC();const E=r.tileID.wrap-t.wrap<<t.overscaledZ;_>0?(g=s.al>>_,v=g*((r.tileID.canonical.x<<_)-t.canonical.x+E),b=g*((r.tileID.canonical.y<<_)-t.canonical.y)):(g=s.al<<-_,v=s.al*(r.tileID.canonical.x-(t.canonical.x+E<<-_)),b=s.al*(r.tileID.canonical.y-(t.canonical.y<<-_))),s.ce(p,0,g,0,g,0,1),s.br(p,p,[v,b,0])}return new Jf(r.tileID,t.key,p)}_findTileCoveringTileID(t,r){let c=r.getTile(t);if(c&&c.hasData())return c;const p=this._findCoveringTileCache[r.id],_=p[t.key];if(c=_?r.getTileByID(_):null,c&&c.hasData()||_===null)return c;let g=c?c.tileID:t,v=g.overscaledZ;const b=r.getSource().minzoom,E=[];if(!_){const z=r.getSource().maxzoom;if(t.canonical.z>=z){const R=t.canonical.z-z;r.getSource().reparseOverscaled?(v=Math.max(t.canonical.z+2,r.transform.tileZoom),g=new s.aQ(v,t.wrap,z,t.canonical.x>>R,t.canonical.y>>R)):R!==0&&(v=z,g=new s.aQ(v,t.wrap,z,t.canonical.x>>R,t.canonical.y>>R))}g.key!==t.key&&(E.push(g.key),c=r.getTile(g))}const C=z=>
3014{E.forEach(R=>{p[R]=z}),E.length=0};for(v-=1;v>=b&&(!c||!c.hasData());v--){c&&C(c.tileID.key);const z=g.calculateScaledKey(v);if(c=r.getTileByID(z),c&&c.hasData())break;const R=p[z];if(R===null)break;R===void 0?E.push(z):c=r.getTileByID(R)}return C(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,r){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[r.key]=!0}}function Vc(l,t,r){const c=function(v,b,E){const C=s.bJ(b,v),z=s.bJ(E,[.2126,.7152,.0722]),R=(B,O,G)=>(1-G)*B+G*O,D=R(1-.3*Math.min(z,1),1,Math.min(C+1,1));return R(.92,1,Math.asin(s.aA(b[2],-1,1))/Math.PI+.5)*D}(l,[0,0,1],t),p=[0,0,0];s.c5(p,r.slice(0,3),c);const _=[0,0,0];s.c5(_,t.slice(0,3),l[2]);const g=[0,0,0];return s.d8(g,p,_),s.db(g)}const o1=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],s1=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class ry{static cacheKey(t,r,c,p){const _=[r];p&&_.push(p.cacheKey);for(const g of c)t.usedDefines.has(g)&&_.push(g);return _.join("/")}constructor(t,r,c,p,_,g){const v=t.gl;this.program=v.createProgram(),this.configuration=p,this.name=r,this.fixedDefines=[...g];const b=`#version 300 es
3015${(p?p.defines():[]).concat(g.map(O=>`#define ${O}`)).join(`
3016`)}`,E=[b,Yx];for(const O of c.fragmentIncludes)E.push(ll[O]);E.push(c.fragmentSource);const C=E.join(`
3017`),z=[b,Wg];for(const O of c.vertexIncludes)z.push(ll[O]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&z.push("uniform int u_instanceID;"),z.push(c.vertexSource);let R=z.join(`
3018`);this.forceManualRenderingForInstanceIDShaders&&(R=R.replaceAll("gl_InstanceID","u_instanceID"));const D=v.createShader(v.FRAGMENT_SHADER);if(v.isContextLost())return void(this.failedToCreate=!0);v.shaderSource(D,C),v.compileShader(D),v.attachShader(this.program,D);const B=v.createShader(v.VERTEX_SHADER);v.isContextLost()?this.failedToCreate=!0:(v.shaderSource(B,R),v.compileShader(B),v.attachShader(this.program,B),this.attributes={},v.linkProgram(this.program),v.deleteShader(B),v.deleteShader(D),this.fixedUniforms=_(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=p?p.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(O=>({u_instanceID:new s.ch(O)}))(t)),(g.includes("TERRAIN")||r.includes("symbol")||r.includes("circle"))&&(this.terrainUniforms=(O=>({u_dem:new s.ch(O),u_dem_prev:new s.ch(O),u_dem_tl:new s.ck(O),u_dem_scale:new s.cj(O),u_dem_tl_prev:new s.ck(O),u_dem_scale_prev:new s.cj(O),u_dem_size:new s.cj(O),u_dem_lerp:new s.cj(O),u_exaggeration:new s.cj(O),u_depth:new s.ch(O),u_depth_size_inv:new s.ck(O),u_depth_range_unpack:new s.ck(O),u_occluder_half_size:new s.cj(O),u_occlusion_depth_offset:new s.cj(O),u_meter_to_dem:new s.cj(O),u_label_plane_matrix_inv:new s.cl(O)}))(t)),g.includes("GLOBE")&&(this.globeUniforms=(O=>({u_tile_tl_up:new s.ci(O),u_tile_tr_up:new s.ci(O),u_tile_br_up:new s.ci(O),u_tile_bl_up:new s.ci(O),u_tile_up_scale:new s.cj(O)}))(t)),g.includes("FOG")&&(this.fogUniforms=(O=>({u_fog_matrix:new s.cl(O),u_fog_range:new s.ck(O),u_fog_color:new s.d3(O),u_fog_horizon_blend:new s.cj(O),u_fog_vertical_limit:new s.ck(O),u_fog_temporal_offset:new s.cj(O),u_frustum_tl:new s.ci(O),u_frustum_tr:new s.ci(O),u_frustum_br:new s.ci(O),u_frustum_bl:new s.ci(O),u_globe_pos:new s.ci(O),u_globe_radius:new s.cj(O),u_globe_transition:new s.cj(O),u_is_globe:new s.ch(O),u_viewport:new s.ck(O)}))(t)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(O=>({u_cutoff_params:new s.d3(O)}))(t)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(O=>({u_lighting_ambient_color:new s.ci(O),u_lighting_directional_dir:new s.ci(O),u_lighting_directional_color:new s.ci(O),u_ground_radiance:new s.ci(O)}))(t)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(O=>({u_light_matrix_0:new s.cl(O),u_light_matrix_1:new s.cl(O),u_fade_range:new s.ck(O),u_shadow_normal_offset:new s.ci(O),u_shadow_intensity:new s.cj(O),u_shadow_texel_size:new s.cj(O),u_shadow_map_resolution:new s.cj(O),u_shadow_direction:new s.ci(O),u_shadow_bias:new s.ci(O),u_shadowmap_0:new s.ch(O),u_shadowmap_1:new s.ch(O)}))(t)))}getAttributeLocation(t,r){let c=this.attributes[r];return c===void 0&&(c=this.attributes[r]=t.getAttribLocation(this.program,r)),c}setTerrainUniformValues(t,r){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in r)c[p]&&c[p].set(this.program,p,r[p])}}setGlobeUniformValues(t,r){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in r)c[p]&&c[p].set(this.program,p,r[p])}}setFogUniformValues(t,r){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in r)c[p].set(this.program,p,r[p])}}setCutoffUniformValues(t,r){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in r)c[p].set(this.program,p,r[p])}}setLightsUniformValues(t,r){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const p in r)c[p].set(this.program,p,r[p])}}setShadowUniformValues(t,r){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const p in r)c[p].set(this.program,p,r[p])}_drawDebugWireframe(t,r,c,p,_,g,v,b,E,C){const z=t.options.wireframe;if(z.terrain===!1&&z.layers2D===!1&&z.layers3D===!1)return;const R=t.context;if(!(()=>!(!z.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!z.layers2D||t._terrain&&t._terrain.renderingToTexture||!o1.includes(this.name))||!(!z.layers3D||!s1.includes(this.name)))())return;const D=R.gl,B=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,_,R);if(!B)return;
vendor: 4,298 bytes, line 3018
3018const O=[...this.fixedDefines,"DEBUG_WIREFRAME"],G=t.getOrCreateProgram(this.name,{config:this.configuration,defines:O});R.program.set(G.program);const U=(W,le,ne)=>{if(le[W]&&ne[W])for(const se in le[W])ne[W][se]&&ne[W][se].set(ne.program,se,le[W][se].current)};E&&E.setUniforms(G.program,R,G.binderUniforms,v,{zoom:b}),U("fixedUniforms",this,G),U("terrainUniforms",this,G),U("globeUniforms",this,G),U("fogUniforms",this,G),U("lightsUniforms",this,G),U("shadowUniforms",this,G),B.bind(),R.setColorMode(new fi([D.ONE,D.ONE_MINUS_SRC_ALPHA,D.ZERO,D.ONE],s.ao.transparent,[!0,!0,!0,!1])),R.setDepthMode(new kt(r.func===D.LESS?D.LEQUAL:r.func,kt.ReadOnly,r.range)),R.setStencilMode(ii.disabled);const Z=3*g.primitiveLength*2,K=3*g.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const W=C||1;for(let le=0;le<W;++le)G.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",le),D.drawElements(D.LINES,Z,D.UNSIGNED_SHORT,K)}else C&&C>1?D.drawElementsInstanced(D.LINES,Z,D.UNSIGNED_SHORT,K,C):D.drawElements(D.LINES,Z,D.UNSIGNED_SHORT,K);_.bind(),R.program.set(this.program),R.setDepthMode(r),R.setStencilMode(c),R.setColorMode(p)}checkUniforms(t,r,c){if(this.fixedDefines.includes(r)){for(const p of Object.keys(c))if(!c[p].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${p} not set but required by ${r} being defined`)}}draw(t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G){const U=t.context,Z=U.gl;if(this.failedToCreate)return;U.program.set(this.program),U.setDepthMode(c),U.setStencilMode(p),U.setColorMode(_),U.setCullFace(g);for(const[ie,Q]of this.fixedUniformsEntries)Q.set(this.program,ie,v[ie]);B&&B.setUniforms(this.program,U,this.binderUniforms,R,{zoom:D});const K={[Z.POINTS]:1,[Z.LINES]:2,[Z.TRIANGLES]:3,[Z.LINE_STRIP]:1}[r];this.checkUniforms(b,"RENDER_SHADOWS",this.shadowUniforms);const W=O||[],le=B?B.getPaintVertexBuffers():[],ne=r===Z.TRIANGLES&&C,se=G&&G>0?1:void 0;for(const ie of z.get()){const Q=ie.vaos||(ie.vaos={});if((Q[b]||(Q[b]=new Kx)).bind(U,this,E,le,C,ie.vertexOffset,W,se),this.forceManualRenderingForInstanceIDShaders){const ce=G||1;for(let ve=0;ve<ce;++ve)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ve),C?Z.drawElements(r,ie.primitiveLength*K,Z.UNSIGNED_SHORT,ie.primitiveOffset*K*2):Z.drawArrays(r,ie.vertexOffset,ie.vertexLength)}else G&&G>1?Z.drawElementsInstanced(r,ie.primitiveLength*K,Z.UNSIGNED_SHORT,ie.primitiveOffset*K*2,G):C?Z.drawElements(r,ie.primitiveLength*K,Z.UNSIGNED_SHORT,ie.primitiveOffset*K*2):Z.drawArrays(r,ie.vertexOffset,ie.vertexLength);ne&&this._drawDebugWireframe(t,c,p,_,C,ie,R,D,B,G)}}}function oy(l,t,r=0){const c=Math.pow(2,t.tileID.overscaledZ),p=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,_=p*(t.tileID.canonical.x+t.tileID.wrap*c),g=p*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.ay(t,1,l.transform.tileZoom),u_pixel_coord_upper:[_>>16,g>>16],u_pixel_coord_lower:[65535&_,65535&g],u_pattern_transition:r}}const Id={terrain:0,flat:1},a1=s.bC(),Ad=(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U)=>{const Z=t.style.light,K=Z.properties.get("position"),W=[K.x,K.y,K.z],le=s.dO();Z.properties.get("anchor")==="viewport"&&(s.dP(le,-t.transform.angle),s.dQ(W,W,le));const ne=Z.properties.get("color").toPremultipliedRenderColor(null),se=t.transform,ie={u_matrix:l,u_lightpos:W,u_lightintensity:Z.properties.get("intensity"),u_lightcolor:[ne.r,ne.g,ne.b],u_vertical_gradient:+r,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:a1,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Id[E],u_base_type:Id[C],u_ao:p,u_edge_radius:_,u_width_scale:g,u_flood_light_color:B,u_vertical_scale:O,u_flood_light_intensity:G,u_ground_shadow_factor:U};return se.projection.name==="globe"&&(ie.u_tile_id=[v.canonical.x,v.canonical.y,1<<v.canonical.z],ie.u_zoom_transition=z,ie.u_inv_rot_matrix=D,ie.u_merc_center=R,ie.u_up_dir=se.projection.upVector(new s.cD(0,0,0),R[0]*s.al,R[1]*s.al),ie.u_height_lift=b),ie},em=(l,t,r,c,p,_)=>({u_matrix:l,u_edge_radius:t,u_width_scale:r,u_vertical_scale:c,u_height_type:Id[p],u_base_type:Id[_]}),sy=(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U)=>{const Z=Ad(l,t,r,c,p,_,g,v,E,C,z,R,D,B,O,G,1,[0,0,0]),K={u_height_factor:-Math.pow(2,v.overscaledZ
vendor: 20,393 bytes, line 3018
3018)/b.tileSize/8};return Object.assign(Z,oy(t,b,U),K)},jc=(l,t,r,c,p,_,g,v,b,E,C)=>({u_matrix:t,u_opacity:r,u_ao_pass:c?1:0,u_meter_to_tile:p,u_ao:_,u_flood_light_intensity:g,u_flood_light_color:v,u_attenuation:b,u_edge_radius:E,u_fb:0,u_fb_size:C,u_dynamic_offset:1}),tm=(l,t,r)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:r}),im=(l,t,r,c,p,_=0)=>Object.assign(tm(l,t,p),oy(r,c,_)),ay=(l,t,r,c)=>({u_matrix:l,u_world:r,u_emissive_strength:t,u_ground_shadow_factor:c}),nm=(l,t,r,c,p,_,g=0)=>Object.assign(im(l,t,r,c,_,g),{u_world:p}),ul=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),Hl=(l,t,r,c,p)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:r,u_height_scale:c,u_reset_depth:p}),Cd=(l,t,r,c,p,_,g,v,b)=>({u_matrix:l,u_normal_matrix:t,u_opacity:r,u_faux_facade_ao_intensity:c,u_camera_pos:p,u_tile_to_meter:_,u_facade_emissive_chance:g,u_flood_light_color:v,u_flood_light_intensity:b}),ly=l=>({u_matrix:l}),hl=l=>({u_matrix:l}),rm=(l,t,r,c,p,_,g,v)=>{const b=s.al/_.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:r.getCameraToCenterDistance(v),u_extrude_scale:[r.pixelsToGLUnits[0]/b,r.pixelsToGLUnits[1]/b],u_zoom_transition:c,u_tile_id:g,u_merc_center:p}},Hu=(l,t,r=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:r}),cy=s.bC(),uy=(l,t,r,c,p,_,g)=>{const v=l.transform,b=v.projection.name==="globe",E=b?s.dR(v.zoom,t.canonical)*v._pixelsPerMercatorPixel:s.ay(r,1,_),C={u_matrix:t.projMatrix,u_extrude_scale:E,u_intensity:g,u_inv_rot_matrix:cy,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(b){C.u_inv_rot_matrix=c,C.u_merc_center=p,C.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],C.u_zoom_transition=s.aj(v.zoom);const z=p[0]*s.al,R=p[1]*s.al;C.u_up_dir=v.projection.upVector(new s.cD(0,0,0),z,R)}return C};function Md(l,[t,r,c,p],[_,g]){if(_===g)return[0,0,0,0];const v=255*(l-1)/(l*(g-_));return[t*v,r*v,c*v,p*v]}function Pd(l,t,[r,c]){return r===c?0:.5/l+(t-r)*(l-1)/(l*(c-r))}const hy=(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z,K,W)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:r,u_merc_matrix:c,u_grid_matrix:p,u_tl_parent:_,u_scale_parent:E,u_fade_t:C.mix,u_opacity:C.opacity*z.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:z.paint.get("raster-brightness-min"),u_brightness_high:z.paint.get("raster-brightness-max"),u_saturation_factor:s.dT(z.paint.get("raster-saturation")),u_contrast_factor:s.dS(z.paint.get("raster-contrast")),u_spin_weights:dy(z.paint.get("raster-hue-rotate")),u_perspective_transform:R,u_raster_elevation:D,u_zoom_transition:g,u_merc_center:v,u_cutoff_params:b,u_colorization_mix:Md(s.dU,O,U),u_colorization_offset:Pd(s.dU,G,U),u_color_ramp:B,u_texture_offset:[K/(Z+2*K),Z/(Z+2*K)],u_texture_res:[Z+2*K,Z+2*K],u_emissive_strength:W});function dy(l){l*=Math.PI/180;const t=Math.sin(l),r=Math.cos(l);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}const ra=.05,l1=(l,t,r,c,p,_,g,v,b,E,C,z)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:r,u_merc_matrix:c,u_grid_matrix:p,u_tl_parent:_,u_scale_parent:E,u_fade_t:C.mix,u_opacity:C.opacity,u_image0:0,u_image1:1,u_raster_elevation:z,u_zoom_transition:g,u_merc_center:v,u_cutoff_params:b}),c1=(l,t,r,c,p,_,g,v,b,E)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:r,u_velocity:c,u_color_ramp:_,u_velocity_res:p,u_max_speed:g,u_uv_offset:v,u_data_scale:[255*b[0],255*b[1]],u_data_offset:E,u_particle_pos_scale:1.1,u_particle_pos_offset:[ra,ra]}),py=(l,t,r,c,p,_,g,v,b,E)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:r,u_velocity_res:c,u_max_speed:p,u_speed_factor:_,u_reset_rate:g,u_rand_seed:Math.random(),u_uv_offset:v,u_data_scale:[255*b[0],255*b[1]],u_data_offset:E,u_particle_pos_scale:1.1,u_particle_pos_offset:[ra,ra]}),fy=s.bC(),Rd=(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z,K,W,le,ne,se)=>{const ie=p.transform,Q={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:ie.getCameraToCenterDistance(Z),u_rotate_symbol:+r,u_aspect_ratio:ie.width/ie.height,u_fade_change:p.options.fadeDuration?p.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:g,u_coord_matrix:v,u_is_text:+E,u_elevation_from_sea:b?1:0,u_pitch_with_map:+c,u_texsize:C,u_texsize_icon:z,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:fy,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:fy,u_up_vector:[0,-1,0],u_color_adj_mat:le,u_icon_transition:ne||0,u_gamma_scale:c?p.transform.getCameraToCenterDistance(Z)*Math.cos(p.terrain?0:p.transform._pitch):1,u_device_pixel_ratio:s.o.devicePixelRatio,u_is_halo:1,u_scale_factor:se||1,u_ground_shadow_factor:K,u_inv_matrix:s.bl(s.bC(),g),u_normal_scale:W,u_lutTexture:Br.LUT};return Z.name==="globe"&&(Q.u_tile_id=[D.canonical.x,D.canonical.y,1<<D.canonical.z],Q.u_zoom_transition=B,Q.u_inv_rot_matrix=G,Q.u_merc_center=O,Q.u_camera_forward=ie._camera.forward(),Q.u_ecef_origin=s.dV(ie.globeMatrix,D.toUnwrapped()),Q.u_tile_matrix=Float32Array.from(ie.globeMatrix),Q.u_up_vector=U),Q},qu=(l,t,r,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:r,u_color:c}),dl=(l,t,r,c,p,_,g,v,b)=>Object.assign(function(E,C,z,R,D,B){const{width:O,height:G}=R.imageManager.getPixelSize(C),U=Math.pow(2,B.tileID.overscaledZ),Z=B.tileSize*Math.pow(2,R.transform.tileZoom)/U,K=Z*(B.tileID.canonical.x+B.tileID.wrap*U),W=Z*B.tileID.canonical.y;return{u_image:0,u_pattern_tl:z.tl,u_pattern_br:z.br,u_texsize:[O,G],u_pattern_size:z.displaySize,u_pattern_units_to_pixels:D?[R.transform.width,-1*R.transform.height]:[1/s.ay(B,1,R.transform.tileZoom),1/s.ay(B,1,R.transform.tileZoom)],u_pixel_coord_upper:[K>>16,W>>16],u_pixel_coord_lower:[65535&K,65535&W]}}(0,_,g,c,v,b),{u_matrix:l,u_emissive_strength:t,u_opacity:r}),Uc=new Float32Array(s.bA([])),ql=(l,t,r,c,p,_,g,v,b,E,C,z,R,D=[0,0,0],B,O,G)=>{const U=p.style.light,Z=U.properties.get("position"),K=[-Z.x,-Z.y,Z.z],W=s.dO();U.properties.get("anchor")==="viewport"&&(s.dP(W,-p.transform.angle),s.dQ(K,K,W));const le=C.alphaMode==="MASK",ne=U.properties.get("color").toNonPremultipliedRenderColor(null),se=R.paint.get("model-ambient-occlusion-intensity"),ie=R.paint.get("model-color").constantOr(s.ao.white).toNonPremultipliedRenderColor(null);return ie.a=R.paint.get("model-color-mix-intensity").constantOr(0),G&&(ie.r=G[0],ie.g=G[1],ie.b=G[2],ie.a=G[3]),O&&(ie.r=O.color.r,ie.g=O.color.g,ie.b=O.color.b,ie.a=O.colorMix,z=O.emissionStrength,_*=O.opacity),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:r,u_node_matrix:c||Uc,u_lightpos:K,u_lightintensity:U.properties.get("intensity"),u_lightcolor:[ne.r,ne.g,ne.b],u_camera_pos:D,u_opacity:_,u_baseTextureIsAlpha:0,u_alphaMask:+le,u_alphaCutoff:C.alphaCutoff,u_baseColorFactor:g.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:v.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:b,u_roughnessFactor:E,u_baseColorTexture:Br.BaseColor,u_metallicRoughnessTexture:Br.MetallicRoughness,u_normalTexture:Br.Normal,u_occlusionTexture:Br.Occlusion,u_emissionTexture:Br.Emission,u_lutTexture:Br.LUT,u_color_mix:ie.toArray01(),u_aoIntensity:se,u_emissive_strength:z,u_occlusionTextureTransform:B||[0,0,0,0]}},om=(l,t=Uc,r=Uc)=>({u_matrix:l,u_instance:t,u_node_matrix:r}),Ld={fillExtrusion:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_opacity:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_flood_light_color:new s.ci(l),u_vertical_scale:new s.cj(l),u_flood_light_intensity:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillExtrusionDepth:l=>({u_matrix:new s.cl(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_vertical_scale:new s.cj(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l)}),fillExtrusionPattern:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_height_factor:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_opacity:new s.cj(l),u_pattern_transition:new s.cj(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.cl(l),u_opacity:new s.cj(l),u_ao_pass:new s.cj(l),u_meter_to_tile:new s.cj(l),u_ao:new s.ck(l),u_flood_light_intensity:new s.cj(l),u_flood_light_color:new s.ci(l),u_attenuation:new s.cj(l),u_edge_radius:new s.cj(l),u_fb:new s.ch(l),u_fb_size:new s.cj(l),u_dynamic_offset:new s.cj(l)}),fill:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),fillOutline:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_ground_shadow_factor:new s.ci(l)}),fillOutlinePattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),building:l=>({u_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_opacity:new s.cj(l),u_faux_facade_ao_intensity:new s.cj(l),u_camera_pos:new s.ci(l),u_tile_to_meter:new s.cj(l),u_facade_emissive_chance:new s.cj(l),u_flood_light_color:new s.ci(l),u_flood_light_intensity:new s.cj(l)}),buildingBloom:l=>({u_matrix:new s.cl(l)}),buildingDepth:l=>({u_matrix:new s.cl(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.cl(l),u_depth_bias:new s.cj(l)}),elevatedStructures:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.cl(l),u_camera_pos:new s.ci(l),u_depth_bias:new s.cj(l),u_height_scale:new s.cj(l),u_reset_depth:new s.cj(l)}),circle:s.dY,collisionBox:l=>({u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_extrude_scale:new s.ck(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l)}),collisionCircle:l=>({u_matrix:new s.cl(l),u_inv_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_viewport_size:new s.ck(l)}),debug:l=>({u_color:new s.dB(l),u_matrix:new s.cl(l),u_overlay:new s.ch(l),u_overlay_scale:new s.cj(l)}),clippingMask:l=>({u_matrix:new s.cl(l)}),heatmap:l=>({u_extrude_scale:new s.cj(l),u_intensity:new s.cj(l),u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_up_dir:new s.ci(l)}),heatmapTexture:l=>({u_image:new s.ch(l),u_color_ramp:new s.ch(l),u_opacity:new s.cj(l)}),hillshade:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_latrange:new s.ck(l),u_light:new s.ck(l),u_shadow:new s.dB(l),u_highlight:new s.dB(l),u_emissive_strength:new s.cj(l),u_accent:new s.dB(l)}),hillshadePrepare:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_dimension:new s.ck(l),u_zoom:new s.cj(l)}),line:s.dX,linePattern:s.dW,raster:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_brightness_low:new s.cj(l),u_brightness_high:new s.cj(l),u_saturation_factor:new s.cj(l),u_contrast_factor:new s.cj(l),u_spin_weights:new s.ci(l),u_perspective_transform:new s.ck(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l),u_colorization_mix:new s.d3(l),u_colorization_offset:new s.cj(l),u_color_ramp:new s.ch(l),u_texture_offset:new s.ck(l),u_texture_res:new s.ck(l),u_emissive_strength:new s.cj(l)}),rasterParticle:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l)}),rasterParticleTexture:l=>({u_texture:new s.ch(l),u_opacity:new s.cj(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_tile_offset:new s.ck(l),u_velocity:new s.ch(l),u_color_ramp:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_velocity:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_speed_factor:new s.cj(l),u_reset_rate:new s.cj(l),u_rand_seed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),symbol:l=>({u_is_size_zoom_constant:new s.ch(l),u_is_size_feature_constant:new s.ch(l),u_size_t:new s.cj(l),u_size:new s.cj(l),u_camera_to_center_distance:new s.cj(l),u_rotate_symbol:new s.ch(l),u_aspect_ratio:new s.cj(l),u_fade_change:new s.cj(l),u_matrix:new s.cl(l),u_label_plane_matrix:new s.cl(l),u_coord_matrix:new s.cl(l),u_is_text:new s.ch(l),u_elevation_from_sea:new s.ch(l),u_pitch_with_map:new s.ch(l),u_texsize:new s.ck(l),u_texsize_icon:new s.ck(l),u_texture:new s.ch(l),u_texture_icon:new s.ch(l),u_gamma_scale:new s.cj(l),u_device_pixel_ratio:new s.cj(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_camera_forward:new s.ci(l),u_tile_matrix:new s.cl(l),u_up_vector:new s.ci(l),u_ecef_origin:new s.ci(l),u_is_halo:new s.ch(l),u_icon_transition:new s.cj(l),u_color_adj_mat:new s.cl(l),u_scale_factor:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_inv_matrix:new s.cl(l),u_normal_scale:new s.cj(l),u_lutTexture:new s.ch(l)}),background:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_color:new s.dB(l)}),backgroundPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_image:new s.ch(l),u_pattern_tl:new s.ck(l),u_pattern_br:new s.ck(l),u_texsize:new s.ck(l),u_pattern_size:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_pattern_units_to_pixels:new s.ck(l)}),terrainRaster:l=>({u_matrix:new s.cl(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_skirt_height:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_emissive_texture_available:new s.cj(l)}),skybox:l=>({u_matrix:new s.cl(l),u_sun_direction:new s.ci(l),u_cubemap:new s.ch(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxGradient:l=>({u_matrix:new s.cl(l),u_color_ramp:new s.ch(l),u_center_direction:new s.ci(l),u_radius:new s.cj(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dC(l),u_sun_direction:new s.ci(l),u_sun_intensity:new s.cj(l),u_color_tint_r:new s.d3(l),u_color_tint_m:new s.d3(l),u_luminance:new s.cj(l)}),globeRaster:l=>({u_proj_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_grid_matrix:new s.dC(l),u_skirt_height:new s.cj(l),u_far_z_cutoff:new s.cj(l),u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_globe_pos:new s.ci(l),u_globe_radius:new s.cj(l),u_viewport:new s.ck(l),u_emissive_texture_available:new s.cj(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_horizon:new s.cj(l),u_transition:new s.cj(l),u_fadeout_range:new s.cj(l),u_atmosphere_fog_color:new s.d3(l),u_high_color:new s.d3(l),u_space_color:new s.d3(l),u_temporal_offset:new s.cj(l),u_horizon_angle:new s.cj(l)}),model:l=>({u_matrix:new s.cl(l),u_lighting_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_node_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_camera_pos:new s.ci(l),u_opacity:new s.cj(l),u_baseColorFactor:new s.d3(l),u_emissiveFactor:new s.d3(l),u_metallicFactor:new s.cj(l),u_roughnessFactor:new s.cj(l),u_baseTextureIsAlpha:new s.ch(l),u_alphaMask:new s.ch(l),u_alphaCutoff:new s.cj(l),u_baseColorTexture:new s.ch(l),u_metallicRoughnessTexture:new s.ch(l),u_normalTexture:new s.ch(l),u_occlusionTexture:new s.ch(l),u_emissionTexture:new s.ch(l),u_lutTexture:new s.ch(l),u_color_mix:new s.d3(l),u_aoIntensity:new s.cj(l),u_emissive_strength:new s.cj(l),u_occlusionTextureTransform:new s.d3(l)}),modelDepth:l=>({u_matrix:new s.cl(l),u_instance:new s.cl(l),u_node_matrix:new s.cl(l)}),groundShadow:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),stars:l=>({u_matrix:new s.cl(l),u_up:new s.ci(l),u_right:new s.ci(l),u_intensity_multiplier:new s.cj(l)}),snowParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_horizontalOscillationRadius:new s.cj(l),u_horizontalOscillationRate:new s.cj(l),u_boxSize:new s.cj(l),u_billboardSize:new s.cj(l),u_simpleShapeParameters:new s.ck(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_particleColor:new s.d3(l),u_direction:new s.ci(l)}),rainParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_texScreen:new s.ch(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_boxSize:new s.cj(l),u_rainDropletSize:new s.ck(l),u_distortionStrength:new s.cj(l),u_rainDirection:new s.ci(l),u_color:new s.d3(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_shapeDirectionalPower:new s.cj(l),u_shapeNormalPower:new s.cj(l),u_mode:new s.cj(l)}),vignette:l=>({u_vignetteShape:new s.ci(l),u_vignetteColor:new s.d3(l)}),occlusion:l=>({u_matrix:new s.cl(l),u_anchorPos:new s.ci(l),u_screenSizePx:new s.ck(l),u_occluderSizePx:new s.ck(l),u_color:new s.d3(l)})};class Ls{constructor(t,r,c,p){this.id=Ls.uniqueIdxCounter,Ls.uniqueIdxCounter++,this.context=t;const _=t.gl;this.buffer=_.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),_.bufferData(_.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||p||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Ls.uniqueIdxCounter,Ls.uniqueIdxCounter++;const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Ls.uniqueIdxCounter=0;const sm={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class my{constructor(t,r,c,p,_,g){this.length=r.length,this.attributes=c,this.itemSize=r.bytesPerElement,this.dynamicDraw=p,this.instanceCount=g,this.context=t;const v=t.gl;this.buffer=v.createBuffer(),t.bindVertexBuffer.set(this.buffer),v.bufferData(v.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?v.DYNAMIC_DRAW:v.STATIC_DRAW),this.dynamicDraw||_||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,t.arrayBuffer)}
3018enableAttributes(t,r){for(let c=0;c<this.attributes.length;c++){const p=r.getAttributeLocation(t,this.attributes[c].name);p!==-1&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,r,c){for(let p=0;p<this.attributes.length;p++){const _=this.attributes[p],g=r.getAttributeLocation(t,_.name);g!==-1&&t.vertexAttribPointer(g,_.components,t[sm[_.type]],!1,this.itemSize,_.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,r,c){for(let p=0;p<this.attributes.length;p++){const _=r.getAttributeLocation(t,this.attributes[p].name);_!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(_,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _y{constructor(t,r,c,p,_){this.context=t,this.width=r,this.height=c;const g=this.framebuffer=t.gl.createFramebuffer();p>0&&(this.colorAttachment0=new wd(t,g,0)),p>1&&(this.colorAttachment1=new wd(t,g,1)),_&&(this.depthAttachmentType=_,this.depthAttachment=_==="renderbuffer"?new Bc(t,g):new ju(t,g))}createColorAttachment(t,r){r===0?this.colorAttachment0=new wd(t,this.framebuffer,0):r===1&&(this.colorAttachment1=new wd(t,this.framebuffer,1))}removeColorAttachment(t,r){const c=this.context.gl;let p;r===0?(p=this.colorAttachment0.get(),this.colorAttachment0=void 0):r===1&&(p=this.colorAttachment1.get(),this.colorAttachment1=void 0),p&&c.deleteTexture(p)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const r=this.colorAttachment0.get();r&&t.deleteTexture(r)}if(this.colorAttachment1){const r=this.colorAttachment1.get();r&&t.deleteTexture(r)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}else{const r=this.depthAttachment.get();r&&t.deleteTexture(r)}t.deleteFramebuffer(this.framebuffer)}}class Gc{constructor(t,r){this.gl=t,this.clearColor=new t1(this),this.clearDepth=new Xg(this),this.clearStencil=new Uf(this),this.colorMask=new _d(this),this.depthMask=new Gf(this),this.stencilMask=new $l(this),this.stencilFunc=new Dc(this),this.stencilOp=new Nu(this),this.stencilTest=new kc(this),this.depthRange=new Yg(this),this.depthTest=new $f(this),this.depthFunc=new Kg(this),this.blend=new Oc(this),this.blendFunc=new gd(this),this.blendColor=new yd(this),this.blendEquation=new Hf(this),this.cullFace=new vd(this),this.cullFaceSide=new Vu(this),this.frontFace=new Jg(this),this.program=new Qg(this),this.activeTexture=new ey(this),this.viewport=new Fc(this),this.bindFramebuffer=new ty(this),this.bindRenderbuffer=new i1(this),this.bindTexture=new n1(this),this.bindVertexBuffer=new r1(this),this.bindElementBuffer=new qf(this),this.bindVertexArrayOES=new Zf(this),this.pixelStoreUnpack=new Wf(this),this.pixelStoreUnpackPremultiplyAlpha=new Xf(this),this.pixelStoreUnpackFlipY=new iy(this),this.options=r?Object.assign({},r):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=r&&!!r.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,r,c){return new Ls(this,t,r,c)}createVertexBuffer(t,r,c,p,_){return new my(this,t,r,c,p,_)}createRenderbuffer(t,r,c){const p=this.gl,_=p.createRenderbuffer();return this.bindRenderbuffer.set(_),p.renderbufferStorage(p.RENDERBUFFER,t,r,c),this.bindRenderbuffer.set(null),_}createFramebuffer(t,r,c,p){return new _y(this,t,r,c,p)}clear({color:t,depth:r,stencil:c,colorMask:p}){const _=this.gl;let g=0;t&&(g|=_.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(p||[!0,!0,!0,!0])),r!==void 0&&(g|=_.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),c!==void 0&&(g|=_.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),_.clear(g)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.by(t.blendFunction,fi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Zl;function At(l,t,r,c,p,_,g){const v=l.context,b=v.gl,E=l.transform,C=[s.aF(E.center.lng),s.aJ(E.center.lat)],z=r.layout.get("symbol-placement"),R=r.layout.get("text-variable-anchor"),D=r.layout.get("icon-rotation-alignment")==="map",B=r.layout.get("text-rotation-alignment")==="map",O=z!=="point",G=[];let U=0,Z=0;for(let Q=0;Q<c.length;Q++){const ce=c[Q],ve=t.getTile(ce),ge=ve.getBucket(r);
3018if(!ge)continue;const Le=ge.getProjection().createInversionMatrix(E,ce.canonical),ze=[],je=Qh(ce,ge,E),nt=!g&&D&&O,Ae=g&&B&&O,fe=R&&ge.hasTextData(),Oe=ge.hasIconTextFit()&&fe&&ge.hasIconData(),Me=nt||Ae||g&&fe||Oe,Ze=ge.projection.name==="globe",ft=Ze?s.aj(E.zoom):0;Ze&&(ze.push("PROJECTION_GLOBE_VIEW"),Me&&ze.push("PROJECTED_POS_ON_VIEWPORT"));const bt=l.getOrCreateProgram("collisionBox",{defines:ze});let ut=je;p[0]===0&&p[1]===0||(ut=l.translatePosMatrix(je,ve,p,_));const rt=g?ge.textCollisionBox:ge.iconCollisionBox,Lt=ge.collisionCircleArray;if(Lt.length>0){const xt=s.bC(),St=ut;s.cP(xt,ge.placementInvProjMatrix,E.glCoordMatrix),s.cP(xt,xt,ge.placementViewportMatrix),G.push({circleArray:Lt,circleOffset:Z,transform:St,invTransform:xt,projection:ge.getProjection()}),U+=Lt.length/4,Z=U}if(!rt)continue;l.terrain&&l.terrain.setupElevationDraw(ve,bt);const Mt=Ze?[ce.canonical.x,ce.canonical.y,1<<ce.canonical.z]:[0,0,0];bt.draw(l,b.LINES,kt.disabled,ii.disabled,l.colorModeForRenderPass(),ei.disabled,rm(ut,Le,E,ft,C,ve,Mt,ge.getProjection()),r.id,rt.layoutVertexBuffer,rt.indexBuffer,rt.segments,null,E.zoom,null,[rt.collisionVertexBuffer,rt.collisionVertexBufferExt])}if(!g||!G.length)return;const K=l.getOrCreateProgram("collisionCircle"),W=new s.dZ;W.resize(4*U),W._trim();let le=0;for(const Q of G)for(let ce=0;ce<Q.circleArray.length/4;ce++){const ve=4*ce,ge=Q.circleArray[ve+0],Le=Q.circleArray[ve+1],ze=Q.circleArray[ve+2],je=Q.circleArray[ve+3];W.emplace(le++,ge,Le,ze,je,0),W.emplace(le++,ge,Le,ze,je,1),W.emplace(le++,ge,Le,ze,je,2),W.emplace(le++,ge,Le,ze,je,3)}(!Zl||Zl.length<2*U)&&(Zl=function(Q){const ce=2*Q,ve=new s.b0;ve.resize(ce),ve._trim();for(let ge=0;ge<ce;ge++){const Le=6*ge;ve.uint16[Le+0]=4*ge+0,ve.uint16[Le+1]=4*ge+1,ve.uint16[Le+2]=4*ge+2,ve.uint16[Le+3]=4*ge+2,ve.uint16[Le+4]=4*ge+3,ve.uint16[Le+5]=4*ge+0}return ve}(U));const ne=v.createIndexBuffer(Zl,!0),se=v.createVertexBuffer(W,s.d_.members,!0);for(const Q of G){const ce={u_matrix:Q.transform,u_inv_matrix:Q.invTransform,u_camera_to_center_distance:(ie=E).getCameraToCenterDistance(Q.projection),u_viewport_size:[ie.width,ie.height]};K.draw(l,b.TRIANGLES,kt.disabled,ii.disabled,l.colorModeForRenderPass(),ei.disabled,ce,r.id,se,ne,s.bg.simpleSegment(0,2*Q.circleOffset,Q.circleArray.length,Q.circleArray.length/2),null,E.zoom)}var ie;se.destroy(),ne.destroy()}const Zu=s.bC();function Ma(l){const t=l._camera.getWorldToCamera(l.worldSize,1),r=s.aB([],t,l.globeMatrix);s.bl(r,r);const c=[0,0,0],p=[0,1,0,0];return s.aC(p,p,r),c[0]=p[0],c[1]=p[1],c[2]=p[2],s.aw(c,c),c}function pl({width:l,height:t,anchor:r,textOffset:c,textScale:p},_){const{horizontalAlign:g,verticalAlign:v}=s.c1(r),b=-(g-.5)*l,E=-(v-.5)*t,C=s.c2(r,c);return new s.P((b/p+C[0])*_,(E/p+C[1])*_)}function Xt(l,t,r,c,p,_,g,v,b,E){const C=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,R=l.icon.dynamicLayoutVertexArray,D={},B=l.getProjection(),O=Qs(g,B,p),G=p.elevation,U=B.upVectorScale(g.canonical,p.center.lat,p.worldSize).metersToTile;z.clear();for(let Z=0;Z<C.length;Z++){const K=C.get(Z),{tileAnchorX:W,tileAnchorY:le,numGlyphs:ne}=K,se=K.hidden||!K.crossTileID||l.allowVerticalPlacement&&!K.placedOrientation?null:c[K.crossTileID];if(se){let ie=0,Q=0,ce=0;const ve=l.elevationType==="road";if(G||ve){const Me=ve?l.getElevationFeatureForText(Z):null,Ze=s.bV.getAtTileOffset(g,new s.P(W,le),G,Me),[ft,bt,ut]=B.upVector(g.canonical,W,le);ie=Ze*ft*U,Q=Ze*bt*U,ce=Ze*ut*U}let[ge,Le,ze,je]=ls(K.projectedAnchorX+ie,K.projectedAnchorY+Q,K.projectedAnchorZ+ce,r?O:_);const nt=rn(p.getCameraToCenterDistance(B),je);let Ae=s.bM(l.textSizeData,b,K)*nt/s.bY;r&&(Ae*=l.tilePixelRatio/v);const fe=pl(se,Ae);r?({x:ge,y:Le,z:ze}=B.projectTilePoint(W+fe.x,le+fe.y,g.canonical),[ge,Le,ze]=ls(ge+ie,Le+Q,ze+ce,_)):(t&&fe._rotate(-p.angle),ge+=fe.x,Le+=fe.y,ze=0);const Oe=l.allowVerticalPlacement&&K.placedOrientation===s.bL.vertical?Math.PI/2:0;for(let Me=0;Me<ne;Me++)s.bO(z,ge,Le,ze,Oe);E&&K.associatedIconIndex>=0&&(D[K.associatedIconIndex]={x:ge,y:Le,z:ze,angle:Oe})}else Ms(ne,z)}if(E){R.clear();const Z=l.icon.placedSymbolArray;for(let K=0;K<Z.length;K++){const W=Z.get(K),{numGlyphs:le}=W,ne=D[K];if(W.hidden||!ne)Ms(le,R);else{const{x:se,y:ie,z:Q,angle:ce}=ne;for(let ve=0;ve<le;ve++)s.bO(R,se,ie,Q,ce)}}l.icon.dynamicLayoutVertexBuffer.updateData(R)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function Wu(l,t,r,c,p,_,g={}){const v=r.paint.get("icon-translate"),b=r.paint.get("text-translate"),E=r.paint.get("icon-translate-anchor"),C=r.paint.get("text-translate-anchor"),z=r.layout.get("icon-rotation-alignment"),R=r.layout.get("text-rotation-alignment"),D=r.layout.get("icon-pitch-alignment"),B=r.layout.get("text-pitch-alignment"),O=r.layout.get("icon-keep-upright"),G=r.layout.get("text-keep-upright"),U=r.paint.get("icon-color-saturation"),Z=r.paint.get("icon-color-contrast"),K=r.paint.get("icon-color-brightness-min"),W=r.paint.get("icon-color-brightness-max"),le=r.layout.get("symbol-elevation-reference")==="sea",ne=r.layout.get("icon-image-use-theme")==="none",se=l.context,ie=se.gl,Q=l.transform,ce=z==="map",ve=R==="map",ge=D==="map",Le=B==="map",ze=r.layout.get("symbol-sort-key").constantOr(1)!==void 0;let je=!1;const nt=l.depthModeForSublayer(0,kt.ReadOnly),Ae=new kt(l.context.gl.LEQUAL,kt.ReadOnly,l.depthRangeFor3D),fe=[s.aF(Q.center.lng),s.aJ(Q.center.lat)],Oe=r.layout.get("text-variable-anchor"),Me=Q.projection.name==="globe",Ze=[],ft=[0,-1,0];for(const bt of c){const ut=t.getTile(bt),rt=ut.getBucket(r);
3018if(!rt||rt.projection.name==="mercator"&&Me||rt.fullyClipped)continue;const Lt=rt.projection.name==="globe",Mt=Lt?s.aj(Q.zoom):0,xt=Qs(bt,rt.getProjection(),Q),St=Q.calculatePixelsToTileUnitsMatrix(ut),Ht=Oe&&rt.hasTextData(),ci=rt.hasIconTextFit()&&Ht&&rt.hasIconData(),Li=rt.getProjection().createInversionMatrix(Q,bt.canonical),Yi=(1<<ut.tileID.canonical.z)*s.al/l.transform.worldSize,zt=en=>{let Ni=[0,0,0];if(en){const gi=l.style.directionalLight,En=l.style.ambientLight;gi&&En&&(Ni=Aa(l.style,gi,En))}return Ni},Zi=en=>{Q.depthOcclusionForSymbolsAndCircles&&(r.hasOcclusionOpacityProperties||l.terrain)&&(en.push("DEPTH_D24"),en.push("DEPTH_OCCLUSION"))},li=en=>{r.lut&&!ne&&(r.lut.texture||(r.lut.texture=new s.d$(l.context,r.lut.image,[r.lut.image.height,r.lut.image.height,r.lut.image.height],se.gl.RGBA8)),se.activeTexture.set(se.gl.TEXTURE0+Br.LUT),r.lut.texture&&r.lut.texture.bind(se.gl.LINEAR,se.gl.CLAMP_TO_EDGE),en.push("APPLY_LUT_ON_GPU"))},Qi=()=>{const en=ce&&r.layout.get("symbol-placement")!=="point",Ni=[];Zi(Ni),li(Ni);const gi=en||ci,En=rt.elevationType==="road",Xn=l.shadowRenderer,Dn=En&&ge&&!!Xn&&Xn.enabled,fn=zt(Dn),yo=En&&ge&&!l.terrain?Ae:nt,Zr=r.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&ge&&Ni.push("PITCH_WITH_MAP_TERRAIN"),Lt&&(Ni.push("PROJECTION_GLOBE_VIEW"),gi&&Ni.push("PROJECTED_POS_ON_VIEWPORT")),Zr>0&&rt.hasAnySecondaryIcon&&Ni.push("ICON_TRANSITION"),!rt.icon.zOffsetVertexBuffer||En&&l.terrain||Ni.push("Z_OFFSET"),U===0&&Z===0&&K===0&&W===1||Ni.push("COLOR_ADJUSTMENT"),rt.sdfIcons&&Ni.push("RENDER_SDF"),Dn&&Ni.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),En&&ge&&!l.terrain&&rt.icon.orientationVertexBuffer&&Ni.push("ELEVATED_ROADS");const gr=rt.icon.programConfigurations.get(r.id),eo=l.getOrCreateProgram("symbol",{config:gr,defines:Ni}),to=ut.imageAtlasTexture?ut.imageAtlasTexture.size:[0,0],$r=rt.iconSizeData,Ko=s.bK($r,Q.zoom),_s=ge||!Q.isOrthographic,Co=co(xt,ut.tileID.canonical,ge,ce,Q,rt.getProjection(),St),Gn=Mu(xt,ut.tileID.canonical,ge,ce,Q,rt.getProjection(),St),er=l.translatePosMatrix(Gn,ut,v,E,!0),mn=l.translatePosMatrix(xt,ut,v,E),sr=gi?Zu:Co,Vn=ce&&!ge&&!en;let kn=ft;!Me&&!Q.mercatorFromTransition||ce||(kn=Ma(Q));const gs=Lt?kn:ft,sh=r.getColorAdjustmentMatrix(U,Z,K,W),ks=Rd($r.kind,Ko,Vn,ge,l,mn,sr,er,le,!1,to,[0,0],0,bt,Mt,fe,Li,gs,rt.getProjection(),fn,Yi,sh,Zr,null),ah=ut.imageAtlasTexture?ut.imageAtlasTexture:null,Jc=r.layout.get("icon-size").constantOr(0)!==1||rt.iconsNeedLinear,ca=rt.sdfIcons||l.options.rotating||l.options.zooming||Jc||_s?ie.LINEAR:ie.NEAREST,Ba=rt.sdfIcons&&r.paint.get("icon-halo-width").constantOr(1)!==0,Qc=l.terrain&&ge&&en?s.bl(s.bC(),Co):Zu;if(en&&rt.icon){const yl=s.bV.getAtTileOffsetFunc(bt,Q.center.lat,Q.worldSize,rt.getProjection()),Na=ed(xt,ut.tileID.canonical,ge,ce,Q,rt.getProjection(),St),Os=r.layout.get("icon-size-scale-range"),Va=s.aA(l.scaleFactor,Os[0],Os[1]);Vg(rt,xt,l,!1,Na,Gn,ge,O,yl,bt,Va)}return{program:eo,buffers:rt.icon,uniformValues:ks,atlasTexture:ah,atlasTextureIcon:null,atlasInterpolation:ca,atlasInterpolationIcon:null,isSDF:rt.sdfIcons,hasHalo:Ba,depthMode:yo,tile:ut,renderWithShadows:Dn,labelPlaneMatrixInv:Qc}},cn=()=>{const en=ve&&r.layout.get("symbol-placement")!=="point",Ni=[],gi=en||Oe||ci,En=rt.elevationType==="road",Xn=l.shadowRenderer,Dn=En&&Le&&!!Xn&&Xn.enabled,fn=zt(Dn),yo=En&&Le&&!l.terrain?Ae:nt;l.terrainRenderModeElevated()&&Le&&Ni.push("PITCH_WITH_MAP_TERRAIN"),Lt&&(Ni.push("PROJECTION_GLOBE_VIEW"),gi&&Ni.push("PROJECTED_POS_ON_VIEWPORT")),!rt.text.zOffsetVertexBuffer||En&&l.terrain||Ni.push("Z_OFFSET"),rt.iconsInText&&Ni.push("RENDER_TEXT_AND_SYMBOL"),Ni.push("RENDER_SDF"),Dn&&Ni.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),En&&Le&&!l.terrain&&rt.text.orientationVertexBuffer&&Ni.push("ELEVATED_ROADS"),Zi(Ni);const Zr=rt.text.programConfigurations.get(r.id),gr=l.getOrCreateProgram("symbol",{config:Zr,defines:Ni});let eo,to=[0,0],$r=null;const Ko=rt.textSizeData;rt.iconsInText&&(to=ut.imageAtlasTexture?ut.imageAtlasTexture.size:[0,0],$r=ut.imageAtlasTexture?ut.imageAtlasTexture:null,eo=Le||!Q.isOrthographic||l.options.rotating||l.options.zooming||Ko.kind==="composite"||Ko.kind==="camera"?ie.LINEAR:ie.NEAREST);const _s=ut.glyphAtlasTexture?ut.glyphAtlasTexture.size:[0,0],Co=r.layout.get("text-size-scale-range"),Gn=s.aA(l.scaleFactor,Co[0],Co[1]),er=s.bK(Ko,Q.zoom,Gn),mn=co(xt,ut.tileID.canonical,Le,ve,Q,rt.getProjection(),St),sr=Mu(xt,ut.tileID.canonical,Le,ve,Q,rt.getProjection(),St),Vn=l.translatePosMatrix(sr,ut,b,C,!0),
3018kn=l.translatePosMatrix(xt,ut,b,C),gs=gi?Zu:mn,sh=ve&&!Le&&!en;let ks=ft;!Me&&!Q.mercatorFromTransition||ve||(ks=Ma(Q));const ah=Rd(Ko.kind,er,sh,Le,l,kn,gs,Vn,le,!0,_s,to,0,bt,Mt,fe,Li,Lt?ks:ft,rt.getProjection(),fn,Yi,null,null,Gn),Jc=ut.glyphAtlasTexture?ut.glyphAtlasTexture:null,ca=ie.LINEAR,Ba=r.paint.get("text-halo-width").constantOr(1)!==0,Qc=l.terrain&&Le&&en?s.bl(s.bC(),mn):Zu;if(en&&rt.text){const yl=s.bV.getAtTileOffsetFunc(bt,Q.center.lat,Q.worldSize,rt.getProjection()),Na=ed(xt,ut.tileID.canonical,Le,ve,Q,rt.getProjection(),St);Vg(rt,xt,l,!0,Na,sr,Le,G,yl,bt,Gn)}return{program:gr,buffers:rt.text,uniformValues:ah,atlasTexture:Jc,atlasTextureIcon:$r,atlasInterpolation:ca,atlasInterpolationIcon:eo,isSDF:!0,hasHalo:Ba,depthMode:yo,tile:ut,renderWithShadows:Dn,labelPlaneMatrixInv:Qc}},on=rt.icon.segments.get().length,Hi=rt.text.segments.get().length,_i=on&&!g.onlyText?Qi():null,Ji=Hi&&!g.onlyIcons?cn():null,Nn=r.paint.get("icon-opacity").constantOr(1),Cn=r.paint.get("text-opacity").constantOr(1);if(ze&&rt.canOverlap){je=!0;const en=Nn&&!g.onlyText?rt.icon.segments.get():[],Ni=Cn&&!g.onlyIcons?rt.text.segments.get():[];for(const gi of en)Ze.push({segments:new s.bg([gi]),sortKey:gi.sortKey,state:_i});for(const gi of Ni)Ze.push({segments:new s.bg([gi]),sortKey:gi.sortKey,state:Ji})}else g.onlyText||Ze.push({segments:Nn?rt.icon.segments:new s.bg([]),sortKey:0,state:_i}),g.onlyIcons||Ze.push({segments:Cn?rt.text.segments:new s.bg([]),sortKey:0,state:Ji})}je&&Ze.sort((bt,ut)=>bt.sortKey-ut.sortKey);for(const bt of Ze){const ut=bt.state;if(ut)if(l.terrain?l.terrain.setupElevationDraw(ut.tile,ut.program,{useDepthForOcclusion:Q.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:ut.labelPlaneMatrixInv}):l.setupDepthForOcclusion(Q.depthOcclusionForSymbolsAndCircles,ut.program),se.activeTexture.set(ie.TEXTURE0),ut.atlasTexture&&ut.atlasTexture.bind(ut.atlasInterpolation,ie.CLAMP_TO_EDGE,!0),ut.atlasTextureIcon&&(se.activeTexture.set(ie.TEXTURE1),ut.atlasTextureIcon&&ut.atlasTextureIcon.bind(ut.atlasInterpolationIcon,ie.CLAMP_TO_EDGE,!0)),ut.renderWithShadows&&l.shadowRenderer.setupShadows(ut.tile.tileID.toUnwrapped(),ut.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,ut.program),ut.hasHalo){const rt=ut.uniformValues;rt.u_is_halo=1,am(ut.buffers,bt.segments,r,l,ut.program,ut.depthMode,p,_,rt,2),rt.u_is_halo=0}else{if(ut.isSDF){const rt=ut.uniformValues;ut.hasHalo&&(rt.u_is_halo=1,am(ut.buffers,bt.segments,r,l,ut.program,ut.depthMode,p,_,rt,1)),rt.u_is_halo=0}am(ut.buffers,bt.segments,r,l,ut.program,ut.depthMode,p,_,ut.uniformValues,1)}}}function am(l,t,r,c,p,_,g,v,b,E){const C=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];p.draw(c,c.context.gl.TRIANGLES,_,g,v,ei.disabled,b,r.id,l.layoutVertexBuffer,l.indexBuffer,t,r.paint,c.transform.zoom,l.programConfigurations.get(r.id),C,E)}function gy(l,t){const r=1<<l.canonical.z,c=(t.x*r-l.canonical.x-l.wrap*r)*s.al,p=(t.y*r-l.canonical.y)*s.al,_=s.e8(t.z,t.y);return s.d5(c,p,_)}function zd(l,t,r,c,p){if(!r.layout||r.layout.get("fill-elevation-reference")==="none"||r.paint.get("fill-opacity").constantOr(1)===0)return;const _=l.context.gl,g=new kt(l.context.gl.LEQUAL,kt.ReadWrite,l.depthRangeFor3D),v=new kt(l.context.gl.GREATER,kt.ReadWrite,l.depthRangeFor3D),b=function(D){let B=.01;return D.isOrthographic&&(B=s.ak(1e-4,B,s.d0(D.pitch>=Rs?1:D.pitch/Rs))),2*B}(l.transform),E=l.transform.getFreeCameraOptions().position,C="elevatedStructuresDepthReconstruct",z=l.getOrCreateProgram(C,{defines:["DEPTH_RECONSTRUCTION"]}),R=l.getOrCreateProgram(C);for(const D of c){const B=t.getTile(D),O=B.getBucket(r);if(!O)continue;const G=O.elevatedStructures;if(!G)continue;const U=O.elevationBufferData.heightRange,Z=gy(D.toUnwrapped(),E),K=l.translatePosMatrix(D.projMatrix,B,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));let W,le,ne,se;if(p==="initialize"){if(!U||U.min>=1||G.depthSegments.segments[0].primitiveLength===0)continue;W=Hl(K,Z,b,1,0),le=g,ne=G.depthSegments,se=z}else if(p==="reset"){if(!U||U.min>=0||G.maskSegments.segments[0].primitiveLength===0)continue;W=Hl(K,Z,0,0,1),le=v,ne=G.maskSegments,se=z}else if(p==="geometry"){if(G.depthSegments.segments[0].primitiveLength===0)continue;W=Hl(K,Z,b,1,0),le=g,ne=G.depthSegments,se=R}se.draw(l,_.TRIANGLES,le,ii.disabled,fi.disabled,ei.disabled,W,r.id,G.vertexBuffer,G.indexBuffer,ne,r.paint,l.transform.zoom)}}function Dd(l,t,r,c){const{painter:p,sourceCache:_,layer:g,coords:v,colorMode:b,elevationType:E,terrainEnabled:C,pass:z}=l,R=p.context.gl,D=g.paint.get("fill-pattern"),B=g.paint.get("fill-pattern-cross-fade"),O=D.constantOr(null);let G=E;E!=="road"||t&&!C||(G="none");const U=G==="road",Z=l.painter.shadowRenderer,K=U&&!!Z&&Z.enabled,W=new kt(p.context.gl.LEQUAL,kt.ReadOnly,p.depthRangeFor3D);let le=[0,0,0];if(K){const Q=p.style.directionalLight,ce=p.style.ambientLight;Q&&ce&&(le=Aa(p.style,Q,ce))}const ne=D&&D.constantOr(1),se=p.terrain&&p.terrain.renderingToTexture,ie=(Q,ce)=>{let ve,ge,Le,ze,je;ce?(ve=ne&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Le=R.LINES):(ve=ne?"fillPattern":"fill",Le=R.TRIANGLES);for(const nt of v){const Ae=_.getTile(nt);
3018if(ne&&!Ae.patternsLoaded())continue;const fe=Ae.getBucket(g);if(!fe)continue;const Oe=t?fe.elevationBufferData:fe.bufferData;if(Oe.isEmpty())continue;p.prepareDrawTile();const Me=Oe.programConfigurations.get(g.id),Ze=p.isTileAffectedByFog(nt),ft=[],bt=[];U&&(ft.push("ELEVATED_ROADS"),bt.push(Oe.elevatedLayoutVertexBuffer)),K&&ft.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),se&&r&&ft.push("USE_MRT1"),ne&&(p.context.activeTexture.set(R.TEXTURE0),Ae.imageAtlasTexture&&Ae.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),Me.updatePaintBuffers());let ut=!1;if(O&&Ae.imageAtlas){const St=Ae.imageAtlas,Ht=s.e3.from(O),ci=Ht.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Li=Ht.getSecondary(),Yi=St.patternPositions.get(ci),zt=Li?St.patternPositions.get(Li.scaleSelf(s.o.devicePixelRatio).toString()):null;ut=!!Yi&&!!zt,Yi&&Me.setConstantPatternPositions(Yi,zt)}B>0&&(ut||Me.getPatternTransitionVertexBuffer("fill-pattern"))&&ft.push("FILL_PATTERN_TRANSITION");const rt=p.getOrCreateProgram(ve,{config:Me,overrideFog:Ze,defines:ft}),Lt=p.translatePosMatrix(nt.projMatrix,Ae,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));K&&Z.setupShadows(Ae.tileID.toUnwrapped(),rt,"vector-tile");const Mt=g.paint.get("fill-emissive-strength");if(ce){ze=Oe.lineIndexBuffer,je=Oe.lineSegments;const St=p.terrain&&p.terrain.renderingToTexture?p.terrain.drapeBufferSize:[R.drawingBufferWidth,R.drawingBufferHeight];ge=ve==="fillOutlinePattern"&&ne?nm(Lt,Mt,p,Ae,St,le,B):ay(Lt,Mt,St,le)}else ze=Oe.indexBuffer,je=Oe.triangleSegments,ge=ne?im(Lt,Mt,p,Ae,le,B):tm(Lt,Mt,le);p.uploadCommonUniforms(p.context,rt,nt.toUnwrapped());let xt=Q;(E==="road"&&!C||E==="offset")&&(xt=W),rt.draw(p,Le,xt,c||p.stencilModeForClipping(nt),b,ei.disabled,ge,g.id,Oe.layoutVertexBuffer,ze,je,g.paint,p.transform.zoom,Me,bt)}};p.renderPass===z&&ie(p.depthModeForSublayer(1,p.renderPass==="opaque"?kt.ReadWrite:kt.ReadOnly),!1),G==="none"&&p.renderPass==="translucent"&&g.paint.get("fill-antialias")&&ie(p.depthModeForSublayer(g.getPaintProperty("fill-outline-color")?2:0,kt.ReadOnly),!0)}function kd(l,t,r,c,p,_,g,v){r.resetLayerRenderingStats(l);const b=l.context,E=b.gl,C=l.transform,z=r.paint.get("fill-extrusion-pattern"),R=r.paint.get("fill-extrusion-pattern-cross-fade"),D=z.constantOr(null),B=z.constantOr(1),O=r.paint.get("fill-extrusion-opacity"),G=l.style.enable3dLights(),U=r.paint.get(G&&!B?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),Z=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),U],K=r.layout.get("fill-extrusion-edge-radius"),W=K>0&&!r.paint.get("fill-extrusion-rounded-roof"),le=W?0:K,ne=C.projection.name==="globe"?s.eb():0,se=C.projection.name==="globe",ie=se?s.aj(C.zoom):0,Q=[s.aF(C.center.lng),s.aJ(C.center.lat)],ce=r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ve=r.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ce?null:r.lut).toArray01().slice(0,3),ge=r.paint.get("fill-extrusion-flood-light-intensity"),Le=r.paint.get("fill-extrusion-vertical-scale"),ze=r.paint.get("fill-extrusion-line-width").constantOr(1)!==0,je=r.paint.get("fill-extrusion-height-alignment"),nt=r.paint.get("fill-extrusion-base-alignment"),Ae=rl(l,r.paint.get("fill-extrusion-cutoff-fade-range")),fe=[];let Oe;se&&fe.push("PROJECTION_GLOBE_VIEW"),Z[0]>0&&fe.push("FAUX_AO"),W&&fe.push("ZERO_ROOF_RADIUS"),v&&fe.push("HAS_CENTROID"),ge>0&&fe.push("FLOOD_LIGHT"),Ae.shouldRenderCutoff&&fe.push("RENDER_CUTOFF"),ze&&fe.push("RENDER_WALL_MODE");const Me=l.renderPass==="shadow",Ze=l.shadowRenderer,ft=Me&&!!Ze,bt=Me?ei.disabled:ei.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let ut=[0,0,0];if(Ze){const Mt=l.style.directionalLight,xt=l.style.ambientLight;Mt&&xt&&(ut=Aa(l.style,Mt,xt)),Me||(fe.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Ze.useNormalOffset&&fe.push("NORMAL_OFFSET")),Oe=fe.concat(["SHADOWS_SINGLE_CASCADE"])}const rt=ft?"fillExtrusionDepth":B?"fillExtrusionPattern":"fillExtrusion",Lt=r.getLayerRenderingStats();for(const Mt of c){const xt=t.getTile(Mt),St=xt.getBucket(r);
3018if(!St||St.projection.name!==C.projection.name)continue;let Ht=!1;Ze&&(Ht=Ze.getMaxCascadeForTile(Mt.toUnwrapped())===0);const ci=l.isTileAffectedByFog(Mt),Li=St.programConfigurations.get(r.id);let Yi=!1;if(D&&xt.imageAtlas){const Hi=xt.imageAtlas,_i=s.e3.from(D),Ji=_i.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Nn=_i.getSecondary(),Cn=Hi.patternPositions.get(Ji),en=Nn?Hi.patternPositions.get(Nn.scaleSelf(s.o.devicePixelRatio).toString()):null;Yi=!!Cn&&!!en,Cn&&Li.setConstantPatternPositions(Cn,en)}R>0&&(Yi||Li.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&fe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const zt=l.getOrCreateProgram(rt,{config:Li,defines:Ht?Oe:fe,overrideFog:ci});if(l.terrain&&l.terrain.setupElevationDraw(xt,zt,{useMeterToDem:!0}),!St.centroidVertexBuffer){const Hi=zt.getAttributeLocation(E,"a_centroid_pos");Hi!==-1&&E.vertexAttrib2f(Hi,0,0)}!Me&&Ze&&Ze.setupShadows(xt.tileID.toUnwrapped(),zt,"vector-tile"),B&&(l.context.activeTexture.set(E.TEXTURE0),xt.imageAtlasTexture&&xt.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),Li.updatePaintBuffers());const Zi=r.paint.get("fill-extrusion-vertical-gradient"),li=1/St.tileToMeter;let Qi;if(Me&&Ze){if(Ra(xt.tileID,St.maxHeight,l))continue;const Hi=Ze.calculateShadowPassMatrixFromTile(xt.tileID.toUnwrapped());Qi=em(Hi,le,li,Le,je,nt)}else{const Hi=l.translatePosMatrix(Mt.expandedProjMatrix,xt,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),_i=C.projection.createInversionMatrix(C,Mt.canonical);Qi=B?sy(Hi,l,Zi,O,Z,le,li,Mt,xt,ne,je,nt,ie,Q,_i,ve,Le,R):Ad(Hi,l,Zi,O,Z,le,li,Mt,ne,je,nt,ie,Q,_i,ve,Le,ge,ut)}l.uploadCommonUniforms(b,zt,Mt.toUnwrapped(),null,Ae);let cn=St.segments;if(C.projection.name==="mercator"&&!Me&&(cn=St.getVisibleSegments(xt.tileID,l.terrain,l.transform.getFrustum(0)),!cn.get().length))continue;if(Lt)if(Me)for(const Hi of cn.get())Lt.numRenderedVerticesInShadowPass+=Hi.primitiveLength;else for(const Hi of cn.get())Lt.numRenderedVerticesInTransparentPass+=Hi.primitiveLength;const on=[];(l.terrain||v)&&on.push(St.centroidVertexBuffer),se&&on.push(St.layoutVertexExtBuffer),ze&&on.push(St.wallVertexBuffer),zt.draw(l,b.gl.TRIANGLES,p,_,g,bt,Qi,r.id,St.layoutVertexBuffer,St.indexBuffer,cn,r.paint,l.transform.zoom,Li,on)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class lm{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Pa(l,t,r,c,p,_,g,v,b,E,C,z,R,D,B,O,G,U,Z,K){const W=t.context,le=W.gl,ne=t.transform,se=t.transform.zoom,ie=[],Q=l.translate,ce=l.translateAnchor,ve=l.edgeRadius,ge=rl(t,l.cutoffFadeRange);C==="clear"?(ie.push("CLEAR_SUBPASS"),K&&(ie.push("CLEAR_FROM_TEXTURE"),W.activeTexture.set(le.TEXTURE0),K.bind(le.LINEAR,le.CLAMP_TO_EDGE))):C==="sdf"?ie.push("SDF_SUBPASS"):C==="emissive"&&(ie.push("USE_MRT1"),W.activeTexture.set(le.TEXTURE0),K.bind(le.LINEAR,le.CLAMP_TO_EDGE)),U&&ie.push("HAS_CENTROID"),ge.shouldRenderCutoff&&ie.push("RENDER_CUTOFF");const Le=(ze,je,nt,Ae,fe)=>{let Oe=ie;je.groundRadiusBuffer!=null&&(Oe=ie.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Me=je.programConfigurations.get(c.id),Ze=t.isTileAffectedByFog(ze),ft=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Me,defines:Oe,overrideFog:Ze}),bt=jc(t,Ae,z,E,fe,[R,D*fe],B,O,G,se>=17?0:ve*fe,K?K.size[0]:0),ut=[];U&&ut.push(je.hiddenByLandmarkVertexBuffer),je.groundRadiusBuffer!=null&&ut.push(je.groundRadiusBuffer),t.uploadCommonUniforms(W,ft,ze.toUnwrapped(),null,ge),ft.draw(t,W.gl.TRIANGLES,_,g,v,b,bt,c.id,je.vertexBuffer,je.indexBuffer,nt,c.paint,se,Me,ut)};for(const ze of p){const je=r.getTile(ze),nt=je.getBucket(c);if(!nt||nt.projection.name!==ne.projection.name||!nt.groundEffect||nt.groundEffect&&!nt.groundEffect.hasData())continue;const Ae=nt.groundEffect,fe=1/nt.tileToMeter;{const Oe=t.translatePosMatrix(ze.projMatrix,je,Q,ce),Me=Ae.getDefaultSegment();Le(ze,Ae,Me,Oe,fe)}if(Z)for(let Oe=0;Oe<4;Oe++){const Me=s.e9[Oe](ze),Ze=r.getTile(Me);if(!Ze)continue;const ft=Ze.getBucket(c);if(!ft||ft.projection.name!==ne.projection.name||!ft.groundEffect||ft.groundEffect&&!ft.groundEffect.hasData())continue;const bt=ft.groundEffect;let ut,rt;Oe===0?(ut=[-s.al,0,0],rt=1):Oe===1?(ut=[s.al,0,0],rt=0):Oe===2?(ut=[0,-s.al,0],rt=3):(ut=[
30180,s.al,0],rt=2);const Lt=bt.regionSegments[rt];if(!Lt)continue;const Mt=new Float32Array(16);s.br(Mt,ze.projMatrix,ut),Le(ze,bt,Lt,t.translatePosMatrix(Mt,je,Q,ce),fe)}}}function u1(l,t,r,c,p,_,g){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const v=_?_.findDEMTileFor(r):null;if(!(v&&v.dem||g))return;_&&v&&v.dem&&c.selfDEMTileTimestamp!==v.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=v.dem._timestamp);const b=U=>new s.P(Math.ceil((U+s.ed)*s.ee),0),E=U=>{const Z=t.getSource().minzoom,K=le=>{const ne=t.getTileByID(le);if(ne&&ne.hasData())return ne.getBucket(p)},W=[0,-1,1];for(const le of W){if(U.overscaledZ+le<Z)continue;const ne=K(U.calculateScaledKey(U.overscaledZ+le));if(ne)return ne}},C=[0,0,0],z=(U,Z)=>(C[0]=Math.min(U.min.y,Z.min.y),C[1]=Math.max(U.max.y,Z.max.y),C[2]=s.al-Z.min.x>U.max.x?Z.min.x-s.al:U.max.x,C),R=(U,Z)=>(C[0]=Math.min(U.min.x,Z.min.x),C[1]=Math.max(U.max.x,Z.max.x),C[2]=s.al-Z.min.y>U.max.y?Z.min.y-s.al:U.max.y,C),D=[(U,Z)=>z(U,Z),(U,Z)=>z(Z,U),(U,Z)=>R(U,Z),(U,Z)=>R(Z,U)],B=(U,Z,K,W,le,ne,se)=>{if(!_)return 0;const ie=[[ne?K:U,ne?U:K,0],[ne?K:Z,ne?Z:K,0]],Q=se<0?s.al+se:se,ce=[ne?Q:(U+Z)/2,ne?(U+Z)/2:Q,0];return K===0&&se<0||K!==0&&se>0?_.getForTilePoints(le,[ce],!0,W):ie.push(ce),_.getForTilePoints(r,ie,!0,v),Math.max(ie[0][2],ie[1][2],ce[2])/_.exaggeration()};for(let U=0;U<4;U++){const Z=c.borderFeatureIndices[U];if(Z.length===0)continue;const K=s.e9[U](r),W=E(K);if(!(W&&W instanceof s.ea))continue;const le=_?_.findDEMTileFor(K):null;if(!(le&&le.dem||g)||(_&&le&&le.dem&&c.borderDEMTileTimestamp[U]!==le.dem._timestamp&&(c.borderDoneWithNeighborZ[U]=-1,c.borderDEMTileTimestamp[U]=le.dem._timestamp),c.borderDoneWithNeighborZ[U]===W.canonical.z))continue;W.centroidVertexArray.length===0&&W.createCentroidsBuffer();const ne=(U<2?1:5)-U,se=W.borderDoneWithNeighborZ[ne]!==c.canonical.z,ie=W.borderFeatureIndices[ne];let Q=0;if(c.canonical.z!==W.canonical.z){for(const ce of Z)c.showCentroid(c.featuresOnBorder[ce]);if(se)for(const ce of ie)W.showCentroid(W.featuresOnBorder[ce]);c.borderDoneWithNeighborZ[U]=W.canonical.z,W.borderDoneWithNeighborZ[ne]=c.canonical.z}for(const ce of Z){const ve=c.featuresOnBorder[ce],ge=c.centroidData[ve.centroidDataIndex],Le=ve.borders[U];let ze;for(;Q<ie.length;){ze=W.featuresOnBorder[ie[Q]];const je=ze.borders[ne];if(je[1]>Le[0]+3||je[0]>Le[0]-3)break;W.showCentroid(ze),Q++}if(ze&&Q<ie.length){const je=Q;let nt=0;for(;!(ze.borders[ne][0]>Le[1]-3)&&(nt++,++Q!==ie.length);)ze=W.featuresOnBorder[ie[Q]];ze=W.featuresOnBorder[ie[je]];let Ae=!1;if(nt>=1){const Me=ze.borders[ne];Math.abs(Le[0]-Me[0])<3&&Math.abs(Le[1]-Me[1])<3&&(nt=1,Ae=!0,Q=je+1)}else if(nt===0){c.showCentroid(ve);continue}const fe=W.centroidData[ze.centroidDataIndex];g&&Ae&&(((O=ge).flags|(G=fe).flags)&s.ec?(O.flags|=s.ec,G.flags|=s.ec):(O.flags&=~s.ec,G.flags&=~s.ec));const Oe=ve.intersectsCount()>1||ze.intersectsCount()>1;if(nt>1)Q=je,ge.centroidXY=fe.centroidXY=new s.P(0,0);else if(le&&le.dem&&!Oe){const Me=D[U](ge,fe),Ze=U%2?s.al-1:0,ft=B(Me[0],Math.min(s.al-1,Me[1]),Ze,le,K,U<2,Me[2]);ge.centroidXY=fe.centroidXY=b(ft)}else Oe?ge.centroidXY=fe.centroidXY=new s.P(0,0):(ge.centroidXY=c.encodeBorderCentroid(ve),fe.centroidXY=W.encodeBorderCentroid(ze));c.writeCentroidToBuffer(ge),W.writeCentroidToBuffer(fe)}else c.showCentroid(ve)}c.borderDoneWithNeighborZ[U]=W.canonical.z,W.borderDoneWithNeighborZ[ne]=c.canonical.z}var O,G;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const Fo=[1,0,0],cm=[0,1,0],_o=[0,0,1];function Ra(l,t,r){const c=r.transform,p=r.shadowRenderer;if(!p)return!0;const _=l.toUnwrapped(),g=c.tileSize*p._cascades[r.currentShadowCascade].scale;let v=t;if(c.elevation){const O=c.elevation.getMinMaxForTile(l);O&&(v+=O.max)}const b=[...p.shadowDirection];b[2]=-b[2];const E=p.computeSimplifiedTileShadowVolume(_,v,g,b);if(!E)return!1;const C=[Fo,cm,_o,b,[b[0],0,b[2]],[0,b[1],b[2]]],z=c.projection.name==="globe",R=c.scaleZoom(g),D=s.cB.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,R,!z),B=p.getCurrentCascadeFrustum();return D.intersectsPrecise(E.vertices,E.planes,C)===0||B.intersectsPrecise(E.vertices,E.planes,C)===0}function Xu(l){const{painter:t,source:r,layer:c,coords:p}=l;let _=l.defines;const g=t.context,v=t.renderPass==="shadow",b=t.renderPass==="light-beam",E=t.shadowRenderer,C=s.ef(t.transform.center.lat,t.transform.zoom),z=rl(t,c.paint.get("building-cutoff-fade-range"));z.shouldRenderCutoff&&(_=_.concat("RENDER_CUTOFF")),l.floodLightIntensity>0&&(_=_.concat("FLOOD_LIGHT"));for(const R of p){const D=r.getTile(R),B=D.getBucket(c);if(!B)continue;E&&E.getMaxCascadeForTile(R.toUnwrapped())===0&&(_=_.concat("SHADOWS_SINGLE_CASCADE"));const O=B.programConfigurations.get(c.id);let G,U,Z,K=t.translatePosMatrix(R.expandedProjMatrix,D,[0,0],"map");if(K=s.cS(s.bC(),K,[1,1,l.verticalScale]),v&&E){if(Ra(D.tileID,B.maxHeight*C,t))continue;let le=E.calculateShadowPassMatrixFromTile(D.tileID.toUnwrapped());le=s.cS(s.bC(),le,[1,1,l.verticalScale]),Z=hl(le),G=U=t.getOrCreateProgram("buildingDepth",{config:O,defines:_,overrideFog:!1})}else if(b)G=U=t.getOrCreateProgram("buildingBloom",{config:O,defines:_,overrideFog:!1}),Z=ly(K);else{const le=t.transform.calculatePosMatrix(R.toUnwrapped(),t.transform.worldSize);s.cS(le,le,[1,1,l.verticalScale]);const ne=s.bC();s.cS(ne,le,[1,-1,1/C]),s.bl(ne,ne),s.eg(ne,ne);const se=t.transform.getFreeCameraOptions().position,ie=1<<R.canonical.z;if(Z=Cd(K,ne,l.opacity,l.facadeAOIntensity,[((se.x-R.wrap)*ie-R.canonical.x)*s.al,(se.y*ie-R.canonical.y)*s.al,se.z*ie*s.al],B.tileToMeter,l.facadeEmissiveChance,l.floodLightColor,l.floodLightIntensity),U=t.getOrCreateProgram("building",{config:O,defines:_,overrideFog:!1}),l.depthOnly===!0)G=U;else{const Q=_.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);G=t.getOrCreateProgram("building",{config:O,defines:Q,overrideFog:!1})}
3018E&&(E.setupShadowsFromMatrix(le,U,!0),G!==U&&E.setupShadowsFromMatrix(le,G,!0))}const W=(le,ne)=>{if(b){const se=le.entranceBloom;ne.draw(t,g.gl.TRIANGLES,l.depthMode,ii.disabled,l.blendMode,ei.disabled,Z,c.id,se.layoutVertexBuffer,se.indexBuffer,se.segmentsBucket,c.paint,t.transform.zoom,O,[se.layoutAttenuationBuffer,se.layoutColorBuffer])}else{const se=le.segmentsBucket;let ie=[le.layoutNormalBuffer,le.layoutCentroidBuffer,le.layoutColorBuffer,le.layoutFloodLightDataBuffer];le.layoutFacadePaintBuffer&&(ie=ie.concat([le.layoutFacadeDataBuffer,le.layoutFacadeVerticalRangeBuffer,le.layoutFacadePaintBuffer])),ne.draw(t,g.gl.TRIANGLES,l.depthMode,ii.disabled,l.blendMode,v?ei.disabled:ei.backCW,Z,c.id,le.layoutVertexBuffer,le.indexBuffer,se,c.paint,t.transform.zoom,O,ie)}};t.uploadCommonUniforms(g,U,R.toUnwrapped(),null,z),B.buildingWithoutFacade&&W(B.buildingWithoutFacade,U),B.buildingWithFacade&&(G!==U&&t.uploadCommonUniforms(g,G,R.toUnwrapped(),null,z),W(B.buildingWithFacade,G))}}function Od(l,t,r,c,p,_,g,v,b,E,C,z,R){const D=l.context.gl,B=l.depthModeForSublayer(1,kt.ReadOnly,D.LEQUAL,!0),O=.1*(1-(G=C))+3*G;var G;const U=l._showOverdrawInspector,Z=z,K=new lm;U||Pa(K,l,t,r,c,B,new ii({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),new fi([D.ONE,D.ONE,D.ONE,D.ONE],s.ao.transparent,[!1,!1,!1,!0],D.MIN),ei.disabled,p,"sdf",_,g,v,b,E,O,Z,!1);{const W=U?ii.disabled:new ii({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),le=U?l.colorModeForRenderPass():new fi([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],s.ao.transparent,[!0,!0,!0,!0]);Pa(K,l,t,r,c,B,W,le,ei.disabled,p,"color",_,g,v,b,E,O,Z,!1)}}function Fd(l){return[l[0]*s.eh,l[1]*s.eh,l[2]*s.eh,0]}function Yu(l,t,r,c,p,_,g,v,b){const E=c.getSource(),C=r.globeSharedBuffers;if(!C)return;let z,R,D;if(t&&(z=c.getTile(t)),E instanceof s.aU?(R=E.texture,D=s.dK(0,0,r.transform)):z&&t&&(R=z.texture,D=s.dK(t.canonical.z,t.canonical.x,r.transform)),!R||!D)return;l||(D=s.cS(s.bC(),D,[1,-1,1]));const B=r.context,O=B.gl,G=p.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR,U=r.colorModeForDrapableLayerRenderPass(_),Z=g.defines;Z.push("GLOBE_POLES");const K=new kt(O.LEQUAL,kt.ReadWrite,r.depthRangeFor3D),W=Float32Array.from(r.transform.expandedFarZProjMatrix),le=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),B.activeTexture.set(O.TEXTURE0),R.bind(G,O.CLAMP_TO_EDGE),B.activeTexture.set(O.TEXTURE1),R.bind(G,O.CLAMP_TO_EDGE),"useMipmap"in R&&B.extTextureFilterAnisotropic&&r.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,B.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,B.extTextureFilterAnisotropicMax);const[ne,se,ie,Q]=t?C.getPoleBuffers(t.canonical.z,!1):C.getPoleBuffers(0,!0),ce=p.paint.get("raster-elevation");let ve;l?(ve=ne,r.renderDefaultNorthPole=ce!==0):(ve=se,r.renderDefaultSouthPole=ce!==0);const ge=Fd(g.mix),Le=((je,nt,Ae,fe,Oe,Me,Ze,ft,bt,ut,rt,Lt,Mt)=>hy(je,nt,Ae,new Float32Array(16),new Float32Array(9),[0,0],fe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Me,[0,0],ft,2,ut,rt,Lt,1,0,Mt))(W,le,D,s.aj(r.transform.zoom),0,p,0,ce,0,ge,g.offset,g.range,_),ze=r.getOrCreateProgram("raster",{defines:Z});r.uploadCommonUniforms(B,ze,null),ze.draw(r,O.TRIANGLES,K,b,U,v,Le,p.id,ve,ie,Q)}function yy(l){const t=l._nearZ,r=l.projection.farthestPixelDistance(l),c=r-t,p=.2*l.height,_=t+p;return[t,r,(_-p-t)/c,(_-t)/c]}function La(l,t,r,c){if(l)return t instanceof lo&&l instanceof Yh?t.getTextureDescriptor(l,r,!0):{texture:l.texture,mix:Fd(c.mix),offset:c.offset,buffer:0,tileSize:1}}var bn=s.ei([{name:"a_index",type:"Int16",components:1}]);class Bd{constructor(t,r,c,p){const _={width:c[0],height:c[1],data:null},g=t.gl;this.targetColorTexture=new s.T(t,_,g.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,_,g.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(r,p),this.lastInvalidatedAt=0}updateParticleTexture(t,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,p=r.width*r.height;this.particleTexture0=new s.T(this.context,r,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,r,c.RGBA8,{premultiply:!1,useMipmap:!1});const _=new s.ej;_.reserve(p);for(let g=0;g<p;g++)_.emplaceBack(g);this.particleIndexBuffer=this.context.createVertexBuffer(_,bn.members,!0),this.particleSegment=s.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function um(l,t,r){if(!l)return null;const c=t.getTextureDescriptor(l,r,!0);if(!c)return null;let{texture:p,mix:_,offset:g,tileSize:v,buffer:b,format:E}=c;if(!p||!E)return null;let C=!1;return E==="uint32"&&(C=!0,_[3]=0,_=Md(s.ek,_,[0,r.paint.get("raster-particle-max-speed")]),g=Pd(s.ek,g,[0,r.paint.get("raster-particle-max-speed")])),{texture:p,textureOffset:[b/(v+2*b),v/(v+2*b)],tileSize:v,scalarData:C,scale:_,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[E]]}}function vy(l){const t=l._nearZ,r=l.projection.farthestPixelDistance(l),c=r-t,p=.2*l.height,_=t+p;return[t,r,(_-p-t)/c,(_-t)/c]}const xy=new s.ao(1,0,0,1),wy=new s.ao(0,1,0,1),by=new s.ao(0,0,1,1),Wl=new s.ao(1,0,1,1),Xl=new s.ao(0,1,1,1);function ct(l,t,r,c,p,_){for(let g=0;g<r.length;g++)if(p){const E=new s.ao(c.r*.8,c.g*.8,c.b*.8,1);_t(l,t,r[g],c,-1,-1,_),_t(l,t,r[g],c,-1,1,_),_t(l,t,r[g],c,1,1,_),_t(l,t,r[g],c,1,-1,_),_t(l,t,r[g],E,0,0,_)}else _t(l,t,r[g],c,0,0,_)}function _t(l,t,r,c,p,_,g){const v=l.context,b=l.transform,E=v.gl,C=b.projection.name==="globe",z=C?["PROJECTION_GLOBE_VIEW"]:[];let R=s.bz(r.projMatrix);if(C&&s.aj(b.zoom)>0){const ge=s.bj(r.canonical,b),Le=s.el(ge);R=s.aB(new Float32Array(16),b.globeMatrix,Le),s.aB(R,b.projMatrix,R)}const D=s.bC();D[12]+=2*p/(s.o.devicePixelRatio*b.width),D[13]+=2*_/(s.o.devicePixelRatio*b.height),s.aB(R,D,R);const B=l.getOrCreateProgram("debug",{defines:z}),O=t.getTileByID(r.key);l.terrain&&l.terrain.setupElevationDraw(O,B);const G=kt.disabled,U=ii.disabled,Z=l.colorModeForRenderPass(),K="$debug";v.activeTexture.set(E.TEXTURE0),l.emptyTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),C?O._makeGlobeTileDebugBuffers(l.context,b):O._makeDebugTileBoundsBuffers(l.context,b.projection);const W=O._tileDebugBuffer||l.debugBuffer,le=O._tileDebugIndexBuffer||l.debugIndexBuffer,ne=O._tileDebugSegments||l.debugSegments;
vendor: 10,600 bytes, line 3018
3018if(B.draw(l,E.LINE_STRIP,G,U,Z,ei.disabled,Hu(R,c.toPremultipliedRenderColor(null)),K,W,le,ne,null,null,null,[O._globeTileDebugBorderBuffer]),g){const ge=O.latestRawTileData,Le=Math.floor((ge&&ge.byteLength||0)/1024);let ze=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(ze+=` => ${r.overscaledZ}`),ze+=` ${O.state}`,ze+=` ${Le}kb`,function(je,nt){je.initDebugOverlayCanvas();const Ae=je.debugOverlayCanvas,fe=je.context.gl,Oe=je.debugOverlayCanvas.getContext("2d");Oe.clearRect(0,0,Ae.width,Ae.height),Oe.shadowColor="white",Oe.shadowBlur=2,Oe.lineWidth=1.5,Oe.strokeStyle="white",Oe.textBaseline="top",Oe.font="bold 36px Open Sans, sans-serif",Oe.fillText(nt,5,5),Oe.strokeText(nt,5,5),je.debugOverlayTexture.update(Ae),je.debugOverlayTexture.bind(fe.LINEAR,fe.CLAMP_TO_EDGE)}(l,ze)}const se=t.getTile(r).tileSize,ie=512/Math.min(se,512)*(r.overscaledZ/b.zoom)*.5,Q=O._tileDebugTextBuffer||l.debugBuffer,ce=O._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,ve=O._tileDebugTextSegments||l.debugSegments;B.draw(l,E.TRIANGLES,G,U,fi.alphaBlended,ei.disabled,Hu(R,s.ao.transparent.toPremultipliedRenderColor(null),ie),K,Q,ce,ve,null,null,null,[O._globeTileDebugTextBuffer])}function Yl(l,t,r,c){be(l,0,t+r/2,l.transform.width,r,c)}function Un(l,t,r,c){be(l,t-r/2,0,r,l.transform.height,c)}function be(l,t,r,c,p,_){const g=l.context,v=g.gl;v.enable(v.SCISSOR_TEST),v.scissor(t*s.o.devicePixelRatio,r*s.o.devicePixelRatio,c*s.o.devicePixelRatio,p*s.o.devicePixelRatio),g.clear({color:_}),v.disable(v.SCISSOR_TEST)}const Ty=s.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Nd}=Ty;function oa(l,t,r,c){l.emplaceBack(t,r,c)}class Vd{constructor(t){this.vertexArray=new s.em,this.indices=new s.b0,oa(this.vertexArray,-1,-1,1),oa(this.vertexArray,1,-1,1),oa(this.vertexArray,-1,1,1),oa(this.vertexArray,1,1,1),oa(this.vertexArray,-1,-1,-1),oa(this.vertexArray,1,-1,-1),oa(this.vertexArray,-1,1,-1),oa(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Nd),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bg.simpleSegment(0,0,36,12)}}function Kl(l,t,r,c,p,_){const g=l.context.gl,v=t.paint.get("sky-atmosphere-color"),b=t.paint.get("sky-atmosphere-halo-color"),E=t.paint.get("sky-atmosphere-sun-intensity"),C=((z,R,D,B,O)=>({u_matrix_3f:z,u_sun_direction:R,u_sun_intensity:D,u_color_tint_r:[B.r,B.g,B.b,B.a],u_color_tint_m:[O.r,O.g,O.b,O.a],u_luminance:5e-5}))(s.eo(s.dO(),c),p,E,v.toPremultipliedRenderColor(null),b.toPremultipliedRenderColor(null));g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+_,t.skyboxTexture,0),r.draw(l,g.TRIANGLES,kt.disabled,ii.disabled,fi.unblended,ei.frontCW,C,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Sy=s.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class $c{constructor(t){const r=new s.ep;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);const c=new s.b0;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(r,Sy.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const h1=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class d1{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Ey{constructor(t){this.colorModeAlphaBlendedWriteRGB=new fi([1,ta,1,ta],s.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new fi([1,0,1,0],s.ao.transparent,[!1,!1,!1,!0]),this.params=new d1,this.updateNeeded=!0}update(t){const r=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new $c(r);const c=this.params.sizeRange,p=this.params.intensityRange,_=function(C){const z=s.eq(30),R=[];for(let D=0;D<C;++D){const B=2*Math.PI*z(),O=Math.acos(1-2*z())-.5*Math.PI;R.push(s.d5(Math.cos(O)*Math.cos(B),Math.cos(O)*Math.sin(B),Math.sin(O)))}return R}(this.params.starsCount),g=s.eq(300),v=new s.er,b=new s.b0;let E=0;for(let C=0;C<_.length;++C){const z=s.c5([],_[C],200),R=Math.max(0,1+.01*c*(1*g()-.5)),D=Math.max(0,1+.01*p*(1*g()-.5));v.emplaceBack(z[0],z[1],z[2],-1,-1,R,D),v.emplaceBack(z[0],z[1],z[2],1,-1,R,D),v.emplaceBack(z[0],z[1],z[2],1,1,R,D),v.emplaceBack(z[0],z[1],z[2],-1,1,R,D),b.emplaceBack(E+0,E+1,E+2),b.emplaceBack(E+0,E+2,E+3),E+=4}this.starsVx=r.createVertexBuffer(v,h1.members),this.starsIdx=r.createIndexBuffer(b),this.starsSegments=s.bg.simpleSegment(0,0,v.length,b.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,r){const c=t.context,p=c.gl,_=t.transform,g=new kt(p.LEQUAL,kt.ReadOnly,[0,1]),v=s.aj(_.zoom),b=t.style.getLut(r.scope),E=r.properties.get("color-use-theme")==="none",C=r.properties.get("color").toNonPremultipliedRenderColor(E?null:b),z=r.properties.get("high-color-use-theme")==="none",R=r.properties.get("high-color").toNonPremultipliedRenderColor(z?null:b),D=r.properties.get("space-color-use-theme")==="none",B=r.properties.get("space-color").toNonPremultipliedRenderColor(D?null:b),O=5e-4,G=s.es(r.properties.get("horizon-blend"),0,1,O,.25),U=s.dE(t,c,_)&&G===O?_.worldSize/(2*Math.PI*1.025)-1:_.globeRadius,Z=t.frameCounter/1e3%1,K=s.ag(_.globeCenterInViewSpace),W=Math.sqrt(Math.pow(K,2)-Math.pow(U,2)),le=Math.acos(W/K),ne=se=>{const ie=_.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];se&&ie.push("ALPHA_PASS");const Q=t.getOrCreateProgram("globeAtmosphere",{defines:ie}),ce=((ge,Le,ze,je,nt,Ae,fe,Oe,Me,Ze,ft,bt)=>({u_frustum_tl:ge,u_frustum_tr:Le,u_frustum_br:ze,u_frustum_bl:je,u_horizon:nt,u_transition:Ae,u_fadeout_range:fe,u_atmosphere_fog_color:Oe.toArray01(),u_high_color:Me.toArray01(),u_space_color:Ze.toArray01(),u_temporal_offset:ft,u_horizon_angle:bt}))(_.frustumCorners.TL,_.frustumCorners.TR,_.frustumCorners.BR,_.frustumCorners.BL,_.frustumCorners.horizon,v,G,C,R,B,Z,le);t.uploadCommonUniforms(c,Q);const ve=this.atmosphereBuffer;ve&&Q.draw(t,p.TRIANGLES,g,ii.disabled,se?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,ei.backCW,ce,se?"atmosphere_glow_alpha":"atmosphere_glow",ve.vertexBuffer,ve.indexBuffer,ve.segments)};ne(!1),ne(!0)}drawStars(t,r){const c=s.aA(r.properties.get("star-intensity"),0,1);if(c===0)return;const p=t.context,_=p.gl,g=t.transform,v=t.getOrCreateProgram("stars"),b=s.c7([]);s.c9(b,b,-g._pitch),s.c8(b,b,-g.angle),s.c9(b,b,s.an(g._center.lat)),s.et(b,b,-s.an(g._center.lng));const E=s.cc(new Float32Array(16),b),C=s.aB([],g.starsProjMatrix,E),z=s.eo([],E),R=s.eu([],z),D=[0,1,0];s.dQ(D,D,R),s.c5(D,D,this.params.sizeMultiplier);const B=[1,0,0];s.dQ(B,B,R),s.c5(B,B,this.params.sizeMultiplier);const O=(G=D,U=B,Z=c,{u_matrix:Float32Array.from(C),u_up:G,u_right:U,u_intensity_multiplier:Z});var G,U,Z;t.uploadCommonUniforms(p,v),this.starsVx&&this.starsIdx&&v.draw(t,_.TRIANGLES,kt.disabled,ii.disabled,this.colorModeAlphaBlendedWriteRGB,ei.disabled,O,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class jd{constructor(){this.visibleTiles=[]}updateBorders(t,r){const c=[],p=[],_=t._getRenderableCoordinates(!1,!0);for(const b of _){const E=t.getTile(b);if(!E.hasData())continue;const C=E.getBucket(r);C&&(C.isEmpty()||(c.push(b.key),p.push({bucket:C,tileID:b.canonical})))}let g=c.length!==this.visibleTiles.length;if(!g){c.sort();for(let b=0;b<c.length;b++)if(c[b]!==this.visibleTiles[b]){g=!0;break}}if(!g)return;const v=new Set;this.visibleTiles=c,p.sort((b,E)=>b.tileID.z-E.tileID.z||b.tileID.x-E.tileID.x||b.tileID.y-E.tileID.y);for(const b of p){const E=new Array,C=new Array,z=b.bucket;for(const R of z.featuresOnBorder)v.has(R.featureId)?C.push(R.footprintIndex):(v.add(R.featureId),E.push(R.footprintIndex));z.updateFootprintHiddenFlags(E,s.ev,!1),z.updateFootprintHiddenFlags(C,s.ev,!0)}}}function Ud(l,t){const r=[...l],c=t.cameraWorldSizeForFog/t.worldSize,p=s.bA([]);return s.cS(p,p,[c,c,1]),s.aB(r,p,r),s.aB(r,t.worldToFogMatrix,r),r}function Gd(l,t,r,c,p){const _=r.material,g=c.context,{baseColorTexture:v,metallicRoughnessTexture:b}=_.pbrMetallicRoughness,{normalTexture:E,occlusionTexture:C,emissionTexture:z}=_;function R(B,O,G){if(B&&(l.push(O),g.activeTexture.set(g.gl.TEXTURE0+G),B.gfxTexture)){const{minFilter:U,magFilter:Z,wrapS:K,wrapT:W}=B.sampler;B.gfxTexture.bindExtraParam(U,Z,K,W)}}R(v,"HAS_TEXTURE_u_baseColorTexture",Br.BaseColor),R(b,"HAS_TEXTURE_u_metallicRoughnessTexture",Br.MetallicRoughness),R(E,"HAS_TEXTURE_u_normalTexture",Br.Normal),R(C,"HAS_TEXTURE_u_occlusionTexture",Br.Occlusion),R(z,"HAS_TEXTURE_u_emissionTexture",Br.Emission),p&&(p.texture||(p.texture=new s.d$(c.context,p.image,[p.image.height,p.image.height,p.image.height],g.gl.RGBA8)),g.activeTexture.set(g.gl.TEXTURE0+Br.LUT),p.texture&&p.texture.bind(g.gl.LINEAR,g.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(r.texcoordBuffer)),r.colorBuffer&&(l.push(r.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(r.colorBuffer)),r.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(r.normalBuffer)),r.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(r.pbrBuffer)),_.alphaMode!=="OPAQUE"&&_.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),_.defined||l.push("DIFFUSE_SHADED");const D=c.shadowRenderer;D&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),D.useNormalOffset&&l.push("NORMAL_OFFSET"))}function $d(l,t,r,c,p,_){const g=l.modelOpacity,v=t.context,b=new kt(t.context.gl.LEQUAL,l.isLightMesh?kt.ReadOnly:kt.ReadWrite,t.depthRangeFor3D),E=t.transform,C=l.mesh,z=C.material,R=z.pbrMetallicRoughness,D=t.style.fog;let B;B=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.aB([],c.zScaleMatrix,l.nodeModelMatrix),s.aB(B,c.negCameraPosMatrix,B);const O=s.bl([],B);s.eg(O,O);
3018const G=r.paint.get("model-color-use-theme").constantOr("default")==="none",U=r.paint.get("model-emissive-strength").constantOr(0),Z=ql(new Float32Array(l.worldViewProjection),new Float32Array(B),new Float32Array(O),null,t,g,R.baseColorFactor,z.emissiveFactor,R.metallicFactor,R.roughnessFactor,z,U,r,void 0,void 0,l.materialOverride,l.modelColor),K={defines:[]},W=[],le=t.shadowRenderer;le&&(le.useNormalOffset=!1),Gd(K.defines,W,C,t,G?null:r.lut);let ne=null;if(D){const Q=Ud(l.nodeModelMatrix,t.transform);if(ne=new Float32Array(Q),E.projection.name!=="globe"){const ce=C.aabb.min,ve=C.aabb.max,[ge,Le]=D.getOpacityForBounds(Q,ce[0],ce[1],ve[0],ve[1]);K.overrideFog=ge>=Ue||Le>=Ue}}const se=rl(t,r.paint.get("model-cutoff-fade-range"));se.shouldRenderCutoff&&K.defines.push("RENDER_CUTOFF");const ie=t.getOrCreateProgram("model",K);t.uploadCommonUniforms(v,ie,null,ne,se),t.renderPass!=="shadow"&&le&&le.setupShadowsFromMatrix(l.nodeModelMatrix,ie),ie.draw(t,v.gl.TRIANGLES,b,p,_,C.material.doubleSided?ei.disabled:ei.backCCW,Z,r.id,C.vertexBuffer,C.indexBuffer,C.segments,r.paint,t.transform.zoom,void 0,W)}function Ku(l,t){return l.style._importedAsBasemap?"basemap":t.scope}function Jl(l,t,r,c,p,_,g,v,b,E){const C=l.transform,z=!!t.isGeometryBloom&&t.isGeometryBloom;if(z&&l.renderPass==="shadow")return;const R=C.projection.name==="globe"?s.eD(r,C):[...r];s.aB(R,R,t.globalMatrix);const D=s.aB([],c,R);if(t.meshes)for(const B of t.meshes){const O=v.get(B.material.name);if(O&&O.opacity<=0)continue;if(B.material.alphaMode!=="BLEND"){g.push({mesh:B,depth:0,modelIndex:p,worldViewProjection:D,nodeModelMatrix:R,isLightMesh:z,materialOverride:O,modelOpacity:b,modelColor:E});continue}const G=s.af([],B.centroid,D);!C.isOrthographic&&G[2]<=0||_.push({mesh:B,depth:G[2],modelIndex:p,worldViewProjection:D,nodeModelMatrix:R,isLightMesh:z,materialOverride:O,modelOpacity:b,modelColor:E})}if(t.children)for(const B of t.children)Jl(l,B,r,c,p,_,g,v,b,E)}function zs(l,t,r,c){const p=r.shadowRenderer;if(!p)return;const _=p.getShadowPassDepthMode(),g=p.getShadowPassColorMode(),v=p.calculateShadowPassMatrixFromMatrix(t),b=om(v);r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,_,ii.disabled,g,ei.disabled,b,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,r.transform.zoom,void 0,void 0)}function Iy(l,t,r,c,p,_){for(const g of p){const v=Object.assign({},c);v.part=g;const b={type:"Unknown",id:t,properties:v},E={orientation:l.paint.get("model-rotation").evaluate(b,r)};_.set(g,E)}}function Ay(l,t,r,c,p,_){for(const g of p){const v=Object.assign({},c);v.part=g;const b={type:"Unknown",id:t,properties:v},E={color:l.paint.get("model-color").evaluate(b,r),colorMix:l.paint.get("model-color-mix-intensity").evaluate(b,r),opacity:l.paint.get("model-opacity").evaluate(b,r),emissionStrength:l.paint.get("model-emissive-strength").evaluate(b,r)};_.set(g,E)}}function Cy(l,t,r,c,p){let _=!1;for(const v of c)v.modelOpacity!==1&&($d(v,l,t,p[v.modelIndex],ii.disabled,fi.disabled),_=!0);for(const v of c)$d(v,l,t,p[v.modelIndex],v.modelOpacity!==1?l.stencilModeFor3D():ii.disabled,l.colorModeForRenderPass());_&&l.resetStencilClippingMasks();const g=fi.additive;for(const v of r)$d(v,l,t,p[v.modelIndex],ii.disabled,v.isLightMesh?g:l.colorModeForRenderPass())}function My(l,t,r){const c=t.updateZoomBasedPaintProperties(),p=function(_,g,v){let b,E,C,z=_.terrain?_.terrain.exaggeration():0;if(_.terrain&&z>0){const R=_.terrain,D=R.findDEMTileFor(v);D&&D.dem?b=s.eF.create(R,v,D):z=0}if(z===0&&(g.terrainElevationMin=0,g.terrainElevationMax=0),z===g.validForExaggeration&&(z===0||b&&b._demTile&&b._demTile.tileID===g.validForDEMTile.id&&b._dem._timestamp===g.validForDEMTile.timestamp))return!1;for(const R in g.instancesPerModel){const D=g.instancesPerModel[R];for(let B=0;B<D.instancedDataArray.length;++B){const O=(b?z*b.getElevationAt(0|D.instancedDataArray.float32[16*B],0|D.instancedDataArray.float32[16*B+1],!0,!0):0)+D.instancesEvaluatedElevation[B];D.instancedDataArray.float32[16*B+6]=O,E=E?Math.min(g.terrainElevationMin,O):O,C=C?Math.max(g.terrainElevationMax,O):O}}return g.terrainElevationMin=E||0,g.terrainElevationMax=C||0,g.validForExaggeration=z,g.validForDEMTile=b&&b._demTile?{id:b._demTile.tileID,timestamp:b._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,t,r);(c||p)&&(t.uploaded=!1,t.upload(l.context))}const sa={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d9([0,0,0],[s.al,s.al,0])};function go(l,t){const r=1<<l.canonical.z,c=t.getFreeCameraOptions().position,p=t.elevation,_=l.canonical.x/r,g=(l.canonical.x+1)/r,v=l.canonical.y/r,b=(l.canonical.y+1)/r;let E=t._centerAltitude;if(p){const D=p.getMinMaxForTile(l);D&&D.max>E&&(E=D.max)}const C=s.aA(c.x,_,g)-c.x,z=s.aA(c.y,v,b)-c.y,R=s.cf(E,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(C*C+z*z+R*R))}function Py(l,t,r,c,p,_,g){const v=l.context,b=l.renderPass==="shadow",E=l.shadowRenderer,C=b&&E?E.getShadowPassDepthMode():new kt(v.gl.LEQUAL,kt.ReadWrite,l.depthRangeFor3D),z=l.isTileAffectedByFog(_),R=l.transform.projection.name==="globe";if(r.meshes)for(const D of r.meshes){const B=R?[]:["MODEL_POSITION_ON_GPU"],O=[];let G,U,Z;const K=!R&&c.instancedDataArray.length>20;K&&B.push("INSTANCED_ARRAYS");const W=rl(l,t.paint.get("model-cutoff-fade-range"));if(W.shouldRenderCutoff&&B.push("RENDER_CUTOFF"),b&&E)G=l.getOrCreateProgram("modelDepth",{defines:B}),U=om(g.shadowTileMatrix,g.shadowTileMatrix,Float32Array.from(r.globalMatrix)),Z=E.get
3018ShadowPassColorMode();else{Gd(B,O,D,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),G=l.getOrCreateProgram("model",{defines:B,overrideFog:z});const ne=D.material,se=ne.pbrMetallicRoughness,ie=t.paint.get("model-opacity").constantOr(1),Q=t.paint.get("model-emissive-strength").constantOr(0);U=ql(_.expandedProjMatrix,Float32Array.from(r.globalMatrix),new Float32Array(16),null,l,ie,se.baseColorFactor,ne.emissiveFactor,se.metallicFactor,se.roughnessFactor,ne,Q,t,p),E&&(g.shadowUniformsInitialized?G.setShadowUniformValues(v,E.getShadowUniformValues()):(E.setupShadows(_.toUnwrapped(),G,"model-tile"),g.shadowUniformsInitialized=!0)),Z=W.shouldRenderCutoff||ie<1||ne.alphaMode!=="OPAQUE"?fi.alphaBlended:fi.unblended}l.uploadCommonUniforms(v,G,_.toUnwrapped(),null,W);const le=D.material.doubleSided?ei.disabled:ei.backCCW;if(K)O.push(c.instancedDataBuffer),G.draw(l,v.gl.TRIANGLES,C,ii.disabled,Z,le,U,t.id,D.vertexBuffer,D.indexBuffer,D.segments,t.paint,l.transform.zoom,void 0,O,c.instancedDataArray.length);else{const ne=b?"u_instance":"u_normal_matrix";for(let se=0;se<c.instancedDataArray.length;++se)U[ne]=new Float32Array(c.instancedDataArray.arrayBuffer,64*se,16),G.draw(l,v.gl.TRIANGLES,C,ii.disabled,Z,le,U,t.id,D.vertexBuffer,D.indexBuffer,D.segments,t.paint,l.transform.zoom,void 0,O)}}if(r.children)for(const D of r.children)Py(l,t,D,c,p,_,g)}const Ju=[1,-1,1];function p1(l,t,r,c){if(!r.modelManager)return!0;const p=r.modelManager;if(!r.shadowRenderer)return!0;const _=r.shadowRenderer,g=t.aabb;let v=!0,b=l.maxHeight;if(b===0){let C=0;for(const z in l.instancesPerModel){const R=p.getModel(z,c);R?C=Math.max(C,Math.max(Math.max(R.aabb.max[0],R.aabb.max[1]),R.aabb.max[2])):v=!1}b=l.maxScale*C*1.41+l.maxVerticalOffset,v&&(l.maxHeight=b)}g.max[2]=b,g.min[2]+=l.terrainElevationMin,g.max[2]+=l.terrainElevationMax,s.af(g.min,g.min,t.tileMatrix),s.af(g.max,g.max,t.tileMatrix);const E=g.intersects(_.getCurrentCascadeFrustum());return r.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=E===2),E===0}function An(l,t){const r=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],p=l.uniformValues.u_cutoff_params[2],_=l.uniformValues.u_cutoff_params[3];return c===r||_===p?1:s.aA(((t-r)/(c-r)-p)/(_-p),0,1)}function Ai(l,t,r,c){if(t.pitch<20)return 1;const p=t.getWorldToCameraMatrix();s.aB(p,p,l);const _=s.bU(r.min[0],r.min[1],r.min[2],1);let g=s.aC(s.eG(),_,p),v=g,b=g;_[1]=r.max[1],g=s.aC(s.eG(),_,p),v=g[1]<v[1]?g:v,b=g[1]>b[1]?g:b,_[0]=r.max[0],g=s.aC(s.eG(),_,p),v=g[1]<v[1]?g:v,b=g[1]>b[1]?g:b,_[1]=r.min[1],g=s.aC(s.eG(),_,p),v=g[1]<v[1]?g:v,b=g[1]>b[1]?g:b;const E=s.aA(c[0],0,1),C=100*t.pixelsPerMeter*s.aA(c[1],0,1),z=s.aA(c[2],0,1),R=s.eH(s.eG(),v,b,E),D=Math.tan(.5*t.fovX),B=-R[2]*D;if(C===0)return R[1]<-Math.abs(B)?z:1;const O=(-Math.abs(B)-R[1])/C,G=(Z,K,W)=>(1-W)*Z+W*K,U=s.aA(G(1,z,O),z,1);return G(1,U,s.aA((t.pitch-20)/20,0,1))}class Ry{}class fl{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,r,c){{const z=this._storage.get(r.id);if(z)return z.lastUsedFrameIdx=t,z.buf}const p=c.gl,_=p.getBufferParameter(p.ELEMENT_ARRAY_BUFFER,p.BUFFER_SIZE),g=new ArrayBuffer(_),v=new Int16Array(g);p.getBufferSubData(p.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const b=new s.eJ;for(let z=0;z<_/2;z+=3){const R=v[z],D=v[z+1],B=v[z+2];b.emplaceBack(R,D),b.emplaceBack(D,B),b.emplaceBack(B,R)}const E=c.bindVertexArrayOES.current,C=new Ry;return C.buf=new Ls(c,b),C.lastUsedFrameIdx=t,this._storage.set(r.id,C),c.bindVertexArrayOES.set(E),C.buf}update(t){for(const[r,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(r))}destroy(){for(const[t,r]of this._storage)r.buf.destroy(),this._storage.delete(t)}}class Hc{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const qc=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class za{constructor(t){this.revealStart=11,this.revealRange=2}}const hm=s.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class dm{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,r){const c=t.getOrCreateProgram("vignette");
3018if(!this.vignetteVx||!this.vignetteIdx){const g=new s.eK,v=new s.b0;g.emplaceBack(-1,-1),g.emplaceBack(1,-1),g.emplaceBack(1,1),g.emplaceBack(-1,1),v.emplaceBack(0,1,2),v.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(g,hm.members),this.vignetteIdx=t.context.createIndexBuffer(v)}const p=s.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const g={u_vignetteShape:(_={vignetteShape:[r.start,r.range,Math.pow(10,r.fadePower)],vignetteColor:[r.color.r,r.color.g,r.color.b,r.color.a*r.strength]}).vignetteShape,u_vignetteColor:_.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,kt.disabled,ii.disabled,fi.alphaBlended,ei.disabled,g,"vignette",this.vignetteVx,this.vignetteIdx,p)}var _}}class pm{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,r){const c=t.getFreeCameraOptions().position,p=c.toAltitude(),_=c.toLngLat(),g=s.an(_.lng),v=s.an(_.lat),b=t.pixelsPerMeter/r,E=g*s.eM,C=s.eM*Math.log(Math.tan(Math.PI/4+v/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const z=-this._offsetYPrev+C,R=-this._elevationPrev+p;this._accumulatedOffsetX+=(-this._offsetXPrev+E)*b,this._accumulatedOffsetY+=z*b,this._accumulatedElevation+=R*b,this._offsetXPrev=E,this._offsetYPrev=C,this._elevationPrev=p}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Hd(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function Xo(l){const t=s.eq(1323123451230),r=[];for(let c=0;c<l;++c){const p=2*t()-1,_=2*t()-1,g=2*t()-1;r.push(s.d5(p,_,g))}return r}function Io(l,t,r,c,p){const _=s.aA((p-r)/(c-r),0,1);return(1-_)*l+_*t}class Ql{constructor(t){this._movement=new pm,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new dm,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,r){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const p=c.starsProjMatrix,_=s.c7([]);s.c9(_,_,s.an(90)-c._pitch),s.c8(_,_,-c.angle);const g=s.cc(new Float32Array(16),_),v=s.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),b=s.eg([],v),E=s.aB([],b,g),C=Date.now()/1e3;return this._accumulatedTimeFromStart+=(C-this._prevTime)*r,this._prevTime=C,{projectionMatrix:p,modelviewMatrix:E}}}class qd extends Ql{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new za("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const r=t.context;if(!this.particlesVx){const c=Xo(this.particlesCount),p=new s.eN,_=new s.b0;let g=0;const v=s.eq(1323123451230);for(let b=0;b<c.length;++b){const E=c[b],C=[2*v()-1,v(),v(),v()];p.emplaceBack(E[0],E[1],E[2],-1,-1,...C),p.emplaceBack(E[0],E[1],E[2],1,-1,...C),p.emplaceBack(E[0],E[1],E[2],1,1,...C),p.emplaceBack(E[0],E[1],E[2],-1,1,...C),_.emplaceBack(g+0,g+1,g+2),_.emplaceBack(g+0,g+2,g+3),g+=4}this.particlesVx=r.createVertexBuffer(p,qc.members),this.particlesIdx=r.createIndexBuffer(_)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const r=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(r.revealStart>c)return;const p=Io(0,1,r.revealStart,r.revealStart+r.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const _=structuredClone(this._params);let g=[-_.direction.x,_.direction.y,-100];s.aw(g,g);
3018const v=structuredClone(this._vignetteParams);v.strength*=p,_.overrideStyleParameters||(_.intensity=t.style.rain.state.density,_.timeFactor=t.style.rain.state.intensity,_.color=structuredClone(t.style.rain.state.color),g=structuredClone(t.style.rain.state.direction),_.screenThinning.intensity=t.style.rain.state.centerThinning,_.dropletSizeX=t.style.rain.state.dropletSize[0],_.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],_.distortionStrength=100*t.style.rain.state.distortionStrength,v.strength=1,v.color=structuredClone(t.style.rain.state.vignetteColor));const b=this.updateOnRender(t,_.timeFactor),E=t.context,C=E.gl,z=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(E,{width:t.width,height:t.height,data:null},C.RGBA8)),_.distortionStrength>0&&(E.activeTexture.set(C.TEXTURE0),this.screenTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),C.copyTexSubImage2D(C.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const R=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(E,R),E.activeTexture.set(C.TEXTURE0),this.screenTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE);const D=[_.color.r,_.color.g,_.color.b,_.color.a],B=(O,G)=>{const U=Hd(this._movement.getPosition(),O),Z=_.dropletSizeX,K=_.dropletSizeX*_.dropletSizeYScale,W=t.width/2,le=t.height/2,ne=Io(0,_.screenThinning.start,0,1,_.screenThinning.intensity),se=Io(.001,_.screenThinning.range,0,1,_.screenThinning.intensity),ie=Io(0,_.screenThinning.particleOffset,0,1,_.screenThinning.intensity),Q=(ce={modelview:b.modelviewMatrix,projection:b.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:U,velocityConeAperture:_.velocityConeAperture,velocity:_.velocity,boxSize:O,rainDropletSize:[Z,K],distortionStrength:_.distortionStrength,rainDirection:g,color:D,screenSize:[z.width,z.height],thinningCenterPos:[W,le],thinningShape:[ne,se,Math.pow(10,_.screenThinning.fadePower)],thinningAffectedRatio:_.screenThinning.affectedRatio,thinningParticleOffset:ie,shapeDirectionalPower:_.shapeDirPower,shapeNormalPower:_.shapeNormalPower,mode:G?0:1},{u_modelview:Float32Array.from(ce.modelview),u_projection:Float32Array.from(ce.projection),u_time:ce.time,u_cam_pos:ce.camPos,u_texScreen:0,u_velocityConeAperture:ce.velocityConeAperture,u_velocity:ce.velocity,u_boxSize:ce.boxSize,u_rainDropletSize:ce.rainDropletSize,u_distortionStrength:ce.distortionStrength,u_rainDirection:ce.rainDirection,u_color:ce.color,u_screenSize:ce.screenSize,u_thinningCenterPos:ce.thinningCenterPos,u_thinningShape:ce.thinningShape,u_thinningAffectedRatio:ce.thinningAffectedRatio,u_thinningParticleOffset:ce.thinningParticleOffset,u_shapeDirectionalPower:ce.shapeDirectionalPower,u_shapeNormalPower:ce.shapeNormalPower,u_mode:ce.mode});var ce;const ve=Math.round(_.intensity*this.particlesCount),ge=s.bg.simpleSegment(0,0,4*ve,2*ve);R.draw(t,C.TRIANGLES,kt.disabled,ii.disabled,fi.alphaBlended,ei.disabled,Q,"rain_particles",this.particlesVx,this.particlesIdx,ge)};_.distortionStrength>0&&B(_.boxSize,!0),B(_.boxSize,!1),this._vignette.draw(t,v)}}const fm=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class mm extends Ql{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new za("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const r=t.context;if(!this.particlesVx){const c=Xo(this.particlesCount),p=new s.eO,_=new s.b0;let g=0;const v=s.eq(1323123451230);for(let b=0;b<c.length;++b){const E=c[b],C=v(),z=v(),R=v(),D=[b/c.length,C,z,R],B=[v(),v()];p.emplaceBack(E[0],E[1],E[2],-1,-1,...D,...B),p.emplaceBack(E[0],E[1],E[2],1,-1,...D,...B),p.emplaceBack(E[0],E[1],E[2],1,1,...D,...B),p.emplaceBack(E[0],E[1],E[2],-1,1,...D,...B),_.emplaceBack(g+0,g+1,g+2),_.emplaceBack(g+0,g+2,g+3),g+=4}this.particlesVx=r.createVertexBuffer(p,fm.members),this.particlesIdx=r.createIndexBuffer(_)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const r=structuredClone(this._params);let c=[-r.direction.x,r.direction.y,-100];s.aw(c,c);
3018const p=structuredClone(this._vignetteParams),_=r.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},g=t.transform.zoom;if(_.revealStart>g)return;const v=Io(0,1,_.revealStart,_.revealStart+_.revealRange,g);p.strength*=v,r.overrideStyleParameters||(r.intensity=t.style.snow.state.density,r.timeFactor=t.style.snow.state.intensity,r.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),r.screenThinning.intensity=t.style.snow.state.centerThinning,r.billboardSize=2.79*t.style.snow.state.flakeSize,p.strength=1,p.color=structuredClone(t.style.snow.state.vignetteColor));const b=this.updateOnRender(t,r.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const E=t.context,C=E.gl,z=t.transform,R=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(E,R),((D,B,O)=>{const G=Hd(this._movement.getPosition(),D),U=z.width/2,Z=z.height/2,K=Io(0,O.screenThinning.start,0,1,O.screenThinning.intensity),W=Io(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),le=Io(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),ne=(se={modelview:b.modelviewMatrix,projection:b.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:G,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,horizontalOscillationRadius:O.horizontalOscillationRadius,horizontalOscillationRate:O.horizontalOscillationRate,boxSize:D,billboardSize:1*O.billboardSize,simpleShapeParameters:[O.shapeFadeStart,O.shapeFadePower],screenSize:[z.width,z.height],thinningCenterPos:[U,Z],thinningShape:[K,W,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:le,color:[O.color.r,O.color.g,O.color.b,O.color.a],direction:c},{u_modelview:Float32Array.from(se.modelview),u_projection:Float32Array.from(se.projection),u_time:se.time,u_cam_pos:se.camPos,u_velocityConeAperture:se.velocityConeAperture,u_velocity:se.velocity,u_horizontalOscillationRadius:se.horizontalOscillationRadius,u_horizontalOscillationRate:se.horizontalOscillationRate,u_boxSize:se.boxSize,u_billboardSize:se.billboardSize,u_simpleShapeParameters:se.simpleShapeParameters,u_screenSize:se.screenSize,u_thinningCenterPos:se.thinningCenterPos,u_thinningShape:se.thinningShape,u_thinningAffectedRatio:se.thinningAffectedRatio,u_thinningParticleOffset:se.thinningParticleOffset,u_particleColor:se.color,u_direction:se.direction});var se;const ie=Math.round(O.intensity*this.particlesCount),Q=s.bg.simpleSegment(0,0,4*ie,2*ie);this.particlesVx&&this.particlesIdx&&R.draw(t,C.TRIANGLES,kt.disabled,ii.disabled,fi.alphaBlended,ei.disabled,ne,"snow_particles",this.particlesVx,this.particlesIdx,Q)})(r.boxSize,0,r),this._vignette.draw(t,p)}}const ml={symbol:function(l,t,r,c,p){if(l.renderPass!=="translucent")return;const _=ii.disabled,g=l.colorModeForRenderPass(),v=r.layout.get("text-variable-anchor"),b=r.layout.get("text-size-scale-range"),E=s.aA(l.scaleFactor,b[0],b[1]);v&&function(R,D,B,O,G,U,Z,K){const W=D.transform,le=G==="map",ne=U==="map";for(const se of R){const ie=O.getTile(se),Q=ie.getBucket(B);if(!Q||!Q.text||!Q.text.segments.get().length)continue;const ce=s.bK(Q.textSizeData,W.zoom,K),ve=Qs(se,Q.getProjection(),W),ge=W.calculatePixelsToTileUnitsMatrix(ie),Le=co(ve,ie.tileID.canonical,ne,le,W,Q.getProjection(),ge),ze=Q.hasIconTextFit()&&Q.hasIconData();ce&&Xt(Q,le,ne,Z,W,Le,se,Math.pow(2,W.zoom-ie.tileID.overscaledZ),ce,ze)}}(c,l,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),p,E);const C=r.paint.get("icon-opacity").constantOr(1)!==0,z=r.paint.get("text-opacity").constantOr(1)!==0;r.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(C||z)?Wu(l,t,r,c,_,g):(C&&Wu(l,t,r,c,_,g,{onlyIcons:!0}),z&&Wu(l,t,r,c,_,g,{onlyText:!0})),t.map.showCollisionBoxes&&(At(l,t,r,c,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),At(l,t,r,c,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,r,c){if(l.renderPass!=="translucent")return;const p=r.paint.get("circle-opacity"),_=r.paint.get("circle-stroke-width"),g=r.paint.get("circle-stroke-opacity"),v=r.layout.get("
3018circle-sort-key").constantOr(1)!==void 0,b=r.paint.get("circle-emissive-strength");if(p.constantOr(1)===0&&(_.constantOr(1)===0||g.constantOr(1)===0))return;const E=l.context,C=E.gl,z=l.transform,R=!(!l.terrain||!l.terrain.enabled),D=r.layout.get("circle-elevation-reference"),B=l.depthModeForSublayer(0,kt.ReadOnly),O=new kt(l.context.gl.LEQUAL,kt.ReadOnly,l.depthRangeFor3D),G=D==="none"||R?B:O,U=ii.disabled,Z=l.colorModeForDrapableLayerRenderPass(b),K=z.projection.name==="globe",W=[s.aF(z.center.lng),s.aJ(z.center.lat)],le=[];for(let se=0;se<c.length;se++){const ie=c[se],Q=t.getTile(ie),ce=Q.getBucket(r);if(!ce||ce.projection.name!==z.projection.name)continue;const ve=ce.programConfigurations.get(r.id),ge=ce.layoutVertexBuffer,Le=ce.globeExtVertexBuffer,ze=ce.indexBuffer,je=s.e0(r),nt=[Le],Ae=l.isTileAffectedByFog(ie);K&&je.push("PROJECTION_GLOBE_VIEW"),je.push("DEPTH_D24"),l.terrain&&z.depthOcclusionForSymbolsAndCircles&&je.push("DEPTH_OCCLUSION"),ce.hasElevation&&!l.terrain&&(je.push("ELEVATED_ROADS"),nt.push(ce.elevatedLayoutVertexBuffer));const fe=l.getOrCreateProgram("circle",{config:ve,defines:je,overrideFog:Ae}),Oe=z.projection.createInversionMatrix(z,ie.canonical),Me={programConfiguration:ve,program:fe,layoutVertexBuffer:ge,dynamicBuffers:nt,indexBuffer:ze,uniformValues:s.e1(l,ie,Q,Oe,W,r),tile:Q};if(v){const Ze=ce.segments.get();for(const ft of Ze)le.push({segments:new s.bg([ft]),sortKey:ft.sortKey,state:Me})}else le.push({segments:ce.segments,sortKey:0,state:Me})}v&&le.sort((se,ie)=>se.sortKey-ie.sortKey);const ne={useDepthForOcclusion:z.depthOcclusionForSymbolsAndCircles};for(const se of le){const{programConfiguration:ie,program:Q,layoutVertexBuffer:ce,dynamicBuffers:ve,indexBuffer:ge,uniformValues:Le,tile:ze}=se.state,je=se.segments;l.terrain&&l.terrain.setupElevationDraw(ze,Q,ne),l.uploadCommonUniforms(E,Q,ze.tileID.toUnwrapped()),Q.draw(l,C.TRIANGLES,G,U,Z,ei.disabled,Le,r.id,ce,ge,je,r.paint,z.zoom,ie,ve)}},heatmap:function(l,t,r,c){if(r.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const p=l.context,_=p.gl,g=ii.disabled,v=new fi([_.ONE,_.ONE,_.ONE,_.ONE],s.ao.transparent,[!0,!0,!0,!0]);(function(D,B,O,G){const U=D.gl,Z=B.width*G,K=B.height*G;D.activeTexture.set(U.TEXTURE1),D.viewport.set([0,0,Z,K]);let W=O.heatmapFbo;if(!W||W&&(W.width!==Z||W.height!==K)){W&&W.destroy();const le=U.createTexture();U.bindTexture(U.TEXTURE_2D,le),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_S,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_T,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.LINEAR),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.LINEAR),W=O.heatmapFbo=D.createFramebuffer(Z,K,1,null),function(ne,se,ie,Q,ce,ve){const ge=ne.gl;ge.texImage2D(ge.TEXTURE_2D,0,ne.extRenderToTextureHalfFloat?ge.RGBA16F:ge.RGBA,ce,ve,0,ge.RGBA,ne.extRenderToTextureHalfFloat?ge.HALF_FLOAT:ge.UNSIGNED_BYTE,null),Q.colorAttachment0.set(ie)}(D,0,le,W,Z,K)}else U.bindTexture(U.TEXTURE_2D,W.colorAttachment0.get()),D.bindFramebuffer.set(W.framebuffer)})(p,l,r,l.transform.projection.name==="globe"?.5:.25),p.clear({color:s.ao.transparent});const b=l.transform,E=b.projection.name==="globe",C=E?["PROJECTION_GLOBE_VIEW"]:[],z=E?ei.frontCCW:ei.disabled,R=[s.aF(b.center.lng),s.aJ(b.center.lat)];for(let D=0;D<c.length;D++){const B=c[D];if(t.hasRenderableParent(B))continue;const O=t.getTile(B),G=O.getBucket(r);if(!G||G.projection.name!==b.projection.name)continue;const U=l.isTileAffectedByFog(B),Z=G.programConfigurations.get(r.id),K=l.getOrCreateProgram("heatmap",{config:Z,defines:C,overrideFog:U}),{zoom:W}=l.transform;l.terrain&&l.terrain.setupElevationDraw(O,K),l.uploadCommonUniforms(p,K,B.toUnwrapped());const le=b.projection.createInversionMatrix(b,B.canonical);K.draw(l,_.TRIANGLES,kt.disabled,g,v,z,uy(l,B,O,le,R,W,r.paint.get("heatmap-intensity")),r.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,r.paint,l.transform.zoom,Z,E?[G.globeExtVertexBuffer]:null)}p.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(p,_){const g=p.context,v=g.gl,b=_.heatmapFbo;if(!b)return;g.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment0.get()),g.activeTexture.set(v.TEXTURE1);let E=_.colorRampTexture;E||(E=_.colorRampTexture=new s.T(g,_.colorRamp,v.RGBA8)),E.bind(v.LINEAR,v.CLAMP_TO_EDGE),p.getOrCreateProgram("heatmapTexture").draw(p,v.TRIANGLES,kt.disabled,ii.disabled,p.colorModeForRenderPass(),ei.disabled,((C,z,R,D)=>({u_image:0,u_color_ramp:1,u_opacity:z.paint.get("heatmap-opacity")}))(0,_),_.id,p.viewportBuffer,p.quadTriangleIndexBuffer,p.viewportSegments,_.paint,p.transform.zoom)}(l,r))},line:function(l,t,r,c){if(l.renderPass!=="translucent")return;const p=r.paint.get("line-opacity"),_=r.paint.get("line-width");if(p.constantOr(1)===0||_.constantOr(1)===0)return;const g=r.paint.get("line-emissive-strength").isConstant(),v=r.paint.get("line-emissive-strength").constantOr(0),b=r.paint.get("line-occlusion-opacity"),E=r.layout.get("line-elevation-reference"),C=r.layout.get("line-width-unit")==="meters",z=E==="sea",R=!(!l.terrain||!l.terrain.enabled),D=l.context,B=D.gl;if(r.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const O=r.layout.get("line-cross-slope"),G=O!==void 0,U=O<1,Z=l.colorModeForDrapableLayerRenderPass(g?v:null),K=l.terrain&&l.terrain.renderingToTexture,W=K?1:s.o.devicePixelRatio,le=r.paint.get("line-dasharray"),ne=le.constantOr(1),se=r.layout.get("line-cap"),ie=le.constantOr(null),Q=se.constantOr(null),ce=r.paint.get("line-pattern"),ve=ce.constantOr(1),ge=r.paint.get("line-pattern-cross-fade"),Le=ce.constantOr(null),ze=r.paint.get("line-opacity").constantOr(1);let je=!ve&&ze!==1||l.depthOcclusion&&b>0&&b<1;const nt=r.paint.get("line-gradient"),Ae=ve?"linePattern":"line",fe=s.e2(r);let Oe;if(K&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(je=!1),b!==0&&l.depthOcclusion){const bt=r.paint._values["line-opacity"];bt&&bt.value&&bt.value.kind==="constant"?Oe=bt.value:s.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}_.value.kind!=="constant"&&_.value.isLineProgressConstant===!1&&fe.push("VARIABLE_LINE_WIDTH"),K&&(l.emissiveMode!=="dual-source-blending"||g?l.emissiveMode==="mrt-fallback"&&fe.push("USE_MRT1"):fe.push("DUAL_SOURCE_BLENDING"));const Me=(bt,ut,rt,Lt,Mt,xt)=>{for(const St of bt){const Ht=t.getTile(St);if(ve&&!Ht.patternsLoaded())continue;const ci=Ht.getBucket(r);
3018if(!ci||ci.elevationType!=="none"&&!Mt||ci.elevationType==="none"&&Mt)continue;l.prepareDrawTile();const Li=[...ut],Yi=l.shadowRenderer,zt=ci.elevationType==="road"&&!!Yi&&Yi.enabled;let Zi=[0,0,0];if(zt){const gi=l.style.directionalLight,En=l.style.ambientLight;gi&&En&&(Zi=Aa(l.style,gi,En)),Li.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const li=ci.programConfigurations.get(r.id);let Qi=!1;if(Le&&Ht.imageAtlas){const gi=s.e3.from(Le),En=gi.getPrimary().scaleSelf(W).toString(),Xn=Ht.imageAtlas.patternPositions.get(En),Dn=gi.getSecondary(),fn=Dn?Ht.imageAtlas.patternPositions.get(Dn.scaleSelf(W).toString()):null;Qi=!!Xn&&!!fn,Xn&&li.setConstantPatternPositions(Xn,fn)}ge>0&&(Qi||li.getPatternTransitionVertexBuffer("line-pattern"))&&Li.push("LINE_PATTERN_TRANSITION");const cn=l.isTileAffectedByFog(St),on=l.getOrCreateProgram(Ae,{config:li,defines:Li,overrideFog:cn});if(!ve&&ie&&Q&&Ht.lineAtlas){const gi=Ht.lineAtlas.getDash(ie,Q);gi&&li.setConstantPatternPositions(gi)}zt&&Yi.setupShadows(Ht.tileID.toUnwrapped(),on,"vector-tile");let[Hi,_i]=r.paint.get("line-trim-offset");(Q==="round"||Q==="square")&&Hi!==_i&&(Hi===0&&(Hi-=1),_i===1&&(_i+=1));const Ji=K?St.projMatrix:null,Nn=C?1/ci.tileToMeter/s.ay(Ht,1,l.transform.zoom):1,Cn=C?1/ci.tileToMeter/s.ay(Ht,1,Math.floor(l.transform.zoom)):1,en=ve?s.e4(l,Ht,r,Ji,W,Nn,Cn,[Hi,_i],Zi,ge):s.e5(l,Ht,r,Ji,ci.lineClipsArray.length,W,Nn,Cn,[Hi,_i],Zi);if(nt){const gi=ci.gradients[r.id];let En=gi.texture;if(r.gradientVersion!==gi.version){let Xn=256;if(r.stepInterpolant){const Dn=t.getSource().maxzoom,fn=St.canonical.z===Dn?Math.ceil(1<<l.transform.maxZoom-St.canonical.z):1;Xn=s.aA(s.e6(ci.maxLineLength/s.al*1024*fn),256,D.maxTextureSize)}gi.gradient=s.e7({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:Xn,image:gi.gradient||void 0,clips:ci.lineClipsArray}),gi.texture?gi.texture.update(gi.gradient):gi.texture=new s.T(D,gi.gradient,B.RGBA8),gi.version=r.gradientVersion,En=gi.texture}D.activeTexture.set(B.TEXTURE1),En.bind(r.stepInterpolant?B.NEAREST:B.LINEAR,B.CLAMP_TO_EDGE)}ne&&(D.activeTexture.set(B.TEXTURE0),Ht.lineAtlasTexture&&Ht.lineAtlasTexture.bind(B.LINEAR,B.REPEAT),li.updatePaintBuffers()),ve&&(D.activeTexture.set(B.TEXTURE0),Ht.imageAtlasTexture&&Ht.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),li.updatePaintBuffers()),Mt&&!z&&l.terrain.setupElevationDraw(Ht,on),l.uploadCommonUniforms(D,on,St.toUnwrapped());const Ni=gi=>{Oe!=null&&(Oe.value=ze*b),on.draw(l,B.TRIANGLES,rt,gi,Z,ei.disabled,en,r.id,ci.layoutVertexBuffer,ci.indexBuffer,ci.segments,r.paint,l.transform.zoom,li,[ci.layoutVertexBuffer2,ci.patternVertexBuffer,ci.zOffsetVertexBuffer]),Oe!=null&&(Oe.value=ze)};if(je&&!Mt){const gi=l.stencilModeForClipping(St).ref;gi===0&&K&&D.clear({stencil:0});const En={func:B.EQUAL,mask:255};en.u_alpha_discard_threshold=.8,Ni(new ii(En,gi,255,B.KEEP,B.KEEP,B.INVERT)),en.u_alpha_discard_threshold=0,Ni(new ii(En,gi,255,B.KEEP,B.KEEP,B.KEEP))}else en.u_alpha_discard_threshold=je&&Mt&&xt?.8:0,Ni(Mt?Lt:l.stencilModeForClipping(St))}};let Ze=l.depthModeForSublayer(0,kt.ReadOnly);const ft=new kt(l.depthOcclusion?B.GREATER:B.LEQUAL,kt.ReadOnly,l.depthRangeFor3D);if(r.hasNonElevatedBuckets){const bt=!K&&l.terrain;b!==0&&bt?s.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has line-z-offset enabled.`):bt?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${r.id}.`):Me(c,fe,Ze,ii.disabled,!1,!0)}if(r.hasElevatedBuckets){E==="hd-road-markup"?R||(Ze=ft,fe.push("ELEVATED_ROADS")):(fe.push("ELEVATED"),Ze=ft,G&&fe.push(U?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),z&&fe.push("ELEVATION_REFERENCE_SEA"));const bt=je?l.stencilModeFor3D():ii.disabled;l.forceTerrainMode=!0,Me(c,fe,Ze,bt,!0,!0),je&&Me(c,fe,Ze,bt,!0,!1),l.forceTerrainMode=!1}je&&(l.resetStencilClippingMasks(),K&&D.clear({stencil:0})),b===0||l.depthOcclusion||K||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,r,c){const p=r.paint.get("fill-color"),_=r.paint.get("fill-opacity");if(_.constantOr(1)===0)return;const g=r.paint.get("fill-emissive-strength"),v=l.colorModeForDrapableLayerRenderPass(g),b=r.paint.get("fill-pattern"),E=l.opaquePassEnabledForLayer()&&!b.constantOr(1)&&p.constantOr(s.ao.transparent).a===1&&_.constantOr(0)===1?"opaque":"translucent";let C="none";r.layout.get("fill-elevation-reference")!=="none"?C="road":r.paint.get("fill-z-offset").constantOr(1)!==0&&(C="offset");const z=!(!l.terrain||!l.terrain.enabled),R={painter:l,sourceCache:t,layer:r,coords:c,colorMode:v,elevationType:C,terrainEnabled:z,pass:E};if(l.renderPass==="shadow")return void(l.shadowRenderer&&C==="road"&&!z&&function(B){const{painter:O,sourceCache:G,layer:U,coords:Z}=B,K=O.context.gl,W=B.painter.shadowRenderer;for(const le of Z){const ne=G.getTile(le),se=ne.getBucket(U);if(!se)continue;const ie=se.elevatedStructures;if(!ie||!ie.shadowCasterSegments||ie.shadowCasterSegments.segments[0].primitiveLength===0)continue;O.prepareDrawTile();const Q=se.bufferData.programConfigurations.get(U.id),ce=O.isTileAffectedByFog(le),ve=O.getOrCreateProgram("elevatedStructuresDepth",{config:Q,overrideFog:ce}),ge=W.calculateShadowPassMatrixFromTile(ne.tileID.toUnwrapped());O.uploadCommonUniforms(O.context,ve,le.toUnwrapped());const Le={u_matrix:ge,u_depth_bias:0};ve.draw(O,K.TRIANGLES,W.getShadowPassDepthMode(),ii.disabled,W.getShadowPassColorMode(),ei.disabled,Le,U.id,ie.vertexBuffer,ie.indexBuffer,ie.shadowCasterSegments,U.paint,O.transform.zoom,Q)}}(R));const D=l.emissiveMode==="mrt-fallback";if(C!=="offset"){if(Dd(R,!1,D),C==="road"){const B=!z&&l.renderPass==="translucent";B&&zd(l,t,r,c,"geometry"),Dd(R,!0,D,ii.disabled),B&&function(O){const{painter:G,sourceCache:U,layer:Z,coords:K,colorMode:W}=O,le=G.context.gl,ne=O.painter.shadowRenderer,se=!!ne&&ne.enabled,ie=new kt(G.context.gl.LEQUAL,kt.ReadOnly,G.depthRangeFor3D);let Q=[0,0,0];if(se){const ve=G.style.directionalLight,ge=G.style.ambientLight;ve&&ge&&(Q=Aa(G.style,ve,ge))}const ce=ve=>{for(const ge of K){const Le=U.getTile(ge),ze=Le.getBucket(Z);if(!ze)continue;const je=ze.elevatedStructures;if(!je)continue;let nt,Ae;if(ve?(nt=je.renderableBridgeSegments,Ae=je.bridgeProgramConfigurations.get(Z.id)):(nt=je.renderableTunnelSegments,Ae=je.tunnelProgramConfigurations.get(Z.id)),!nt||nt.segments[0].primitiveLength===0)continue;Ae.updatePaintBuffers(),G.prepareDrawTile();const fe=G.isTileAffectedByFog(ge),Oe=[];se&&Oe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Me=G.getOrCreateProgram("elevatedStructures",{config:Ae,overrideFog:fe,defines:Oe}),Ze=G.translatePosMatrix(ge.projMatrix,Le,Z.paint.get("fill-translate"),Z.paint.get("fill-translate-anchor"));se&&ne.setupShadows(Le.tileID.toUnwrapped(),Me,"vector-tile");
3018const ft=ul(Ze,Q);G.uploadCommonUniforms(G.context,Me,ge.toUnwrapped()),Me.draw(G,le.TRIANGLES,ie,ii.disabled,W,ei.backCCW,ft,Z.id,je.vertexBuffer,je.indexBuffer,nt,Z.paint,G.transform.zoom,Ae,[je.vertexBufferNormal])}};ce(!0),ce(!1)}(R)}}else Dd(R,!1,D,l.stencilModeFor3D())},"fill-extrusion":function(l,t,r,c){const p=r.paint.get("fill-extrusion-opacity"),_=l.context,g=_.gl,v=l.terrain,b=v&&v.renderingToTexture;if(p===0)return;const E=l.emissiveMode==="mrt-fallback",C=l.conflationActive&&l.style.isLayerClipped(r,t.getSource()),z=l.style.order.indexOf(r.fqid);if(C&&function(R,D,B,O,G){for(const U of O){const Z=D.getTile(U).getBucket(B);Z&&(Z.updateReplacement(U,R.replacementSource,G),Z.uploadCentroid(R.context))}}(l,t,r,c,z),v||C)for(const R of c){const D=t.getTile(R).getBucket(r);D&&u1(l.context,t,R,D,r,v,C)}if(l.renderPass==="shadow"&&l.shadowRenderer){const R=l.shadowRenderer;if(v&&p<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ad)return;const D=R.getShadowPassDepthMode(),B=R.getShadowPassColorMode();kd(l,t,r,c,D,ii.disabled,B,C)}else if(l.renderPass==="translucent"){const R=!r.paint.get("fill-extrusion-pattern").constantOr(1),D=r.paint.get("fill-extrusion-color").constantOr(s.ao.white);if(!b&&D.a!==0){const B=new kt(l.context.gl.LEQUAL,kt.ReadWrite,l.depthRangeFor3D);p===1&&R?kd(l,t,r,c,B,ii.disabled,fi.unblended,C):(kd(l,t,r,c,B,ii.disabled,fi.disabled,C),kd(l,t,r,c,B,l.stencilModeFor3D(),l.colorModeForRenderPass(),C),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&R&&(!v&&l.transform.projection.name!=="globe"||b)){const B=r.paint.get("fill-extrusion-opacity"),O=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),G=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),U=r.paint.get("fill-extrusion-flood-light-intensity"),Z=r.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",K=r.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Z?null:r.lut).toArray01().slice(0,3),W=O>0&&G>0,le=U>0,ne=(Q,ce,ve)=>(1-ve)*Q+ve*ce,se=new lm;se.translate=r.paint.get("fill-extrusion-translate"),se.translateAnchor=r.paint.get("fill-extrusion-translate-anchor"),se.edgeRadius=r.layout.get("fill-extrusion-edge-radius"),se.cutoffFadeRange=r.paint.get("fill-extrusion-cutoff-fade-range");const ie=Q=>{const ce=l.depthModeForSublayer(1,kt.ReadOnly,g.LEQUAL,!0),ve=r.paint.get(Q?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ge=ne(.1,3,ve),Le=l._showOverdrawInspector;if(!Le){const ze=new ii({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),je=new fi([g.ONE,g.ONE,g.ONE,g.ONE],s.ao.transparent,[!1,!1,!1,!0],g.MIN);Pa(se,l,t,r,c,ce,ze,je,ei.disabled,Q,"sdf",B,O,G,U,K,ge,C,!1)}{const ze=Le?ii.disabled:new ii({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),je=Le?l.colorModeForRenderPass():new fi([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],s.ao.transparent,[!0,!0,!0,!0]);Pa(se,l,t,r,c,ce,ze,je,ei.disabled,Q,"color",B,O,G,U,K,ge,C,!1)}};if(b){const Q=()=>{const ve=v.drapeBufferSize[0],ge=v.drapeBufferSize[1];let Le=v.framebufferCopyTexture;return Le&&(!Le||Le.size[0]===ve&&Le.size[1]===ge)||(Le&&Le.destroy(),Le=v.framebufferCopyTexture=new s.T(_,new s.q({width:ve,height:ge}),g.RGBA8)),Le.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexSubImage2D(g.TEXTURE_2D,0,0,0,0,0,ve,ge),Le},ce=(ve,ge,Le)=>{const ze=l.depthModeForSublayer(1,kt.ReadOnly,g.LEQUAL,!1),je=r.paint.get(ve?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),nt=ne(.1,3,je);{const Ae=new fi([g.ONE,g.ONE,g.ONE,g.ONE],s.ao.transparent,[!1,!1,!1,!0]);Pa(se,l,t,r,c,ze,ii.disabled,Ae,ei.disabled,ve,"clear",B,O,G,U,K,nt,C,ge)}{const Ae=new ii({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),fe=new fi([g.ONE,g.ONE,g.ONE,g.ONE],s.ao.transparent,[!1,!1,!1,!0],g.MIN);Pa(se,l,t,r,c,ze,Ae,fe,ei.disabled,ve,"sdf",B,O,G,U,K,nt,C,ge)}E&&!ve&&(Le=Q());
3018{const Ae=ve?g.ZERO:g.ONE_MINUS_DST_ALPHA,fe=new ii({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),Oe=new fi([Ae,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],s.ao.transparent,[!0,!0,!0,!0]);Pa(se,l,t,r,c,ze,fe,Oe,ei.disabled,ve,"color",B,O,G,U,K,nt,C,ge)}if(!E||ve){const Ae=new fi([g.ONE,g.ONE,g.ONE,ve?g.ZERO:g.ONE],s.ao.transparent,[!1,!1,!1,!0],ve?g.FUNC_ADD:g.MAX);Pa(se,l,t,r,c,ze,ii.disabled,Ae,ei.disabled,ve,"clear",B,O,G,U,K,nt,C,ge,Le)}else{g.drawBuffers([g.NONE,g.COLOR_ATTACHMENT1]);const Ae=new ii({func:g.EQUAL,mask:255},254,255,g.KEEP,g.DECR,g.DECR),fe=new fi([g.ONE,g.ONE,g.ONE,g.ONE],s.ao.transparent,[!0,!1,!1,!1],g.MAX);Pa(se,l,t,r,c,ze,Ae,fe,ei.disabled,ve,"emissive",B,O,G,U,K,nt,C,ge,Le),g.drawBuffers([g.COLOR_ATTACHMENT0])}};if(W||le){let ve;l.prepareDrawTile(),E&&!W||(ve=Q()),W&&ce(!0,!1,ve),le&&ce(!1,!0,ve)}}else W&&ie(!0),le&&ie(!1),(W||le)&&l.resetStencilClippingMasks()}}},building:function(l,t,r,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const p=r.paint.get("building-ambient-occlusion-ground-intensity"),_=r.paint.get("building-ambient-occlusion-ground-radius"),g=r.paint.get("building-ambient-occlusion-ground-attenuation"),v=r.paint.get("building-opacity");if(v<=0)return;let b=p>0&&_>0,E=!0;const C=r.paint.get("building-vertical-scale");if(C<=0)return;l.shadowRenderer||(E=!1);const z=l.conflationActive&&l.style.isLayerClipped(r,t.getSource()),R=l.style.order.indexOf(r.fqid);if(function(D,B,O,G,U,Z){for(const K of Z){const W=B.getTile(K).getBucket(O);W&&(U&&W.updateReplacement(K,D.replacementSource,G),W.uploadUpdatedIndexBuffer(D.context))}}(l,t,r,R,z,c),function(D,B,O,G){for(const U of G){const Z=B.getTile(U).getBucket(O);Z&&Z.needsEvaluation()&&Z.uploadUpdatedColorBuffer(D.context)}}(l,t,r,c),r.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const D=l.shadowRenderer,B=[],O=D.getShadowPassDepthMode();Xu({painter:l,source:t,layer:r,coords:c,defines:B,blendMode:D.getShadowPassColorMode(),depthMode:O,opacity:v,verticalScale:C,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(l.renderPass==="translucent"){let D=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];E&&(D=D.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer&&l.shadowRenderer.useNormalOffset&&(D=D.concat("NORMAL_OFFSET"));const B=r.paint.get("building-facade-emissive-chance"),O=r.paint.get("building-ambient-occlusion-intensity"),G=r.paint.get("building-flood-light-intensity"),U=r.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",Z=r.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(U?null:r.lut).toArray01().slice(0,3),K=r.paint.get("building-flood-light-ground-attenuation"),W=G>0,le=new kt(l.context.gl.LEQUAL,kt.ReadWrite,l.depthRangeFor3D);v<1&&Xu({painter:l,source:t,layer:r,coords:c,defines:D,blendMode:fi.disabled,depthMode:le,opacity:v,verticalScale:C,facadeEmissiveChance:B,facadeAOIntensity:O,floodLightIntensity:G,floodLightColor:Z,depthOnly:!0});const ne=l.colorModeForRenderPass();Xu({painter:l,source:t,layer:r,coords:c,defines:D,blendMode:ne,depthMode:le,opacity:v,verticalScale:C,facadeEmissiveChance:B,facadeAOIntensity:O,floodLightIntensity:G,floodLightColor:Z}),b&&Od(l,t,r,c,!0,v,p,_,G,Z,g,z),W&&Od(l,t,r,c,!1,v,p,_,G,Z,K,z)}else if(l.renderPass==="light-beam"){const D=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],B=new kt(l.context.gl.LEQUAL,kt.ReadOnly,l.depthRangeFor3D);Xu({painter:l,source:t,layer:r,coords:c,defines:D,blendMode:fi.alphaBlended,depthMode:B,opacity:v,verticalScale:C,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,r,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const p=l.context,_=l.terrain&&l.terrain.renderingToTexture,[g,v]=l.renderPass!=="translucent"||_?[{},c]:l.stencilConfigForOverlap(c);for(const b of v){const E=t.getTile(b);if(E.needsHillshadePrepare&&l.renderPass==="offscreen")e1(l,E,r);else if(l.renderPass==="translucent"){const C=l.depthModeForSublayer(0,kt.ReadOnly),z=r.paint.get("hillshade-emissive-strength"),R=l.colorModeForDrapableLayerRenderPass(z),D=_&&l.terrain?l.terrain.stencilModeForRTTOverlap(b):g[b.overscaledZ];Qx(l,b,E,r,C,D,R)}}p.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,r,c,p,_){if(l.renderPass!=="translucent"||r.paint.get("raster-opacity")===0)return;const g=l.transform.projection.name==="globe",v=r.paint.get("raster-elevation")!==0,b=v&&g;if(l.renderElevatedRasterBackface&&!b)return;const E=l.context,C=E.gl,z=t.getSource(),R=function(ne,se,ie,Q,ce){const ve=se.paint.get("raster-color"),ge=ne.type==="raster-array",Le=[],ze=se.paint.get("raster-resampling"),je=se.paint.get("raster-color-mix");let nt=se.paint.get("raster-color-range");const Ae=[je[0],je[1],je[2],0],fe=je[3];let Oe=ze==="nearest"?Q.NEAREST:Q.LINEAR;if(ge&&(Le.push("RASTER_ARRAY"),ve||Le.push("RASTER_COLOR"),ze==="linear"&&Le.push("RASTER_ARRAY_LINEAR"),Oe=Q.NEAREST,!nt&&ne.rasterLayers)){const Me=ne.rasterLayers.find(({id:Ze})=>Ze===se.sourceLayer);Me&&Me.fields&&Me.fields.range&&(nt=Me.fields.range)}if(nt=nt||[0,1],ve){Le.push("RASTER_COLOR"),ie.activeTexture.set(Q.TEXTURE2),se.updateColorRamp(nt);let Me=se.colorRampTexture;Me||(Me=se.colorRampTexture=new s.T(ie,se.colorRamp,Q.RGBA8)),Me.bind(Q.LINEAR,Q.CLAMP_TO_EDGE)}return ce&&Le.push("USE_MRT1"),{mix:Ae,range:nt,offset:fe,defines:Le,resampling:Oe}}(z,r,E,C,l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback");if(z instanceof s.aU&&!c.length&&!g)return;const D=r.paint.get("raster-emissive-strength"),B=l.colorModeForDrapableLayerRenderPass(D),O=l.terrain&&l.terrain.renderingToTexture,G=!l.options.moving,U=r.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;if(z instanceof s.aU&&!c.length&&(z.onNorthPole||z.onSouthPole)){const ne=v?l.stencilModeFor3D():ii.disabled;return void Yu(!!z.onNorthPole,null,l,t,r,D,R,ei.disabled,ne)}if(!c.length)return;const[Z,K]=z instanceof s.aU||O?[{},c]:l.stencilConfigForOverlap(c),W=K[K.length-1].overscaledZ;b&&R.defines.push("PROJECTION_GLOBE_VIEW"),v&&R.defines.push("RENDER_CUTOFF");const le=(ne,se,ie)=>{for(const Q of ne){const ce=Q.toUnwrapped(),ve=t.getTile(Q);if(O&&(!ve||!ve.hasData()))continue;E.activeTexture.set(C.TEXTURE0);const ge=La(ve,z,r,R);if(!ge||!ge.texture)continue;const{texture:Le,mix:ze,offset:je,tileSize:nt,buffer:Ae}=ge;let fe,Oe;O?(fe=kt.disabled,Oe=Q.projMatrix):v?(fe=new kt(C.LEQUAL,kt.ReadWrite,l.depthRangeFor3D),Oe=g?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ce,G)):(fe=l.depthModeForSublayer(Q.overscaledZ-W,r.paint.get("raster-opacity")===1?kt.ReadWrite:kt.ReadOnly,C.LESS),Oe=l.transform.calculateProjMatrix(ce,G));const Me=l.terrain&&O?l.terrain.stencilModeForRTTOverlap(Q):Z[Q.overscaledZ],Ze=_?0:r.paint.get("raster-fade-duration");ve.registerFadeDuration(Ze);
3018const ft=t.findLoadedParent(Q,0),bt=$u(ve,ft,t,l.transform,Ze);let ut,rt;!bt.isFading&&ve.refreshedUponExpiration&&(ve.refreshedUponExpiration=!1),l.terrain&&l.terrain.prepareDrawTile(),E.activeTexture.set(C.TEXTURE0),Le.bind(U,C.CLAMP_TO_EDGE),E.activeTexture.set(C.TEXTURE1),ft?(ft.texture&&ft.texture.bind(U,C.CLAMP_TO_EDGE),ut=Math.pow(2,ft.tileID.overscaledZ-ve.tileID.overscaledZ),rt=[ve.tileID.canonical.x*ut%1,ve.tileID.canonical.y*ut%1]):Le.bind(U,C.CLAMP_TO_EDGE),"useMipmap"in Le&&E.extTextureFilterAnisotropic&&l.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const Lt=l.transform;let Mt;const xt=v?yy(Lt):[0,0,0,0];let St,Ht,ci,Li,Yi,zt=0;if(b&&z instanceof s.aU&&z.coordinates.length>3)St=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0)))),Ht=Float32Array.from(Lt.globeMatrix),ci=Float32Array.from(s.dF(Lt)),Li=[s.aF(Lt.center.lng),s.aJ(Lt.center.lat)],Mt=z.elevatedGlobePerspectiveTransform,Yi=z.elevatedGlobeGridMatrix||new Float32Array(9);else if(b){const cn=s.dG(Q.canonical);zt=s.dH(cn.getCenter().lat),St=Float32Array.from(s.bk(s.dJ(Q.canonical))),Ht=Float32Array.from(Lt.globeMatrix),ci=Float32Array.from(s.dF(Lt)),Li=[s.aF(Lt.center.lng),s.aJ(Lt.center.lat)],Mt=[0,0],Yi=Float32Array.from(s.dI(Q.canonical,cn,zt,Lt.worldSize/Lt._pixelsPerMercatorPixel))}else Mt=z instanceof s.aU?z.perspectiveTransform:[0,0],St=new Float32Array(16),Ht=new Float32Array(9),ci=new Float32Array(16),Li=[0,0],Yi=new Float32Array(9);const Zi=hy(Oe,St,Ht,ci,Yi,rt||[0,0],s.aj(l.transform.zoom),Li,xt,ut||1,bt,r,Mt,v?r.paint.get("raster-elevation"):0,2,ze,je,R.range,nt,Ae,D),li=l.isTileAffectedByFog(Q),Qi=l.getOrCreateProgram("raster",{defines:R.defines,overrideFog:li});if(l.uploadCommonUniforms(E,Qi,ce),z instanceof s.aU){const cn=z.elevatedGlobeVertexBuffer,on=z.elevatedGlobeIndexBuffer;if(O||!g)z.boundsBuffer&&z.boundsSegments&&Qi.draw(l,C.TRIANGLES,fe,ii.disabled,B,ei.disabled,Zi,r.id,z.boundsBuffer,l.quadTriangleIndexBuffer,z.boundsSegments);else if(cn&&on){const Hi=Lt.zoom<=s.c_?z.elevatedGlobeSegments:z.getSegmentsForLongitude(Lt.center.lng);Hi&&Qi.draw(l,C.TRIANGLES,fe,ii.disabled,B,se,Zi,r.id,cn,on,Hi)}}else if(b){fe=new kt(C.LEQUAL,kt.ReadOnly,l.depthRangeFor3D);const cn=l.globeSharedBuffers;if(cn){const[on,Hi,_i]=cn.getGridBuffers(zt,!1);Qi.draw(l,C.TRIANGLES,fe,ie||Me,l.colorModeForRenderPass(),se,Zi,r.id,on,Hi,_i)}}else{const{tileBoundsBuffer:cn,tileBoundsIndexBuffer:on,tileBoundsSegments:Hi}=l.getTileBoundsBuffers(ve);Qi.draw(l,C.TRIANGLES,fe,Me,B,ei.disabled,Zi,r.id,cn,on,Hi)}}if(!(z instanceof s.aU)&&b)for(const Q of ne){const ce=Q.canonical.y===(1<<Q.canonical.z)-1;Q.canonical.y===0&&Yu(!0,Q,l,t,r,D,R,se,ie||ii.disabled),ce&&Yu(!1,Q,l,t,r,D,R,se===ei.frontCW?ei.backCW:ei.frontCW,ie||ii.disabled)}};b?le(K,l.renderElevatedRasterBackface?ei.backCW:ei.frontCW,l.stencilModeFor3D()):le(K,ei.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,r,c,p,_){l.renderPass==="offscreen"&&function(g,v,b,E){if(!E.length)return;const C=g.context,z=C.gl,R=v.getSource();if(!(R instanceof lo))return;const D=Math.ceil(Math.sqrt(b.paint.get("raster-particle-count")));let B=b.particlePositionRGBAImage;if(!B||B.width!==D){const K=function(W){const le=W*W,ne=new Uint8Array(4*le),se=function(Q){return Q|=0,Q=Math.imul(2747636419^Q,2654435769),Q=Math.imul(Q^Q>>>16,2654435769),((Q=Math.imul(Q^Q>>>16,2654435769))>>>0)/4294967296},ie=1/1.1;for(let Q=0;Q<le;Q++){const ce=ie*(se(2*Q+0)+ra),ve=ie*(se(2*Q+1)+ra),ge=255*ce%1,Le=255*ve%1,ze=ge,je=ve-Le/255,nt=Le;ne[4*Q+0]=255*(ce-ge/255),ne[4*Q+1]=255*ze,ne[4*Q+2]=255*je,ne[4*Q+3]=255*nt}return ne}(D);B=b.particlePositionRGBAImage=new s.q({width:D,height:D},K)}let O=b.particleFramebuffer;O?O.width!==D&&(O.destroy(),O=b.particleFramebuffer=C.createFramebuffer(D,D,1,null)):O=b.particleFramebuffer=C.createFramebuffer(D,D,1,null);const G=[];for(const K of E){const W=v.getTile(K);if(!(W instanceof Yh))continue;const le=um(W,R,b);
vendor: 4,562 bytes, line 3018
3018if(!le)continue;const ne=[W.tileSize,W.tileSize];let se=b.tileFramebuffer;se||(se=b.tileFramebuffer=C.createFramebuffer(ne[0],ne[1],1,null));let ie=W.rasterParticleState;ie||(ie=W.rasterParticleState=new Bd(C,K,ne,B));const Q=ie.update(b.lastInvalidatedAt);ie.particleTextureDimension!==D&&ie.updateParticleTexture(K,B);const ce=ie.targetColorTexture;ie.targetColorTexture=ie.backgroundColorTexture,ie.backgroundColorTexture=ce;const ve=ie.particleTexture0;ie.particleTexture0=ie.particleTexture1,ie.particleTexture1=ve,G.push([K,le,ie,Q])}if(G.length===0)return;const U=s.o.now(),Z=b.previousDrawTimestamp?.001*(U-b.previousDrawTimestamp):.0167;if(b.previousDrawTimestamp=U,b.hasColorMap()){C.activeTexture.set(z.TEXTURE0+2);let K=b.colorRampTexture;K||(K=b.colorRampTexture=new s.T(C,b.colorRamp,z.RGBA8)),K.bind(z.LINEAR,z.CLAMP_TO_EDGE)}C.bindFramebuffer.set(b.tileFramebuffer.framebuffer),function(K,W,le){const ne=K.context,se=ne.gl,ie=W.tileFramebuffer;ne.activeTexture.set(se.TEXTURE0);const Q={u_texture:0,u_opacity:1.05*(ve=W.paint.get("raster-particle-fade-opacity-factor"))/(ve+.05)},ce=K.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var ve;for(const ge of le){const[,,Le,ze]=ge;ie.colorAttachment0.set(Le.targetColorTexture.texture),ne.viewport.set([0,0,ie.width,ie.height]),ne.clear({color:s.ao.transparent}),ze&&(Le.backgroundColorTexture.bind(se.NEAREST,se.CLAMP_TO_EDGE),ce.draw(K,se.TRIANGLES,kt.disabled,ii.disabled,fi.alphaBlended,ei.disabled,Q,W.id,K.viewportBuffer,K.quadTriangleIndexBuffer,K.viewportSegments))}}(g,b,G),function(K,W,le,ne){const se=K.context,ie=se.gl,Q=le.tileFramebuffer,ce=K.transform.projection.name==="globe",ve=le.paint.get("raster-particle-max-speed");for(const ge of ne){const[Le,ze,je]=ge;se.activeTexture.set(ie.TEXTURE0+0),ze.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE),Q.colorAttachment0.set(je.targetColorTexture.texture);const nt=K.getOrCreateProgram("rasterParticleDraw",{defines:ze.defines,overrideFog:!1});se.activeTexture.set(ie.TEXTURE0+1);const Ae=ze.scalarData?[]:[0,1,2,3].map(Me=>s.e9[Me](Le));Ae.push(Le);const fe=Le.canonical.x,Oe=Le.canonical.y;for(const Me of Ae){const Ze=W.getTile(ce?Me.wrapped():Me);if(!Ze)continue;const ft=Ze.rasterParticleState;if(!ft)continue;const bt=Me.canonical.x+(1<<Me.canonical.z)*(Me.wrap-Le.wrap),ut=Me.canonical.y;ft.particleTexture0.bind(ie.NEAREST,ie.CLAMP_TO_EDGE);const rt=c1(1,ft.particleTexture0.size[0],[bt-fe,ut-Oe],0,ze.texture.size,2,ve,ze.textureOffset,ze.scale,ze.offset);nt.draw(K,ie.POINTS,kt.disabled,ii.disabled,fi.alphaBlended,ei.disabled,rt,le.id,ft.particleIndexBuffer,void 0,ft.particleSegment)}}}(g,v,b,G),C.bindFramebuffer.set(b.particleFramebuffer.framebuffer),function(K,W,le,ne){const se=K.context,ie=se.gl,Q=W.paint.get("raster-particle-max-speed"),ce=ne*W.paint.get("raster-particle-speed-factor")*.15,ve=function(Le){return Math.pow(Le,6)}(.01+1*W.paint.get("raster-particle-reset-rate-factor")),ge=W.particleFramebuffer;se.viewport.set([0,0,ge.width,ge.height]);for(const Le of le){const[,ze,je]=Le;se.activeTexture.set(ie.TEXTURE0+0),ze.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE),se.activeTexture.set(ie.TEXTURE0+1);const nt=je.particleTexture0;nt.bind(ie.NEAREST,ie.CLAMP_TO_EDGE);const Ae=py(1,nt.size[0],0,ze.texture.size,Q,ce,ve,ze.textureOffset,ze.scale,ze.offset);ge.colorAttachment0.set(je.particleTexture1.texture),se.clear({color:s.ao.transparent}),K.getOrCreateProgram("rasterParticleUpdate",{defines:ze.defines}).draw(K,ie.TRIANGLES,kt.disabled,ii.disabled,fi.unblended,ei.disabled,Ae,W.id,K.viewportBuffer,K.quadTriangleIndexBuffer,K.viewportSegments)}}(g,b,G,Z)}(l,t,r,c),l.renderPass==="translucent"&&(function(g,v,b,E,C){const z=g.context,R=z.gl,D=v.getSource().tileSize,B=5*(1-s.ah(s.cL,s.cL+1,g.transform.zoom))*D+b.paint.get("raster-particle-elevation"),O=!g.options.moving,G=g.transform.projection.name==="globe";if(!E.length)return;const[U,Z]=g.stencilConfigForOverlap(E),K=[];G&&K.push("PROJECTION_GLOBE_VIEW");const W=g.stencilModeFor3D();for(const le of Z){const ne=le.toUnwrapped(),se=v.getTile(le);if(!se.rasterParticleState)continue;const ie=se.rasterParticleState,Q=100;se.registerFadeDuration(Q);const ce=v.findLoadedParent(le,0),ve=$u(se,ce,v,g.transform,Q);let ge,Le;g.terrain&&g.terrain.prepareDrawTile(),z.activeTexture.set(R.TEXTURE0),ie.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),z.activeTexture.set(R.TEXTURE1),ce&&ce.rasterParticleState?(ce.rasterParticleState.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),ge=Math.pow(2,ce.tileID.overscaledZ-se.tileID.overscaledZ
3018),Le=[se.tileID.canonical.x*ge%1,se.tileID.canonical.y*ge%1]):ie.targetColorTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const ze=G?Float32Array.from(g.transform.expandedFarZProjMatrix):g.transform.calculateProjMatrix(ne,O),je=g.transform,nt=vy(je),Ae=s.dG(le.canonical),fe=s.dH(Ae.getCenter().lat);let Oe,Me,Ze,ft,bt;G?(Oe=Float32Array.from(s.bk(s.dJ(le.canonical))),Me=Float32Array.from(je.globeMatrix),Ze=Float32Array.from(s.dF(je)),ft=[s.aF(je.center.lng),s.aJ(je.center.lat)],bt=Float32Array.from(s.dI(le.canonical,Ae,fe,je.worldSize/je._pixelsPerMercatorPixel))):(Oe=new Float32Array(16),Me=new Float32Array(9),Ze=new Float32Array(16),ft=[0,0],bt=new Float32Array(9));const ut=l1(ze,Oe,Me,Ze,bt,Le||[0,0],s.aj(g.transform.zoom),ft,nt,ge||1,ve,B),rt=g.isTileAffectedByFog(le),Lt=g.getOrCreateProgram("rasterParticle",{defines:K,overrideFog:rt});if(g.uploadCommonUniforms(z,Lt,ne),G){const Mt=new kt(R.LEQUAL,kt.ReadOnly,g.depthRangeFor3D),xt=0,St=g.globeSharedBuffers;if(St){const[Ht,ci,Li]=St.getGridBuffers(fe,xt!==0);Lt.draw(g,R.TRIANGLES,Mt,W,fi.alphaBlended,g.renderElevatedRasterBackface?ei.frontCCW:ei.backCCW,ut,b.id,Ht,ci,Li)}}else{const Mt=g.depthModeForSublayer(0,kt.ReadOnly),xt=U[le.overscaledZ],{tileBoundsBuffer:St,tileBoundsIndexBuffer:Ht,tileBoundsSegments:ci}=g.getTileBoundsBuffers(se);Lt.draw(g,R.TRIANGLES,Mt,xt,fi.alphaBlended,ei.disabled,ut,b.id,St,Ht,ci)}}g.resetStencilClippingMasks()}(l,t,r,c),l.style.map.triggerRepaint())},background:function(l,t,r,c){const p=r.paint.get("background-color"),_=r.paint.get("background-color-use-theme").constantOr("default")==="none",g=r.paint.get("background-opacity"),v=r.paint.get("background-emissive-strength"),b=r.paint.get("background-pitch-alignment")==="viewport";if(g===0)return;const E=l.context,C=E.gl,z=l.transform,R=z.tileSize,D=r.paint.get("background-pattern");let B;if(D!==void 0&&(D===null||(B=l.imageManager.getPattern(s.I.from(D.toString()),r.scope,l.style.getLut(r.scope)),!B)))return;const O=!D&&p.a===1&&g===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==O)return;const G=ii.disabled,U=l.depthModeForSublayer(0,O==="opaque"?kt.ReadWrite:kt.ReadOnly),Z=l.colorModeForDrapableLayerRenderPass(v),K=D?"backgroundPattern":"background";let W,le=c;le||(W=l.getBackgroundTiles(),le=Object.values(W).map(se=>se.tileID)),D&&(E.activeTexture.set(C.TEXTURE0),l.imageManager.bind(l.context,r.scope));const ne=[];if(l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&ne.push("USE_MRT1"),b){const se=l.getOrCreateProgram(K,{overrideFog:!1,overrideRtt:!0,defines:ne}),ie=new Float32Array(s.bA([])),Q=new s.aQ(0,0,0,0,0),ce=D?dl(ie,v,g,l,0,r.scope,B,b,{tileID:Q,tileSize:R}):qu(ie,v,g,p.toPremultipliedRenderColor(_?null:r.lut));se.draw(l,C.TRIANGLES,U,G,Z,ei.disabled,ce,r.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const se of le){const ie=l.isTileAffectedByFog(se),Q=l.getOrCreateProgram(K,{overrideFog:ie,defines:ne}),ce=se.toUnwrapped(),ve=c?se.projMatrix:l.transform.calculateProjMatrix(ce);l.prepareDrawTile();const ge=t?t.getTile(se):W?W[se.key]:new Bl(se,R,z.zoom,l),Le=D?dl(ve,v,g,l,0,r.scope,B,b,{tileID:se,tileSize:R}):qu(ve,v,g,p.toPremultipliedRenderColor(_?null:r.lut));l.uploadCommonUniforms(E,Q,ce);const{tileBoundsBuffer:ze,tileBoundsIndexBuffer:je,tileBoundsSegments:nt}=l.getTileBoundsBuffers(ge);Q.draw(l,C.TRIANGLES,U,G,Z,ei.disabled,Le,r.id,ze,je,nt)}},sky:function(l,t,r){const c=l._atmosphere?s.aj(l.transform.zoom):1,p=r.paint.get("sky-opacity")*c;if(p===0)return;const _=l.context,g=r.paint.get("sky-type"),v=new kt(_.gl.LEQUAL,kt.ReadOnly,[0,1]),b=l.frameCounter/1e3%1;g==="atmosphere"?l.renderPass==="offscreen"?r.needsSkyboxCapture(l)&&(function(E,C,z,R){const D=E.context,B=D.gl;let O=C.skyboxFbo;if(!O){O=C.skyboxFbo=D.createFramebuffer(32,32,1,null),C.skyboxGeometry=new Vd(D),C.skyboxTexture=D.gl.createTexture(),B.bindTexture(B.TEXTURE_CUBE_MAP,C.skyboxTexture),B.texParameteri(B.TEXTURE_CUBE_MAP,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_CUBE_MAP,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_CUBE_MAP,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_CUBE_MAP,B.TEXTURE_MAG_FILTER,B.LINEAR);for(let K=0;K<6;++K)B.texImage2D(B.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,B.RGBA,32,32,0,B.RGBA,B.UNSIGNED_BYTE,null)}D.bindFramebuffer.set(O.framebuffer),D.viewport.set([0,0,32,32]);const G=C.getCenter(E,!0),U=E.getOrCreateProgram("skyboxCapture"),Z=new Float64Array(16);s.bA(Z),s.en(Z,Z,.5*-Math.PI),Kl(E,C,U,Z,G,0),s.bA(Z),s.en(Z,Z,.5*Math.PI),Kl(E,C,U,Z,G,1),s.bA(Z),s.cU(Z,Z,.5*-Math.PI),Kl(E,C,U,Z,G,2),s.bA(Z),s.cU(Z,Z,.5*Math.PI),Kl(E,C,U,Z,G,3),s.bA(Z),Kl(E,C,U,Z,G,4),s.bA(Z),s.en(Z,Z,Math.PI),Kl(E,C,U,Z,G,5),D.viewport.set([0,0,E.width,E.height])}(l,r),r.markSkyboxValid(l)):l.renderPass==="sky"&&function(E,C,z,R,D){const B=E.context,O=B.gl,G=E.transform,U=E.getOrCreateProgram("skybox");B.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_CUBE_MAP,C.skyboxTexture);const Z=((K,W,le,ne,se)=>({u_matrix:K,u_sun_direction:W,u_cubemap:0,u_opacity:ne,u_temporal_offset:se}))(G.skyboxMatrix,C.getCenter(E,!1),0,R,D);E.uploadCommonUniforms(B,U),U.draw(E,O.TRIANGLES,z,ii.disabled,E.colorModeForRenderPass(),ei.backCW,Z,"skybox",C.skyboxGeometry.vertexBuffer,C.skyboxGeometry.indexBuffer,C.skyboxGeometry.segment)}(l,r,v,p,b):g==="gradient"&&l.renderPass==="sky"&&function(E,C,z,R,D){const B=E.context,O=B.gl,G=E.transform,U=E.getOrCreateProgram("skyboxGradient");C.skyboxGeometry||(C.skyboxGeometry=new Vd(B)),B.activeTexture.set(O.TEXTURE0);let Z=C.colorRampTexture;Z||(Z=C.colorRampTexture=new s.T(B,C.colorRamp,O.RGBA8)),Z.bind(O.LINEAR,O.CLAMP_TO_EDGE);const K=((W,le,ne,se,ie)=>({u_matrix:W,u_color_ramp:0,u_center_direction:le,u_radius:s.an(ne),u_opacity:se,u_temporal_offset:ie}))(G.skyboxMatrix,C.getCenter(E,!1),C.paint.get("sky-gradient-radius"),R,D);E.uploadCommonUniforms(B,U),U.draw(E,O.TRIANGLES,z,ii.disabled,E.colorModeForRenderPass(),ei.backCW,K,"skyboxGradient",C.skyboxGeometry.vertexBuffer,C.skyboxGeometry.indexBuffer,C.skyboxGeometry.segment)}(l,r,v,p,b)},custom:function(l,t,r,c){const p=l.context,_=r.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&r.isDraped(t)){if(l.renderPass==="offscreen"){const g=_.prerender;if(g){if(l.setCustomLayerDefaults(),p.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const v=l.transform.pointMerc;g.call(_,p.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[v.x,v.y],l.transform.pixelsPerMeterRatio)}else g.call(_,p.gl,l.transform.customLayerMatrix());p.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const v=_.renderToTile;if(v){const b=c[0].canonical,E={x:b.x+c[0].wrap*(_.wrapTileId?0:1<<b.z),y:b.y,z:b.z};p.setDepthMode(kt.disabled),p.setStencilMode(ii.disabled),p.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),v.call(_,p.gl,E),p.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),p.setColorMode(l.colorModeForRenderPass()),p.setStencilMode(ii.disabled);const g=_.renderingMode==="3d"?new kt(l.context.gl.LEQUAL,kt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,kt.ReadOnly);if(p.setDepthMode(g),l.transform.projection.name==="globe"){const v=l.transform.pointMerc;_.render(p.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[v.x,v.y],l.transform.pixelsPerMeterRatio)}else _.render(p.gl,l.transform.customLayerMatrix());p.setDirty(),l.setBaseState(),p.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,r,c){if(l.renderPass==="opaque")return;const p=r.paint.get("model-opacity").constantOr(1),_=r.paint.get("model-elevation-reference"),g=_==="ground",v=_==="ground";if(p===0)return;const b=r.paint.get("model-cast-shadows");
3018if(l.renderPass==="shadow"&&(!b||l.terrain&&p<.65&&r._transitionablePaint._values["model-opacity"].value.expression instanceof s.ad))return;const E=l.shadowRenderer,C=r.paint.get("model-receive-shadows");E&&(E.useNormalOffset=!0,C||(E.enabled=!1));const z=()=>{E&&(E.useNormalOffset=!0,C||(E.enabled=!0))},R=t.getSource();if(l.renderPass==="light-beam"&&R.type!=="batched-model")return;if(R.type==="vector"||R.type==="geojson")return function(W,le,ne,se,ie){const Q=W.transform,ce=Q.projection.name==="globe",ve=Q.getFreeCameraOptions().position;if(!W.modelManager)return;const ge=W.modelManager;ne.modelManager=ge;const Le=W.shadowRenderer;if(!ne._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ze=ne._unevaluatedLayout._values["model-id"],je=Object.assign({},ne.layout.get("model-id").parameters),nt=W.style.order.indexOf(ne.fqid),Ae=ne.paint.get("model-opacity").constantOr(1);for(const fe of se){const Oe=le.getTile(fe).getBucket(ne);if(!Oe||Oe.projection.name!==Q.projection.name)continue;const Me=Oe.getModelUris();if(Me&&!Oe.modelsRequested&&(ge.addModelsFromBucket(Me,ie),Oe.modelsRequested=!0),ce)je.zoom=fe.overscaledZ;else{const xt=go(fe,Q);je.zoom=xt}const Ze=ze.possiblyEvaluate(je);if(My(W,Oe,fe),sa.shadowUniformsInitialized=!1,sa.useSingleShadowCascade=!!Le&&Le.getMaxCascadeForTile(fe.toUnwrapped())===0,W.renderPass==="shadow"&&Le){if(W.currentShadowCascade===1&&Oe.isInsideFirstShadowMapFrustum)continue;const xt=Q.calculatePosMatrix(fe.toUnwrapped(),Q.worldSize);if(sa.tileMatrix.set(xt),sa.shadowTileMatrix=Float32Array.from(Le.calculateShadowPassMatrixFromMatrix(xt)),sa.aabb.min=[0,0,0],sa.aabb.max[0]=sa.aabb.max[1]=s.al,sa.aabb.max[2]=0,p1(Oe,sa,W,ne.scope))continue}const ft=1<<fe.canonical.z,bt=[((ve.x-fe.wrap)*ft-fe.canonical.x)*s.al,(ve.y*ft-fe.canonical.y)*s.al,ve.z*ft*s.al];W.conflationActive&&Object.keys(Oe.instancesPerModel).length>0&&W.style.isLayerClipped(ne,le.getSource())&&Oe.updateReplacement(fe,W.replacementSource,nt,ne.scope)&&(Oe.uploaded=!1,Oe.upload(W.context));let ut=0;const rt=new Array,Lt=new Array,Mt=new Array;for(let xt in Oe.instancesPerModel){const St=Oe.instancesPerModel[xt];St.features.length>0&&!ce&&(xt=Ze.evaluate(St.features[0].feature,{}));const Ht=ge.getModel(xt,ie);if(Ht||ge.hasURLBeenRequested(xt)||Oe.modelUris.includes(xt)||(Oe.modelUris.push(xt),Oe.modelsRequested=!1),Ht&&Ht.uploaded)if(ce){const ci=s.c5([],[ve.x,ve.y,ve.z],W.transform.worldSize);s.ew(ci,ci);for(let Li=0;Li<St.instancedDataArray.length;++Li){const Yi=[0,0,0],zt=[1,1,1],Zi=s.ex(),li=St.tileCoordinatesForInstance(Li),Qi=St.transformForInstance(Li);s.ey(zt,Qi),s.ez(Zi,Qi),s.eA(Yi,Zi);const cn=St.translationForInstance(Li),on=new s.aT(0,0);s.eB(Oe.canonical,on,li.x,li.y);const Hi=s.bC();s.eC(Hi,Ht,W.transform,on,Yi,zt,cn,!0,!1,!1);const _i=St.colorForInstance(Li),Ji=s.bA([]),Nn=s.ef(on.lat,W.transform.zoom),Cn=s.bq([],[1,1,1/Nn]);s.br(Ji,Ji,ci),Mt.push({zScaleMatrix:Cn,negCameraPosMatrix:Ji});for(const en of Ht.nodes)Jl(W,en,Hi,W.transform.expandedFarZProjMatrix,ut,rt,Lt,Ht.materialOverrides,Ae,_i);++ut}}else for(const ci of Ht.nodes)Py(W,ne,ci,St,bt,fe,sa)}if(ce)if(W.renderPass==="shadow"){for(const xt of Lt)zs(xt.mesh,xt.nodeModelMatrix,W,ne);for(const xt of rt)zs(xt.mesh,xt.nodeModelMatrix,W,ne)}else Cy(W,ne,rt,Lt,Mt)}}(l,t,r,c,Ku(l,r)),void z();if(!R.loaded())return;if(R.type==="batched-model")return function(W,le,ne,se){ne.resetLayerRenderingStats(W);const ie=W.context,Q=W.transform,ce=W.style.fog,ve=W.shadowRenderer;if(Q.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${Q.projection.name} projection is not yet implemented`);const ge=W.transform.getFreeCameraOptions().position,Le=s.c5([],[ge.x,ge.y,ge.z],W.transform.worldSize),ze=s.ew([],Le),je=s.bA([]),nt=s.ef(Q.center.lat,Q.zoom),Ae=s.bq([],[1,1,1/nt]);s.br(je,je,ze);const fe=ne.paint.get("model-opacity").constantOr(1),Oe=new kt(ie.gl.LEQUAL,kt.ReadWrite,W.depthRangeFor3D),Me=new kt(ie.gl.LEQUAL,kt.ReadOnly,W.depthRangeFor3D),Ze=new s.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),ft=W.renderPass==="shadow",bt=ft&&ve?ve.getCurrentCascadeFrustum():Q.getFrustum(Q.scaleZoom(Q.worldSize)),ut=ne.paint.get("model-front-cutoff"),rt=ut[2]<1,Lt=rl(W,ne.paint.get("model-cutoff-fade-range")),Mt=ne.getLayerRenderingStats();(function(xt,St,Ht,ci){const Li=xt.terrain?xt.terrain.exaggeration():0,Yi=xt.transform.zoom;for(const zt of ci){const Zi=St.getTile(zt).getBucket(Ht);Zi&&(Zi.setFilter(Ht.filter),xt.conflationActive&&Zi.updateReplacement(zt,xt.replacementSource),Zi.evaluateTransform(xt,Ht),xt.terrain&&Li>0&&Zi.elevationUpdate(xt.terrain,Li,zt,Ht.source),Zi.needsReEvaluation(xt,Yi,Ht)&&Zi.evaluate(Ht))}})(W,le,ne,se),function(){let xt,St,Ht;rt?(xt=se.length-1,St=-1,Ht=-1):(xt=0,St=se.length,Ht=1);const ci=new Float64Array(16),Li=s.cA(),Yi=new s.P(0,0);for(let zt=xt;zt!==St;zt+=Ht){const Zi=se[zt],li=le.getTile(Zi).getBucket(ne);if(!li||!li.uploaded)continue;let Qi=!1;ve&&(Qi=ve.getMaxCascadeForTile(Zi.toUnwrapped())===0);const cn=Q.calculatePosMatrix(Zi.toUnwrapped(),Q.worldSize),on=li.modelTraits;!ft&&rt&&(s.bl(ci,cn),s.af(Li,Le,ci),Yi.x=Li[0],Yi.y=Li[1]);const Hi=[];li.setFilter(ne.filter);
3018for(const _i of li.getNodesInfo()){if(_i.hiddenByReplacement||!_i.node.meshes)continue;const Ji=_i.node;let Nn=0;W.terrain&&Ji.elevation&&(Nn=Ji.elevation*W.terrain.exaggeration());const Cn=(()=>{const eo=_i.aabb;return Ze.min=[...eo.min],Ze.max=[...eo.max],Ze.min[2]+=Nn,Ze.max[2]+=Nn,s.af(Ze.min,Ze.min,cn),s.af(Ze.max,Ze.max,cn),Ze})(),en=_i.evaluatedScale;if(en[0]<=1&&en[1]<=1&&en[2]<=1&&Cn.intersects(bt)===0)continue;if(!ft&&rt){const eo=.16666666666666666;_i.cameraCollisionOpacity=Le[0]>Cn.min[0]&&Le[0]<Cn.max[0]&&Le[1]>Cn.min[1]&&Le[1]<Cn.max[1]&&Le[2]*nt<Cn.max[2]&&Ji.footprint&&s.c0(Yi,Ji.footprint)?Math.max(_i.cameraCollisionOpacity-eo,0):Math.min(1,_i.cameraCollisionOpacity+eo)}const Ni=[...cn],gi=1/s.d7(Zi.canonical),En=Ji.anchor?Ji.anchor[0]:0,Xn=Ji.anchor?Ji.anchor[1]:0;s.br(Ni,Ni,[En*(en[0]-1)+_i.evaluatedTranslation[0]*gi,Xn*(en[1]-1)+_i.evaluatedTranslation[1]*gi,Nn+_i.evaluatedTranslation[2]]),s.cq(en,s.eE)||s.cS(Ni,Ni,en);const Dn=s.aB([],Ni,Ji.globalMatrix),fn=s.aB([],Q.expandedFarZProjMatrix,Dn),yo=s.aB([],Q.expandedFarZProjMatrix,Ni),Zr=s.aC([],[En,Xn,Nn,1],fn)[2];Ji.hidden=!1;let gr=fe;ft||(rt&&(gr*=_i.cameraCollisionOpacity,gr*=Ai(Ni,Q,_i.aabb,ut)),gr*=An(Lt,Zr)),gr!==0?Hi.push({nodeInfo:_i,depth:Zr,opacity:gr,wvpForNode:fn,wvpForTile:yo,nodeModelMatrix:Dn,tileModelMatrix:Ni}):Ji.hidden=!0}ft||Hi.sort((_i,Ji)=>!rt||_i.opacity===1&&Ji.opacity===1?_i.depth<Ji.depth?-1:1:_i.opacity===1?-1:Ji.opacity===1?1:_i.depth>Ji.depth?-1:1);for(const _i of Hi){const Ji=_i.nodeInfo,Nn=Ji.node;let Cn=s.aB([],Ae,_i.tileModelMatrix);s.aB(Cn,je,Cn);const en=s.bl([],Cn);s.eg(en,en),s.cS(en,en,Ju),Cn=s.aB(Cn,Cn,Nn.globalMatrix);const Ni=W.renderPass==="light-beam",gi=ne.paint.get("model-color-use-theme").constantOr("default")==="none",En=on&s.eI.HasMapboxMeshFeatures,Xn=En?0:Ji.evaluatedRMEA[0][2];for(let Dn=0;Dn<Nn.meshes.length;++Dn){const fn=Nn.meshes[Dn],yo=Dn===Nn.lightMeshIndex;let Zr=_i.wvpForNode;if(yo){if(!Ni&&!W.terrain&&W.shadowRenderer){W.currentLayer<W.firstLightBeamLayer&&(W.firstLightBeamLayer=W.currentLayer);continue}Zr=_i.wvpForTile}else if(Ni)continue;const gr={defines:[]},eo=[];if(!ft&&ve&&(ve.useNormalOffset=!!fn.normalBuffer),Gd(gr.defines,eo,fn,W,gi?null:ne.lut),En||gr.defines.push("DIFFUSE_SHADED"),Qi&&gr.defines.push("SHADOWS_SINGLE_CASCADE"),Mt&&(ft?Mt.numRenderedVerticesInShadowPass+=fn.vertexArray.length:Mt.numRenderedVerticesInTransparentPass+=fn.vertexArray.length),ft){zs(fn,_i.nodeModelMatrix,W,ne);continue}let to=null;if(ce){const er=Ud(_i.nodeModelMatrix,W.transform);if(to=new Float32Array(er),Q.projection.name!=="globe"){const mn=fn.aabb.min,sr=fn.aabb.max,[Vn,kn]=ce.getOpacityForBounds(er,mn[0],mn[1],sr[0],sr[1]);gr.overrideFog=Vn>=Ue||kn>=Ue}}const $r=fn.material;let Ko;$r.occlusionTexture&&$r.occlusionTexture.offsetScale&&(Ko=$r.occlusionTexture.offsetScale,gr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const _s=W.getOrCreateProgram("model",gr);!ft&&ve&&ve.setupShadowsFromMatrix(_i.tileModelMatrix,_s,ve.useNormalOffset),W.uploadCommonUniforms(ie,_s,null,to);const Co=$r.pbrMetallicRoughness;Co.metallicFactor=.9,Co.roughnessFactor=.5;const Gn=ql(new Float32Array(Zr),new Float32Array(Cn),new Float32Array(en),new Float32Array(Nn.globalMatrix),W,_i.opacity,Co.baseColorFactor,$r.emissiveFactor,Co.metallicFactor,Co.roughnessFactor,$r,Xn,ne,[0,0,0],Ko);!yo&&(Ji.hasTranslucentParts||_i.opacity<1)&&_s.draw(W,ie.gl.TRIANGLES,Oe,ii.disabled,fi.disabled,ei.backCCW,Gn,ne.id,fn.vertexBuffer,fn.indexBuffer,fn.segments,ne.paint,W.transform.zoom,void 0,eo),_s.draw(W,ie.gl.TRIANGLES,yo?Me:Oe,ii.disabled,yo||_i.opacity<1||Ji.hasTranslucentParts?fi.alphaBlended:fi.unblended,ei.backCCW,Gn,ne.id,fn.vertexBuffer,fn.indexBuffer,fn.segments,ne.paint,W.transform.zoom,void 0,eo)}}}}()}(l,t,r,c),void z();if(R.type!=="model")return;const D=R.getModels(),B=[],O=l.transform.getFreeCameraOptions().position,G=s.c5([],[O.x,O.y,O.z],l.transform.worldSize);s.ew(G,G);const U=[],Z=[];let K=0;for(const W of D){const le=t.getFeatureState("",W.id),ne={type:"Unknown",id:W.id,properties:W.featureProperties},se=r.paint.get("model-rotation").evaluate(ne,le),ie=r.paint.get("model-scale").evaluate(ne,le),Q=r.paint.get("model-translation").evaluate(ne,le),ce=r.paint.get("model-opacity").evaluate(ne,le);Iy(r,W.id,le,W.featureProperties,W.nodeOverrideNames,W.nodeOverrides),Ay(r,W.id,le,W.featureProperties,W.materialOverrideNames,W.materialOverrides),W.nodeOverrides.size>0&&W.computeBoundsAndApplyParent(),W.computeModelMatrix(l,se,ie,Q,v,g,!1);const ve=s.bA([]),ge=s.ef(W.position.lat,l.transform.zoom),Le=s.bq([],[1,1,1/ge]);s.br(ve,ve,G),B.push({zScaleMatrix:Le,negCameraPosMatrix:ve});for(const ze of W.nodes)Jl(l,ze,W.matrix,l.transform.expandedFarZProjMatrix,K,U,Z,W.materialOverrides,ce);K++}if(U.sort((W,le)=>le.depth-W.depth),l.renderPass!=="shadow")Cy(l,r,U,Z,B),z();else{for(const W of Z)zs(W.mesh,W.nodeModelMatrix,l,r);for(const W of U)zs(W.mesh,W.nodeModelMatrix,l,r);z()}}},Zd={line:function(l,t,r){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();
3018for(const p of c){const _=t.getTile(p).getBucket(l);if(_&&(_.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,r){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(r.modelManager&&r.modelManager.upload(r,Ku(r,l)));if(c.type==="batched-model"||c.type!=="model")return;const p=c.getModels();for(const _ of p)_.upload(r.context)},raster:function(l,t,r){const c=t.getSource();if(!(c instanceof lo&&c.loaded()))return;const p=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!p)return;const _=l.paint.get("raster-array-band")||c.getInitialBand(p);if(_==null)return;const g=t.getIds().map(v=>t.getTileByID(v));for(const v of g)v.updateNeeded(l.id,_)&&c.prepareTile(v,p,l.id,_)},"raster-particle":function(l,t,r){const c=t.getSource();if(!(c instanceof lo&&c.loaded()))return;const p=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!p)return;const _=l.paint.get("raster-particle-array-band")||c.getInitialBand(p);if(_==null)return;const g=t.getIds().map(v=>t.getTileByID(v));for(const v of g)v.updateNeeded(l.id,_)&&c.prepareTile(v,p,l.id,_)}},Yo={fill:zd},Wd={fill:function(l,t,r,c){if(!r.layout||r.layout.get("fill-elevation-reference")==="none"||r.paint.get("fill-opacity").constantOr(1)===0)return;const p=l.context.gl,_=new kt(p.LEQUAL,kt.ReadOnly,l.depthRangeFor3D),g=new ii({func:p.ALWAYS,mask:255},255,255,p.KEEP,p.KEEP,p.REPLACE),v=l.transform.getFreeCameraOptions().position,b=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const E of c){const C=t.getTile(E),z=C.getBucket(r);if(!z)continue;const R=z.elevatedStructures;if(!R||R.depthSegments.segments[0].primitiveLength===0)continue;const D=gy(E.toUnwrapped(),v),B=l.translatePosMatrix(E.projMatrix,C,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),O=Hl(B,D,0,1,0);b.draw(l,p.TRIANGLES,_,g,fi.disabled,ei.disabled,O,r.id,R.vertexBuffer,R.indexBuffer,R.depthSegments,r.paint,l.transform.zoom)}}};class Xd{constructor(t,r,c,p,_){this.context=new Gc(t,r),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=s.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const g=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const b of g)this._debugParams.enabledLayers[b]=!0;for(const b of g);this.occlusionParams=new Hc,this.setup(),this.numSublayers=Oo.maxUnderzooming+Oo.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Rc(this),this._wireframeDebugCache=new fl,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const v=new s.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new s.T(this.context,v,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=p,this.worldview=_,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,r){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Qf(this,t));const p=this._terrain;this.transform.elevation=c?p:null,p.update(t,this.transform,r),this.transform.elevation&&!p.enabled&&(this.transform.elevation=null)}_updateFog(t){const r=t.fog;if(!r||this.transform.projection.name==="globe"||r.getOpacity(this.transform.pitch)<1||r.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,p]=r.getFovAdjustedRange(this.transform._fov);if(c>p)return void(this.transform.fogCullDistSq=null);const _=c+.78*(p-c);this.transform.fogCullDistSq=_*_}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new Qf(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,r){if(this.width=t*s.o.devicePixelRatio,this.height=r*s.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,r=new s.bd;r.emplaceBack(0,0),r.emplaceBack(s.al,0),r.emplaceBack(0,s.al),r.emplaceBack(s.al,s.al),this.tileExtentBuffer=t.createVertexBuffer(r,s.bf.members),this.tileExtentSegments=s.bg.simpleSegment(0,0,4,2);const c=new s.bd;c.emplaceBack(0,0),c.emplaceBack(s.al,0),c.emplaceBack(0,s.al),c.emplaceBack(s.al,s.al),this.debugBuffer=t.createVertexBuffer(c,s.bf.members),this.debugSegments=s.bg.simpleSegment(0,0,4,5);const p=new s.bd;p.emplaceBack(-1,-1),p.emplaceBack(1,-1),p.emplaceBack(-1,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,s.bf.members),this.viewportSegments=s.bg.simpleSegment(0,0,4,2);const _=new s.b1;_.emplaceBack(0,0,0,0),_.emplaceBack(s.al,0,s.al,0),_.emplaceBack(0,s.al,0,s.al),_.emplaceBack(s.al,s.al,s.al,s.al),this.mercatorBoundsBuffer=t.createVertexBuffer(_,s.bi.members),this.mercatorBoundsSegments=s.bg.simpleSegment(0,0,4,2);const g=new s.b0;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(g);const v=new s.be;for(const E of[0,1,3,2,0])v.emplaceBack(E);this.debugIndexBuffer=t.createIndexBuffer(v),this.emptyTexture=new s.T(t,new s.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bC();const b=this.context.gl;this.stencilClearMode=new ii({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,kt.disabled,this.stencilClearMode,fi.disabled,ei.disabled,Gu(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,r,c){if(!r||this.currentStencilSource===r.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let v=!1;for(const b of c)if(this._tileClippingMaskIDs[b.key]===void 0){v=!0;break}if(!v)return}this.currentStencilSource=r.id;const p=this.context,_=p.gl;this.nextStencilID+c.length>256&&this.clearStencil(),p.setColorMode(fi.disabled),p.setDepthMode(kt.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const v of c){const b=r.getTile(v),E=this._tileClippingMaskIDs[v.key]=this.nextStencilID++,{tileBoundsBuffer:C,tileBoundsIndexBuffer:z,tileBoundsSegments:R}=this.getTileBoundsBuffers(b);g.draw(this,_.TRIANGLES,kt.disabled,new ii({func:_.ALWAYS,mask:0},E,255,_.KEEP,_.KEEP,_.REPLACE),fi.disabled,ei.disabled,Gu(v.projMatrix),"$clipping",C,z,R)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,r=this.context.gl;return new ii({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const r=this.context.gl;return new ii({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}stencilConfigForOverlap(t){const r=this.context.gl,c=t.sort((g,v)=>
3018v.overscaledZ-g.overscaledZ),p=c[c.length-1].overscaledZ,_=c[0].overscaledZ-p+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const g={};for(let v=0;v<_;v++)g[v+p]=new ii({func:r.GEQUAL,mask:255},v+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=_,[g,c]}return[{[p]:ii.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new fi([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?fi.unblended:fi.alphaBlended}colorModeForDrapableLayerRenderPass(t){const r=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new fi([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new s.ao(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new fi([r.ONE,r.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,r.ONE_MINUS_SRC_ALPHA],s.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,r,c,p=!1){if(this.depthOcclusion)return new kt(this.context.gl.GREATER,kt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!p)return kt.disabled;const _=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new kt(c||this.context.gl.LEQUAL,r,[_,_])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,r=Math.ceil(this.width),c=Math.ceil(this.height),p=this.context.bindFramebuffer.get(),_=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),r!==0&&c!==0&&(this.depthFBO=new _y(this.context,r,c,0,"texture"),this.depthTexture=new s.T(this.context,{width:r,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(p),t.bindTexture(t.TEXTURE_2D,_),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,r,c,0,0,r,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,r)=>t+r/this._fpsHistory.length,0))}render(t,r){const c=s.o.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=r;const p=this.style._mergedLayers,_=!(!this.terrain||!this.terrain.enabled),g=()=>this.style._getOrder(_).filter(Ae=>{const fe=p[Ae];return!(fe.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[fe.type]});let v=g(),b=!1,E=!1,C=null,z=0,R=!1;for(const Ae of v){const fe=p[Ae];fe.visibility!=="none"&&(fe.type==="circle"?b=!0:fe.type==="building"?(C=fe,++z):fe.type==="symbol"&&(fe.hasOcclusionOpacityProperties?E=!0:b=!0))}this.updateEmissiveMode();let D=v.map(Ae=>p[Ae]);const B=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.o.now()),this.imageManager.beginFrame();for(const Ae in B){const fe=B[Ae];fe.used&&(fe.prepare(this.context),fe.getSource().usedInConflation&&++z)}let O=!1;for(const Ae of D)Ae.isHidden(this.transform.zoom)||(Ae.type==="clip"&&(O=!0),this.prepareLayer(Ae));const G={},U={},Z={},K={},W={};for(const Ae in B){const fe=B[Ae];G[Ae]=fe.getVisibleCoordinates(),U[Ae]=G[Ae].slice().reverse(),Z[Ae]=fe.getVisibleCoordinates(!0).reverse(),K[Ae]=fe.getShadowCasterCoordinates(),W[Ae]=fe.sortCoordinatesByDistance(G[Ae])}const le=Ae=>{const fe=this.style.getLayerSourceCache(Ae);return fe&&fe.used?fe.getSource():null};if(z||O||this._clippingActiveLastFrame){const Ae=[],fe=[];let Oe=0;for(const Me of D)this.isSourceForClippingOrConflation(Me,le(Me))&&(Ae.push(Me),fe.push(Oe)),Oe++;if(Ae&&(O||Ae.length>1)||this._clippingActiveLastFrame){O=!1;const Me=[];for(let Ze=0;Ze<Ae.length;
3018Ze++){const ft=Ae[Ze],bt=fe[Ze],ut=this.style.getLayerSourceCache(ft);if(!ut||!ut.used||!ut.getSource().usedInConflation&&ft.type!=="clip"&&ft.type!=="building")continue;let rt=s.eQ,Lt=s.b_.None;const Mt=[];let xt=!0;if(ft.type==="building")rt=s.eS;else if(ft.type==="clip"){rt=bt;for(const St of ft.layout.get("clip-layer-types"))Lt|=St==="model"?s.b_.Model:St==="symbol"?s.b_.Symbol:s.b_.FillExtrusion;for(const St of ft.layout.get("clip-layer-scope"))Mt.push(St);ft.isHidden(this.transform.zoom)?xt=!1:O=!0}xt&&Me.push({layer:ft.fqid,cache:ut,order:rt,clipMask:Lt,clipScope:Mt})}this.replacementSource.setSources(Me),R=!0}}this._clippingActiveLastFrame=O,R||this.replacementSource.clear(),this.conflationActive=R,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let Ae=0;Ae<D.length;Ae++){const fe=D[Ae];if(fe.visibility==="none")continue;const Oe=fe.cutoffRange();if(this.longestCutoffRange=Math.max(Oe,this.longestCutoffRange),Oe>0){const Me=le(fe);Me&&(this.minCutoffZoom=Math.max(Me.minzoom,this.minCutoffZoom)),fe.minzoom&&(this.minCutoffZoom=Math.max(fe.minzoom,this.minCutoffZoom))}fe.is3D(_)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ae),this._lastOcclusionLayer=Ae)}const ne=this.style&&this.style.fog;ne?(this._fogVisible=ne.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ne.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Z),this.opaquePassCutoff=0,v=g(),D=v.map(Ae=>p[Ae]));const se=this._shadowRenderer;if(se){se.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ae in B)for(const fe of G[Ae]){let Oe={min:0,max:0};this.terrain&&(Oe=this.terrain.getMinMaxForTile(fe)||Oe),se.addShadowReceiver(fe.toUnwrapped(),Oe.min,Oe.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ey(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ie=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),Q=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ie&&!this._snow&&(this._snow=new mm(this)),!ie&&this._snow&&(this._snow.destroy(),delete this._snow),Q&&!this._rain&&(this._rain=new qd(this)),!Q&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),C){this.buildingTileBorderManager||(this.buildingTileBorderManager=new jd);const Ae=this.style.getLayerSourceCache(C);this.buildingTileBorderManager.updateBorders(Ae,C)}if(!so.has(this.context.gl))return;this.renderPass="offscreen";for(const Ae of D){const fe=t.getLayerSourceCache(Ae);if(!Ae.hasOffscreenPass()||Ae.isHidden(this.transform.zoom))continue;const Oe=fe?U[fe.id]:void 0;(Ae.type==="custom"||Ae.type==="raster"||Ae.type==="raster-particle"||Ae.isSky()||Oe&&Oe.length)&&this.renderLayer(this,fe,Ae,Oe)}this.depthRangeFor3D=[0,1-(D.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,K)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ce=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),ve=(()=>{if(r.showOverdrawInspector)return s.ao.black;const Ae=this.style.fog;if(Ae&&this.transform.projection.supportsFog){const fe=this.style.getLut(Ae.scope);if(!ce){const Oe=Ae.properties.get("color-use-theme")==="none",Me=Ae.properties.get("color").toNonPremultipliedRenderColor(Oe?null:fe).toArray01();return new s.ao(...Me)}if(ce){const Oe=Ae.properties.get("space-color-use-theme")==="none",Me=Ae.properties.get("space-color").toNonPremultipliedRenderColor(Oe?null:fe).toArray01();return new s.ao(...Me)}}return s.ao.transparent})();if(this.context.clear({color:ve,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ce&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=v.length-1;this.currentLayer>=0;this.currentLayer--){const Ae=D[this.currentLayer],fe=t.getLayerSourceCache(Ae);if(Ae.isSky())continue;const Oe=fe?(Ae.is3D(_)?W:U)[fe.id]:void 0;this._renderTileClippingMasks(Ae,fe,Oe),this.renderLayer(this,fe,Ae,Oe)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ce&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isH
3018orizonVisible()))for(this.currentLayer=0;this.currentLayer<v.length;this.currentLayer++){const Ae=D[this.currentLayer],fe=t.getLayerSourceCache(Ae);Ae.isSky()&&this.renderLayer(this,fe,Ae,fe?U[fe.id]:void 0)}function ge(Ae,fe){let Oe;return fe&&(Oe=(Ae.type==="symbol"?Z:Ae.is3D(_)?W:U)[fe.id]),Oe}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<v.length;){const Ae=D[this.currentLayer];if(Ae.type==="raster"||Ae.type==="raster-particle"){const fe=t.getLayerSourceCache(Ae);this.renderLayer(this,fe,Ae,ge(Ae,fe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Le=0;se&&(Le=se.getShadowCastingLayerCount());let ze=!1,je=-1;for(let Ae=0;Ae<v.length;++Ae){const fe=D[Ae];fe.isHidden(this.transform.zoom)||fe.is3D(_)&&(je=Ae)}E&&je===-1&&(b=!0);let nt=!1;for(;this.currentLayer<v.length;){const Ae=D[this.currentLayer],fe=t.getLayerSourceCache(Ae);if(Ae.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(Ae)){if(Ae.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!nt&&Ae.is3D(_)&&!_){const Oe=this.currentLayer,Me=Ze=>{for(this.currentLayer=0;this.currentLayer<D.length;this.currentLayer++){const ft=D[this.currentLayer];if(Yo[ft.type]){const bt=this.style.getLayerSourceCache(ft);Yo[ft.type](this,bt,ft,ge(ft,bt),Ze)}}};Me("initialize"),Me("reset"),this.currentLayer=Oe,nt=!0}if(b&&!ze&&this.terrain&&!this.transform.isOrthographic&&(ze=!0,this.blitDepth()),E&&je!==-1&&this.currentLayer===je+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(Ae,fe,fe?G[fe.id]:void 0),this.renderLayer(this,fe,Ae,ge(Ae,fe)),!this.terrain&&se&&Le>0&&Ae.hasShadowPass()&&--Le==0){{this.clearStencil(),this.resetStencilClippingMasks();const Oe=this.currentLayer;for(this.currentLayer=0;this.currentLayer<D.length;this.currentLayer++){const Me=D[this.currentLayer];if(Wd[Me.type]){const Ze=this.style.getLayerSourceCache(Me);Wd[Me.type](this,Ze,Me,ge(Me,Ze))}}this.currentLayer=Oe}if(se.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Oe=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Oe;this.currentLayer++){const Me=D[this.currentLayer];if(!Me.hasLightBeamPass())continue;const Ze=t.getLayerSourceCache(Me);this.renderLayer(this,Ze,Me,Ze?U[Ze.id]:void 0)}this.currentLayer=Oe,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Oe=this.currentLayer;this.depthOcclusion=!0;for(const Me of this.layersWithOcclusionOpacity){this.currentLayer=Me;const Ze=D[this.currentLayer],ft=t.getLayerSourceCache(Ze),bt=ft?U[ft.id]:void 0;this.terrain||this._renderTileClippingMasks(Ze,ft,ft?G[ft.id]:void 0),this.renderLayer(this,ft,Ze,bt)}this.depthOcclusion=!1,this.currentLayer=Oe,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 Ae=null;D.forEach(fe=>{const Oe=t.getLayerSourceCache(fe);Oe&&!fe.isHidden(this.transform.zoom)&&Oe.getVisibleCoordinates().length&&(!Ae||Ae.getSource().maxzoom<Oe.getSource().maxzoom)&&(Ae=Oe)}),Ae&&this.options.showTileBoundaries&&ct(this,Ae,Ae.getVisibleCoordinates(),s.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&ct(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(Ae){const fe=Ae.transform.padding;Yl(Ae,Ae.transform.height-(fe.top||0),3,xy),Yl(Ae,fe.bottom||0,3,wy),Un(Ae,fe.left||0,3,by),Un(Ae,Ae.transform.width-(fe.right||0),3,Wl);const Oe=Ae.transform.centerPoint;(function(Me,Ze,ft,bt){be(Me,Ze-1,ft-10,2,20,bt),be(Me,Ze-10,ft-1,20,2,bt)})(Ae,Oe.x,Ae.transform.height-Oe.y,Xl)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
3018anvasCopy()),R||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:r}=this.transform.projection,c=!r||!r.includes(t.type);if(Zd[t.type]&&(c||this.terrain&&t.type==="custom")){const p=this.style.getLayerSourceCache(t);Zd[t.type](t,p,this)}this.gpuTimingEnd()}renderLayer(t,r,c,p){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||p&&p.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||ml[c.type](t,r,c,p,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const r=this.context.extTimerQuery,c=this.context.gl;let p=this.gpuTimers[t.id];p||(p=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),p.calls++,c.beginQuery(r.TIME_ELAPSED_EXT,p.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,r=this.context.gl,c=r.createQuery();this.deferredRenderGpuTimeQueries.push(c),r.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const r={};for(const c in t){const p=t[c],_=this.context.extTimerQuery,g=_.getQueryParameter(p.query,this.context.gl.QUERY_RESULT)/1e6;_.deleteQueryEXT(p.query),r[c]=g}return r}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const r=this.context.gl;let c=0;for(const p of t)c+=r.getQueryParameter(p,r.QUERY_RESULT)/1e6,r.deleteQuery(p);return c}translatePosMatrix(t,r,c,p,_){if(!c[0]&&!c[1])return t;const g=_?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(g){const E=Math.sin(g),C=Math.cos(g);c=[c[0]*C-c[1]*E,c[0]*E+c[1]*C]}const v=[_?c[0]:s.ay(r,c[0],this.transform.zoom),_?c[1]:s.ay(r,c[1],this.transform.zoom),0],b=new Float32Array(16);return s.br(b,t,v),b}saveTileTexture(t){if(t.context!==this.context)return;const r=t.size[0],c=this._tileTextures[r];c?c.push(t):this._tileTextures[r]=[t]}getTileTexture(t){const r=this._tileTextures[t];return r&&r.length>0?r.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,r,c){const p=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,_=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(_.push("LIGHTING_3D_MODE"),_.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):p||_.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||_.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(_.push("TERRAIN"),this.linearFloatFilteringSupported()&&_.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&_.push("GLOBE"),!this._fogVisible||p||r!==void 0&&!r||_.push("FOG","FOG_DITHERING"),p&&_.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&_.push("OVERDRAW_INSPECTOR"),_}getOrCreateProgram(t,r){this.cache=this.cache||{};const c=r&&r.defines||[],p=r&&r.config,_=this.currentGlobalDefines(t,r&&r.overrideFog,r&&r.overrideRtt).concat(c),g=ry.cacheKey(Vf[t],t,_,p);return this.cache[g]||(this.cache[g]=new ry(this.context,t,Vf[t],p,Ld[t],_)),this.cache[g]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
3018stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,r){if(this.style.enable3dLights()){const c=this.style.directionalLight,p=this.style.ambientLight;if(c&&p){const _=((g,v,b)=>{const E=g.properties.get("direction"),C=g.properties.get("color-use-theme")==="none",z=g.properties.get("color").toNonPremultipliedRenderColor(C?null:b.getLut(g.scope)).toArray01(),R=g.properties.get("intensity"),D=v.properties.get("color-use-theme")==="none",B=v.properties.get("color").toNonPremultipliedRenderColor(D?null:b.getLut(v.scope)).toArray01(),O=v.properties.get("intensity"),G=[E.x,E.y,E.z],U=s.dN(B,O),Z=s.dN(z,R);return{u_lighting_ambient_color:U,u_lighting_directional_dir:G,u_lighting_directional_color:Z,u_ground_radiance:Vc(G,Z,U)}})(c,p,this.style);r.setLightsUniformValues(t,_)}}}uploadCommonUniforms(t,r,c,p,_){if(this.uploadCommonLightUniforms(t,r),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const v=g.getOpacity(this.transform.pitch),b=((E,C,z,R,D,B,O,G,U,Z,K,W)=>{const le=E.transform,ne=C.properties.get("color-use-theme")==="none",se=C.properties.get("color").toNonPremultipliedRenderColor(ne?null:E.style.getLut(C.scope)).toArray01();se[3]=R;const ie=E.frameCounter/1e3%1,[Q,ce]=C.properties.get("vertical-range");return{u_fog_matrix:z?le.calculateFogTileMatrix(z):W||E.identityMat,u_fog_range:C.getFovAdjustedRange(le._fov),u_fog_color:se,u_fog_horizon_blend:C.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(Q,ce),ce],u_fog_temporal_offset:ie,u_frustum_tl:D,u_frustum_tr:B,u_frustum_br:O,u_frustum_bl:G,u_globe_pos:U,u_globe_radius:Z,u_viewport:K,u_globe_transition:s.aj(le.zoom),u_is_globe:+(le.projection.name==="globe")}})(this,g,c,v,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.o.devicePixelRatio,this.transform.height*s.o.devicePixelRatio],p);r.setFogUniformValues(t,b)}_&&r.setCutoffUniformValues(t,_.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,r=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const p of c)r[p.key]=t[p.key]||new Bl(p,512,this.transform.tileZoom,this,void 0,this.worldview);return r}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,r){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!r||r.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let r=this._cachedTileFogOpacities[t.key];return r||(this._cachedTileFogOpacities[t.key]=r=this.style.fog.getOpacityForTile(t)),r[0]>=Ue||r[1]>=Ue}setupDepthForOcclusion(t,r,c){const p=this.context,_=p.gl,g=!!c;var v;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),p.activeTexture.set(_.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((v=this.depthRangeFor3D)[1]-v[0]),-1-2*v[0]/(v[1]-v[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
vendor: 16,948 bytes, line 3018
3018DepthTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE),p.activeTexture.set(_.TEXTURE0),g||r.setTerrainUniformValues(p,c)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function Yd(l,t){let r=!1,c=null;const p=()=>{c=null,r&&(l(),c=setTimeout(p,t),r=!1)};return()=>(r=!0,c||p(),c)}class _m{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Yd(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const r=mr(t);if(this._hashName){const c=this._hashName;let p=!1;const _=location.hash.slice(1).split("&").map(g=>{const v=g.split("=")[0];return v===c?(p=!0,`${v}=${r}`):g}).filter(g=>g);return p||_.push(`${c}=${r}`),`#${_.join("&")}`}return`#${r}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let r;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(r=c)}),(r&&r[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const r=this._getCurrentHash();if(r.length>=3&&!r.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(r[3]||0):t.getBearing();return t.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:c,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function mr(l,t){const r=l.getCenter(),c=Math.round(100*l.getZoom())/100,p=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,p),g=Math.round(r.lng*_)/_,v=Math.round(r.lat*_)/_,b=l.getBearing(),E=l.getPitch();let C=t?`/${g}/${v}/${c}`:`${c}/${v}/${g}`;return(b||E)&&(C+="/"+Math.round(10*b)/10),E&&(C+=`/${Math.round(E)}`),C}const Zc={linearity:.3,easing:s.eT(0,0,.3,1)},gm=Object.assign({deceleration:2500,maxSpeed:1400},Zc),ym=Object.assign({deceleration:20,maxSpeed:1400},Zc),ec=Object.assign({deceleration:1e3,maxSpeed:360},Zc),vm=Object.assign({deceleration:1e3,maxSpeed:90},Zc);class xm{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,r=s.o.now();for(;t.length>0&&r-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const r={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)r.zoom+=_.zoomDelta||0,r.bearing+=_.bearingDelta||0,r.pitch+=_.pitchDelta||0,_.panDelta&&r.pan._add(_.panDelta),_.around&&(r.around=_.around),_.pinchAround&&(r.pinchAround=_.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(r.pan.mag()){const _=aa(r.pan.mag(),c,Object.assign({},gm,t||{}));p.offset=r.pan.mult(_.amount/r.pan.mag()),p.center=this._map.transform.center,Wc(p,_)}if(r.zoom){const _=aa(r.zoom,c,ym);p.zoom=this._map.transform.zoom+_.amount,Wc(p,_)}if(r.bearing){const _=aa(r.bearing,c,ec);p.bearing=this._map.transform.bearing+s.aA(_.amount,-179,179),Wc(p,_)}if(r.pitch){const _=aa(r.pitch,c,vm);p.pitch=this._map.transform.pitch+_.amount,Wc(p,_)}if(p.zoom||p.bearing){const _=r.pinchAround===void 0?r.around:r.pinchAround;p.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),p.noMoveStart=!0,p}}function Wc(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function aa(l,t,r){const{maxSpeed:c,linearity:p,deceleration:_}=r,g=s.aA(l*p/(t/1e3),-c,c),v=Math.abs(g)/(_*p);return{easing:r.easing,duration:1e3*v,amount:g*(v/2)}}class Ao extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,c,p={}){const _=si(r.getCanvasContainer(),c),g=r.unproject(_);super(t,Object.assign({point:_,lngLat:g,originalEvent:c},p)),this._defaultPrevented=!1,this.target=r}}class _l extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,c){const p=t==="touchend"?c.changedTouches:c.touches,_=ji(r.getCanvasContainer(),p),g=_.map(b=>r.unproject(b)),v=_.reduce((b,E,C,z)=>b.add(E.div(z.length)),new s.P(0,0));super(t,{points:_,point:v,lngLats:g,lngLat:r.unproject(v),originalEvent:c}),this._defaultPrevented=!1}}class wm extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class Kd{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new wm(this._map,t))}mousedown(t,r){return this._mousedownPos=r,this._firePreventable(new Ao(t.type,this._map,t))}mouseup(t){this._map.fire(new Ao(t.type,this._map,t))}preclick(t){const r=new MouseEvent("preclick",t);this._map.fire(new Ao(r.type,this._map,r))}click(t,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Ao(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Ao(t.type,this._map,t))}mouseover(t){this._map.fire(new Ao(t.type,this._map,t))}mouseout(t){this._map.fire(new Ao(t.type,this._map,t))}touchstart(t){return this._firePreventable(new _l(t.type,this._map,t))}touchmove(t){this._map.fire(new _l(t.type,this._map,t))}touchend(t){this._map.fire(new _l(t.type,this._map,t))}touchcancel(t){this._map.fire(new _l(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bm{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Ao(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ao("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ao(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Jd{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._container=t.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(t,r){this.isEnabled()&&t.shiftKey&&t.button===0&&(dt(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(t,r){if(!this._active)return;const c=r,p=this._startPos,_=this._lastPos;if(!p||!_||_.equals(c)||!this._box&&c.dist(p)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=at("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const g=Math.min(p.x,c.x),v=Math.max(p.x,c.x),b=Math.min(p.y,c.y),E=Math.max(p.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${g}px,${b}px)`,this._box.style.width=v-g+"px",this._box.style.height=E-b+"px")})}mouseupWindow(t,r){if(!this._active)return;const c=this._startPos,p=r;if(c&&t.button===0){if(this.reset(),qt(),c.x!==p.x||c.y!==p.y)return this._map.fire(new s.z("boxzoomend",{originalEvent:t})),{cameraAnimation:_=>_.fitScreenCoordinates(c,p,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Vt(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new s.z(t,{originalEvent:r}))}}function Qd(l,t){const r={};for(let c=0;c<l.length;c++)r[l[c].identifier]=t[c];return r}class Ly{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,r,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(p){const _=new s.P(0,0);for(const g of p)_._add(g);return _.div(p.length)}(r),this.touches=Qd(c,r)))}touchmove(t,r,c){if(this.aborted||!this.centroid)return;const p=Qd(c,r);for(const _ in this.touches){const g=p[_];(!g||g.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(t,r,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class ep{constructor(t){this.singleTap=new Ly(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,r,c){this.singleTap.touchstart(t,r,c)}touchmove(t,r,c){this.singleTap.touchmove(t,r,c)}touchend(t,r,c){const p=this.singleTap.touchend(t,r,c);if(p){const _=t.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(p)<30;if(_&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class zy{constructor(){this._zoomIn=new ep({numTouches:1,numTaps:2}),this._zoomOut=new ep({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,r,c){this._zoomIn.touchstart(t,r,c),this._zoomOut.touchstart(t,r,c)}touchmove(t,r,c){this._zoomIn.touchmove(t,r,c),this._zoomOut.touchmove(t,r,c)}touchend(t,r,c){const p=this._zoomIn.touchend(t,r,c),_=this._zoomOut.touchend(t,r,c);return p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(p)},{originalEvent:t})}):_?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(_)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Dy={0:1,2:2},Tm={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class tp{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,r){return!1}_move(t,r){return{}}mousedown(t,r){if(this._lastPoint)return;const c=Ui(t);this._correctButton(t,c)&&(this._lastPoint=r,this._eventButton=c)}mousemoveWindow(t,r){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&function(p,_){const g=Dy[_];return p.buttons===void 0||(p.buttons&g)!==g}(t,this._eventButton))this.reset();else if(this._moved||!(r.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(c,r)}}mouseupWindow(t){this._lastPoint&&Ui(t)===this._eventButton&&(this._moved&&qt(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ky extends tp{mousedown(t,r){super.mousedown(t,r),this._lastPoint&&(this._active=!0)}_correctButton(t,r){return r===0&&!t.ctrlKey}_move(t,r){return{around:r,panDelta:r.sub(t)}}}class Sm extends tp{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Tm[t.pitchRotateKey]:void 0}_correctButton(t,r){return this._pitchRotateKey?r===0&&t[this._pitchRotateKey]:r===0&&t.ctrlKey||r===2}_move(t,r){const c=.8*(r.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Em extends tp{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Tm[t.pitchRotateKey]:void 0}_correctButton(t,r){return this._pitchRotateKey?r===0&&t[this._pitchRotateKey]:r===0&&t.ctrlKey||r===2}_move(t,r){const c=-.5*(r.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Oy{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),s.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(t,r,c){return this._calculateTransform(t,r,c)}touchmove(t,r,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!s.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,r,c)}}touchend(t,r,c){this._calculateTransform(t,r,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,c){c.length>0&&(this._active=!0);const p=Qd(c,r),_=new s.P(0,0),g=new s.P(0,0);let v=0;for(const E in p){const C=p[E],z=this._touches[E];z&&(_._add(C),g._add(C.sub(z)),v++,p[E]=C)}if(this._touches=p,v<this._minTouches||!g.mag())return;const b=g.div(v);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:_.div(v),panDelta:b}}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=at("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 ip{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,r,c){return{}}touchstart(t,r,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([r[0],r[1]]))}touchmove(t,r,c){const p=this._firstTwoTouches;if(!p)return;t.preventDefault();const[_,g]=p,v=Qu(c,r,_),b=Qu(c,r,g);if(!v||!b)return;const E=this._aroundCenter?null:v.add(b).div(2);return this._move([v,b],E,t)}touchend(t,r,c){if(!this._firstTwoTouches)return;const[p,_]=this._firstTwoTouches,g=Qu(c,r,p),v=Qu(c,r,_);g&&v||(this._active&&qt(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Qu(l,t,r){for(let c=0;c<l.length;c++)if(l[c].identifier===r)return t[c]}function Fy(l,t){return Math.log2(l/t)}class f1 extends ip{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,r){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Fy(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Fy(this._distance,c),pinchAround:r}}}function By(l,t){return 180*l.angleWith(t)/Math.PI}class zn extends ip{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,r){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:By(this._vector,c),pinchAround:r}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const r=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const p=By(t,c);return Math.abs(p)<r}}
vendor: 4,268 bytes, line 3018
3018function np(l){return Math.abs(l.y)>Math.abs(l.x)}class m1 extends ip{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,np(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,r,c){const p=this._lastPoints;if(!p)return;const _=t[0].sub(p[0]),g=t[1].sub(p[1]);return this._map._cooperativeGestures&&!s.eU()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(_,g,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(_.y+g.y)/2*-.5})}gestureBeginsVertically(t,r,c){if(this._valid!==void 0)return this._valid;const p=t.mag()>=2,_=r.mag()>=2;if(!p&&!_)return;if(!p||!_)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const g=t.y>0==r.y>0;return np(t)&&np(r)&&g}}const _1={panStep:100,bearingStep:15,pitchStep:10};class g1{constructor(){const t=_1;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,c=0,p=0,_=0,g=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),_=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),_=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),g=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(c=0,p=0),{cameraAnimation:v=>{const b=v.getZoom();v.easeTo({duration:300,easeId:"keyboardHandler",easing:eh,zoom:r?Math.round(b)+r*(t.shiftKey?2:1):b,bearing:v.getBearing()+c*this._bearingStep,pitch:v.getPitch()+p*this._pitchStep,offset:[-_*this._panStep,-g*this._panStep],center:v.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function eh(l){return l*(2-l)}const Im=4.000244140625,Am=1/450;class rp{constructor(t,r){this._map=t,this._el=t.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Am,s.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.o.now(),p=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,r!==0&&r%Im==0?this._type="wheel":r!==0&&Math.abs(r)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const r=si(this._el,t);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._triggerRe
3018nderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const r=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const E=this._type==="wheel"&&Math.abs(this._delta)>Im?this._wheelZoomRate:this._defaultZoomRate;let C=2/(1+Math.exp(-Math.abs(this._delta*E)));this._delta<0&&C!==0&&(C=1/C);const z=r(),R=Math.pow(2,z),D=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):R;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(D*C))),this._type==="wheel"&&(this._startZoom=z,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:r(),p=this._startZoom,_=this._easing;let g,v=!1;if(this._type==="wheel"&&p&&_){const E=Math.min((s.o.now()-this._lastWheelEventTime)/200,1),C=_(E);g=s.ak(p,c,C),E<1?this._frameId||(this._frameId=!0):v=!0}else g=c,v=!0;this._active=!0,v&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let b=g-r();return b*this._lastDelta<0&&(b=0),{noInertia:!0,needsRenderFrame:!v,zoomDelta:b,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=s.eV;if(this._prevEase){const c=this._prevEase,p=(s.o.now()-c.start)/c.duration,_=c.easing(p+.01)-c.easing(p),g=.27/Math.sqrt(_*_+1e-4)*.01,v=Math.sqrt(.0729-g*g);r=s.eT(g,v,.25,1)}return this._prevEase={start:s.o.now(),duration:t,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=at("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Da{constructor(t,r){this._clickZoom=t,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 op{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,r){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _r{constructor(){this._tap=new ep({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,r,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=r[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,r,c))}touchmove(t,r,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const p=r[0],_=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(t,r,c)}touchend(t,r,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,r,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class la{constructor(t,r,c){this._el=t,this._mousePan=r,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class th{constructor(t,r,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=r,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class sp{constructor(t,r,c,p){this._el=t,this._touchZoom=r,this._touchRotate=c,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ih=l=>l.zoom||l.drag||l.pitch||l.rotate;class y1 extends s.z{}class nh{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,r){const c=s.av([],r,t);
vendor: 4,200 bytes, line 3018
3018this.radius=s.ag(c[2]<0?s.eX([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eX(t,t,this.constants),s.aw(t,t),s.eY(t,t,this.constants);const r=s.c5([],t,this.radius);if(r[2]>0){const c=s.c5([],[0,0,1],s.bJ(r,[0,0,1])),p=s.c5([],s.aw([],[r[0],r[1],0]),this.radius),_=s.d8([],r,s.c5([],s.av([],s.d8([],p,c),r),2));r[0]=_[0],r[1]=_[1]}return r}}function ap(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class v1{constructor(t,r){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xm(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new nh,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),s.aY(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,_,g]of this._listeners){const v=p===document?this.handleWindowEvent:this.handleEvent;p.addEventListener(_,v,g)}}destroy(){for(const[t,r,c]of this._listeners){const p=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(r,p,c)}}_addDefaultHandlers(t){const r=this._map,c=r.getCanvasContainer();this._add("mapEvent",new Kd(r,t));const p=r.boxZoom=new Jd(r,t);this._add("boxZoom",p);const _=new zy,g=new op;r.doubleClickZoom=new Da(g,_),this._add("tapZoom",_),this._add("clickZoom",g);const v=new _r;this._add("tapDragZoom",v);const b=r.touchPitch=new m1(r);this._add("touchPitch",b);const E=new Sm(t),C=new Em(t);r.dragRotate=new th(t,E,C),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",C,["mouseRotate"]);const z=new ky(t),R=new Oy(r,t);r.dragPan=new la(c,z,R),this._add("mousePan",z),this._add("touchPan",R,["touchZoom","touchRotate"]);const D=new zn,B=new f1;r.touchZoomRotate=new sp(c,B,D,v),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]),this._add("blockableMapEvent",new bm(r));const O=r.scrollZoom=new rp(r,this);this._add("scrollZoom",O,["mousePan"]);const G=r.keyboard=new g1;this._add("keyboard",G);for(const U of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[U]&&r[U].enable(t[U])}_add(t,r,c){this._handlers.push({handlerName:t,handler:r,allowed:c}),this._handlersById[t]=r}stop(t){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ih(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,r,c){for(const p in t)if(p!==c&&(!r||r.indexOf(p)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const r=[];for(const c of t)this._el.contains(c.target)&&r.push(c);return r}handleEvent(t,r){this._updatingCamera=!0;const c=t.type==="renderFrame",p=c?void 0:t,_={needsRenderFrame:!1},g={},v={},b=t.touches?this._getMapTouches(t.touches):void 0,E=b?ji(this._el,b):c?void 0:si(this._el,t);for(const{handlerName:R,handler:D,allowed:B}of this._handlers){if(!D.isEnabled())continue;let O;this._blockedByActive(v,B,R)?D.reset():D[r||t.type]&&(O=D[r||t.type](t,E,b),this.mergeHandlerResult(_,g,O,R,p),O&&O.needsRenderFrame&&this._triggerRenderFrame()),(O||D.isActive())&&(v[R]=D)}const C={};for(const R in this._previousActiveHandlers)v[R]||(C[R]=p);this._previousActiveHandlers=v,(Object.keys(C).length||ap(_))&&(this._changes.push([_,g,C]),this._triggerRe
3018nderFrame()),(Object.keys(v).length||ap(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:z}=_;z&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],z(this._map))}mergeHandlerResult(t,r,c,p,_){if(!c)return;Object.assign(t,c);const g={handlerName:p,originalEvent:c.originalEvent||_};c.zoomDelta!==void 0&&(r.zoom=g),c.panDelta!==void 0&&(r.drag=g),c.pitchDelta!==void 0&&(r.pitch=g),c.bearingDelta!==void 0&&(r.rotate=g)}_applyChanges(){const t={},r={},c={};for(const[p,_,g]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(t.around=p.around),p.aroundCoord!==void 0&&(t.aroundCoord=p.aroundCoord),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),Object.assign(r,_),Object.assign(c,g);this._updateMapTransform(t,r,c),this._changes=[]}_updateMapTransform(t,r,c){const p=this._map,_=p.transform,g=Z=>[Z.x,Z.y,Z.z];if((Z=>{const K=this._eventsInProgress.drag;return K&&!this._handlersById[K.handlerName].isActive()})()&&!ap(t)){const Z=_.zoom;_.cameraElevationReference="sea",this._originalZoom!=null&&_._orthographicProjectionAtLowPitch&&_.projection.name!=="globe"&&_.pitch===0?(_.cameraElevationReference="ground",_.zoom=this._originalZoom):(_.recenterOnTerrain(),_.cameraElevationReference="ground"),Z!==_.zoom&&this._map._update(!0)}if(_._isCameraConstrained&&p._stop(!0),!ap(t))return void this._fireEvents(r,c,!0);let{panDelta:v,zoomDelta:b,bearingDelta:E,pitchDelta:C,around:z,aroundCoord:R,pinchAround:D}=t;_._isCameraConstrained&&(b>0&&(b=0),_._isCameraConstrained=!1),D!==void 0&&(z=D),(b||(Z=>r[Z]&&!this._eventsInProgress[Z])("drag"))&&z&&(this._dragOrigin=g(_.pointCoordinate3D(z)),this._originalZoom=_.zoom,this._trackingEllipsoid.setup(_._camera.position,this._dragOrigin)),_.cameraElevationReference="sea",p._stop(!0),z=z||p.transform.centerPoint,E&&(_.bearing+=E),C&&(_.pitch+=C),_._updateCameraState();const B=[0,0,0];if(v)if(_.projection.name==="mercator"){const Z=this._trackingEllipsoid.projectRay(_.screenPointToMercatorRay(z).dir),K=this._trackingEllipsoid.projectRay(_.screenPointToMercatorRay(z.sub(v)).dir);B[0]=K[0]-Z[0],B[1]=K[1]-Z[1]}else{const Z=_.pointCoordinate(z);if(_.projection.name==="globe"){v=v.rotate(-_.angle);const K=_._pixelsPerMercatorPixel/_.worldSize;B[0]=-v.x*s.eW(s.a$(Z.y))*K,B[1]=-v.y*s.eW(_.center.lat)*K}else{const K=_.pointCoordinate(z.sub(v));Z&&K&&(B[0]=K.x-Z.x,B[1]=K.y-Z.y)}}const O=_.zoom,G=[0,0,0];if(b){const Z=g(R||_.pointCoordinate3D(z)),K={dir:s.aw([],s.av([],Z,_._camera.position))};if(K.dir[2]<0){const W=_.zoomDeltaToMovement(Z,b);s.c5(G,K.dir,W)}}const U=s.d8(B,B,G);_._translateCameraConstrained(U),b&&Math.abs(_.zoom-O)>1e-4&&_.recenterOnTerrain(),_.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,c,!0)}_fireEvents(t,r,c){const p=ih(this._eventsInProgress),_=ih(t),g={};for(const C in t){const{originalEvent:z}=t[C];this._eventsInProgress[C]||(g[`${C}start`]=z),this._eventsInProgress[C]=t[C]}!p&&_&&this._fireEvent("movestart",_.originalEvent);for(const C in g)this._fireEvent(C,g[C]);_&&this._fireEvent("move",_.originalEvent);for(const C in t){const{originalEvent:z}=t[C];this._fireEvent(C,z)}const v={};let b;for(const C in this._eventsInProgress){const{handlerName:z,originalEvent:R}=this._eventsInProgress[C];this._handlersById[z].isActive()||(delete this._eventsInProgress[C],b=r[z]||R,v[`${C}end`]=b)}for(const C in v)this._fireEvent(C,v[C]);const E=ih(this._eventsInProgress);if(c&&(p||_)&&!E){this._updatingCamera=!0;const C=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=R=>R!==0&&-this._bearingSnap<R&&R<this._bearingSnap;C?(z(C.bearing||this._map.getBearing())&&(C.bearing=0),this._map.easeTo(C,{originalEvent:b})):(this._map.fire(new s.z("moveend",{originalEvent:b})),z(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new s.z(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new y1("renderFrame",{timeStamp:t})),this._applyChanges()})}
vendor: 9,499 bytes, line 3018
3018_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const lp="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Cm extends s.E{constructor(t,r){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=r.respectPrefersReducedMotion!==!1,s.aY(["_renderFrameCallback"],this)}getCenter(){return new s.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(t,r){return this.jumpTo({center:t},r)}panBy(t,r,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},r),c)}panTo(t,r,c){return this.easeTo(Object.assign({center:t},r),c)}getZoom(){return this.transform.zoom}setZoom(t,r){return this.jumpTo({zoom:t},r),this}zoomTo(t,r,c){return this.easeTo(Object.assign({zoom:t},r),c)}zoomIn(t,r){return this.zoomTo(this.getZoom()+1,t,r),this}zoomOut(t,r){return this.zoomTo(this.getZoom()-1,t,r),this}getBearing(){return this.transform.bearing}setBearing(t,r){return this.jumpTo({bearing:t},r),this}getPadding(){return this.transform.padding}setPadding(t,r){return this.jumpTo({padding:t},r),this}rotateTo(t,r,c){return this.easeTo(Object.assign({bearing:t},r),c)}resetNorth(t,r){return this.rotateTo(0,Object.assign({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},t),r),this}snapToNorth(t,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,r):this}getPitch(){return this.transform.pitch}setPitch(t,r){return this.jumpTo({pitch:t},r),this}cameraForBounds(t,r){t=s.aI.convert(t);const c=r&&r.bearing||0,p=r&&r.pitch||0,_=t.getNorthWest(),g=t.getSouthEast();return this._cameraForBounds(this.transform,_,g,c,p,r)}_extendPadding(t){const r={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},r,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},r,t)}_extendCameraOptions(t){return(t=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,r){const c=r.max[0]-r.min[0],p=r.max[1]-r.min[1];return c/p>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):p/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,r,c,p,_,g){const v=t.clone(),b=this._extendCameraOptions(g);v.bearing=p,v.pitch=_;const E=s.aT.convert(r),C=s.aT.convert(c),z=.5*(E.lat+C.lat),R=.5*(E.lng+C.lng),D=s.eZ(z,R),B=s.aw([],D),O=s.aw([],s.bI([],B,[0,1,0])),G=s.bI([],O,B),U=[O[0],O[1],O[2],0,G[0],G[1],G[2],0,B[0],B[1],B[2],0,0,0,0,1],Z=[D,s.eZ(E.lat,E.lng),s.eZ(C.lat,E.lng),s.eZ(C.lat,C.lng),s.eZ(E.lat,C.lng),s.eZ(z,E.lng),s.eZ(z,C.lng),s.eZ(E.lat,R),s.eZ(C.lat,R)];let K=s.d9.fromPoints(Z.map(Me=>[s.bJ(O,Me),s.bJ(G,Me),s.bJ(B,Me)]));const W=s.af([],K.center,U);s.e_(W)===0&&s.e$(W,0,0,1),s.aw(W,W),s.c5(W,W,s.aD),v.center=s.f0(W);const le=v.getWorldToCameraMatrix(),ne=s.bl(new Float64Array(16),le);K=s.d9.applyTransform(K,s.aB([],le,U));const se=this._extendAABB(K,v,b,p);if(!se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");K=se,s.af(W,W,le);const ie=.5*(K.max[2]-K.min[2]),Q=this._minimumAABBFrustumDistance(v,K),ce=s.c5([],[0,0,1],ie),ve=s.d8(ce,W,ce),ge=Q+(v.pitch===0?0:s.bG(W,ve)),Le=v.globeCenterInViewSpace,ze=s.av([],W,[Le[0],Le[1],Le[2]]);s.aw(ze,ze),s.c5(ze,ze,ge);const je=s.d8([],W,ze);s.af(je,je,ne);const nt=s.eM/s.aD,Ae=s.ag(je),fe=s.cf(Math.max(Ae*nt-s.eM,Number.EPSILON),0),Oe=Math.min(v.zoomFromMercatorZAdjusted(fe),b.maxZoom);return Oe>.5*(s.c_+s.cL)?(v.setProjection({name:"mercator"}),v.zoom=Oe,this._cameraForBounds(v,r,c,p,_,g)):{center:v.center,zoom:Oe,bearing:p,pitch:_}}_extendAABB(t,r,c,p){const _=.5*((c.padding.left||0)+(c.padding.right||0)),g=.5*((c.padding.top||0)+(c.padding.bottom||0)),v=g,b=_,E=_,C=g,z=r.width-(b+E),R=r.height-(v+C),D=s.av([],t.max,t.min),B=Math.min(z/D[0],R/D[1]),O=Math.min(r.scaleZoom(r.scale*B),c.maxZoom);if(isNaN(O))return null;const G=r.scale/r.zoomScale(O),U=new s.d9([t.min[0]-b*G,t.min[1]-C*G,t.min[2]],[t.max[0]+E*G,t.max[1]+v*G,t.max[2]]),Z=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.an(p));return U.center[0]-=Z.x*G,U.center[1]+=Z.y*G,U}queryTerrainElevation(t,r){const c=this.transform.elevation;return c?(r=Object.assign({},{exaggerated:!0},r),c.getAtPoint(s.ae.fromLngLat(t),null,r.exaggerated)):null}_cameraForBounds(t,r,c,p,_,g){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,r,c,p,_,g);const v=t.clone(),b=this._extendCameraOptions(g);v.bearing=p,v.pitch=_;const E=s.aT.convert(r),C=s.aT.convert(c),z=new s.aT(E.lng,C.lat),R=new s.aT(C.lng,E.lat),D=v.project(E),B=v.project(C),O=this.queryTerrainElevation(E),G=this.queryTerrainElevation(C),U=this.queryTerrainElevation(z),Z=this.queryTerrainElevation(R),K=[[D.x,D.y,Math.min(O||0,G||0,U||0,Z||0)],[B.x,B.y,Math.max(O||0,G||0,U||0,Z||0)]];let W=s.d9.fromPoints(K);const le=v.getWorldToCameraMatrix(),ne=s.bl(new Float64Array(16),le);W=s.d9.applyTransform(W,le);const se=this._extendAABB(W,v,b,p);if(!se)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");W=se;const ie=.5*s.av([],W.max,W.min)[2],Q=this._minimumAABBFrustumDistance(v,W),ce=[0,0,1,0];s.aC(ce,ce,le),s.f1(ce,ce);const ve=s.c5([],ce,Q+ie),ge=s.d8([],W.center,ve);s.af(W.center,W.center,ne),s.af(ge,ge,ne);const Le=v.unproject(new s.P(W.center[0],W.center[1])),ze=s.f2(v.projection,Le),je=Math.pow(2,ze),nt=Math.min(v._zoomFromMercatorZ(ge[2]*v.pixelsPerMeter*je/v.worldSize),b.maxZoom);return v.mercatorFromTransition&&nt<.5*(s.c_+s.cL)?(v.setProjection({name:"globe"}),v.zoom=nt,this._cameraForBounds(v,r,c,p,_,g)):{center:Le,zoom:nt,bearing:p,pitch:_}}fitBounds(t,r,c){const p=this.cameraForBounds(t,r);return this._fitInternal(p,r,c)}fitScreenCoordinates(t,r,c,p,_){const g=s.P.convert(t),v=s.P.convert(r),b=new s.P(Math.min(g.x,v.x),Math.min(g.y,v.y)),E=new s.P(Math.max(g.x,v.x),Math.max(g.y,v.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,v))return this;const C=this.transform.pointLocation3D(b),z=this.transform.pointLocation3D(E),R=this.transform.pointLocation3D(new s.P(b.x,E.y)),D=this.transform.pointLocation3D(new s.P(E.x,b.y)),B=[Math.min(C.lng,z.lng,R.lng,D.lng),Math.min(C.lat,z.lat,R.lat,D.lat)],O=[Math.max(C.lng,z.lng,R.lng,D.lng),Math.max(C.lat,z.lat,R.lat,D.lat)],G=p&&p.pitch?p.pitch:this.getPitch(),U=this._cameraForBounds(this.transform,B,O,c,G,p);return this._fitInternal(U,p,_)}_fitInternal(t,r,c){return t?(r=Object.assign(t,r)).linear?this.easeTo(r,c):this.flyTo(r,c):this}jumpTo(t,r){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let p=!1,_=!1,g=!1;"zoom"in t&&c.zoom!==+t.zoom&&(p=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.aT.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(_=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(g=!0,c.pitch=+t.pitch);const v=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(v))if(t.retainPadding===!1){const b=c.clone();b.padding=v,c.setLocationAtPoint(c.center,b.centerPoint)}else c.padding=v;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.z("movestart",r)).fire(new s.z("move",r)),p&&this.fire(new s.z("zoomstart",r)).fire(new s.z("zoom",r)).fire(new s.z("zoomend",r)),_&&this.fire(new s.z("rotatestart",r)).fire(new s.z("rotate",r)).fire(new s.z("rotateend",r)),g&&this.fire(new s.z("pitchstart",r)).fire(new s.z("pitch",r)).fire(new s.z("pitchend",r)),this.fire(new s.z("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(lp),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,r){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(lp),this;this.stop();const p=c.zoom,_=c.pitch,g=c.bearing;c.setFreeCameraOptions(t);const v=p!==c.zoom,b=_!==c.pitch,E=g!==c.bearing;return this.fire(new s.z("movestart",r)).fire(new s.z("move",r)),v&&this.fire(new s.z("zoomstart",r)).fire(new s.z("zoom",r)).fire(new s.z("zoomend",r)),E&&this.fire(new s.z("rotatestart",r)).fire(new s.z("rotate",r)).fire(new s.z("rotateend",r)),b&&this.fire(new s.z("pitchstart",r)).fire(new s.z("pitch",r)).fire(new s.z("pitchend",r)),this.fire(new s.z("moveend",r)),this}easeTo(t,r){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:s.eV},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,p=this.getZoom(),_=this.getBearing(),g=this.getPitch(),v=this.getPadding(),b="zoom"in t?+t.zoom:p,E="bearing"in t?this._normalizeBearing(t.bearing,_):_,C="pitch"in t?+t.pitch:g,z=this._extendPadding(t.padding),R=s.P.convert(t.offset);let D,B,O;if(c.projection.name==="globe"){const ce=s.ae.fromLngLat(c.center),ve=R.rotate(-c.angle);ce.x+=ve.x/c.worldSize,ce.y+=ve.y/c.worldSize;const ge=ce.toLngLat(),Le=s.aT.convert(t.center||ge);this._normalizeCenter(Le),D=c.centerPoint.add(ve),B=new s.P(ce.x,ce.y).mult(c.worldSize),O=new s.P(s.aF(Le.lng),s.aJ(Le.lat)).mult(c.worldSize).sub(B)}else{D=c.centerPoint.add(R);const ce=c.pointLocation(D),ve=s.aT.convert(t.center||ce);this._normalizeCenter(ve),B=c.project(ce),O=c.project(ve).sub(B)}const G=c.zoomScale(b-p);let U,Z;t.around&&(U=s.aT.convert(t.around),Z=c.locationPoint(U));const K=this._zooming||b!==p,W=this._rotating||_!==E,le=this._pitching||
3018C!==g,ne=!c.isPaddingEqual(z),se=t.retainPadding===!1?c.clone():c,ie=ce=>ve=>{if(K&&(ce.zoom=s.ak(p,b,ve)),W&&(ce.bearing=s.ak(_,E,ve)),le&&(ce.pitch=s.ak(g,C,ve)),ne&&(se.interpolatePadding(v,z,ve),D=se.centerPoint.add(R)),U)ce.setLocationAtPoint(U,Z);else{const ge=ce.zoomScale(ce.zoom-p),Le=b>p?Math.min(2,G):Math.max(.5,G),ze=Math.pow(Le,1-ve),je=ce.unproject(B.add(O.mult(ve*ze)).mult(ge));ce.setLocationAtPoint(ce.renderWorldCopies?je.wrap():je,D)}return t.preloadOnly||this._fireMoveEvents(r),ce};if(t.preloadOnly){const ce=this._emulate(ie,t.duration,c);return this._preloadTiles(ce),this}const Q={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=K,this._rotating=W,this._pitching=le,this._padding=ne,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,Q),this._ease(ie(c),ce=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(r,ce)},t),this}_prepareEase(t,r,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),r||c.moving||this.fire(new s.z("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.z("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.z("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.z("move",t)),this._zooming&&this.fire(new s.z("zoom",t)),this._rotating&&this.fire(new s.z("rotate",t)),this._pitching&&this.fire(new s.z("pitch",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,p=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.z("zoomend",t)),p&&this.fire(new s.z("rotateend",t)),_&&this.fire(new s.z("pitchend",t)),this.fire(new s.z("moveend",t))}flyTo(t,r){if(this._prefersReducedMotion(t)){const Me=s.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Me,r)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:s.eV},t);const c=this.transform,p=this.getZoom(),_=this.getBearing(),g=this.getPitch(),v=this.getPadding(),b="zoom"in t?s.aA(+t.zoom,c.minZ
vendor: 4,925 bytes, line 3018
3018oom,c.maxZoom):p,E="bearing"in t?this._normalizeBearing(t.bearing,_):_,C="pitch"in t?+t.pitch:g,z=this._extendPadding(t.padding),R=c.zoomScale(b-p),D=s.P.convert(t.offset);let B=c.centerPoint.add(D);const O=c.pointLocation(B),G=s.aT.convert(t.center||O);this._normalizeCenter(G);const U=c.project(O),Z=c.project(G).sub(U);let K=t.curve;const W=Math.max(c.width,c.height),le=W/R,ne=Z.mag();if("minZoom"in t){const Me=s.aA(Math.min(t.minZoom,p,b),c.minZoom,c.maxZoom),Ze=W/c.zoomScale(Me-p);K=Math.sqrt(Ze/ne*2)}const se=K*K;function ie(Me){const Ze=(le*le-W*W+(Me?-1:1)*se*se*ne*ne)/(2*(Me?le:W)*se*ne);return Math.log(Math.sqrt(Ze*Ze+1)-Ze)}function Q(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function ce(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const ve=ie(0);let ge=function(Me){return ce(ve)/ce(ve+K*Me)},Le=function(Me){return W*((ce(ve)*(Q(Ze=ve+K*Me)/ce(Ze))-Q(ve))/se)/ne;var Ze},ze=(ie(1)-ve)/K;if(Math.abs(ne)<1e-6||!isFinite(ze)){if(Math.abs(W-le)<1e-6)return this.easeTo(t,r);const Me=le<W?-1:1;ze=Math.abs(Math.log(le/W))/K,Le=function(){return 0},ge=function(Ze){return Math.exp(Me*K*Ze)}}t.duration="duration"in t?+t.duration:1e3*ze/("screenSpeed"in t?+t.screenSpeed/K:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const je=_!==E,nt=C!==g,Ae=!c.isPaddingEqual(z),fe=t.retainPadding===!1?c.clone():c,Oe=Me=>Ze=>{const ft=Ze*ze,bt=1/ge(ft);Me.zoom=Ze===1?b:p+Me.scaleZoom(bt),je&&(Me.bearing=s.ak(_,E,Ze)),nt&&(Me.pitch=s.ak(g,C,Ze)),Ae&&(fe.interpolatePadding(v,z,Ze),B=fe.centerPoint.add(D));const ut=Ze===1?G:Me.unproject(U.add(Z.mult(Le(ft))).mult(bt));return Me.setLocationAtPoint(Me.renderWorldCopies?ut.wrap():ut,B),Me._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(r),Me};if(t.preloadOnly){const Me=this._emulate(Oe,t.duration,c);return this._preloadTiles(Me),this}return this._zooming=!0,this._rotating=je,this._pitching=nt,this._padding=Ae,this._prepareEase(r,!1),this._ease(Oe(c),()=>this._afterEase(r),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,r)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,r,c){c.animate===!1||c.duration===0?(t(1),r()):(this._easeStart=s.o.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.o.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,r){t=s.bT(t,-180,180);const c=Math.abs(t-r);return Math.abs(t-360-r)<c&&(t-=360),Math.abs(t+360-r)<c&&(t+=360),t}_normalizeCenter(t){const r=this.transform;if(r.maxBounds||r.projection.name!=="globe"&&!r.renderWorldCopies)return;const c=t.lng-r.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&s.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,r,c){const p=Math.ceil(15*r/1e3),_=[],g=t(c.clone());for(let v=0;v<=p;v++){const b=g(v/p);_.push(b.clone())}return _}_preloadTiles(t,r){}}class rh{constructor(t={}){this.options=t,s.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const r=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=at("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=at("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const p=at("span","mapboxgl-ctrl-icon",this._compactButton);return p.setAttribute("aria-hidden","true"),p.setAttribute("title",c),this._innerContainer=at("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),r===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
3018se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(t){const c=r.reduce((p,_,g)=>(_.value&&(p+=`${_.key}=${_.value}${g<r.length-1?"&":""}`),p),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${mr(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const r=this._map.style._mergedSourceCaches;for(const p in r){const _=r[p];if(_.used){const g=_.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t.sort((p,_)=>p.length-_.length),t=t.filter((p,_)=>{for(let g=_+1;g<t.length;g++)if(t[g].indexOf(p)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.map(p=>function(_){const g=new DOMParser().parseFromString(_,"text/html");return Array.from(g.body.querySelectorAll("*")).forEach(v=>{const b=v.textContent||"";if(v.tagName!=="A")return void v.replaceWith(g.createTextNode(b));const E=v.getAttribute("href");if(!E||!/^(https?:|mailto:)/i.test(E))return void v.replaceWith(g.createTextNode(b));const C=g.createElement("a");C.href=E,C.textContent=b,C.rel="noopener nofollow";const z=v.getAttribute("class");z&&(C.className=z),v.replaceWith(C)}),g.body.innerHTML}(p)).join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class oh{constructor(){s.aY(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=at("div","mapboxgl-ctrl");const r=at("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(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const r in t){const c=t[r].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const r=t[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class Xc{constructor(){s.aY(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=at("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",r=>this._onIndoorUpdate(r)),this._container}_createButton(t,r){const c=at("button",t,this._container);return c.type="button",c.addEventListener("click",r),c}_createSeparator(){return at("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(t,r){this._map&&(t.setAttribute("aria-label",r),t.textContent=r)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return this._model=t,void(this._container.style.display="none");const r=this._model;this._model=t,this._container.style.display="inline-block",this._container.style.borderRadius="8px",r&&Array.from(this._container.children).forEac
3018h(c=>c.remove()),t.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(t.floors,t.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const t=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const r=this._map;this._model&&r&&r._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});at("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(t),this._createSeparator()}_updateBuildingsButtonState(){const t=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");t&&this._model&&(this._model.activeFloorsVisible?t.classList.remove("mapboxgl-ctrl-level-button-selected"):t.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(t,r){for(let c=0;c<t.length;c++){const p=t[c],_=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(p.id)});this._setButtonTitle(_,p.zIndex.toString()),this._model&&p.id===this._model.selectedFloorId&&r&&_.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(_),c<t.length-1&&this._createSeparator()}}}class ka{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const r=++this._id;return this._queue.push({callback:t,id:r,cancelled:!1}),r}remove(t){const r=this._currentlyRunning,c=r?this._queue.concat(r):this._queue;for(const p of c)if(p.id===t)return void(p.cancelled=!0)}run(t=0){const r=this._currentlyRunning=this._queue;this._queue=[];for(const c of r)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Oa{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const r=s.dD((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,r,c){this._start=this.getValue(r),this._end=t,this._startTime=r,this._endTime=r+c}}const Fa={"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 gl extends s.z{constructor(t,r,c,p){const{point:_,lngLat:g,originalEvent:v,target:b}=t;super(t.type,{point:_,lngLat:g,originalEvent:v,target:b}),this.preventDefault=()=>{t.preventDefault()},this.id=r,this.interaction=c,this.feature=p}}class Ds{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,r){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=r.filter;let p=r.type;c&&this.filters.set(t,s.b6(c)),p==="mouseover"&&(p="mouseenter"),p==="mouseout"&&(p="mouseleave");const _=this.interactionsByType.get(p)||new Map;p==="mouseenter"||p==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,r)):_.size===0&&this.map.on(p,this.handleType),_.size===0&&this.interactionsByType.set(p,_),_.set(t,r),this.typeById.set(t,p)}
3018get(t){const r=this.typeById.get(t);if(!r)return;const c=this.interactionsByType.get(r);return c?c.get(t):void 0}remove(t){const r=this.typeById.get(t);if(!r)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(r);c&&(c.delete(t),r==="mouseenter"||r==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(r,this.handleType))}queryTargets(t,r){const c=[];for(const[p,_]of r)_.target&&c.push({targetId:p,target:_.target,filter:this.filters.get(p)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const r=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());r.length&&(t.type="mouseenter",this.handleType(t,r));const c=new Map;for(const[p,{feature:_}]of this.prevHoveredFeatures)this.hoveredFeatures.has(p)||c.set(_.id,_);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const r=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);r.length&&(t.type="mouseleave",this.handleType(t,r)),this.hoveredFeatures.clear()}handleType(t,r){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void s.w("mouseenter interaction required for mouseleave to work.");const p=Array.from(this.interactionsByType.get(t.type)).reverse(),_=!!r;r=r||this.queryTargets(t.point,p);let g=!1;const v=new Set;for(const b of r){for(const[E,C]of p){if(!C.target)continue;const z=b.variants?b.variants[E]:null;if(z){for(const R of z){if(Ac(R,b,v,E))continue;const D=new s.dx(b,R),B=Ol(R,b,E);_&&D.id!==void 0&&(D.state=this.map.getFeatureState(D));const O=c?this.prevHoveredFeatures.get(B):null,G=new gl(t,E,C,D),U=O?O.stop:C.handler(G);if(c&&this.hoveredFeatures.set(B,{feature:b,stop:U}),U!==!1){g=!0;break}}if(g)break}}if(g)break}if(!g)for(const[b,E]of p){const{handler:C,target:z}=E;if(!z&&C(new gl(t,b,E,null))!==!1)break}}}function x1(l,t){if(Array.isArray(l)&&Array.isArray(t)){const r=new Set(l),c=new Set(t);return r.size===c.size&&l.every(p=>c.has(p))}return s.by(l,t)}const w1={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},b1={showCompass:!0,showZoom:!0,visualizePitch:!1};class T1{constructor(t,r,c=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new Sm({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new Em({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(t,r){this.mouseRotate.mousedown(t,r),this.mousePitch&&this.mousePitch.mousedown(t,r),dt()}move(t,r){const c=this.map,p=this.mouseRotate.mousemoveWindow(t,r),_=p&&p.bearingDelta;if(_&&c.setBearing(c.getBearing()+_),this.mousePitch){const g=this.mousePitch.mousemoveWindow(t,r),v=g&&g.pitchDelta;v&&c.setPitch(c.getPitch()+v)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Vt(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),si(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,si(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ji(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=ji(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Mm(l,t,r){if(l=new s.aT(l.lng,l.lat),t){const c=new s.aT(l.lng-360,l.lat),p=new s.aT(l.lng+360,l.lat),_=360*Math.ceil(Math.abs(l.lng-r.center.lng)/360),g=r.locationPoint3D(l).distSqr(t),v=t.x<0||t.y<0||t.x>r.width||t.y>r.height;r.locationPoint3D(c).distSqr(t)<g&&(v||Math.abs(c.lng-r.center.lng)<_)?l=c:r.locationPoint3D(p).distSqr(t)<g&&(v||Math.abs(p.lng-r.center.lng)<_)&&(l=p)}for(;Math.abs(l.lng-r.center.lng)>180;){const c=r.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=r.width&&c.y<=r.height)break;l.lng>r.center.lng?l.lng-=360:l.lng+=360}return l}
3018const Qr={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%)"},ps={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class cp extends s.E{constructor(t,r){super(),(t instanceof HTMLElement||r)&&(t=Object.assign({element:t},r)),s.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:p="#3FB1CE",scale:_=1,draggable:g=!1,clickTolerance:v=0,rotation:b=ps.rotation,rotationAlignment:E=ps.rotationAlignment,pitchAlignment:C=ps.pitchAlignment,occludedOpacity:z=ps.occludedOpacity,altitude:R=ps.altitude}=t||{};this._anchor=c,this._color=p,this._scale=_,this._draggable=g,this._clickTolerance=v,this._rotation=b,this._rotationAlignment=E,this._pitchAlignment=C,this._occludedOpacity=z,this._altitude=R,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",O=>{O.preventDefault()}),this._element.addEventListener("mousedown",O=>{O.preventDefault()});const D=this._element.classList;for(const O in Qr)D.remove(`mapboxgl-marker-anchor-${O}`);D.add(`mapboxgl-marker-anchor-${this._anchor}`);const B=t&&t.className?t.className.trim().split(/\s+/):[];D.add(...B),this._popup=null}_createDefaultMarker(){const t=at("div"),r=Ft("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=Ft("radialGradient",{id:"shadowGradient"},Ft("defs",{},r));Ft("stop",{offset:"10%","stop-opacity":.4},c),Ft("stop",{offset:"100%","stop-opacity":.05},c),Ft("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r)}return Ft("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),Ft("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),Ft("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||ps.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const p=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
30180,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const r=t.code,c=t.charCode||t.keyCode;r!=="Space"&&r!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const r=t.originalEvent.target,c=this._element;this._popup&&(r===c||c.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,r=this._pos;if(!t||!r)return!1;const c=t.unproject(r,this._altitude),p=t.getFreeCameraOptions();if(!p.position)return!1;const _=p.position.toLngLat();return _.distanceTo(c)<.9*_.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const r=this._pos;if(!r||r.x<0||r.x>t.transform.width||r.y<0||r.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(r,this._altitude);let p;t._showingGlobe()&&s.f5(t.transform,this._lngLat)?p=0:(p=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(p*=this._occludedOpacity)),this._element.style.opacity=`${p}`,this._element.style.pointerEvents=p>0?"auto":"none",this._popup&&this._popup._setOpacity(p),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const r=this._offset.mult(this._scale);this._element.style.transform=`
3019            translate(${t.x}px,${t.y}px)
3020            ${Qr[this._anchor]}
3021            ${this._calculateXYTransform()} ${this._calculateZTransform()}
3022            translate(${r.x}px,${r.y}px)
3023        `}_calculateXYTransform(){const t=this._pos,r=this._map,c=this.getPitchAlignment();if(!r||!t||c!=="map")return"";if(!r._showingGlobe()){const b=r.getPitch();return b?`rotateX(${b}deg)`:""}const p=s.cX(s.f6(r.transform,this._lngLat)),_=t.sub(s.f7(r.transform)),g=Math.abs(_.x)+Math.abs(_.y);if(g===0)return"";const v=p/g;return`rotateX(${-_.y*v}deg) rotateY(${_.x*v}deg)`}_calculateZTransform(){const t=this._pos,r=this._map;if(!r||!t)return"";let c=0;const p=this.getRotationAlignment();if(p==="map")if(r._showingGlobe()){const _=r.project(new s.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),g=r.project(new s.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(_);c=s.cX(Math.atan2(g.y,g.x))-90}else c=-r.getBearing();else if(p==="horizon"){const _=s.ah(4,6,r.getZoom()),g=s.f7(r.transform);g.y+=_*r.transform.height;const v=t.sub(g),b=s.cX(Math.atan2(v.y,v.x));c=(b>90?b-270:b+90)*(1-_)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const r=this._map;
3023r&&(r.transform.renderWorldCopies&&(this._lngLat=Mm(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),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(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const r=this._map;if(!r)return;const c=this._pointerdownPos,p=this._positionDelta;if(c&&p){if(!this._isDragging){const _=this._clickTolerance||r._clickTolerance;if(t.point.dist(c)<_)return;this._isDragging=!0}this._pos=t.point.sub(p),this._lngLat=r.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.z("dragstart"))),this.fire(new s.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.z("dragend")),this._state="inactive"}_addDragHandler(t){const r=this._map,c=this._pos;r&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.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(t){this._draggable=!!t;const r=this._map;return r&&(t?(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(t){return this._rotation=t||ps.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||ps.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||ps.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||ps.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const S1={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Yc={maxWidth:100,unit:"metric"},Pm={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},fs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},ms=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function tc(l=new s.P(0,0),t="bottom"){if(typeof l=="number"){const r=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new s.P(0,l);case"top-left":return new s.P(r,r);case"top-right":return new s.P(-r,r);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(r,-r);case"bottom-right":return new s.P(-r,-r);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:de,supported:mt.supported,setRTLTextPlugin:s.fb,getRTLTextPluginStatus:s.fa,Map:class extends Cm{constructor(l){tt.mark(Ee.create);const t=l;if((l=Object.assign({}
3023,w1,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&s.f3(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new zf(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new ka,this._domRenderTaskQueue=new ka,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.b2(),this._locale=Object.assign({},Fa,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Oa(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new Cr(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const r=document.getElementById(l.container);if(!r)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=r}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new v1(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),l.hash&&(this._hash=new _m(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const r=l.bounds;r&&(this.resize(),this.fitBounds(r,Object.assign({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new rh({customAttribution:l.customAttribution}
3023)),this._logoControl=new oh,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",r=>{this._update(r.dataType==="style"),this.fire(new s.z(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new s.z(`${r.dataType}dataloading`,r))}),this._interactions=new Ds(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new s.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(r,c.firstChild):c.appendChild(r),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new s.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new s.z("movestart",l)).fire(new s.z("move",l)),this.fire(new s.z("resize",l)),t&&this.fire(new s.z("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aI.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const r of this._controls)r._setLanguage&&r._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let r;t==="globe"&&l.zoom>=s.cL?(l.setMercatorFromTransition(),r=!0):t==="mercator"&&l.zoom<s.cL&&(l.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
3023Update(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;const r=this.transform.mercatorFromTransition;t=l.name==="globe"&&this.transform.zoom>=s.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate();const c=this.transform.getProjection().name==="mercator"&&r!==this.transform.mercatorFromTransition;return(t||c)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.aT.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,r){const c=p=>{let _=[];if(Array.isArray(t)){const g=t.filter(v=>this.getLayer(v));_=g.length?this.queryRenderedFeatures(p,{layers:g}):[]}else _=this.queryRenderedFeatures(p,{target:t});return _};if(l==="mouseenter"||l==="mouseover"){let p=!1;return{listener:r,targets:t,delegates:{mousemove:g=>{const v=c(g.point);v.length?p||(p=!0,r.call(this,new Ao(l,this,g.originalEvent,{features:v}))):p=!1},mouseout:()=>{p=!1}}}}if(l==="mouseleave"||l==="mouseout"){let p=!1;return{listener:r,targets:t,delegates:{mousemove:v=>{c(v.point).length?p=!0:p&&(p=!1,r.call(this,new Ao(l,this,v.originalEvent)))},mouseout:v=>{p&&(p=!1,r.call(this,new Ao(l,this,v.originalEvent)))}}}}{const p=_=>{const g=c(_.point);g.length&&(_.features=g,r.call(this,_),delete _.features)};return{listener:r,targets:t,delegates:{[l]:p}}}}on(l,t,r){if(typeof t=="function"||r===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,r);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const p in c.delegates)this.on(p,c.delegates[p]);return this}once(l,t,r){if(typeof t=="function"||r===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,r);for(const p in c.delegates)this.once(p,c.delegates[p]);return this}off(l,t,r){if(typeof t=="function"||r===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(p=>{for(let _=0;_<p.length;_++){const g=p[_];if(g.listener===r&&x1(g.targets,t)){for(const v in g.delegates)this.off(v,g.delegates[v]);return p.splice(_,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const _=this.style.queryRenderedFeatures(l,void 0,this.transform),g=this.style.queryRenderedFeatureset(l,void 0,this.transform);return _.concat(g)}let r=!0;if(t.target&&(r=this._isTargetValid(t.target),r&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const _ of t.layers)if(!this._isValidId(_)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let p=[];return c&&(p=p.concat(this.style.queryRenderedFeatures(l,t,this.transform))),r&&(p=p.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),p}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}queryRasterValue(l,t,r){return this._isValidId(l)?this.style.queryRasterValue(l,t,r):Promise.resolve(null)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3023pectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(r,c)=>{if(r){const p=typeof r=="string"?r:r instanceof Error?r.message:r.error;s.w(`Unable to perform style diff: ${p}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const r=Object.assign({},t);t&&t.config&&(r.initialConfig=t.config,delete r.config),this.style=new ds(this,r).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ds(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.y(new Error("IDs can't be empty."))),!1):!s.dr(l)||(this.fire(new s.y(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,r){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,r)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:r=1,sdf:c=!1,stretchX:p,stretchY:_,content:g}={}){this._lazyInitEmptyStyle();const v=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:b,height:E,data:C}=s.o.getImageData(t);this.style.addImage(v,{data:new s.q({width:b,height:E},C),pixelRatio:r,stretchX:p,stretchY:_,content:g,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:b,height:E}=t,C=t;this.style.addImage(v,{data:new s.q({width:b,height:E},new Uint8Array(C.data)),pixelRatio:r,stretchX:p,stretchY:_,content:g,sdf:c,usvg:!1,version:0,userImage:C}),C.onAdd&&C.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const r=s.I.from(l),c=this.style.getImage(r);if(!c)return void this.fire(new s.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.o.getImageData(t):t,{width:_,height:g,data:v}=p;if(_===void 0||g===void 0)return void this.fire(new s.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(_!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||g!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.y(new Error(`The width and height of the updated image (${_}, ${g})
3024                must be that same as the previous version of the image
3025                (${c.data.width}, ${c.data.height})`)));const b=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let E=!1;c.usvg?(c.data=new s.q({width:_,height:g},new Uint8Array(v)),c.usvg=!1,c.icon=void 0,E=!0):c.data.replace(v,b),this.style.updateImage(r,c,E)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.y(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.n(this._requestManager.transformRequest(l,s.R.Image),(r,c)=>{t(r,c instanceof HTMLImageElement?s.o.getImageData(c):c)})}
vendor: 4,584 bytes, line 3025
3025listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new s.y(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(r=>this.fire(new s.y(new Error("Failed to add import",r)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,r){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,r),this._update(!0)):this}setFilter(l,t,r={}){return this._isValidId(l)?(this.style.setFilter(l,t,r),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,r,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,r,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,r,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,r,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}setLayerProperty(l,t,r,c={}){return this._isValidId(l)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(l,t,r,c),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,r){return this.style.setConfigProperty(l,t,r),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthogra
3025phicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aT.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.indoor.selectFloor(l)}_setIndoorActiveFloorsVisibility(l){this.indoor.setActiveFloorsVisibility(l)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Xc),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let r,c,p,_=this._container;for(;_&&(!c||!p);){const g=window.getComputedStyle(_).transform;g&&g!=="none"&&(r=g.match(/matrix.*\((.+)\)/)[1].split(", "),r[0]&&r[0]!=="0"&&r[0]!=="1"&&(c=r[0]),r[3]&&r[3]!=="0"&&r[3]!=="1"&&(p=r[3])),_=_.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=p?Math.abs(t/p):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new qg(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=at("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=at("div","mapboxgl-canvas-container",l);this._canvas=at("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const r=this._controlContainer=at("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(p=>{c[p]=at("div",`mapboxgl-ctrl-${p}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const r=s.o.devicePixelRatio||1;this._canvas.width=r*Math.ceil(l),this._canvas.height=r*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=Object.assign({},mt.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(jr(t,!0),this.painter=new Xd(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",r=>{r.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.k.testSupport(t)):this.fire(new s.y(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.z("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.z("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.z("renderstart")),++this._frameId;const r=this.painter.context.extTimerQuery,c=s.o.now(),p=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=p.createQuery(),p.beginQuery(r.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
vendor: 7,005 bytes, line 3025
3025(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const _=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,C=this.transform.pitch,z=s.o.now(),R=new s.ac(E,{now:z,fadeDuration:_,pitch:C,transition:this.style.transition,worldview:this._worldview});this.style.update(R)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(c);const v=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,_,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),v&&(this._placementDirty=v.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:_,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,tt.mark(Ee.load),this.fire(new s.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const E=s.o.now()-c;p.endQuery(r.TIME_ELAPSED_EXT),setTimeout(()=>{const C=p.getQueryParameter(t,p.QUERY_RESULT)/1e6;p.deleteQuery(t),this.fire(new s.z("gpu-timing-frame",{cpuTime:E,gpuTime:C}))},50)}if(this.listens("gpu-timing-layer")){const E=this.painter.collectGpuTimers();setTimeout(()=>{const C=this.painter.queryGpuTimers(E);this.fire(new s.z("gpu-timing-layer",{layerTimes:C}))},50)}if(this.listens("gpu-timing-deferred-render")){const E=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const C=this.painter.queryGpuTimeDeferredRender(E);this.fire(new s.z("gpu-timing-deferred-render",{gpuTime:C}))},50)}const b=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(b||this._repaint)this.triggerRepaint();else{const E=this.idle();if(E&&(g=this._updateAverageElevation(c,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),E&&(this.fire(new s.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const C=this._calculateSpeedIndex();this.fire(new s.z("speedindexcompleted",{speedIndex:C})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||b||(this._fullyLoaded=!0,tt.mark(Ee.fullLoad),this._performanceMetricsCollection&&qn(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const r=p=>(this.transform.averageElevation=p,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&r(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const p=this.transform.averageElevation;let _=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(_)?_=0:this._averageElevationLastSampledAt=l;const g=Math.abs(p-_);if(g>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(_),r(_);this._averageElevation.easeTo(_,l,300)}else if(g>1e-4)return this._averageElevation.jumpTo(_),r(_)}return!!this._averageElevation.isEasing(l)&&r(this._averageElevation.getValue(l))}_authenticate(){Ss(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===Ii||l.status===401)){const t=this.painter.context.gl;jr(t,!1),this._logoControl instanceof oh&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Sn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&br(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&un(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){nr(this._requestManager._customAccessToken)}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const r=this.painter.context.gl,c=r.createFramebuffer();function p(_){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,_,0);const g=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,g),g}return r.bindFramebuffer(r.FRAMEBUFFER,c),this._canvasPixelComparison(p(l),t.canvasCopies.map(p),t.timeStamps)}_canvasPixelComparison(l,t,r){let c=r[1]-r[0];const p=l.length/4;for(let _=0;_<t.length;_++){const g=t[_];let v=0;for(let b=0;b<g.length;
3025b+=4)g[b]===l[b]&&g[b+1]===l[b+1]&&g[b+2]===l[b+2]&&g[b+3]===l[b+3]&&(v+=1);c+=(r[_+2]-r[_+1])*(1-v/p)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor&&this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),so.delete(this.painter.context.gl),Jn.remove(),Si.remove(),this._removed=!0,this.fire(new s.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.o.frame(t=>{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bw(t,(r,c)=>r._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this.style&&l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,l&&this._update())}_setCacheLimits(l,t){s.f4(l,t)}get version(){return de}},NavigationControl:class{constructor(l={}){this.options=Object.assign({},b1,l),this._container=at("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(s.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),at("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),at("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:t}):r.resetNorth({},{originalEvent:t}))}
3025),this._compassIcon=at("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;const t=l.getZoom(),r=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new T1(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const r=at("button",l,this._container);return r.type="button",r.addEventListener("click",t),r}_setButtonTitle(l,t){if(!this._map)return;const r=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",r),l.firstElementChild&&l.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},S1,l),s.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Yd(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=at("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(r=!!this.options.geolocation)=>{this._supportsGeolocation=r,l(r)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(r=>t(r.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),r=l.coords;return!!t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.z("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
3025RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("geolocate",Object.assign({coords:l.coords,timestamp:l.timestamp},l.toJSON?{toJSON:l.toJSON.bind(l)}:{}))),this._finish()}}_updateCamera(l){const t=new s.aT(l.coords.longitude,l.coords.latitude),r=l.coords.accuracy,c=this._map.getBearing(),p=Object.assign({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(r),p,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.aT(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=s.cf(1,l._center.lat)*l.worldSize,r=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=at("button","mapboxgl-ctrl-geolocate",this._container),at("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3025se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=at("div","mapboxgl-user-location"),this._dotElement.appendChild(at("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(at("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new cp({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=at("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new cp({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.z("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
3025se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:rh,ScaleControl:class{constructor(l={}){this.options=Object.assign({},Yc,l),s.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,r=t._containerHeight/2,c=t._containerWidth/2-l/2,p=t.unproject([c,r]),_=t.unproject([c+l,r]),g=p.distanceTo(_);if(this.options.unit==="imperial"){const v=3.2808*g;v>5280?this._setScale(l,v/5280,"mile"):this._setScale(l,v,"foot")}else this.options.unit==="nautical"?this._setScale(l,g/1852,"nautical-mile"):g>=1e3?this._setScale(l,g/1e3,"kilometer"):this._setScale(l,g,"meter")}_setScale(l,t,r){this._map._requestDomTask(()=>{const c=function(_){const g=Math.pow(10,`${Math.floor(_)}`.length-1);let v=_/g;return v=v>=10?10:v>=5?5:v>=3?3:v>=2?2:v>=1?1:function(b){const E=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*E)/E}(v),g*v}(t),p=c/t;this._container.innerHTML=r!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(c):`${c}&nbsp;${Pm[r]}`,this._container.style.width=l*p+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=at("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=at("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=at("button","mapboxgl-ctrl-fullscreen",this._controlContainer);at("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Xc,Popup:class extends s.E{constructor(l){super(),this.options=Object.assign(Object.create(fs),l),this._altitude=this.options.altitude,s.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.z("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.aT.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),r=document.createElement("body");let c;for(r.innerHTML=l;c=r.firstChild,c;
3025)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=at("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const r=this._closeButton=at("button","mapboxgl-popup-close-button",t);r.type="button",r.setAttribute("aria-label","Close popup"),r.innerHTML='<span aria-hidden="true">&#215;</span>',r.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,r=this._container,c=this._pos;if(!t||!r||!c)return"bottom";const p=r.offsetWidth,_=r.offsetHeight,g=c.x<p/2,v=c.x>t.transform.width-p/2;if(c.y+l<_)return g?"top-left":v?"top-right":"top";if(c.y>t.transform.height-_){if(g)return"bottom-left";if(v)return"bottom-right"}return g?"left":v?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,r=this._content;if(!t||!this._lngLat&&!this._trackPointer||!r)return;let c=this._container;if(c||(c=this._container=at("div","mapboxgl-popup",t.getContainer()),this._tip=at("div","mapboxgl-popup-tip",c),c.appendChild(r)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Mm(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const p=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),_=tc(this.options.offset),g=this._anchor=this._getAnchor(_.y),v=tc(this.options.offset,g),b=p.add(v).round();t._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${Qr[g]} translate(${b.x}px,${b.y}px)`)})}if(!this._marker&&t._showingGlobe()){const p=s.f5(t.transform,this._lngLat)?0:1;this._setOpacity(p)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(ms);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:cp,Style:ds,LngLat:s.aT,LngLatBounds:s.aI,Point:s.P,MercatorCoordinate:s.ae,FreeCameraOptions:mo,Evented:s.E,config:s.e,prewarm:s.f9,clearPrewarmedResources:s.f8,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.fi.workerCount},set workerCount(l){s.fi.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.fh(l)},get workerUrl(){return s.fg.workerUrl},set workerUrl(l){s.fg.workerUrl=l},get workerClass(){return s.fg.workerClass},set workerClass(l){s.fg.workerClass=l},get workerParams(){return s.fg.workerParams},set workerParams(l){s.fg.workerParams=l},get dracoUrl(){return s.ff()},set dracoUrl(l){s.fe(l)},get meshoptUrl(){return s.fd()},set meshoptUrl(l){s.fc(l)},setNow:s.o.setNow,restoreNow:s.o.restoreNow}});var X=L;return X})})(pS);var GP=pS.exports;const wf=$w(GP),ok="";function $P({onZoomIn:h,onZoomOut:f,onToggle3D:w,is3D:A}){return _e.jsxs("div",{className:"map-controls",children:[_e.jsxs("div",{className:"map-3d-toggle",title:A?"Switch to 2D view":"Switch to 3D view",children:[_e.jsx("span",{className:`toggle-label ${A?"":"active"}`,children:"2D"}),_e.jsx("div",{className:`toggle-switch ${A?"active":""}`,onClick:w,role:"switch","aria-checked":A,"aria-label":"Toggle 3D view",tabIndex:0,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),w())},children:_e.jsx("div",{className:"toggle-switch-knob"})}),_e.jsx("span",{className:`toggle-label ${A?"active":""}`,children:"3D"})]}),_e.jsx("button",{className:"map-control-btn zoom-in",onClick:h,"aria-label":"Zoom in",title:"Zoom in",children:_e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:_e.jsx("path",{d:"M9 3v12M3 9h12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),_e.jsx("button",{className:"map-control-btn zoom-out",onClick:f,"aria-label":"Zoom out",title:"Zoom out",children:_e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:_e.jsx("path",{d:"M3 9h12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]})}function HP({layers:h,layerVisibility:f,onLayerToggle:w}){const[A,L]=st.useState(!1);return!h||h.length===0?null:_e.jsxs("div",{className:`layers-panel ${A?"open":""}`,children:[_e.jsxs("button",{className:"layers-panel-tab",onClick:()=>L(!A),"aria-expanded":A,"aria-label":A?"Close layers panel":"Open layers panel",children:[_e.jsx("svg",{className:"layers-panel-icon",width:"18",height:"18",viewBox:"0 0 256 256",fill:"currentColor",children:_e.jsx("path",{d:"M220.54,86.66l-88-48.18a8,8,0,0,0-7.68,0l-88,48.18a8,8,0,0,0,0,14l88,48.18a8,8,0,0,0,7.68,0l88-48.18a8,8,0,0,0,0-14ZM128,133.33,54.08,93.33,128,53.33l73.92,40ZM216.54,155.66l-88,48.18a8,8,0,0,1-7.68,0l-88-48.18a8,8,0,0,1,7.68-14L128,185.33l87.46-41.85a8,8,0,1,1,7.68,14Z"})}),_e.jsx("span",{className:"layers-panel-label",children:"Layers"}),_e.jsx("svg",{className:`layers-panel-chevron ${A?"open":""}`,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_e.jsxs("div",{className:"layers-panel-content",children:[_e.jsx("div",{className:"layers-panel-header",children:_e.jsx("h3",{children:"Map Layers"})}),_e.jsx("div",{className:"layers-panel-list",children:h.map(F=>_e.jsxs("label",{className:"layers-panel-item",children:[_e.jsx("input",{type:"checkbox",checked:f[F.id]||!1,onChange:X=>w(F.id,X.target.checked)}),_e.jsx("span",{className:"layers-panel-checkbox",children:_e.jsx("svg",{viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M2.5 6L5 8.5L9.5 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),_e.jsx("span",{className:"layers-panel-item-label",children:F.label})]},F.id))})]})]})}const bf={proposed:"#50E3C2",approved:"#08B2E3",under_construction:"#F8E71C",completed:"#005E7C",cancelled:"#F93950"},qP=st.forwardRef(function({projects:f,center:w,mapboxToken:A,mapboxStyle:L,onBoundsChange:F,availableLayers:X=[],layerVisibility:s={},onLayerToggle:de},Ee){const tt=st.useRef(null),Ie=st.useRef(null),He=st.useRef(null),[vt,mt]=st.useState(!1),[at,Ft]=st.useState(null),[Ve,Se]=st.useState(!1),Ce=st.useRef(new Set),dt=st.useRef(null),Vt=st.useRef(null),jt=st.useCallback((qe,ti=!1)=>
3025{const ai=qe.article_count||0,Si=Array.isArray(qe.uses)?qe.uses.join(" / "):qe.uses||"",Sn=qe.neighborhood||"",Kn=Si&&Sn?" · ":"";return`
3026      <div class="project-popup-content">
3027        ${ti&&qe.image_url?`<div class="project-popup-image" style="background-image: url('${qe.image_url}')"></div>`:""}
3028        <div class="project-popup-body">
3029          <span class="project-popup-status status-${qe.status}">${qe.status_label}</span>
3030          <h3 class="project-popup-title">${qe.title}</h3>
3031          <p class="project-popup-meta">${Si}${Kn}${Sn}</p>
3032          <div class="project-popup-footer">
3033            ${ai>0?`<span class="project-popup-article-count">${ai} article${ai!==1?"s":""}</span>`:"<span></span>"}
3034            <a href="${qe.url}" target="_blank" rel="noopener noreferrer" class="project-popup-link">View Details →</a>
3035          </div>
3036        </div>
3037      </div>
3038    `},[]);st.useImperativeHandle(Ee,()=>({focusOnProject:qe=>{if(!Ie.current||!Ve)return;ji();const ti=[qe.lon,qe.lat];Vt.current=ti,mt(!0),Ie.current.flyTo({center:ti,zoom:17,pitch:60,bearing:0,duration:2e3}),setTimeout(()=>{qt(qe),si(ti)},2e3)},highlightProject:async qe=>{if(!Ie.current||!Ve)return;ji(),He.current&&He.current.remove();const ti=[qe.lon,qe.lat],ai=Ie.current.getZoom(),Si=(async()=>{let vn={...qe};try{const nr=await fetch(`/map/api/${qe.nid}`);if(nr.ok){const oo=await nr.json();
3038!oo.article_count&&qe.article_count&&(oo.article_count=qe.article_count),vn=oo}}catch(nr){console.warn("Failed to load project details:",nr)}return vn})(),Sn=(async()=>{const vn=qe.image_url;return vn?new Promise(nr=>{const oo=new Image;oo.onload=()=>nr(!0),oo.onerror=()=>nr(!1),oo.src=vn}):!1})(),Kn=new Promise(vn=>{Ie.current.once("moveend",vn)});Ie.current.flyTo({center:ti,zoom:Math.max(ai,14),duration:800,padding:{top:150,bottom:0,left:0,right:0}});const[br,Or]=await Promise.all([Si,Sn,Kn]),un=document.createElement("div");un.className="project-popup",un.innerHTML=jt(br,Or&&!!br.image_url),He.current.setLngLat(ti).setDOMContent(un).addTo(Ie.current)},stopOrbit:()=>{ji()},flyTo:(qe,ti)=>{!Ie.current||!Ve||Ie.current.flyTo({center:[qe,ti],zoom:15,duration:1500})},fitToProjects:qe=>{if(!Ie.current||!Ve)return;ji(),mt(!1);const ti=(qe||[]).map(Si=>[Number(Si.lon),Number(Si.lat)]).filter(([Si,Sn])=>Number.isFinite(Si)&&Number.isFinite(Sn));if(ti.length===0){Ie.current.easeTo({pitch:0,bearing:0,duration:800});return}if(ti.length===1){Ie.current.easeTo({center:ti[0],zoom:14,pitch:0,bearing:0,duration:800});return}const ai=ti.reduce((Si,Sn)=>Si.extend(Sn),new wf.LngLatBounds(ti[0],ti[0]));Ie.current.fitBounds(ai,{padding:{top:60,bottom:60,left:60,right:60},pitch:0,bearing:0,maxZoom:15,duration:800})}}),[Ve]);const qt=st.useCallback(async qe=>{if(!Ie.current||!He.current)return;const ti=[qe.lon,qe.lat],ai=document.createElement("div");ai.className="project-popup",ai.innerHTML=jt(qe,!1),He.current.setLngLat(ti).setDOMContent(ai).addTo(Ie.current);try{const Si=await fetch(`/map/api/${qe.nid}`);if(Si.ok){const Sn=await Si.json();if(!Sn.article_count&&qe.article_count&&(Sn.article_count=qe.article_count),He.current.isOpen()){const Kn=document.createElement("div");Kn.className="project-popup",Kn.innerHTML=jt(Sn,!0),He.current.setDOMContent(Kn)}}}catch(Si){console.warn("Failed to load project details:",Si)}},[jt]),si=st.useCallback(qe=>{if(!Ie.current)return;const ti=2e4,ai=Date.now(),Si=Ie.current.getBearing(),Sn=()=>{if(!Ie.current||!Vt.current)return;const br=(Date.now()-ai)%ti/ti,Or=Si+br*360;Ie.current.setBearing(Or),Ie.current.setCenter(qe),dt.current=requestAnimationFrame(Sn)};dt.current=requestAnimationFrame(Sn)},[]),ji=st.useCallback(()=>{dt.current&&(cancelAnimationFrame(dt.current),dt.current=null),Vt.current=null},[]);st.useEffect(()=>{if(!Ie.current)return;const qe=()=>{dt.current&&ji()};return Ie.current.on("dragstart",qe),Ie.current.on("zoomstart",qe),Ie.current.on("rotatestart",qe),()=>{Ie.current&&(Ie.current.off("dragstart",qe),Ie.current.off("zoomstart",qe),Ie.current.off("rotatestart",qe))}},[ji]),st.useEffect(()=>{if(!(!A||Ie.current))return wf.accessToken=A,Ie.current=new wf.Map({container:tt.current,style:L||"mapbox://styles/mapbox/light-v11",center:[w.lon,w.lat],zoom:11,pitch:0,bearing:0}),He.current=new wf.Popup({closeButton:!0,closeOnClick:!1,maxWidth:"320px",offset:15}),Ie.current.addControl(new wf.NavigationControl({showCompass:!1}),"bottom-right"),Ie.current.on("load",()=>{Ii(),Hn(),ri(),Ei(),Se(!0)}),()=>{ji(),Ie.current&&(Ie.current.remove(),Ie.current=null)}},[A,L]),st.useEffect(()=>{if(!tt.current)return;const qe=new ResizeObserver(()=>{requestAnimationFrame(()=>{Ie.current&&Ie.current.resize()})});return qe.observe(tt.current),()=>{qe.disconnect()}},[]),st.useEffect(()=>{!Ie.current||!Ve||X.forEach(qe=>{const ti=s[qe.id]||!1,ai=Ce.current.has(qe.id);ti&&!ai?Ui(qe):!ti&&ai?ar(qe.id):ti&&ai&&fr(qe.id)})},[s,Ve,X]);const Ui=async qe=>{if(Ie.current)try{const ti=await fetch(qe.source);if(!ti.ok)throw new Error(`Failed to load ${qe.source}`);const ai=await ti.json();if(Ie.current.getSource(qe.id)||Ie.current.addSource(qe.id,{type:"geojson",data:ai}),qe.fillStyle){const Si=`${qe.id}-fill`;Ie.current.getLayer(Si)||Ie.current.addLayer({id:Si,source:qe.id,type:qe.fillStyle.type,paint:qe.fillStyle.paint},"clusters")}if(Ie.current.getLayer(qe.id)||Ie.current.addLayer({id:qe.id,source:qe.id,type:qe.style.type,paint:qe.style.paint},"clusters"),qe.labelStyle){const Si=`${qe.id}-label`;Ie.current.getLayer(Si)||Ie.current.addLayer({id:Si,source:qe.id,type:qe.labelStyle.type,layout:qe.labelStyle.layout,paint:qe.labelStyle.paint})}Ce.current.add(qe.id)}catch(ti){console.error(`Error loading layer ${qe.id}:`,ti)}},ar=qe=>{Ie.current&&(Ie.current.getLayer(qe)&&Ie.current.setLayoutProperty(qe,"visibility","none"),Ie.current.getLayer(`${qe}-fill`)&&Ie.current.setLayoutProperty(`${qe}-fill`,"visibility","none"),Ie.current.getLayer(`${qe}-label`)&&Ie.current.setLayoutProperty(`${qe}-label`,"visibility","none"))},fr=qe=>{Ie.current&&(Ie.current.getLayer(qe)&&Ie.current.setLayoutProperty(qe,"visibility","visible"),Ie.current.getLayer(`${qe}-fill`)&&Ie.current.setLayoutProperty(`${qe}-fill`,"visibility","visible"),Ie.current.getLayer(`${qe}-label`)&&Ie.current.setLayoutProperty(`${qe}-label`,"visibility","visible"))};st.useEffect(()=>{Ie.current&&w&&Ie.current.flyTo({center:[w.lon,w.lat],zoom:11,duration:1e3})},[w]),st.useEffect(()=>{if(!Ie.current||!Ie.current.isStyleLoaded())return;const qe=Ie.current.getSource("projects");qe&&qe.setData(Cr())},[f]);const Ii=st.useCallback(()=>{var ai;if(!Ie.current)return;const ti=(ai=Ie.current.getStyle().layers.find(Si=>Si.type==="symbol"&&Si.layout["text-field"]))==null?void 0:ai.id;Ie.current.addLayer({id:"3d-buildings",source:"composite","source-layer":"building",filter:["==","extrude","true"],type:"fill-extrusion",minzoom:14,paint:{"fill-extrusion-color":"#aaa","fill-extrusion-height":["interpolate",["linear"],["zoom"],14,0,14.5,["get","height"]],"fill-extrusion-base":["interpolate",["linear"],["zoom"],14,0,14.5,["get","min_height"]],"fill-extrusion-opacity":.6}},ti)},[]),Cr=st.useCallback(()=>({type:"FeatureCollection",features:f.map(qe=>{var ti;return{type:"Feature",properties:{nid:qe.nid,title:qe.title,url:qe.url,status:qe.status,status_label:qe.status_label,uses:((ti=qe.uses)==null?void 0:ti.join(" / "))||"",neighborhood:qe.neighborhood,image_url:qe.image_url,article_c
3038ount:qe.article_count||0},geometry:{type:"Point",coordinates:[qe.lon,qe.lat]}}})}),[f]),Hn=st.useCallback(()=>{Ie.current&&(Ie.current.addSource("projects",{type:"geojson",data:Cr(),cluster:!0,clusterMaxZoom:14,clusterRadius:50}),Ie.current.addLayer({id:"clusters",type:"circle",source:"projects",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#08B2E3",10,"#50E3C2",50,"#005E7C"],"circle-radius":["step",["get","point_count"],20,10,25,50,35],"circle-stroke-width":2,"circle-stroke-color":"#fff"}}),Ie.current.addLayer({id:"cluster-count",type:"symbol",source:"projects",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["DIN Pro Medium","Arial Unicode MS Bold"],"text-size":14},paint:{"text-color":"#fff"}}),Ie.current.addLayer({id:"unclustered-point",type:"circle",source:"projects",filter:["!",["has","point_count"]],paint:{"circle-color":["match",["get","status"],"proposed",bf.proposed,"approved",bf.approved,"under_construction",bf.under_construction,"completed",bf.completed,"cancelled",bf.cancelled,"#08B2E3"],"circle-radius":10,"circle-stroke-width":2,"circle-stroke-color":"#fff"}}))},[Cr]),ri=st.useCallback(()=>{Ie.current&&(Ie.current.on("click","clusters",qe=>{const ti=Ie.current.queryRenderedFeatures(qe.point,{layers:["clusters"]}),ai=ti[0].properties.cluster_id;Ie.current.getSource("projects").getClusterExpansionZoom(ai,(Si,Sn)=>{Si||Ie.current.easeTo({center:ti[0].geometry.coordinates,zoom:Sn})})}),Ie.current.on("click","unclustered-point",async qe=>{ji();const ti=qe.features[0],ai=ti.geometry.coordinates.slice(),Si=ti.properties;for(;Math.abs(qe.lngLat.lng-ai[0])>180;)ai[0]+=qe.lngLat.lng>ai[0]?360:-360;Ft(Si);const Sn=document.createElement("div");Sn.className="project-popup",Sn.innerHTML=jt(Si,!1),He.current.setLngLat(ai).setDOMContent(Sn).addTo(Ie.current);try{const Kn=await fetch(`/map/api/${Si.nid}`);if(Kn.ok){const br=await Kn.json();if(!br.article_count&&Si.article_count&&(br.article_count=Si.article_count),He.current.isOpen()){const Or=document.createElement("div");Or.className="project-popup",Or.innerHTML=jt(br,!0),He.current.setDOMContent(Or)}}}catch(Kn){console.warn("Failed to load project details:",Kn)}}),Ie.current.on("mouseenter","clusters",()=>{Ie.current.getCanvas().style.cursor="pointer"}),Ie.current.on("mouseleave","clusters",()=>{Ie.current.getCanvas().style.cursor=""}),Ie.current.on("mouseenter","unclustered-point",()=>{Ie.current.getCanvas().style.cursor="pointer"}),Ie.current.on("mouseleave","unclustered-point",()=>{Ie.current.getCanvas().style.cursor=""}),Ie.current.on("moveend",Ei))},[ji,jt]),Ei=st.useCallback(()=>{if(!Ie.current||!F)return;const qe=Ie.current.getBounds();F({north:qe.getNorth(),south:qe.getSouth(),east:qe.getEast(),west:qe.getWest()})},[F]),Gt=st.useCallback(()=>{Ie.current&&Ie.current.zoomIn()},[]),Ti=st.useCallback(()=>{Ie.current&&Ie.current.zoomOut()},[]),Ct=st.useCallback(()=>{if(!Ie.current)return;const qe=!vt;mt(qe),Ie.current.easeTo({pitch:qe?45:0,bearing:0,duration:500})},[vt]);return _e.jsxs("div",{className:"map-view",children:[_e.jsx("div",{ref:tt,className:"map-container"}),_e.jsx($P,{onZoomIn:Gt,onZoomOut:Ti,onToggle3D:Ct,is3D:vt}),_e.jsx(HP,{layers:X,layerVisibility:s,onLayerToggle:de})]})});function ZP({project:h,viewMode:f="grid",onHighlight:w}){const{title:A,url:L,status:F,status_label:X,uses:s,neighborhood:de,image_url:Ee,article_count:tt=0}=h,Ie=f==="split",He=Ft=>{Ft.preventDefault(),Ie&&w?w(h):window.open(L,"_blank","noopener,noreferrer")},vt=Ft=>{Ft.preventDefault(),Ft.stopPropagation(),window.open(L,"_blank","noopener,noreferrer")},mt=Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&(Ft.preventDefault(),Ie&&w?w(h):window.open(L,"_blank","noopener,noreferrer"))},at=Array.isArray(s)?s.join(" / "):s;return _e.jsxs("article",{className:"project-card",onClick:He,onKeyDown:mt,role:"link",tabIndex:0,"aria-label":`View ${A}`,children:[_e.jsxs("div",{className:"project-card-image-wrapper",children:[_e.jsx("span",{className:`project-card-status status-${F}`,children:X}),Ee?_e.jsx("img",{src:Ee,alt:A,className:"project-card-image",loading:"lazy"}):_e.jsx("div",{className:"project-card-no-image",children:_e.jsx("span",{children:"No Image"})})]}),_e.jsxs("div",{className:"project-card-body",children:[_e.jsxs("div",{className:"project-card-meta",children:[de&&_e.jsx("span",{className:"project-card-neighborhood",children:de}),at&&_e.jsx("span",{className:"project-card-uses",children:at})]}),_e.jsx("h3",{className:"project-card-title",children:A}
3038),_e.jsx("div",{className:"project-card-divider"}),_e.jsxs("div",{className:"project-card-footer",children:[_e.jsxs("span",{className:"project-card-article-count",children:[tt," article",tt!==1?"s":""]}),_e.jsxs("a",{href:L,className:"project-card-footer-link",onClick:vt,onKeyDown:Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&vt(Ft)},children:["View Details ",_e.jsx("span",{className:"project-card-footer-arrow",children:"→"})]})]})]})]})}function WP({projects:h,fullWidth:f=!1,showFooter:w=!1,totalCount:A=0,viewMode:L="grid",onHighlight:F}){return!h||h.length===0?_e.jsxs("div",{className:"grid-view-empty",children:[_e.jsx("p",{children:"No projects in this area."}),_e.jsx("p",{className:"grid-view-empty-hint",children:"Try zooming out or panning the map."})]}):_e.jsx("div",{className:`grid-view ${f?"grid-view-full":""}`,children:_e.jsxs("div",{className:"grid-view-scroll",children:[_e.jsx("div",{className:"grid-view-grid",children:h.map(X=>_e.jsx(ZP,{project:X,viewMode:L,onHighlight:F},X.nid))}),w&&_e.jsx("div",{className:"grid-view-footer",children:_e.jsxs("p",{children:["End of catalog / ",A||h.length," Active Projects"]})})]})})}const XP=[{value:"grid",label:"Grid",icon:"grid"},{value:"split",label:"Split",icon:"split"},{value:"map",label:"Map",icon:"map"}];function YP({viewMode:h,onChange:f}){return _e.jsx("div",{className:"layout-toggle",children:XP.map(w=>_e.jsx("button",{className:`layout-toggle-btn ${w.value===h?"active":""}`,onClick:()=>f(w.value),title:`${w.label} View`,"aria-pressed":w.value===h,children:_e.jsx(KP,{type:w.icon})},w.value))})}function KP({type:h}){switch(h){case"grid":return _e.jsx("svg",{className:"layout-icon",width:"20",height:"20",viewBox:"0 0 256 256",fill:"currentColor",children:_e.jsx("path",{d:"M104,40H56A16,16,0,0,0,40,56v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,104,40Zm0,64H56V56h48ZM200,40H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,64H152V56h48Zm-96,32H56a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,104,136Zm0,64H56V152h48Zm96-64H152a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V152A16,16,0,0,0,200,136Zm0,64H152V152h48Z"})});case"split":return _e.jsx("svg",{className:"layout-icon",width:"20",height:"20",viewBox:"0 0 256 256",fill:"currentColor",children:_e.jsx("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H88V200H40ZM216,200H104V56H216Z"})});case"map":return _e.jsx("svg",{className:"layout-icon",width:"20",height:"20",viewBox:"0 0 256 256",fill:"currentColor",children:_e.jsx("path",{d:"M228.92,49.69a8,8,0,0,0-6.86-1.45L160.93,63.52,99.58,32.84a8,8,0,0,0-5.52-.6l-64,16A8,8,0,0,0,24,56V200a8,8,0,0,0,9.94,7.76l61.13-15.28,61.35,30.68A8.15,8.15,0,0,0,160,224a8,8,0,0,0,1.94-.24l64-16A8,8,0,0,0,232,200V56A8,8,0,0,0,228.92,49.69ZM104,52.94l48,24V203.06l-48-24ZM40,62.25l48-12v127.5l-48,12Zm176,131.5-48,12V78.25l48-12Z"})});default:return null}}function $x({label:h,options:f,selected:w,onChange:A}){const[L,F]=st.useState(!1),X=st.useRef(null);st.useEffect(()=>{const tt=Ie=>{X.current&&!X.current.contains(Ie.target)&&F(!1)};return document.addEventListener("mousedown",tt),()=>document.removeEventListener("mousedown",tt)},[]);const s=tt=>{const Ie=w.includes(tt)?w.filter(He=>He!==tt):[...w,tt];A(Ie)},de=()=>{A([]),F(!1)},Ee=w.length>0;return _e.jsxs("div",{className:"filter-dropdown",ref:X,children:[_e.jsxs("button",{className:`filter-dropdown-trigger ${L?"active":""} ${Ee?"has-selection":""}`,onClick:()=>F(!L),"aria-expanded":L,"aria-haspopup":"listbox",children:[_e.jsx("span",{children:h}),Ee&&_e.jsx("span",{className:"filter-dropdown-badge",children:w.length}),_e.jsx("svg",{className:"filter-dropdown-chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_e.jsxs("div",{className:`filter-dropdown-menu ${L?"open":""}`,role:"listbox",children:[f.map(tt=>{const Ie=w.includes(tt);return _e.jsxs("div",{className:`filter-dropdown-option ${Ie?"selected":""}`,role:"option","aria-selected":Ie,onClick:()=>s(tt),children:[_e.jsx("span",{className:"filter-dropdown-checkbox",children:_e.jsx("svg",{className:"filter-dropdown-checkmark",viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M2.5 6L5 8.5L9.5 4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),_e.jsx("span",{className:"filter-dropdown-label",children:tt})]},tt)}),Ee&&_e.jsx("button",{className:"filter-dropdown-clear",onClick:de,children:"Clear All"})]})]})}function JP({label:h,value:f,onChange:w,placeholder:A="Project Name"}){const[L,F]=st.useState(f||""),X=st.useCallback(de=>{const Ee=de.target.value;F(Ee),X.timeoutId&&clearTimeout(X.timeoutId),X.timeoutId=setTimeout(()=>{w(Ee)},300)},[w]),s=st.useCallback(()=>{F(""),w("")},[w]);return _e.jsxs("div",{className:"text-filter",children:[_e.jsx("input",{type:"text",className:"text-filter-input",value:L,onChange:X,placeholder:A,"aria-label":h}),L&&_e.jsx("button",{className:"text-filter-clear",onClick:s,"aria-label":"Clear search",children:_e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"
3038currentColor",children:_e.jsx("path",{d:"M9.53 3.53a.75.75 0 0 0-1.06-1.06L6 4.94 3.53 2.47a.75.75 0 0 0-1.06 1.06L4.94 6 2.47 8.47a.75.75 0 1 0 1.06 1.06L6 7.06l2.47 2.47a.75.75 0 1 0 1.06-1.06L7.06 6l2.47-2.47Z"})})})]})}function QP({companies:h=[],selected:f=[],onChange:w}){const[A,L]=st.useState(""),[F,X]=st.useState(!1),[s,de]=st.useState(-1),Ee=st.useRef(null),tt=st.useRef(null),Ie=h.filter(Ce=>Ce.toLowerCase().includes(A.toLowerCase())&&!f.includes(Ce)).slice(0,10),He=st.useCallback(Ce=>{L(Ce.target.value),de(-1)},[]),vt=st.useCallback(Ce=>{var dt;w([...f,Ce]),L(""),de(-1),(dt=tt.current)==null||dt.focus()},[f,w]),mt=st.useCallback((Ce,dt)=>{dt.stopPropagation(),w(f.filter(Vt=>Vt!==Ce))},[f,w]),at=st.useCallback(Ce=>{if(Ie.length===0){Ce.key==="Escape"&&(X(!1),de(-1));return}switch(Ce.key){case"ArrowDown":Ce.preventDefault(),de(dt=>dt<Ie.length-1?dt+1:dt);break;case"ArrowUp":Ce.preventDefault(),de(dt=>dt>0?dt-1:-1);break;case"Enter":Ce.preventDefault(),s>=0&&vt(Ie[s]);break;case"Escape":X(!1),de(-1);break}},[Ie,s,vt]);st.useEffect(()=>{const Ce=dt=>{Ee.current&&!Ee.current.contains(dt.target)&&(X(!1),de(-1),L(""))};return document.addEventListener("mousedown",Ce),()=>document.removeEventListener("mousedown",Ce)},[]);const Ft=st.useCallback(Ce=>{Ce.stopPropagation(),w([]),L(""),X(!1)},[w]),Ve=st.useCallback(()=>{X(!F),F||setTimeout(()=>{var Ce;return(Ce=tt.current)==null?void 0:Ce.focus()},0)},[F]),Se=f.length>0;return _e.jsxs("div",{className:"company-filter",ref:Ee,children:[_e.jsxs("button",{className:`filter-dropdown-trigger ${F?"active":""} ${Se?"has-selection":""}`,onClick:Ve,"aria-expanded":F,"aria-haspopup":"listbox",children:[_e.jsx("span",{children:"Company"}),Se&&_e.jsx("span",{className:"filter-dropdown-badge",children:f.length}),_e.jsx("svg",{className:"filter-dropdown-chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_e.jsxs("div",{className:`company-filter-menu ${F?"open":""}`,children:[Se&&_e.jsx("div",{className:"company-filter-selected",children:f.map(Ce=>_e.jsxs("div",{className:"company-filter-selected-item",children:[_e.jsx("span",{className:"company-filter-selected-label",children:Ce}),_e.jsx("button",{className:"company-filter-selected-remove",onClick:dt=>mt(Ce,dt),"aria-label":`Remove ${Ce}`,children:_e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"currentColor",children:_e.jsx("path",{d:"M9.53 3.53a.75.75 0 0 0-1.06-1.06L6 4.94 3.53 2.47a.75.75 0 0 0-1.06 1.06L4.94 6 2.47 8.47a.75.75 0 1 0 1.06 1.06L6 7.06l2.47 2.47a.75.75 0 1 0 1.06-1.06L7.06 6l2.47-2.47Z"})})})]},Ce))}),_e.jsx("div",{className:"company-filter-search",children:_e.jsx("input",{ref:tt,type:"text",className:"company-filter-search-input",value:A,onChange:He,onKeyDown:at,placeholder:"Search companies...","aria-label":"Search companies","aria-autocomplete":"list"})}),Ie.length>0&&_e.jsx("ul",{className:"company-filter-suggestions",role:"listbox",children:Ie.map((Ce,dt)=>_e.jsx("li",{role:"option","aria-selected":dt===s,className:`company-filter-suggestion ${dt===s?"highlighted":""}`,onClick:()=>vt(Ce),onMouseEnter:()=>de(dt),children:Ce},Ce))}),A&&Ie.length===0&&_e.jsx("div",{className:"company-filter-no-results",children:"No companies found"}),Se&&_e.jsx("button",{className:"filter-dropdown-clear",onClick:Ft,children:"Clear All"})]})]})}function eR({cities:h={},currentDomain:f}){const[w,A]=st.useState(!1),L=st.useRef(null);if(!h||Object.keys(h).length===0)return null;const F=h[f],X=(F==null?void 0:F.label)||"Select City";st.useEffect(()=>{const Ee=tt=>{L.current&&!L.current.contains(tt.target)&&A(!1)};return document.addEventListener("mousedown",Ee),()=>document.removeEventListener("mousedown",Ee)},[]);const s=st.useCallback(Ee=>{const tt=h[Ee];if(tt&&tt.subdomain){const Ie=new URL(window.location.href),He=Ie.hostname.split(".");He.length>=2&&(He[0]=tt.subdomain,Ie.hostname=He.join("."),window.location.href=Ie.toString())}A(!1)},[h]),de=Object.entries(h).sort((Ee,tt)=>Ee[1].label.localeCompare(tt[1].label));return _e.jsxs("div",{className:"city-selector",ref:L,children:[_e.jsxs("button",{className:`city-selector-trigger ${w?"open":""}`,onClick:()=>A(!w),"aria-expanded":w,"aria-haspopup":"listbox",children:[_e.jsx("span",{className:"city-selector-label",children:"City"}),_e.jsx("span",{className:"city-selector-value",children:X}),_e.jsx("svg",{className:`city-selector-chevron ${w?"open":""}`,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:_e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),w&&_e.jsx("div",{className:"city-selector-dropdown",role:"listbox",children:de.map(([Ee,tt])=>_e.jsxs("button",{className:`city-selector-option ${Ee===f?"selected":""}`,onClick:()=>s(Ee),role:"option","aria-selected":Ee===f,children:[tt.label,Ee===f&&_e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"
3038currentColor",children:_e.jsx("path",{d:"M11.78 4.22a.75.75 0 0 1 0 1.06l-5.5 5.5a.75.75 0 0 1-1.06 0l-2.5-2.5a.75.75 0 1 1 1.06-1.06L5.75 9.19l4.97-4.97a.75.75 0 0 1 1.06 0Z"})})]},Ee))})]})}function tR({onClick:h,count:f=0,isSubscriber:w=!1}){const A=w?`My Searches${f>0?` (${f})`:""}`:'Pro feature: Save & manage searches. Click "Get Pro" to upgrade.';return _e.jsxs("button",{className:`saved-searches-button ${f>0?"has-searches":""}`,onClick:h,title:A,"aria-label":A,children:[_e.jsx("svg",{className:"saved-searches-button__icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:_e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),_e.jsx("span",{className:"saved-searches-button__label",children:"My Searches"}),f>0&&_e.jsx("span",{className:"saved-searches-button__badge",children:f})]})}function iR({onClick:h,loading:f=!1,isSubscriber:w=!1}){const A=w?"Save this search":'Pro feature: Save searches. Click "Get Pro" to upgrade.';return _e.jsx("button",{className:`quick-save-button ${f?"loading":""}`,onClick:h,disabled:f,title:A,"aria-label":A,children:f?_e.jsx("span",{className:"quick-save-button__spinner"}):_e.jsx(_e.Fragment,{children:_e.jsxs("svg",{className:"quick-save-button__icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[_e.jsx("path",{d:"M17 21l-5-3.5L7 21V5a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2z"}),_e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"14"}),_e.jsx("line",{x1:"9",y1:"11",x2:"15",y2:"11"})]})})})}function nR({onClick:h,isSubscriber:f=!1,disabled:w=!1}){const A=f?"Export data":'Pro feature: Export data. Click "Get Pro" to upgrade.';return _e.jsx("button",{className:"export-button",onClick:h,disabled:w,title:A,"aria-label":A,children:_e.jsxs("svg",{className:"export-button__icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),_e.jsx("polyline",{points:"17 8 12 3 7 8"}),_e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})})}function rR({onClick:h}){const f="Watch the map overview video";return _e.jsx("button",{className:"help-button",onClick:h,title:f,"aria-label":f,children:_e.jsxs("svg",{className:"help-button__icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_e.jsx("circle",{cx:"12",cy:"12",r:"10"}),_e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),_e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})})}function fS(h){var w,A,L,F;if(!h)return[];const f=[];return(w=h.neighborhood)!=null&&w.length&&h.neighborhood.forEach(X=>f.push({label:X,type:"neighborhood"})),(A=h.uses)!=null&&A.length&&h.uses.forEach(X=>f.push({label:X,type:"uses"})),(L=h.status)!=null&&L.length&&h.status.forEach(X=>f.push({label:X,type:"status"})),(F=h.company)!=null&&F.length&&h.company.forEach(X=>f.push({label:X,type:"company"})),h.title&&f.push({label:`"${h.title}"`,type:"title"}),f}function oR({isOpen:h,onClose:f,searches:w=[],onLoadSearch:A,onDeleteSearch:L,onUpdateSearch:F,onSaveCurrentSearch:X,onToggleNotifications:s,onExportSearch:de,currentFilters:Ee,isSubscriber:tt=!1,loading:Ie=!1}){const[He,vt]=st.useState(null),[mt,at]=st.useState(""),[Ft,Ve]=st.useState(""),[Se,Ce]=st.useState(""),dt=st.useRef(null),Vt=st.useRef(null),jt=st.useRef(null);st.useEffect(()=>{const Ct=qe=>{qe.key==="Escape"&&f()};if(h)return document.addEventListener("keydown",Ct),()=>document.removeEventListener("keydown",Ct)},[h,f]),st.useEffect(()=>{He&&Vt.current&&(Vt.current.focus(),Vt.current.select())},[He]);const qt=st.useCallback(Ct=>{dt.current&&!dt.current.contains(Ct.target)&&f()},[f]),si=st.useCallback(Ct=>{vt(Ct.id),at(Ct.name),Ve(Ct.name)},[]),ji=st.useCallback(()=>{He&&mt.trim()&&(F(He,{name:mt.trim()},Ft),vt(null),at(""),Ve(""))},[He,mt,Ft,F]),Ui=st.useCallback(()=>{vt(null),at(""),Ve("")},[]),ar=st.useCallback(Ct=>{Ct.key==="Enter"?ji():Ct.key==="Escape"&&Ui()},[ji,Ui]),fr=st.useCallback(Ct=>{s&&s(Ct.id,!Ct.notifications_enabled,Ct.name)},[s]),Ii=st.useCallback(Ct=>{L(Ct.id,Ct.name)},[L]),Cr=st.useCallback(Ct=>{A(Ct),f()},[A,f]),Hn=st.useCallback(Ct=>{Ct.preventDefault(),Se.trim()&&(X(Se.trim()),Ce(""))},[Se,X]),ri=st.useCallback(Ct=>{var ti,ai,Si,Sn;if(!Ct)return"No filters";const qe=[];return(ti=Ct.neighborhood)!=null&&ti.length&&qe.push(Ct.neighborhood.join(", ")),(ai=Ct.uses)!=null&&ai.length&&qe.push(Ct.uses.join(", ")),(Si=Ct.status)!=null&&Si.length&&qe.push(Ct.status.join(", ")),(Sn=Ct.company)!=null&&Sn.length&&qe.push(Ct.company.join(", ")),Ct.title&&qe.push(`"${Ct.title}"`),qe.length>0?qe.join(" / "):"All projects"},[]),Ei=st.useCallback(Ct=>Ct===0?"No new updates":Ct===1?"1 new project matched":`${Ct} new projects matched`,[]);if(!h)return null;const Gt=fS(Ee),Ti=Gt.length>0;return _e.jsx("div",{className:"saved-searches-modal-backdrop",onClick:qt,children:_e.jsxs("div",{className:"saved-searches-modal",ref:dt,role:"dialog","aria-modal":"true",children:[_e.jsxs("div",{className:"saved-searches-modal__header",children:[_e.jsx("h2",{children:"Saved Searches"}),_e.jsx("button",{className:"saved-searches-modal__close",onClick:f,"aria-label":"Close",children:_e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:_e.jsx("path",{d:"M2 2L18 18M2 18L18 2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),_e.jsx("div",{className:"saved-searches-modal__content",children:tt?_e.jsxs(_e.Fragment,{children:[_e.jsxs("div",{className:"saved-searches-modal__current-filters",children:[_e.jsx("div",{className:"saved-searches-modal__current-filters-label",children:"CURRENT VIEW FILTERS"}),_e.jsx("div",{className:"saved-searches-modal__current-filters-pills",children:Ti?Gt.map((Ct,qe)=>_e.jsx("span",{className:`saved-searches-modal__filter-pill saved-searches-modal__filter-pill--${Ct.type}`,children:Ct.label},qe)):_e.jsx("span",{className:"saved-searches-modal__filter-pill saved-searches-modal__filter-pill--empty",children:"No filters applied"})})]}),_e.jsxs("form",{className:"saved-searches-modal__save-form",onSubmit:Hn,children:[_e.jsx("input",{ref:jt,type:"text",placeholder:"Name this search...",value:Se,onChange:Ct=>Ce(Ct.target.value),className:"saved-searches-modal__save-input"}),_e.jsx("button",{type:"submit",className:"saved-searches-modal__save-btn",disabled:!Se.trim()||Ie,children:"+ Save"})]}),Ie?_e.jsxs("div",{className:"saved-searches-modal__loading",children:[_e.jsx("div",{className:"loading-spinner"}),_e.jsx("p",{children:"Loading saved searches..."})]}):w.length===0?_e.jsxs("div",{className:"saved-searches-modal__empty",children:[_e.jsx("p",{children:"No saved searches yet."}),_e.jsx("p",{className:"saved-searches-modal__empty-hint",children:"Apply filters to the map and save your search to access it later."})]}):_e.jsx("ul",{className:"saved-searches-modal__list",children:w.map(Ct=>_e.jsxs("li",{className:"saved-search-item",children:[_e.jsx("div",{className:"saved-search-item__main",children:He===Ct.id?_e.jsxs("div",{className:"saved-search-item__edit",children:[_e.jsx("input",{ref:Vt,type:"text",value:mt,onChange:qe=>at(qe.target.value),onKeyDown:ar,className:"saved-search-item__edit-input"}),_e.jsx("button",{onClick:ji,className:"saved-search-item__edit-save",title:"Save",children:"✓"}),_e.jsx("button",{onClick:Ui,className:"saved-search-item__edit-cancel",title:"Cancel",children:"✕"})]}):_e.jsx(_e.Fragment,{children:_e.jsxs("div",{className:"saved-search-item__info",children:[_e.jsx("button",{type:"button",className:"saved-search-item__name-btn",onClick:()=>
3038Cr(Ct),title:"Load this search","aria-label":`Load saved search: ${Ct.name}`,children:Ct.name}),_e.jsx("span",{className:"saved-search-item__filters",children:ri(Ct.filters)}),_e.jsx("span",{className:`saved-search-item__status ${Ct.new_projects_count>0?"saved-search-item__status--has-updates":""}`,children:Ei(Ct.new_projects_count||0)})]})})}),He!==Ct.id&&_e.jsxs("div",{className:"saved-search-item__actions",children:[(()=>{const qe=Ct.notifications_enabled?"Disable email notifications":"Enable email notifications";return _e.jsxs("button",{className:`saved-search-item__btn saved-search-item__btn--notify ${Ct.notifications_enabled?"active":""}`,onClick:()=>fr(Ct),"data-tooltip":qe,"aria-label":qe,children:[_e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[_e.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),_e.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),Ct.notifications_enabled&&_e.jsx("svg",{className:"saved-search-item__checkmark",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:_e.jsx("polyline",{points:"20 6 9 17 4 12"})})]})})(),de&&_e.jsx("button",{className:"saved-search-item__btn saved-search-item__btn--export",onClick:()=>de(Ct),"data-tooltip":"Export data","aria-label":"Export data",children:_e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),_e.jsx("polyline",{points:"17 8 12 3 7 8"}),_e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}),_e.jsx("button",{className:"saved-search-item__btn saved-search-item__btn--rename",onClick:()=>si(Ct),"data-tooltip":"Rename","aria-label":"Rename",children:_e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[_e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),_e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),_e.jsx("button",{className:"saved-search-item__btn saved-search-item__btn--delete",onClick:()=>Ii(Ct),"data-tooltip":"Delete","aria-label":"Delete",children:_e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[_e.jsx("polyline",{points:"3 6 5 6 21 6"}),_e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),_e.jsx("button",{className:"saved-search-item__btn saved-search-item__btn--view",onClick:()=>Cr(Ct),"data-tooltip":"Load this search","aria-label":"Load this search",children:_e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[_e.jsx("circle",{cx:"11",cy:"11",r:"7"}),_e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})})]})]},Ct.id))})]}):_e.jsxs("div",{className:"saved-searches-modal__upgrade",children:[_e.jsx("div",{className:"saved-searches-modal__upgrade-icon",children:_e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:_e.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})}),_e.jsx("h3",{children:"Save Your Searches"}),_e.jsx("p",{children:"Upgrade to Pro to save unlimited searches, get daily email alerts for new projects, and export data."}),_e.jsx("a",{href:"/subscribe",className:"saved-searches-modal__upgrade-btn",children:"Get Pro"})]})})]})})}const sR=[{id:"csv",label:"CSV",hint:"Comma-separated values (.csv)"},{id:"json",label:"JSON",hint:"Structured JSON (.json)"},{id:"xlsx",label:"Excel",hint:"Coming soon",disabled:!0},{id:"gsheet",label:"Google Sheet",hint:"Coming soon",disabled:!0}];function aR({isOpen:h,onClose:f,filters:w,projectNids:A=[],searchName:L=null,savedSearchId:F=null,quota:X,quotaLoading:s=!1,onExport:de}){const[Ee,tt]=st.useState("csv"),[Ie,He]=st.useState(!1),[vt,mt]=st.useState(!1),[at,Ft]=st.useState(null),Ve=st.useRef(null);st.useEffect(()=>{h||(tt("csv"),He(!1),mt(!1),Ft(null))}
3038,[h]),st.useEffect(()=>{const ri=Ei=>{Ei.key==="Escape"&&!vt&&f()};if(h)return document.addEventListener("keydown",ri),()=>document.removeEventListener("keydown",ri)},[h,f,vt]);const Se=st.useCallback(ri=>{vt||Ve.current&&!Ve.current.contains(ri.target)&&f()},[f,vt]),Ce=st.useMemo(()=>fS(w),[w]),dt=Ce.length>0,Vt=A.length,jt=X?X.remaining:null,qt=X?X.limit:null,si=X?X.days_remaining:null,ji=jt!==null&&Vt>jt&&jt>0,Ui=ji?Vt-jt:0,ar=jt===null?Vt:Math.min(Vt,jt),fr=jt===0,Ii=Vt===0,Cr=!vt&&!s&&!fr&&!Ii&&(!ji||Ie),Hn=st.useCallback(async()=>{if(!(!Cr||!de)){mt(!0),Ft(null);try{const ri=await de({filters:w||{},projectNids:A,format:Ee,name:L,savedSearchId:F});ri!=null&&ri.success?f():(mt(!1),Ft((ri==null?void 0:ri.message)||(ri==null?void 0:ri.error)||"Export failed."))}catch(ri){mt(!1),Ft((ri==null?void 0:ri.message)||"Export failed.")}}},[Cr,de,w,A,Ee,L,F,f]);return h?_e.jsx("div",{className:"export-modal-backdrop",onClick:Se,children:_e.jsxs("div",{className:"export-modal",ref:Ve,role:"dialog","aria-modal":"true","aria-labelledby":"export-modal-title",children:[_e.jsxs("div",{className:"export-modal__header",children:[_e.jsx("h2",{id:"export-modal-title",children:"Export Data"}),_e.jsx("button",{className:"export-modal__close",onClick:f,disabled:vt,"aria-label":"Close",children:_e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:_e.jsx("path",{d:"M2 2L18 18M2 18L18 2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),_e.jsxs("div",{className:"export-modal__content",children:[_e.jsx("div",{className:"export-modal__quota",children:s?_e.jsx("span",{className:"export-modal__quota-loading",children:"Checking quota…"}):X?_e.jsxs(_e.Fragment,{children:[_e.jsx("span",{className:"export-modal__quota-num",children:jt}),_e.jsxs("span",{className:"export-modal__quota-text",children:["of ",qt," project exports remaining this month"]}),_e.jsxs("span",{className:"export-modal__quota-reset",children:["· resets in ",si," day",si===1?"":"s"]})]}):_e.jsx("span",{className:"export-modal__quota-text",children:"Quota unavailable"})}),_e.jsxs("div",{className:"export-modal__section",children:[_e.jsx("div",{className:"export-modal__section-label",children:L?`Criteria — "${L}"`:"Current view filters"}),_e.jsx("div",{className:"export-modal__pills",children:dt?Ce.map((ri,Ei)=>_e.jsx("span",{className:`saved-searches-modal__filter-pill saved-searches-modal__filter-pill--${ri.type}`,children:ri.label},`${ri.type}-${Ei}`)):_e.jsx("span",{className:"saved-searches-modal__filter-pill saved-searches-modal__filter-pill--empty",children:"No filters applied — all projects"})})]}),_e.jsx("div",{className:"export-modal__match",children:Ii?_e.jsx("span",{className:"export-modal__match--empty",children:"Your search returns 0 projects. Adjust the filters to export data."}):_e.jsxs("span",{children:["Your search returns"," ",_e.jsx("strong",{children:Vt})," ","project",Vt===1?"":"s","."]})}),fr&&_e.jsxs("div",{className:"export-modal__warning export-modal__warning--exhausted",children:["You've reached your monthly export limit of ",qt," projects. The quota resets in ",si," day",si===1?"":"s","."]}),ji&&!fr&&_e.jsxs("div",{className:"export-modal__warning",children:[_e.jsxs("p",{children:["Only ",_e.jsx("strong",{children:jt})," of these"," ",_e.jsx("strong",{children:Vt})," projects will be exported to stay within your monthly limit. The remaining"," ",_e.jsx("strong",{children:Ui})," will be skipped."]}),_e.jsxs("label",{className:"export-modal__ack",children:[_e.jsx("input",{type:"checkbox",checked:Ie,onChange:ri=>He(ri.target.checked),disabled:vt}),_e.jsxs("span",{children:["I understand — export"," ",jt," project",jt===1?"":"s"]})]})]}),_e.jsxs("div",{className:"export-modal__section",children:[_e.jsx("div",{className:"export-modal__section-label",children:"Format"}),_e.jsx("div",{className:"export-modal__formats",children:sR.map(ri=>_e.jsxs("label",{className:`export-modal__format ${ri.disabled?"is-disabled":""} ${Ee===ri.id?"is-selected":""}`,children:[_e.jsx("input",{type:"radio",name:"export-format",value:ri.id,checked:Ee===ri.id,onChange:()=>tt(ri.id),disabled:ri.disabled||vt}),_e.jsxs("span",{className:"export-modal__format-main",children:[_e.jsx("span",{className:"export-modal__format-label",children:ri.label}),_e.jsx("span",{className:"export-modal__format-hint",children:ri.hint})]})]},ri.id))})]}),at&&_e.jsx("div",{className:"export-modal__error",role:"alert",children:at}),_e.jsxs("div",{className:"export-modal__actions",children:[_e.jsx("button",{type:"button",className:"export-modal__cancel",onClick:f,disabled:vt,children:"Cancel"}),_e.jsx("button",{type:"button",className:"export-modal__submit",onClick:Hn,disabled:!Cr,children:vt?"Exporting…":`Export ${ar} project${ar===1?"":"s"}`})]})]})]})}):null}function lR({isOpen:h,onClose:f,feature:w="this feature",title:A="Upgrade to Pro",de
3038scription:L=null}){const F=st.useRef(null);st.useEffect(()=>{const de=Ee=>{Ee.key==="Escape"&&f()};if(h)return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[h,f]);const X=st.useCallback(de=>{F.current&&!F.current.contains(de.target)&&f()},[f]);if(!h)return null;const s=`Upgrade to Pro to ${w}, get daily email alerts for new projects, and export data.`;return _e.jsx("div",{className:"pro-upgrade-modal-backdrop",onClick:X,children:_e.jsxs("div",{className:"pro-upgrade-modal",ref:F,role:"dialog","aria-modal":"true",children:[_e.jsx("button",{className:"pro-upgrade-modal__close",onClick:f,"aria-label":"Close",children:_e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:_e.jsx("path",{d:"M2 2L18 18M2 18L18 2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),_e.jsxs("div",{className:"pro-upgrade-modal__content",children:[_e.jsx("div",{className:"pro-upgrade-modal__icon",children:_e.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:_e.jsx("path",{d:"M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"})})}),_e.jsx("h3",{children:A}),_e.jsx("p",{children:L||s}),_e.jsx("a",{href:"/subscribe",className:"pro-upgrade-modal__btn",children:"Get Pro"})]})]})})}const cR="https://www.youtube-nocookie.com/embed/7U-Up0YjMtQ?autoplay=1&mute=1&controls=1&rel=0&modestbranding=1&playsinline=1";function uR({isOpen:h,onClose:f}){const w=st.useRef(null);st.useEffect(()=>{const L=F=>{F.key==="Escape"&&f()};if(h)return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[h,f]);const A=st.useCallback(L=>{w.current&&!w.current.contains(L.target)&&f()},[f]);return h?_e.jsx("div",{className:"overview-video-modal-backdrop",onClick:A,children:_e.jsxs("div",{className:"overview-video-modal",ref:w,role:"dialog","aria-modal":"true","aria-label":"Map overview video",children:[_e.jsx("button",{className:"overview-video-modal__close",onClick:f,"aria-label":"Close",children:_e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:_e.jsx("path",{d:"M2 2L18 18M2 18L18 2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}),_e.jsx("div",{className:"overview-video-modal__player",children:_e.jsx("iframe",{className:"overview-video-modal__frame",src:cR,title:"Map overview video",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0})})]})}):null}function hR(h){const[f,w]=st.useState([]),[A,L]=st.useState({lat:34.0522,lon:-118.2437}),[F,X]=st.useState(null),[s,de]=st.useState({}),[Ee,tt]=st.useState([]),[Ie,He]=st.useState([]),[vt,mt]=st.useState(!0),[at,Ft]=st.useState(null);return st.useEffect(()=>{if(!h){Ft("No API URL provided"),mt(!1);return}(async()=>{try{mt(!0),Ft(null);const Se=await fetch(h,{headers:{Accept:"application/json"}});if(!Se.ok)throw new Error(`HTTP error! status: ${Se.status}`);const Ce=await Se.json();w(Ce.projects||[]),Ce.center&&L(Ce.center),Ce.domain&&X(Ce.domain),Ce.cities&&de(Ce.cities),Ce.neighborhoods&&tt(Ce.neighborhoods),Ce.companies&&He(Ce.companies)}catch(Se){console.error("Error fetching projects:",Se),Ft(Se.message)}finally{mt(!1)}})()},[h]),{projects:f,center:A,domain:F,cities:s,neighborhoods:Ee,companies:Ie,loading:vt,error:at}}function dR(h){const[f,w]=st.useState([]),[A,L]=st.useState(!1),[F,X]=st.useState(null),s=st.useCallback(async()=>{if(!h){w([]);return}L(!0),X(null);try{const He=await fetch("/api/saved-searches",{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(!He.ok){if(He.status===403){w([]);return}throw new Error("Failed to fetch saved searches")}const vt=await He.json();w(vt.searches||[])}catch(He){console.error("Error fetching saved searches:",He),X(He.message),w([])}finally{L(!1)}},[h]),de=st.useCallback(async(He,vt)=>{if(!h)return{success:!1,error:"Pro subscription required"};try{const mt=await fetch("/api/saved-searches",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"}
3038,body:JSON.stringify({name:He,filters:vt})});if(!mt.ok){const Ft=await mt.json().catch(()=>({}));throw new Error(Ft.message||"Failed to save search")}const at=await mt.json();return at.search&&w(Ft=>[at.search,...Ft]),{success:!0,search:at.search}}catch(mt){return console.error("Error saving search:",mt),{success:!1,error:mt.message}}},[h]),Ee=st.useCallback(async(He,vt)=>{if(!h)return{success:!1,error:"Pro subscription required"};try{const mt=await fetch(`/api/saved-searches/${He}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(vt)});if(!mt.ok)throw new Error("Failed to update search");const at=await mt.json();return at.search&&w(Ft=>Ft.map(Ve=>Ve.id===He?at.search:Ve)),{success:!0,search:at.search}}catch(mt){return console.error("Error updating search:",mt),{success:!1,error:mt.message}}},[h]),tt=st.useCallback(async He=>{if(!h)return{success:!1,error:"Pro subscription required"};try{if(!(await fetch(`/api/saved-searches/${He}`,{method:"DELETE",credentials:"include",headers:{Accept:"application/json"}})).ok)throw new Error("Failed to delete search");return w(mt=>mt.filter(at=>at.id!==He)),{success:!0}}catch(vt){return console.error("Error deleting search:",vt),{success:!1,error:vt.message}}},[h]),Ie=st.useCallback(async He=>{if(!h)return{success:!1,error:"Pro subscription required"};try{const vt=await fetch(`/api/saved-searches/${He}/viewed`,{method:"PATCH",credentials:"include",headers:{Accept:"application/json"}});if(!vt.ok)throw new Error("Failed to mark search as viewed");const mt=await vt.json();return mt.search&&w(at=>at.map(Ft=>Ft.id===He?{...Ft,...mt.search,new_projects_count:0}:Ft)),{success:!0,search:mt.search}}catch(vt){return console.error("Error marking search as viewed:",vt),{success:!1,error:vt.message}}},[h]);return st.useEffect(()=>{h&&s()},[h,s]),{searches:f,loading:A,error:F,fetchSearches:s,saveSearch:de,updateSearch:Ee,deleteSearch:tt,markViewed:Ie}}function pR(h,f){if(h){const w=h.match(/filename\*\s*=\s*(?:UTF-8''|)([^;]+)/i);if(w&&w[1])try{return decodeURIComponent(w[1].trim().replace(/^"|"$/g,""))}catch{}const A=h.match(/filename\s*=\s*"?([^";]+)"?/i);if(A&&A[1])return A[1].trim()}return`urbanize_projects.${f}`}function fR(h,f){const w=URL.createObjectURL(h),A=document.createElement("a");A.href=w,A.download=f,document.body.appendChild(A),A.click(),document.body.removeChild(A),setTimeout(()=>URL.revokeObjectURL(w),1e3)}function mR(h){const[f,w]=st.useState(null),[A,L]=st.useState(!1),[F,X]=st.useState(null),s=st.useCallback(async()=>{if(!h)return w(null),null;L(!0),X(null);try{const Ee=await fetch("/api/exports/quota",{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(!Ee.ok){if(Ee.status===403)return w(null),null;throw new Error("Failed to fetch export quota")}const tt=await Ee.json();return w(tt.quota||null),tt.quota||null}catch(Ee){return console.error("Error fetching export quota:",Ee),X(Ee.message),null}finally{L(!1)}},[h]),de=st.useCallback(async({filters:Ee,projectNids:tt,format:Ie,name:He=null,savedSearchId:vt=null})=>{if(!h)return{success:!1,error:"Pro subscription required"};if(!Array.isArray(tt)||tt.length===0)return{success:!1,error:"No projects selected for export"};if(!["csv","json","xlsx"].includes(Ie))return{success:!1,error:"Unsupported format"};try{const mt=await fetch("/api/exports",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify({filters:Ee||{},project_nids:tt,format:Ie,name:He,saved_search_id:vt})});if(!mt.ok){let qt={};try{qt=await mt.json()}catch{}if(mt.status===429)return qt.quota&&w(qt.quota),{success:!1,error:"quota_exceeded",message:qt.message||"Monthly export limit reached."};if(mt.status===403)return{success:!1,error:"Pro subscription required"};throw new Error(qt.message||`Export failed (${mt.status})`)}const at=mt.headers,Ft=parseInt(at.get("X-Export-Count")||"0",10),Ve=parseInt(at.get("X-Export-Requested")||`${tt.length}`,10),Se=parseInt(at.get("X-Quota-Remaining")||"0",10),Ce=parseInt(at.get("X-Quota-Limit")||"0",10),dt=parseInt(at.get("X-Quota-Resets-At")||"0",10),Vt=pR(at.get("Content-Disposition"),Ie),jt=await mt.blob();return fR(jt,Vt),Number.isFinite(Se)&&Number.isFinite(Ce)&&Ce>
30380?w(qt=>({...qt||{},used:Ce-Se,limit:Ce,remaining:Se,resets_at:dt||(qt==null?void 0:qt.resets_at)||0,days_remaining:(qt==null?void 0:qt.days_remaining)??0})):s(),{success:!0,exportCount:Ft,requestedCount:Ve,truncated:Ft<Ve,filename:Vt,remaining:Se}}catch(mt){return console.error("Error exporting data:",mt),{success:!1,error:mt.message}}},[h,s]);return st.useEffect(()=>{h?s():w(null)},[h,s]),{quota:f,quotaLoading:A,quotaError:F,fetchQuota:s,exportData:de}}const _R="/sites/default/files/map-layers",gR=[],yR={la_urbanize_city:[{id:"la-council-districts",label:"LA City Council Districts",type:"geojson",source:`${_R}/la-council-districts.geojson?v=2`,style:{type:"line",paint:{"line-color":"#374151","line-width":1.5,"line-opacity":1}},fillStyle:{type:"fill",paint:{"fill-color":["match",["get","DISTNO"],1,"#ef4444",2,"#f97316",3,"#eab308",4,"#22c55e",5,"#14b8a6",6,"#06b6d4",7,"#3b82f6",8,"#8b5cf6",9,"#d946ef",10,"#ec4899",11,"#f43f5e",12,"#78716c",13,"#64748b",14,"#0891b2",15,"#059669","#6B7280"],"fill-opacity":.5}},labelStyle:{type:"symbol",layout:{"text-field":["concat","District ",["to-string",["get","DISTNO"]]],"text-font":["DIN Pro Medium","Arial Unicode MS Bold"],"text-size":14,"text-anchor":"center","text-allow-overlap":!1,"text-ignore-placement":!1},paint:{"text-color":"#1f2937","text-halo-color":"#ffffff","text-halo-width":2}},defaultVisible:!1}],chicago_urbanize_city:[],atlanta_urbanize_city:[],nyc_urbanize_city:[],sf_urbanize_city:[]};function mS(h){const f=yR[h]||[];return[...gR,...f]}function vR(h){const f=mS(h),w={};return f.forEach(A=>{w[A.id]=A.defaultVisible||!1}),w}const va={SPLIT:"split",MAP:"map",GRID:"grid"};function _S(h){return String(h).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Dg(h,f){if(!f)return h;const w=f.uses||[],A=f.status||[],L=f.neighborhood||[],F=f.company||[],X=(f.title||"").toLowerCase();return h.filter(s=>!(w.length>0&&!(Array.isArray(s.uses)?s.uses:[]).some(Ee=>w.includes(Ee))||A.length>0&&!A.includes(s.status_label)||L.length>0&&!L.includes(s.neighborhood)||F.length>0&&!(Array.isArray(s.companies)?s.companies:[]).some(Ee=>F.includes(Ee))||X&&!(s.title||"").toLowerCase().includes(X)))}function xR({apiUrl:h,mapboxToken:f,mapboxStyle:w,cityName:A="Urbanize"}){const[L,F]=st.useState(va.MAP),[X,s]=st.useState(null),[de,Ee]=st.useState({uses:[],status:[],neighborhood:[],company:[],title:""}),[tt,Ie]=st.useState(!1),He=st.useRef(null),vt=st.useRef(null),mt=st.useRef(null),[at,Ft]=st.useState({isAuthenticated:!1,isSubscriber:!1}),[Ve,Se]=st.useState(!0),[Ce,dt]=st.useState(!1),[Vt,jt]=st.useState(!1),[qt,si]=st.useState(!1),[ji,Ui]=st.useState({filters:null,projectNids:[],searchName:null,savedSearchId:null}),[ar,fr]=st.useState(!1),[Ii,Cr]=st.useState("save unlimited searches"),[Hn,ri]=st.useState(!1),{projects:Ei,center:Gt,domain:Ti,cities:Ct,neighborhoods:qe,companies:ti,loading:ai,error:Si}=hR(h),{searches:Sn,loading:Kn,saveSearch:br,updateSearch:Or,deleteSearch:un,markViewed:vn}=dR(at.isSubscriber),{quota:nr,quotaLoading:oo,exportData:qn}=mR(at.isSubscriber);st.useEffect(()=>{(async()=>{var Dt,Pi,In;if((In=(Pi=(Dt=window.drupalSettings)==null?void 0:Dt.urbanize)==null?void 0:Pi.paywall)!=null&&In.bypass){Ft({isAuthenticated:!0,isSubscriber:!0}),Se(!1);return}if(typeof window.urbanizeMembership>"u"||typeof window.urbanizeMembership.getCurrentUserInfo!="function"){Ft({isAuthenticated:!1,isSubscriber:!1}),Se(!1);return}try{const Tr=await window.urbanizeMembership.getCurrentUserInfo();Ft({isAuthenticated:Tr.isAuthenticated||!1,isSubscriber:Tr.isSubscriber||!1})}catch(Tr){console.warn("Error checking user auth:",Tr),Ft({isAuthenticated:!1,isSubscriber:!1})}finally{Se(!1)}})()},[]);const Jn=st.useCallback((Wt,Dt="success",Pi={})=>{const Tr={success:"status",error:"error",info:"status",warning:"warning"}[Dt]||"status",ko=typeof Wt=="string"?_S(Wt):Wt&&Wt.html||"";if(!window.Drupal||!window.Drupal.Message)return(Dt==="error"?console.error:console.log)(ko),null;try{return new window.Drupal.Message().add(ko,{type:Tr,persist:!!Pi.persist})}catch(Ic){return console.error("Failed to show notification:",Ic),null}},[]),Ss=st.useCallback(Wt=>{if(!(!Wt||!window.Drupal||!window.Drupal.Message))try{new window.Drupal.Message().remove(Wt)}catch{}},[]),so=st.useCallback(Wt=>{const Dt=Wt?document.querySelector(`[data-drupal-message-id="${Wt}"]`):document,Pi=Dt&&Dt.querySelector("[data-map-open-saved-searches]");Pi&&Pi.addEventListener("click",In=>
3038{In.preventDefault(),Ss(Wt),dt(!0)},{once:!0})},[Ss]),jr=st.useCallback(()=>{const Dt=Sn.filter(In=>In.name.toLowerCase().startsWith(`${A.toLowerCase()} search `)).map(In=>{const Tr=In.name.match(/search (\d+)$/i);return Tr?parseInt(Tr[1],10):0}),Pi=Math.max(0,...Dt)+1;return`${A} search ${Pi}`},[A,Sn]),rr=st.useCallback(async()=>{if(!at.isSubscriber){Cr("save unlimited searches"),fr(!0);return}jt(!0);const Wt=jr(),Dt=await br(Wt,de);if(jt(!1),Dt.success){const Pi=`Your search has been saved as "<strong>${_S(Wt)}</strong>". You can access, edit, and set up alerts for this search by clicking the <svg style="vertical-align:middle;display:inline-block;margin:0 4px" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/></svg> button or by <a href="#" data-map-open-saved-searches>clicking here</a>.`,In=Jn({html:Pi},"success",{persist:!0});so(In)}else Jn(`Failed to save search: ${Dt.error}`,"error")},[at.isSubscriber,jr,br,de,Jn,so]),wu=st.useCallback(async Wt=>{const Dt=await br(Wt,de);Dt.success?Jn(`Your search has been saved as "${Wt}".`,"success"):Jn(`Failed to save search: ${Dt.error}`,"error")},[br,de,Jn]),Go=st.useCallback(Wt=>{if(L!==va.MAP&&L!==va.SPLIT||!mt.current||!mt.current.fitToProjects)return;const Dt=Dg(Ei,Wt);mt.current.fitToProjects(Dt)},[L,Ei]),xa=st.useCallback(Wt=>{const Dt=Wt.filters?{uses:Wt.filters.uses||[],status:Wt.filters.status||[],neighborhood:Wt.filters.neighborhood||[],company:Wt.filters.company||[],title:Wt.filters.title||""}:null;Dt&&Ee(Dt),Go(Dt||de),vn(Wt.id)},[vn,de,Go]),$s=st.useCallback(async(Wt,Dt)=>{const Pi=await un(Wt);Pi.success?Jn(`"${Dt}" has been deleted.`,"success"):Jn(`Failed to delete search: ${Pi.error}`,"error")},[un,Jn]),Hs=st.useCallback(async(Wt,Dt,Pi)=>{const In=await Or(Wt,Dt);In.success&&Dt.name?Jn(`"${Pi}" has been renamed to "${Dt.name}".`,"success"):In.success||Jn(`Failed to update search: ${In.error}`,"error")},[Or,Jn]),Ur=st.useCallback(async(Wt,Dt,Pi)=>{const In=await Or(Wt,{notifications_enabled:Dt});In.success?Jn(`Email notifications for "${Pi}" have been ${Dt?"enabled":"disabled"}.`,"success"):Jn(`Failed to update notifications: ${In.error}`,"error")},[Or,Jn]),Es=st.useCallback(()=>{if(!at.isSubscriber){Cr("save and manage unlimited searches"),fr(!0);return}dt(!0)},[at.isSubscriber]),Qa=st.useCallback(()=>{if(!at.isSubscriber){Cr("export project data"),fr(!0);return}const Wt=Dg(Ei,de);Ui({filters:de,projectNids:Wt.map(Dt=>Dt.nid),searchName:null,savedSearchId:null}),si(!0)},[at.isSubscriber,de,Ei]),$o=st.useCallback(Wt=>{const Dt=Wt.filters||{},Pi=Dg(Ei,Dt);Ui({filters:Dt,projectNids:Pi.map(In=>In.nid),searchName:Wt.name||null,savedSearchId:Wt.id||null}),dt(!1),si(!0)},[Ei]),Is=st.useCallback(async Wt=>{const Dt=await qn(Wt);if(Dt.success){const Pi=Wt.format==="xlsx"?"Excel":Wt.format.toUpperCase();let In=`Exported ${Dt.exportCount} project${Dt.exportCount===1?"":"s"} as ${Pi}.`;Dt.truncated&&(In+=` (Monthly limit reached; ${Dt.requestedCount-Dt.exportCount} skipped.)`),Jn(In,"success")}else Dt.error==="quota_exceeded"?Jn(Dt.message||"Monthly export limit reached.","error"):Dt.error==="Pro subscription required"?Jn("A Pro subscription is required to export data.","error"):Dt.error&&Jn(`Export failed: ${Dt.message||Dt.error}`,"error");return Dt},[qn,Jn]);st.useEffect(()=>{if(ai||!Ei.length)return;const Wt=new URLSearchParams(window.location.search),Dt=Wt.get("project");if(!Dt)return;const Pi=Ei.find(Tr=>String(Tr.nid)===Dt);Pi&&mt.current&&mt.current.highlightProject&&setTimeout(()=>mt.current.highlightProject(Pi),500),Wt.delete("project");const In=Wt.toString()?`${window.location.pathname}?${Wt}`:window.location.pathname;window.history.replaceState({},"",In)},[ai,Ei]),st.useEffect(()=>{const Wt=new URLSearchParams(window.location.search);if(Wt.get("overview")!=="1")return;ri(!0),Wt.delete("overview");const Dt=Wt.toString()?`${window.location.pathname}?${Wt}`:window.location.pathname;window.history.replaceState({},"",Dt)},[]);const Yr=st.useMemo(()=>mS(Ti),[Ti]),[wa,qs]=st.useState({});st.useMemo(()=>{Ti&&qs(vR(Ti))},[Ti]);const ba=st.useCallback((Wt,Dt)=>{qs(Pi=>({...Pi,[Wt]:Dt}))},[]),Zs=st.useMemo(()=>{const Wt=new Set,Dt=new Set;return Ei.forEach(Pi=>
3038{Array.isArray(Pi.uses)&&Pi.uses.forEach(In=>In&&Wt.add(In)),Pi.status_label&&Dt.add(Pi.status_label)}),{uses:Array.from(Wt).sort(),status:Array.from(Dt).sort(),neighborhood:qe}},[Ei,qe]),Qn=st.useMemo(()=>Dg(Ei,de),[Ei,de]),Gr=st.useCallback((Wt,Dt)=>Dt?Wt.filter(Pi=>{const{lat:In,lon:Tr}=Pi;return In>=Dt.south&&In<=Dt.north&&Tr>=Dt.west&&Tr<=Dt.east}):Wt,[]),Ws=st.useMemo(()=>L===va.MAP||L===va.SPLIT?Gr(Qn,X):L===va.GRID?tt?Qn:Gr(Qn,He.current):Qn,[L,Qn,X,tt,Gr]),Xs=st.useCallback(Wt=>{s(Wt),vt.current=Wt},[]),ss=st.useCallback(Wt=>{Wt===va.GRID&&(He.current=vt.current,Ie(!1)),F(Wt)},[]),Do=st.useCallback((Wt,Dt)=>{const Pi={...de,[Wt]:Dt};Ee(Pi),L===va.GRID?Ie(!0):Go(Pi)},[L,de,Go]),Ho=st.useCallback(Wt=>{const Dt={...de,title:Wt};Ee(Dt),L===va.GRID?Ie(!0):Go(Dt)},[L,de,Go]),Ll=st.useCallback(Wt=>{mt.current&&mt.current.highlightProject&&mt.current.highlightProject(Wt)},[]);return ai?_e.jsx("div",{className:"project-map-container",children:_e.jsxs("div",{className:"project-map-loading",children:[_e.jsx("div",{className:"loading-spinner"}),_e.jsx("p",{children:"Loading projects..."})]})}):Si?_e.jsx("div",{className:"project-map-container",children:_e.jsxs("div",{className:"project-map-error",children:[_e.jsxs("p",{children:["Error loading projects: ",Si]}),_e.jsx("button",{onClick:()=>window.location.reload(),children:"Retry"})]})}):_e.jsxs("div",{className:`project-map-container view-mode-${L}`,children:[_e.jsxs("header",{className:"project-map-header",children:[_e.jsxs("div",{className:"project-map-header-left",children:[_e.jsx(eR,{cities:Ct,currentDomain:Ti}),_e.jsx($x,{label:"Land Use",options:Zs.uses,selected:de.uses,onChange:Wt=>Do("uses",Wt)}),_e.jsx($x,{label:"Status",options:Zs.status,selected:de.status,onChange:Wt=>Do("status",Wt)}),_e.jsx($x,{label:"Neighborhood",options:Zs.neighborhood,selected:de.neighborhood,onChange:Wt=>Do("neighborhood",Wt)}),_e.jsx(QP,{companies:ti,selected:de.company,onChange:Wt=>Do("company",Wt)}),_e.jsx(JP,{label:"Search by title",value:de.title,onChange:Ho,placeholder:"Project Name"}),_e.jsxs("span",{className:"project-count",children:[Ws.length," project",Ws.length!==1?"s":""]})]}),_e.jsxs("div",{className:"project-map-header-right",children:[!Ve&&_e.jsxs("div",{className:"saved-searches-buttons",children:[_e.jsx(nR,{onClick:Qa,isSubscriber:at.isSubscriber}),_e.jsx(iR,{onClick:rr,loading:Vt,isSubscriber:at.isSubscriber}),_e.jsx(tR,{onClick:Es,count:Sn.length,isSubscriber:at.isSubscriber}),_e.jsx(rR,{onClick:()=>ri(!0)})]}),_e.jsx(YP,{viewMode:L,onChange:ss})]})]}),_e.jsxs("div",{className:"project-map-content",children:[_e.jsx("div",{className:`panel-left ${L}`,children:_e.jsx(WP,{projects:Ws,fullWidth:L===va.GRID,showFooter:L===va.GRID,totalCount:Ws.length,viewMode:L,onHighlight:Ll})}),_e.jsx("div",{className:`panel-right ${L}`,children:_e.jsx(qP,{ref:mt,projects:Qn,center:Gt,mapboxToken:f,mapboxStyle:w,onBoundsChange:Xs,availableLayers:Yr,layerVisibility:wa,onLayerToggle:ba})})]}),_e.jsx(oR,{isOpen:Ce,onClose:()=>dt(!1),searches:Sn,onLoadSearch:xa,onDeleteSearch:$s,onUpdateSearch:Hs,onToggleNotifications:Ur,onExportSearch:$o,onSaveCurrentSearch:wu,currentFilters:de,isSubscriber:at.isSubscriber,loading:Kn}),_e.jsx(aR,{isOpen:qt,onClose:()=>si(!1),filters:ji.filters,projectNids:ji.projectNids,searchName:ji.searchName,savedSearchId:ji.savedSearchId,quota:nr,quotaLoading:oo,onExport:Is}),_e.jsx(lR,{isOpen:ar,onClose:()=>fr(!1),feature:Ii}),_e.jsx(uR,{isOpen:Hn,onClose:()=>ri(!1)})]})}const ak="",gS=()=>{var A;const h=document.getElementById("project-map-root");if(!h){console.error("Project map root element not found");return}const f=((A=window.drupalSettings)==null?void 0:A.urbanizeProjectMap)||{};hS(h).render(_e.jsx(RC.StrictMode,{children:_e.jsx(xR,{apiUrl:f.apiUrl||h.dataset.apiUrl,mapboxToken:f.mapboxToken,mapboxStyle:f.mapboxStyle,cityName:f.cityName||"Urbanize"})}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",gS):gS()})();
3039//# sourceMappingURL=project-map.js.map

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.