@local-logic/sdks-app 1.0.0-beta.67 → 1.0.0-beta.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Driving.5e24f736.svg +5 -0
- package/dist/assets/Walking.a0dcd971.svg +3 -0
- package/dist/assets/auto-track-legacy.a46e361b.js +1 -0
- package/dist/assets/auto-track.bcea5d95.js +1 -0
- package/dist/assets/close.74ac3780.svg +3 -0
- package/dist/assets/directions.ccc1cf15.svg +3 -0
- package/dist/assets/index-legacy.0be73293.js +1 -0
- package/dist/assets/{index-legacy.33579fb2.js → index-legacy.46f64d17.js} +1 -1
- package/dist/assets/index-legacy.57bc6187.js +1 -0
- package/dist/assets/{index-legacy.45d65bd6.js → index-legacy.5bcad02a.js} +1 -1
- package/dist/assets/index-legacy.770cfe03.js +1 -0
- package/dist/assets/{index-legacy.33ce598b.js → index-legacy.93d69255.js} +1 -1
- package/dist/assets/{index-legacy.c10a590c.js → index-legacy.98ea5567.js} +13 -13
- package/dist/assets/index-legacy.9eb391ce.js +1 -0
- package/dist/assets/{index-legacy.631596f5.js → index-legacy.b7a4faaa.js} +1 -1
- package/dist/assets/index-legacy.c4bf8ae2.js +1 -0
- package/dist/assets/index-legacy.d5ed91f3.js +1 -0
- package/dist/assets/index-legacy.ded6c0c3.js +1 -0
- package/dist/assets/index-legacy.ea25d2c0.js +40 -0
- package/dist/assets/index-legacy.fe28c497.js +1 -0
- package/dist/assets/{chevron_right.08649806.css → index.08649806.css} +0 -0
- package/dist/assets/index.0ad6c4c5.js +1 -0
- package/dist/assets/index.130c24fb.js +1 -0
- package/dist/assets/{index.9c7a418d.js → index.16564d34.js} +1 -1
- package/dist/assets/index.3f198d2d.js +633 -0
- package/dist/assets/index.499b0146.js +1 -0
- package/dist/assets/index.520a122e.js +224 -0
- package/dist/assets/index.6afa5429.js +1 -0
- package/dist/assets/index.939781f4.js +116 -0
- package/dist/assets/{index.689aa908.js → index.9c4a9ff4.js} +326 -304
- package/dist/assets/index.9c512de3.js +1 -0
- package/dist/assets/{index.aad70e37.js → index.a930ac3c.js} +1 -1
- package/dist/assets/index.d464e7cf.js +1 -0
- package/dist/assets/index.e63e2d64.js +1 -0
- package/dist/assets/index.f4fcee01.js +1 -0
- package/dist/assets/{index.umd-legacy.77e7f5f5.js → index.umd-legacy.97cfaf3e.js} +1 -1
- package/dist/assets/{index.umd.3636b63d.js → index.umd.fababc47.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/types/components/Search/index.d.ts +16 -0
- package/dist/types/components/Search/index.d.ts.map +1 -0
- package/dist/types/{sdks/DataExplorer/components/Map → components}/Search/index.js +11 -8
- package/dist/types/components/Search/index.js.map +1 -0
- package/dist/types/{sdks/DataExplorer/components/Map → components}/Search/styles.d.ts +6 -1
- package/dist/types/components/Search/styles.d.ts.map +1 -0
- package/dist/types/{sdks/DataExplorer/components/Map → components}/Search/styles.js +12 -5
- package/dist/types/components/Search/styles.js.map +1 -0
- package/dist/types/{sdks/DataExplorer/features → components/Search}/useGeocodes.d.ts +0 -0
- package/dist/types/components/Search/useGeocodes.d.ts.map +1 -0
- package/dist/types/{sdks/DataExplorer/features → components/Search}/useGeocodes.js +0 -0
- package/dist/types/components/Search/useGeocodes.js.map +1 -0
- package/dist/types/{sdks/DataExplorer/features → components/Search}/useSuggestions.d.ts +0 -0
- package/dist/types/components/Search/useSuggestions.d.ts.map +1 -0
- package/dist/types/{sdks/DataExplorer/features → components/Search}/useSuggestions.js +0 -0
- package/dist/types/components/Search/useSuggestions.js.map +1 -0
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js +1 -0
- package/dist/types/context/languageProvider/data-explorer/locales/en/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js +1 -0
- package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js.map +1 -1
- package/dist/types/context/languageProvider/data-explorer/types.d.ts +1 -1
- package/dist/types/context/languageProvider/data-explorer/types.d.ts.map +1 -1
- package/dist/types/context/languageProvider/index.d.ts +2 -2
- package/dist/types/context/languageProvider/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/local-content/locales/en/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/local-content/locales/en/index.js +9 -0
- package/dist/types/context/languageProvider/local-content/locales/en/index.js.map +1 -1
- package/dist/types/context/languageProvider/local-content/locales/fr/index.d.ts.map +1 -1
- package/dist/types/context/languageProvider/local-content/locales/fr/index.js +9 -0
- package/dist/types/context/languageProvider/local-content/locales/fr/index.js.map +1 -1
- package/dist/types/context/languageProvider/local-content/types.d.ts +2 -1
- package/dist/types/context/languageProvider/local-content/types.d.ts.map +1 -1
- package/dist/types/features/calculateRoute/index.d.ts +3 -0
- package/dist/types/features/calculateRoute/index.d.ts.map +1 -0
- package/dist/types/features/calculateRoute/index.js +3 -0
- package/dist/types/features/calculateRoute/index.js.map +1 -0
- package/dist/types/features/calculateRoute/keyFactory.d.ts +15 -0
- package/dist/types/features/calculateRoute/keyFactory.d.ts.map +1 -0
- package/dist/types/features/calculateRoute/keyFactory.js +5 -0
- package/dist/types/features/calculateRoute/keyFactory.js.map +1 -0
- package/dist/types/features/calculateRoute/types.d.ts +14 -0
- package/dist/types/features/calculateRoute/types.d.ts.map +1 -0
- package/dist/types/features/calculateRoute/types.js +2 -0
- package/dist/types/features/calculateRoute/types.js.map +1 -0
- package/dist/types/features/calculateRoute/useCommute.d.ts +12 -0
- package/dist/types/features/calculateRoute/useCommute.d.ts.map +1 -0
- package/dist/types/features/calculateRoute/useCommute.js +31 -0
- package/dist/types/features/calculateRoute/useCommute.js.map +1 -0
- package/dist/types/hooks/useIsMobile.js +1 -1
- package/dist/types/hooks/useIsMobile.js.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/DataExplorer/components/Map/index.js +4 -2
- package/dist/types/sdks/DataExplorer/components/Map/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/index.d.ts +8 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/index.js +92 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/styles.d.ts +6 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/styles.js +35 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/CommuteCalculator/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.d.ts +4 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.js +25 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.d.ts +7 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.js +30 -0
- package/dist/types/sdks/LocalContent/Map/CommuteContainer/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.js +28 -7
- package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/context.d.ts +9 -0
- package/dist/types/sdks/LocalContent/context.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/context.js +11 -1
- package/dist/types/sdks/LocalContent/context.js.map +1 -1
- package/dist/types/services/decodePolyline/index.d.ts +3 -0
- package/dist/types/services/decodePolyline/index.d.ts.map +1 -0
- package/dist/types/services/decodePolyline/index.js +128 -0
- package/dist/types/services/decodePolyline/index.js.map +1 -0
- package/dist/types/services/pluralize/index.d.ts +2 -0
- package/dist/types/services/pluralize/index.d.ts.map +1 -0
- package/dist/types/services/pluralize/index.js +7 -0
- package/dist/types/services/pluralize/index.js.map +1 -0
- package/package.json +3 -3
- package/dist/assets/auto-track-legacy.f9840683.js +0 -1
- package/dist/assets/auto-track.f73c34a7.js +0 -1
- package/dist/assets/chevron_right-legacy.4a96f715.js +0 -1
- package/dist/assets/chevron_right.427d77f6.js +0 -587
- package/dist/assets/index-legacy.0d90becf.js +0 -40
- package/dist/assets/index-legacy.211144f2.js +0 -1
- package/dist/assets/index-legacy.3b49d3a5.js +0 -1
- package/dist/assets/index-legacy.45d7b5c7.js +0 -1
- package/dist/assets/index-legacy.4789c6e5.js +0 -1
- package/dist/assets/index-legacy.6ed29dcf.js +0 -1
- package/dist/assets/index-legacy.ab44ba23.js +0 -1
- package/dist/assets/index-legacy.b87ca0ca.js +0 -1
- package/dist/assets/index.4b180792.js +0 -1
- package/dist/assets/index.4b5f7238.js +0 -1
- package/dist/assets/index.603b7e8b.js +0 -1
- package/dist/assets/index.9276bc44.js +0 -1
- package/dist/assets/index.adca6e84.js +0 -176
- package/dist/assets/index.c9949bba.js +0 -1
- package/dist/assets/index.e77bdb0c.js +0 -156
- package/dist/assets/index.e82abb8d.js +0 -1
- package/dist/assets/index.fd288973.js +0 -1
- package/dist/assets/index.fe0fe532.js +0 -1
- package/dist/types/sdks/DataExplorer/components/Map/Search/index.d.ts +0 -10
- package/dist/types/sdks/DataExplorer/components/Map/Search/index.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Map/Search/index.js.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Map/Search/styles.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/components/Map/Search/styles.js.map +0 -1
- package/dist/types/sdks/DataExplorer/features/useGeocodes.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/features/useGeocodes.js.map +0 -1
- package/dist/types/sdks/DataExplorer/features/useSuggestions.d.ts.map +0 -1
- package/dist/types/sdks/DataExplorer/features/useSuggestions.js.map +0 -1
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import{D as Mp,E as ih,G as zp,H as rh,J as nh,K as Pp,P as kp,Q as Dp,V as oh,W as Lp,X as Qs,r as ge,Y as Rp,Z as Bp,g as Fp,j as Oi,$ as Sc,d as Op,R as ut,a0 as Up,a1 as Ii,a2 as $p,s as ts,a3 as mh,y as vo,a4 as Vp,h as Np,i as Gp,a5 as qp}from"./index.9c4a9ff4.js";class Zp extends Mp{constructor(k,R){super(),this.client=k,this.options=R,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(R)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.length===1&&(this.currentQuery.addObserver(this),sh(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.listeners.length||this.destroy()}shouldFetchOnReconnect(){return wc(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return wc(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=[],this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(k,R){const N=this.options,G=this.currentQuery;if(this.options=this.client.defaultQueryOptions(k),ih(N,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=N.queryKey),this.updateQuery();const X=this.hasListeners();X&&ah(this.currentQuery,G,this.options,N)&&this.executeFetch(),this.updateResult(R),X&&(this.currentQuery!==G||this.options.enabled!==N.enabled||this.options.staleTime!==N.staleTime)&&this.updateStaleTimeout();const fe=this.computeRefetchInterval();X&&(this.currentQuery!==G||this.options.enabled!==N.enabled||fe!==this.currentRefetchInterval)&&this.updateRefetchInterval(fe)}getOptimisticResult(k){const R=this.client.getQueryCache().build(this.client,k);return this.createResult(R,k)}getCurrentResult(){return this.currentResult}trackResult(k){const R={};return Object.keys(k).forEach(N=>{Object.defineProperty(R,N,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(N),k[N])})}),R}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:k,...R}={}){return this.fetch({...R,meta:{refetchPage:k}})}fetchOptimistic(k){const R=this.client.defaultQueryOptions(k),N=this.client.getQueryCache().build(this.client,R);return N.isFetchingOptimistic=!0,N.fetch().then(()=>this.createResult(N,R))}fetch(k){var R;return this.executeFetch({...k,cancelRefetch:(R=k.cancelRefetch)!=null?R:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(k){this.updateQuery();let R=this.currentQuery.fetch(this.options,k);return k!=null&&k.throwOnError||(R=R.catch(zp)),R}updateStaleTimeout(){if(this.clearStaleTimeout(),rh||this.currentResult.isStale||!nh(this.options.staleTime))return;const R=Pp(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},R)}computeRefetchInterval(){var k;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(k=this.options.refetchInterval)!=null?k:!1}updateRefetchInterval(k){this.clearRefetchInterval(),this.currentRefetchInterval=k,!(rh||this.options.enabled===!1||!nh(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||kp.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(k,R){const N=this.currentQuery,G=this.options,X=this.currentResult,fe=this.currentResultState,a=this.currentResultOptions,ye=k!==N,pe=ye?k.state:this.currentQueryInitialState,Ee=ye?this.currentResult:this.previousQueryResult,{state:be}=k;let{dataUpdatedAt:ne,error:ht,errorUpdatedAt:nt,fetchStatus:Xe,status:ot}=be,zt=!1,at=!1,yt;if(R._optimisticResults){const kt=this.hasListeners(),ui=!kt&&sh(k,R),si=kt&&ah(k,N,R,G);(ui||si)&&(Xe=Dp(k.options.networkMode)?"fetching":"paused",ne||(ot="loading")),R._optimisticResults==="isRestoring"&&(Xe="idle")}if(R.keepPreviousData&&!be.dataUpdateCount&&Ee!=null&&Ee.isSuccess&&ot!=="error")yt=Ee.data,ne=Ee.dataUpdatedAt,ot=Ee.status,zt=!0;else if(R.select&&typeof be.data<"u")if(X&&be.data===(fe==null?void 0:fe.data)&&R.select===this.selectFn)yt=this.selectResult;else try{this.selectFn=R.select,yt=R.select(be.data),yt=oh(X==null?void 0:X.data,yt,R),this.selectResult=yt,this.selectError=null}catch(kt){this.selectError=kt}else yt=be.data;if(typeof R.placeholderData<"u"&&typeof yt>"u"&&ot==="loading"){let kt;if(X!=null&&X.isPlaceholderData&&R.placeholderData===(a==null?void 0:a.placeholderData))kt=X.data;else if(kt=typeof R.placeholderData=="function"?R.placeholderData():R.placeholderData,R.select&&typeof kt<"u")try{kt=R.select(kt),kt=oh(X==null?void 0:X.data,kt,R),this.selectError=null}catch(ui){this.selectError=ui}typeof kt<"u"&&(ot="success",yt=kt,at=!0)}this.selectError&&(ht=this.selectError,yt=this.selectResult,nt=Date.now(),ot="error");const Nt=Xe==="fetching";return{status:ot,fetchStatus:Xe,isLoading:ot==="loading",isSuccess:ot==="success",isError:ot==="error",data:yt,dataUpdatedAt:ne,error:ht,errorUpdatedAt:nt,failureCount:be.fetchFailureCount,errorUpdateCount:be.errorUpdateCount,isFetched:be.dataUpdateCount>0||be.errorUpdateCount>0,isFetchedAfterMount:be.dataUpdateCount>pe.dataUpdateCount||be.errorUpdateCount>pe.errorUpdateCount,isFetching:Nt,isRefetching:Nt&&ot!=="loading",isLoadingError:ot==="error"&&be.dataUpdatedAt===0,isPaused:Xe==="paused",isPlaceholderData:at,isPreviousData:zt,isRefetchError:ot==="error"&&be.dataUpdatedAt!==0,isStale:Ic(k,R),refetch:this.refetch,remove:this.remove}}updateResult(k){const R=this.currentResult,N=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,ih(N,R))return;this.currentResult=N;const G={cache:!0},X=()=>{if(!R)return!0;const{notifyOnChangeProps:fe}=this.options;if(fe==="all"||!fe&&!this.trackedProps.size)return!0;const a=new Set(fe!=null?fe:this.trackedProps);return this.options.useErrorBoundary&&a.add("error"),Object.keys(this.currentResult).some(ye=>{const pe=ye;return this.currentResult[pe]!==R[pe]&&a.has(pe)})};(k==null?void 0:k.listeners)!==!1&&X()&&(G.listeners=!0),this.notify({...G,...k})}updateQuery(){const k=this.client.getQueryCache().build(this.client,this.options);if(k===this.currentQuery)return;const R=this.currentQuery;this.currentQuery=k,this.currentQueryInitialState=k.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(R==null||R.removeObserver(this),k.addObserver(this))}onQueryUpdate(k){const R={};k.type==="success"?R.onSuccess=!k.manual:k.type==="error"&&!Lp(k.error)&&(R.onError=!0),this.updateResult(R),this.hasListeners()&&this.updateTimers()}notify(k){Qs.batch(()=>{if(k.onSuccess){var R,N,G,X;(R=(N=this.options).onSuccess)==null||R.call(N,this.currentResult.data),(G=(X=this.options).onSettled)==null||G.call(X,this.currentResult.data,null)}else if(k.onError){var fe,a,ye,pe;(fe=(a=this.options).onError)==null||fe.call(a,this.currentResult.error),(ye=(pe=this.options).onSettled)==null||ye.call(pe,void 0,this.currentResult.error)}k.listeners&&this.listeners.forEach(Ee=>{Ee(this.currentResult)}),k.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function jp(C,k){return k.enabled!==!1&&!C.state.dataUpdatedAt&&!(C.state.status==="error"&&k.retryOnMount===!1)}function sh(C,k){return jp(C,k)||C.state.dataUpdatedAt>0&&wc(C,k,k.refetchOnMount)}function wc(C,k,R){if(k.enabled!==!1){const N=typeof R=="function"?R(C):R;return N==="always"||N!==!1&&Ic(C,k)}return!1}function ah(C,k,R,N){return R.enabled!==!1&&(C!==k||N.enabled===!1)&&(!R.suspense||C.state.status!=="error")&&Ic(C,R)}function Ic(C,k){return C.isStaleByTime(k.staleTime)}const gh=ge.exports.createContext(!1),Xp=()=>ge.exports.useContext(gh);gh.Provider;var _h={exports:{}},yh={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.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 Qo=ge.exports;function Wp(C,k){return C===k&&(C!==0||1/C===1/k)||C!==C&&k!==k}var Hp=typeof Object.is=="function"?Object.is:Wp,Kp=Qo.useState,Jp=Qo.useEffect,Yp=Qo.useLayoutEffect,Qp=Qo.useDebugValue;function ef(C,k){var R=k(),N=Kp({inst:{value:R,getSnapshot:k}}),G=N[0].inst,X=N[1];return Yp(function(){G.value=R,G.getSnapshot=k,vc(G)&&X({inst:G})},[C,R,k]),Jp(function(){return vc(G)&&X({inst:G}),C(function(){vc(G)&&X({inst:G})})},[C]),Qp(R),R}function vc(C){var k=C.getSnapshot;C=C.value;try{var R=k();return!Hp(C,R)}catch(N){return!0}}function tf(C,k){return k()}var rf=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?tf:ef;yh.useSyncExternalStore=Qo.useSyncExternalStore!==void 0?Qo.useSyncExternalStore:rf;(function(C){C.exports=yh})(_h);function nf(){let C=!1;return{clearReset:()=>{C=!1},reset:()=>{C=!0},isReset:()=>C}}const of=ge.exports.createContext(nf()),sf=()=>ge.exports.useContext(of);function af(C,k){return typeof C=="function"?C(...k):!!C}function lf(C,k){const R=Rp({context:C.context}),N=Xp(),G=sf(),X=R.defaultQueryOptions(C);X._optimisticResults=N?"isRestoring":"optimistic",X.onError&&(X.onError=Qs.batchCalls(X.onError)),X.onSuccess&&(X.onSuccess=Qs.batchCalls(X.onSuccess)),X.onSettled&&(X.onSettled=Qs.batchCalls(X.onSettled)),X.suspense&&typeof X.staleTime!="number"&&(X.staleTime=1e3),(X.suspense||X.useErrorBoundary)&&(G.isReset()||(X.retryOnMount=!1));const[fe]=ge.exports.useState(()=>new k(R,X)),a=fe.getOptimisticResult(X);if(_h.exports.useSyncExternalStore(ge.exports.useCallback(ye=>N?()=>{}:fe.subscribe(Qs.batchCalls(ye)),[fe,N]),()=>fe.getCurrentResult(),()=>fe.getCurrentResult()),ge.exports.useEffect(()=>{G.clearReset()},[G]),ge.exports.useEffect(()=>{fe.setOptions(X,{listeners:!1})},[X,fe]),X.suspense&&a.isLoading&&a.isFetching&&!N)throw fe.fetchOptimistic(X).then(({data:ye})=>{X.onSuccess==null||X.onSuccess(ye),X.onSettled==null||X.onSettled(ye,null)}).catch(ye=>{G.clearReset(),X.onError==null||X.onError(ye),X.onSettled==null||X.onSettled(void 0,ye)});if(a.isError&&!G.isReset()&&!a.isFetching&&af(X.useErrorBoundary,[a.error,fe.getCurrentQuery()]))throw a.error;return X.notifyOnChangeProps?a:fe.trackResult(a)}function xh(C,k,R){const N=Bp(C,k,R);return lf(N,Zp)}const cf=ge.exports.createContext(null);function uf(C){const k=C.clone();return k.pixelsToGLUnits=C.pixelsToGLUnits,k}function lh(C){return{longitude:C.center.lng,latitude:C.center.lat,zoom:C.zoom,pitch:C.pitch,bearing:C.bearing,padding:C.padding}}function ch(C,k){const R=k.viewState||k;let N=!1;if("longitude"in R&&"latitude"in R){const G=C.center;C.center=new G.constructor(R.longitude,R.latitude),N=N||G!==C.center}if("zoom"in R){const G=C.zoom;C.zoom=R.zoom,N=N||G!==C.zoom}if("bearing"in R){const G=C.bearing;C.bearing=R.bearing,N=N||G!==C.bearing}if("pitch"in R){const G=C.pitch;C.pitch=R.pitch,N=N||G!==C.pitch}return R.padding&&!C.isPaddingEqual(R.padding)&&(N=!0,C.padding=R.padding),N}const hf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function uh(C){if(!C)return null;if(typeof C=="string"||("toJS"in C&&(C=C.toJS()),!C.layers))return C;const k={};for(const N of C.layers)k[N.id]=N;const R=C.layers.map(N=>{const G=k[N.ref];let X=null;if("interactive"in N&&(X={...N},delete X.interactive),G){X=X||{...N},delete X.ref;for(const fe of hf)fe in G&&(X[fe]=G[fe])}return X||N});return{...C,layers:R}}function df(C,k){const R=Array.isArray(C)?C[0]:C?C.x:0,N=Array.isArray(C)?C[1]:C?C.y:0,G=Array.isArray(k)?k[0]:k?k.x:0,X=Array.isArray(k)?k[1]:k?k.y:0;return R===G&&N===X}function Un(C,k){if(C===k)return!0;if(!C||!k)return!1;if(Array.isArray(C)){if(!Array.isArray(k)||C.length!==k.length)return!1;for(let R=0;R<C.length;R++)if(!Un(C[R],k[R]))return!1;return!0}else if(Array.isArray(k))return!1;if(typeof C=="object"&&typeof k=="object"){const R=Object.keys(C),N=Object.keys(k);if(R.length!==N.length)return!1;for(const G of R)if(!k.hasOwnProperty(G)||!Un(C[G],k[G]))return!1;return!0}return!1}const hh={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},bc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},dh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},pf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],ff=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class es{constructor(k,R,N){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=G=>{const X=this.props[dh[G.type]];X&&X(G)},this._onPointerEvent=G=>{(G.type==="mousemove"||G.type==="mouseout")&&this._updateHover(G);const X=this.props[hh[G.type]];if(X){if(this.props.interactiveLayerIds&&G.type!=="mouseover"&&G.type!=="mouseout"){const fe=this._hoveredFeatures||this._map.queryRenderedFeatures(G.point,{layers:this.props.interactiveLayerIds});G.features=fe}X(G),delete G.features}},this._onCameraEvent=G=>{if(!this._internalUpdate){const X=this.props[bc[G.type]];X&&X(G)}G.type in this._deferredEvents&&(this._deferredEvents[G.type]=!1)},this._MapClass=k,this.props=R,this._initialize(N)}get map(){return this._map}get transform(){return this._renderTransform}setProps(k){const R=this.props;this.props=k;const N=this._updateSettings(k,R);N&&this._createShadowTransform(this._map);const G=this._updateSize(k),X=this._updateViewState(k,!0);this._updateStyle(k,R),this._updateStyleComponents(k,R),this._updateHandlers(k,R),(N||G||X&&!this._map.isMoving())&&this.redraw()}static reuse(k,R){const N=es.savedMaps.pop();if(!N)return null;const G=N.map,X=G.getContainer();for(R.className=X.className;X.childNodes.length>0;)R.appendChild(X.childNodes[0]);G._container=R,N.setProps({...k,styleDiffing:!1}),G.resize();const{initialViewState:fe}=k;return fe&&(fe.bounds?G.fitBounds(fe.bounds,{...fe.fitBoundsOptions,duration:0}):N._updateViewState(fe,!1)),G.isStyleLoaded()?G.fire("load"):G.once("styledata",()=>G.fire("load")),N}_initialize(k){const{props:R}=this,N={...R,...R.initialViewState,accessToken:R.mapboxAccessToken||mf()||null,container:k,style:uh(R.mapStyle)},G=N.initialViewState||N.viewState||N;if(Object.assign(N,{center:[G.longitude||0,G.latitude||0],zoom:G.zoom||0,pitch:G.pitch||0,bearing:G.bearing||0}),R.gl){const pe=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=pe,R.gl)}const X=new this._MapClass(N);G.padding&&X.setPadding(G.padding),R.cursor&&(X.getCanvas().style.cursor=R.cursor),this._createShadowTransform(X);const fe=X._render;X._render=pe=>{this._inRender=!0,fe.call(X,pe),this._inRender=!1};const a=X._renderTaskQueue.run;X._renderTaskQueue.run=pe=>{a.call(X._renderTaskQueue,pe),this._onBeforeRepaint()},X.on("render",()=>this._onAfterRepaint());const ye=X.fire;X.fire=this._fireEvent.bind(this,ye),X.on("resize",()=>{this._renderTransform.resize(X.transform.width,X.transform.height)}),X.on("styledata",()=>this._updateStyleComponents(this.props,{})),X.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const pe in hh)X.on(pe,this._onPointerEvent);for(const pe in bc)X.on(pe,this._onCameraEvent);for(const pe in dh)X.on(pe,this._onEvent);this._map=X}recycle(){es.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const k=this._map;!this._inRender&&k.style&&(k._frame&&(k._frame.cancel(),k._frame=null),k._render())}_createShadowTransform(k){const R=uf(k.transform);k.painter.transform=R,this._renderTransform=R}_updateSize(k){const{viewState:R}=k;if(R){const N=this._map;if(R.width!==N.transform.width||R.height!==N.transform.height)return N.resize(),!0}return!1}_updateViewState(k,R){if(this._internalUpdate)return!1;const N=this._map,G=this._renderTransform,{zoom:X,pitch:fe,bearing:a}=G,ye=N.isMoving();ye&&(G.cameraElevationReference="sea");const pe=ch(G,{...lh(N.transform),...k});if(ye&&(G.cameraElevationReference="ground"),pe&&R){const Ee=this._deferredEvents;Ee.move=!0,Ee.zoom||(Ee.zoom=X!==G.zoom),Ee.rotate||(Ee.rotate=a!==G.bearing),Ee.pitch||(Ee.pitch=fe!==G.pitch)}return ye||ch(N.transform,k),pe}_updateSettings(k,R){const N=this._map;let G=!1;for(const X of pf)X in k&&!Un(k[X],R[X])&&(G=!0,N[`set${X[0].toUpperCase()}${X.slice(1)}`](k[X]));return G}_updateStyle(k,R){if(k.cursor!==R.cursor&&(this._map.getCanvas().style.cursor=k.cursor),k.mapStyle!==R.mapStyle){const N={diff:k.styleDiffing};return"localIdeographFontFamily"in k&&(N.localIdeographFontFamily=k.localIdeographFontFamily),this._map.setStyle(uh(k.mapStyle),N),!0}return!1}_updateStyleComponents(k,R){const N=this._map;let G=!1;return N.style.loaded()&&("light"in k&&!Un(k.light,R.light)&&(G=!0,N.setLight(k.light)),"fog"in k&&!Un(k.fog,R.fog)&&(G=!0,N.setFog(k.fog)),"terrain"in k&&!Un(k.terrain,R.terrain)&&(!k.terrain||N.getSource(k.terrain.source))&&(G=!0,N.setTerrain(k.terrain))),G}_updateHandlers(k,R){const N=this._map;let G=!1;for(const X of ff){const fe=k[X];Un(fe,R[X])||(G=!0,fe?N[X].enable(fe):N[X].disable())}return G}_updateHover(k){var R;const{props:N}=this;if(N.interactiveLayerIds&&(N.onMouseMove||N.onMouseEnter||N.onMouseLeave)){const X=k.type,fe=((R=this._hoveredFeatures)===null||R===void 0?void 0:R.length)>0;let a;if(X==="mousemove")try{a=this._map.queryRenderedFeatures(k.point,{layers:N.interactiveLayerIds})}catch(pe){a=[]}else a=[];const ye=a.length>0;!ye&&fe&&(k.type="mouseleave",this._onPointerEvent(k)),this._hoveredFeatures=a,ye&&!fe&&(k.type="mouseenter",this._onPointerEvent(k)),k.type=X}else this._hoveredFeatures=null}_fireEvent(k,R,N){const G=this._map,X=G.transform,fe=typeof R=="string"?R:R.type;return fe==="move"&&this._updateViewState(this.props,!1),fe in bc&&(typeof R=="object"&&(R.viewState=lh(X)),this._map.isMoving())?(G.transform=this._renderTransform,k.call(G,R,N),G.transform=X,G):(k.call(G,R,N),G)}_onBeforeRepaint(){const k=this._map;this._internalUpdate=!0;for(const N in this._deferredEvents)this._deferredEvents[N]&&k.fire(N);this._internalUpdate=!1;const R=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=R}}}es.savedMaps=[];function mf(){let C=null;if(typeof location<"u"){const k=/access_token=([^&\/]*)/.exec(location.search);C=k&&k[1]}try{C=C||process.env.MapboxAccessToken}catch(k){}try{C=C||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch(k){}return C}const gf=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function _f(C,k){if(!C)return null;const R=C.map,N={getMap:()=>R,getCenter:()=>C.transform.center,getZoom:()=>C.transform.zoom,getBearing:()=>C.transform.bearing,getPitch:()=>C.transform.pitch,getPadding:()=>C.transform.padding,getBounds:()=>C.transform.getBounds(),project:G=>C.transform.locationPoint(k.LngLat.convert(G)),unproject:G=>C.transform.pointLocation(k.Point.convert(G)),queryTerrainElevation:(G,X)=>{const fe=R.transform;R.transform=C.transform;const a=R.queryTerrainElevation(G,X);return R.transform=fe,a}};for(const G of yf(R))!(G in N)&&!gf.includes(G)&&(N[G]=R[G].bind(R));return N}function yf(C){const k=new Set;let R=C;for(;R;){for(const N of Object.getOwnPropertyNames(R))N[0]!=="_"&&typeof C[N]=="function"&&N!=="fire"&&N!=="setEventedParent"&&k.add(N);R=Object.getPrototypeOf(R)}return Array.from(k)}const xf=typeof document<"u"?ge.exports.useLayoutEffect:ge.exports.useEffect,vf=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function bf(C,k){for(const R of vf)R in k&&(C[R]=k[R]);k.RTLTextPlugin&&C.getRTLTextPluginStatus&&C.getRTLTextPluginStatus()==="unavailable"&&C.setRTLTextPlugin(k.RTLTextPlugin,R=>{R&&console.error(R)},!1)}const fl=ge.exports.createContext(null),wf={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:C=>console.error(C.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},vh=ge.exports.forwardRef((C,k)=>{const R=ge.exports.useContext(cf),[N,G]=ge.exports.useState(null),X=ge.exports.useRef(),{current:fe}=ge.exports.useRef({mapLib:null,map:null});ge.exports.useEffect(()=>{const ye=C.mapLib;let pe=!0,Ee;return Promise.resolve(ye||Fp(()=>import("./index.b70ba4b0.js").then(be=>be.i),[])).then(be=>{if(!!pe){if(be.Map||(be=be.default),!be||!be.Map)throw new Error("Invalid mapLib");if(be.supported(C))bf(be,C),C.reuseMaps&&(Ee=es.reuse(C,X.current)),Ee||(Ee=new es(be.Map,C,X.current)),fe.map=_f(Ee,be),fe.mapLib=be,G(Ee),R==null||R.onMapMount(fe.map,C.id);else throw new Error("Map is not supported by this browser")}}).catch(be=>{C.onError({type:"error",target:null,originalEvent:null,error:be})}),()=>{pe=!1,Ee&&(R==null||R.onMapUnmount(C.id),C.reuseMaps?Ee.recycle():Ee.destroy())}},[]),xf(()=>{N&&N.setProps(C)}),ge.exports.useImperativeHandle(k,()=>fe.map,[N]);const a=ge.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...C.style}),[C.style]);return Oi("div",{id:C.id,ref:X,style:a,children:N&&Oi(fl.Provider,{value:fe,children:C.children})})});vh.displayName="Map";vh.defaultProps=wf;const Tf=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function bo(C,k){if(!C||!k)return;const R=C.style;for(const N in k){const G=k[N];Number.isFinite(G)&&!Tf.test(N)?R[N]=`${G}px`:R[N]=G}}const Ef={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function bh(C){const{map:k,mapLib:R}=ge.exports.useContext(fl),N=ge.exports.useRef({props:C});N.current.props=C;const G=ge.exports.useMemo(()=>{let X=!1;ge.exports.Children.forEach(C.children,ye=>{ye&&(X=!0)});const fe={...C,element:X?document.createElement("div"):null},a=new R.Marker(fe).setLngLat([C.longitude,C.latitude]);return a.getElement().addEventListener("click",ye=>{var pe,Ee;(Ee=(pe=N.current.props).onClick)===null||Ee===void 0||Ee.call(pe,{type:"click",target:a,originalEvent:ye})}),a.on("dragstart",ye=>{var pe,Ee;const be=ye;be.lngLat=G.getLngLat(),(Ee=(pe=N.current.props).onDragStart)===null||Ee===void 0||Ee.call(pe,be)}),a.on("drag",ye=>{var pe,Ee;const be=ye;be.lngLat=G.getLngLat(),(Ee=(pe=N.current.props).onDrag)===null||Ee===void 0||Ee.call(pe,be)}),a.on("dragend",ye=>{var pe,Ee;const be=ye;be.lngLat=G.getLngLat(),(Ee=(pe=N.current.props).onDragEnd)===null||Ee===void 0||Ee.call(pe,be)}),a},[]);return ge.exports.useEffect(()=>(G.addTo(k.getMap()),()=>{G.remove()}),[]),ge.exports.useEffect(()=>{bo(G.getElement(),C.style)},[C.style]),(G.getLngLat().lng!==C.longitude||G.getLngLat().lat!==C.latitude)&&G.setLngLat([C.longitude,C.latitude]),C.offset&&!df(G.getOffset(),C.offset)&&G.setOffset(C.offset),G.isDraggable()!==C.draggable&&G.setDraggable(C.draggable),G.getRotation()!==C.rotation&&G.setRotation(C.rotation),G.getRotationAlignment()!==C.rotationAlignment&&G.setRotationAlignment(C.rotationAlignment),G.getPitchAlignment()!==C.pitchAlignment&&G.setPitchAlignment(C.pitchAlignment),G.getPopup()!==C.popup&&G.setPopup(C.popup),Sc.exports.createPortal(C.children,G.getElement())}bh.defaultProps=Ef;const Sf=ge.exports.memo(bh);function ph(C){return new Set(C?C.trim().split(/\s+/):[])}function If(C){const{map:k,mapLib:R}=ge.exports.useContext(fl),N=ge.exports.useMemo(()=>document.createElement("div"),[]),G=ge.exports.useRef({props:C});G.current.props=C;const X=ge.exports.useMemo(()=>{const fe={...C},a=new R.Popup(fe).setLngLat([C.longitude,C.latitude]);return a.once("open",ye=>{var pe,Ee;(Ee=(pe=G.current.props).onOpen)===null||Ee===void 0||Ee.call(pe,ye)}),a},[]);if(ge.exports.useEffect(()=>{const fe=a=>{var ye,pe;(pe=(ye=G.current.props).onClose)===null||pe===void 0||pe.call(ye,a)};return X.on("close",fe),X.setDOMContent(N).addTo(k.getMap()),()=>{X.off("close",fe),X.isOpen()&&X.remove()}},[]),ge.exports.useEffect(()=>{bo(X.getElement(),C.style)},[C.style]),X.isOpen()&&((X.getLngLat().lng!==C.longitude||X.getLngLat().lat!==C.latitude)&&X.setLngLat([C.longitude,C.latitude]),C.offset&&!Un(X.options.offset,C.offset)&&X.setOffset(C.offset),(X.options.anchor!==C.anchor||X.options.maxWidth!==C.maxWidth)&&(X.options.anchor=C.anchor,X.setMaxWidth(C.maxWidth)),X.options.className!==C.className)){const fe=ph(X.options.className),a=ph(C.className);for(const ye of fe)a.has(ye)||X.removeClassName(ye);for(const ye of a)fe.has(ye)||X.addClassName(ye);X.options.className=C.className}return Sc.exports.createPortal(C.children,N)}ge.exports.memo(If);function ta(C,k,R,N){const G=ge.exports.useContext(fl),X=ge.exports.useMemo(()=>C(G),[]);return ge.exports.useEffect(()=>{const fe=N||R||k,a=typeof k=="function"&&typeof R=="function"?k:null,ye=typeof R=="function"?R:typeof k=="function"?k:null,{map:pe}=G;return pe.hasControl(X)||(pe.addControl(X,fe==null?void 0:fe.position),a&&a(G)),()=>{ye&&ye(G),pe.hasControl(X)&&pe.removeControl(X)}},[]),X}function Cf(C){const k=ta(({mapLib:R})=>new R.AttributionControl(C),{position:C.position});return ge.exports.useEffect(()=>{bo(k._container,C.style)},[C.style]),null}const Lm=ge.exports.memo(Cf);function Af(C){const k=ta(({mapLib:R})=>new R.FullscreenControl({container:C.containerId&&document.getElementById(C.containerId)}),{position:C.position});return ge.exports.useEffect(()=>{bo(k._controlContainer,C.style)},[C.style]),null}ge.exports.memo(Af);const wh=ge.exports.forwardRef((C,k)=>{const R=ge.exports.useRef({props:C}),N=ta(({mapLib:G})=>{const X=new G.GeolocateControl(C),fe=X._setupUI;return X._setupUI=a=>{X._container.hasChildNodes()||fe(a)},X.on("geolocate",a=>{var ye,pe;(pe=(ye=R.current.props).onGeolocate)===null||pe===void 0||pe.call(ye,a)}),X.on("error",a=>{var ye,pe;(pe=(ye=R.current.props).onError)===null||pe===void 0||pe.call(ye,a)}),X.on("outofmaxbounds",a=>{var ye,pe;(pe=(ye=R.current.props).onOutOfMaxBounds)===null||pe===void 0||pe.call(ye,a)}),X.on("trackuserlocationstart",a=>{var ye,pe;(pe=(ye=R.current.props).onTrackUserLocationStart)===null||pe===void 0||pe.call(ye,a)}),X.on("trackuserlocationend",a=>{var ye,pe;(pe=(ye=R.current.props).onTrackUserLocationEnd)===null||pe===void 0||pe.call(ye,a)}),X},{position:C.position});return R.current.props=C,ge.exports.useImperativeHandle(k,()=>({trigger:()=>N.trigger()}),[]),ge.exports.useEffect(()=>{bo(N._container,C.style)},[C.style]),null});wh.displayName="GeolocateControl";ge.exports.memo(wh);function Mf(C){const k=ta(({mapLib:R})=>new R.NavigationControl(C),{position:C.position});return ge.exports.useEffect(()=>{bo(k._container,C.style)},[C.style]),null}const Rm=ge.exports.memo(Mf),zf={unit:"metric",maxWidth:100};function Th(C){const k=ta(({mapLib:R})=>new R.ScaleControl(C),{position:C.position});return(k.options.unit!==C.unit||k.options.maxWidth!==C.maxWidth)&&(k.options.maxWidth=C.maxWidth,k.setUnit(C.unit)),ge.exports.useEffect(()=>{bo(k._container,C.style)},[C.style]),null}Th.defaultProps=zf;ge.exports.memo(Th);var Eh={exports:{}};(function(C,k){(function(R,N){C.exports=N()})(Op,function(){var R,N,G;function X(a,ye){if(!R)R=ye;else if(!N)N=ye;else{var pe="var sharedChunk = {}; ("+R+")(sharedChunk); ("+N+")(sharedChunk);",Ee={};R(Ee),G=ye(Ee),typeof window<"u"&&(G.workerUrl=window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"})))}}X(["exports"],function(a){var ye=pe;function pe(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function Ee(i,e,r,o){const c=new ye(i,e,r,o);return function(h){return c.solve(h)}}pe.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var p=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const be=Ee(.25,.1,.25,1);function ne(i,e,r){return Math.min(r,Math.max(e,i))}function ht(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function nt(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Xe=1;function ot(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function zt(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function at(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function yt(i){return Array.isArray(i)?i.map(yt):typeof i=="object"&&i?zt(i,yt):i}const Nt={};function Et(i){Nt[i]||(typeof console<"u"&&console.warn(i),Nt[i]=!0)}function kt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ui(i){let e=0;for(let r,o,c=0,h=i.length,p=h-1;c<h;p=c++)r=i[c],o=i[p],e+=(o.x-r.x)*(r.y+o.y);return e}function si(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function wo(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const p=c||h;return e[o]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let lr,Gr,cr=null;function un(i){if(cr==null){const e=i.navigator?i.navigator.userAgent:null;cr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return cr}function Er(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const Sr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(lr||(lr=document.createElement("a")),lr.href=i,lr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Gr==null&&(Gr=matchMedia("(prefers-reduced-motion: reduce)")),Gr.matches)}};var He=ur;function ur(i,e){this.x=i,this.y=e}ur.prototype={clone:function(){return new ur(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ur.convert=function(i){return i instanceof ur?i:Array.isArray(i)?new ur(i[0],i[1]):i};const hr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},qi="mapbox-tiles";let Zi,qr,hn=500,dn=50;function pn(){typeof caches>"u"||Zi||(Zi=caches.open(qi))}let Qi=1/0;const Ir={supported:!1,testSupport:function(i){!vi&&Ar&&(fn?$n(i):Cr=i)}};let Cr,Ar,vi=!1,fn=!1;function $n(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Ar),i.isContextLost())return;Ir.supported=!0}catch(r){}i.deleteTexture(e),vi=!0}typeof document<"u"&&(Ar=document.createElement("img"),Ar.onload=function(){Cr&&$n(Cr),Cr=null,fn=!0},Ar.onerror=function(){vi=!0,Cr=null},Ar.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const dr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(dr);class Ci extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const Vn=si()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Mr(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Vn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((p,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(w=>w.ok?((E,A,z)=>{(i.type==="arrayBuffer"?E.arrayBuffer():i.type==="json"?E.json():E.text()).then(P=>{h||(A&&z&&function(q,V,ee){if(pn(),!Zi)return;const se={status:V.status,statusText:V.statusText,headers:new Headers};V.headers.forEach((re,_e)=>se.headers.set(_e,re));const Q=wo(V.headers.get("Cache-Control")||"");Q["no-store"]||(Q["max-age"]&&se.headers.set("Expires",new Date(ee+1e3*Q["max-age"]).toUTCString()),new Date(se.headers.get("Expires")).getTime()-ee<42e4||function(re,_e){if(qr===void 0)try{new Response(new ReadableStream),qr=!0}catch(me){qr=!1}qr?_e(re.body):re.blob().then(_e)}(V,re=>{const _e=new Response(re,se);pn(),Zi&&Zi.then(me=>me.put(function(Be){const Ue=Be.indexOf("?");return Ue<0?Be:Be.slice(0,Ue)}(q.url),_e)).catch(me=>Et(me.message))}))}(o,A,z),c=!0,e(null,P,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(P=>{h||e(new Error(P.message))})})(w,null,x):w.blob().then(E=>e(new Ci(w.status,w.statusText,i.url,E)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const mn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(si()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!si()){const o=i.url.substring(0,i.url.indexOf("://"));return(hr.REGISTERED_PROTOCOLS[o]||Mr)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Vn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Mr(i,e);if(si()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const p in o.headers)h.setRequestHeader(p,o.headers[p]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let p=h.response;if(o.type==="json")try{p=JSON.parse(h.response)}catch(m){return c(m)}c(null,p,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const p=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Ci(h.status,h.statusText,o.url,p))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},gn=function(i,e){return mn(nt(i,{type:"arrayBuffer"}),e)};function Nn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const pt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let er,zr;er=[],zr=0;const Pr=function(i,e){if(Ir.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),zr>=hr.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return er.push(h),h}zr++;let r=!1;const o=()=>{if(!r)for(r=!0,zr--;er.length&&zr<hr.MAX_PARALLEL_IMAGE_REQUESTS;){const h=er.shift(),{requestParameters:p,callback:m,cancelled:g}=h;g||(h.cancel=Pr(p,m).cancel)}},c=gn(i,(h,p,m,g)=>{o(),h?e(h):p&&function(x,w){typeof createImageBitmap=="function"?function(E,A){const z=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(z).then(P=>{A(null,P)}).catch(P=>{A(new Error(`Could not load image because of ${P.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,A){const z=new Image;z.onload=()=>{A(null,z),URL.revokeObjectURL(z.src),z.onload=null,window.requestAnimationFrame(()=>{z.src=pt})},z.onerror=()=>A(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 P=new Blob([new Uint8Array(E)],{type:"image/png"});z.src=E.byteLength?URL.createObjectURL(P):pt}(x,w)}(p,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Gn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function pr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class fr{constructor(e,r={}){nt(this,r),this.type=e}}class _n extends fr{constructor(e,r={}){super("error",nt({error:e},r))}}class mr{on(e,r){return this._listeners=this._listeners||{},Gn(e,r,this._listeners),this}off(e,r){return pr(e,r,this._listeners),pr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Gn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new fr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)pr(o,m,this._oneTimeListeners),m.call(this,e);const p=this._eventedParent;p&&(nt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof _n&&console.error(e.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,r){return this._eventedParent=e,this._eventedParentData=r,this}}var de={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Ae{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Zr(i){const e=i.value;return e?[new Ae(i.key,e,"constants have been deprecated as of v8")]:[]}function ji(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function ft(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ui(i){if(Array.isArray(i))return i.map(Ui);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ui(i[r]);return e}return ft(i)}class Ai extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Mi{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Mi(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 kr={kind:"null"},Se={kind:"number"},et={kind:"string"},Ye={kind:"boolean"},ai={kind:"color"},Dr={kind:"object"},Je={kind:"value"},gr={kind:"collator"},Qt={kind:"formatted"},yn={kind:"padding"},jt={kind:"resolvedImage"};function gi(i,e){return{kind:"array",itemType:i,N:e}}function St(i){if(i.kind==="array"){const e=St(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const xn=[kr,Se,et,Ye,ai,Qt,Dr,gi(Je),yn,jt];function tr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of xn)if(!tr(r,e))return null}}return`Expected ${St(i)} but found ${St(e)} instead.`}function jr(i,e){return e.some(r=>r.kind===i.kind)}function Xr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var vn,Wr={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 B(i){return(i=Math.round(i))<0?0:i>255?255:i}function b(i){return B(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function S(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function D(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{vn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Wr)return Wr[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),p=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(p.length!==4)return null;m=S(p.pop());case"rgb":return p.length!==3?null:[b(p[0]),b(p[1]),b(p[2]),m];case"hsla":if(p.length!==4)return null;m=S(p.pop());case"hsl":if(p.length!==3)return null;var g=(parseFloat(p[0])%360+360)%360/360,x=S(p[1]),w=S(p[2]),E=w<=.5?w*(x+1):w+x-w*x,A=2*w-E;return[B(255*D(A,E,g+1/3)),B(255*D(A,E,g)),B(255*D(A,E,g-1/3)),m];default:return null}}return null}}catch(i){}class L{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof L)return e;if(typeof e!="string")return;const r=vn(e);return r?new L(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}L.black=new L(0,0,0,1),L.white=new L(1,1,1,1),L.transparent=new L(0,0,0,0),L.red=new L(1,0,0,1);class Z{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class j{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof j)return e;if(typeof e=="number")return new j([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new j(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function le(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function xe(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof L||i instanceof Z||i instanceof W||i instanceof j||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!xe(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!xe(i[e]))return!1;return!0}return!1}function ae(i){if(i===null)return kr;if(typeof i=="string")return et;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Se;if(i instanceof L)return ai;if(i instanceof Z)return gr;if(i instanceof W)return Qt;if(i instanceof j)return yn;if(i instanceof J)return jt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=ae(o);if(r){if(r===c)continue;r=Je;break}r=c}return gi(r||Je,e)}return Dr}function Oe(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof L||i instanceof W||i instanceof j||i instanceof J?i.toString():JSON.stringify(i)}class $e{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!xe(e[1]))return r.error("invalid value");const o=e[1];let c=ae(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new $e(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class De{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ze={string:et,number:Se,boolean:Ye,object:Dr};class We{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ze[x],c++}else m=Je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=gi(m,g)}else{if(!Ze[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ze[h]}const p=[];for(;c<e.length;c++){const m=r.parse(e[c],c,Je);if(!m)return null;p.push(m)}return new We(o,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!tr(this.type,ae(o)))return o;if(r===this.args.length-1)throw new De(`Expected value to be of type ${St(this.type)}, but found ${St(ae(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const mt={"to-boolean":Ye,"to-color":ai,"to-number":Se,"to-string":et};class Ke{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!mt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=mt[o],h=[];for(let p=1;p<e.length;p++){const m=r.parse(e[p],p,Je);if(!m)return null;h.push(m)}return new Ke(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof L)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:le(r[0],r[1],r[2],r[3]),!o))return new L(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new De(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=j.parse(r);if(c)return c}throw new De(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new De(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Oe(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Oe(this.args[0].evaluate(e))):Oe(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const tt=["Unknown","Point","LineString","Polygon"];class gt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?tt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=L.parse(e)),r}}class Ct{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=Ct.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of m){g=new Tn(r.registry,r.path,null,r.scope);const E=[];let A=!1;for(let z=1;z<e.length;z++){const P=e[z],q=Array.isArray(x)?x[z-1]:x.type,V=g.parse(P,1+E.length,q);if(!V){A=!0;break}E.push(V)}if(!A)if(Array.isArray(x)&&x.length!==E.length)g.error(`Expected ${x.length} arguments, but found ${E.length} instead.`);else{for(let z=0;z<E.length;z++){const P=Array.isArray(x)?x[z]:x.type,q=E[z];g.concat(z+1).checkSubtype(P,q.type)}if(g.errors.length===0)return new Ct(o,h,w,E)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:p).map(([E])=>{return A=E,Array.isArray(A)?`(${A.map(St).join(", ")})`:`(${St(A.type)}...)`;var A}).join(" | "),w=[];for(let E=1;E<e.length;E++){const A=r.parse(e[E],1+w.length);if(!A)return null;w.push(St(A.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){Ct.definitions=r;for(const o in r)e[o]=Ct}}class ei{constructor(e,r,o){this.type=gr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Ye);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Ye);if(!h)return null;let p=null;return o.locale&&(p=r.parse(o.locale,1,et),!p)?null:new ei(c,h,p)}evaluate(e){return new Z(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}}const Rt=8192;function hi(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function bn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function qn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*Rt),Math.round(o*c*Rt)]}function At(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],p=i[1]-r[1];return o*p-h*c==0&&o*h<=0&&c*p<=0}function is(i,e){let r=!1;for(let p=0,m=e.length;p<m;p++){const g=e[p];for(let x=0,w=g.length;x<w-1;x++){if(At(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function rs(i,e){for(let r=0;r<e.length;r++)if(is(i,e[r]))return!0;return!1}function na(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],p=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return p>0&&m<0||p<0&&m>0}function oa(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((m=[(p=x[w+1])[0]-(h=x[w])[0],p[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&na(o,c,h,p)&&na(h,p,o,c))return!0;var o,c,h,p,m,g;return!1}function ns(i,e){for(let r=0;r<i.length;++r)if(!is(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(oa(i[r],i[r+1],e))return!1;return!0}function gl(i,e){for(let r=0;r<e.length;r++)if(ns(i,e[r]))return!0;return!1}function To(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let p=0;p<i[c].length;p++){const m=qn(i[c][p],r);hi(e,m),h.push(m)}o.push(h)}return o}function os(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=To(i[c],e,r);o.push(h)}return o}function sa(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}hi(e,i)}function aa(i,e,r,o){const c=Math.pow(2,o.z)*Rt,h=[o.x*Rt,o.y*Rt],p=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];sa(x,e,r,c),p.push(x)}return p}function la(i,e,r,o){const c=Math.pow(2,o.z)*Rt,h=[o.x*Rt,o.y*Rt],p=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+h[0],w.y+h[1]];hi(e,E),x.push(E)}p.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const x of g)sa(x,e,r,c)}var m;return p}class Hr{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(xe(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Hr(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Hr(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Hr(o,o)}return r.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(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,p),g=aa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!is(x,m))return!1}if(o.type==="MultiPolygon"){const m=os(o.coordinates,h,p),g=aa(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!rs(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=To(o.coordinates,h,p),g=la(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!ns(x,m))return!1}if(o.type==="MultiPolygon"){const m=os(o.coordinates,h,p),g=la(r.geometry(),c,h,p);if(!bn(c,h))return!1;for(const x of g)if(!gl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Zn(i){if(i instanceof Ct&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Hr)return!1;let e=!0;return i.eachChild(r=>{e&&!Zn(r)&&(e=!1)}),e}function wn(i){if(i instanceof Ct&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!wn(r)&&(e=!1)}),e}function Eo(i,e){if(i instanceof Ct&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Eo(o,e)&&(r=!1)}),r}class So{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new So(o,r.scope.get(o)):r.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}}class Tn{constructor(e,r=[],o,c=new Mi,h=[]){this.registry=e,this.path=r,this.key=r.map(p=>`[${p}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,p){return p==="assert"?new We(h,[c]):p==="coerce"?new Ke(h,[c]):c}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 c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let p=h.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"assert")}if(!(p instanceof $e)&&p.type.kind!=="resolvedImage"&&ss(p)){const m=new gt;try{p=new $e(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}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,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new Tn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ai(o,e))}checkSubtype(e,r){const o=tr(e,r);return o&&this.error(o),o}}function ss(i){if(i instanceof So)return ss(i.boundExpression);if(i instanceof Ct&&i.name==="error"||i instanceof ei||i instanceof Hr)return!1;const e=i instanceof Ke||i instanceof We;let r=!0;return i.eachChild(o=>{r=e?r&&ss(o):r&&o instanceof $e}),!!r&&Zn(i)&&Eo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Io(i,e){const r=i.length-1;let o,c,h=0,p=r,m=0;for(;h<=p;)if(m=Math.floor((h+p)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new De("Input is not a number.");p=m-1}return 0}class jn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let p=1;p<e.length;p+=2){const m=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,h);if(!E)return null;h=h||E.type,c.push([m,E])}return new jn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[Io(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Bt(i,e,r){return i*(1-r)+e*r}var Xn=Object.freeze({__proto__:null,number:Bt,color:function(i,e,r){return new L(Bt(i.r,e.r,r),Bt(i.g,e.g,r),Bt(i.b,e.b,r),Bt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Bt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new j([Bt(o[0],c[0],r),Bt(o[1],c[1],r),Bt(o[2],c[2],r),Bt(o[3],c[3],r)])}});const ca=.95047,ua=1.08883,as=4/29,Co=6/29,ha=3*Co*Co,_l=Math.PI/180,yl=180/Math.PI;function ls(i){return i>.008856451679035631?Math.pow(i,1/3):i/ha+as}function cs(i){return i>Co?i*i*i:ha*(i-as)}function us(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function hs(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function xt(i){const e=hs(i.r),r=hs(i.g),o=hs(i.b),c=ls((.4124564*e+.3575761*r+.1804375*o)/ca),h=ls((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-ls((.0193339*e+.119192*r+.9503041*o)/ua)),alpha:i.a}}function da(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*cs(e),r=ca*cs(r),o=ua*cs(o),new L(us(3.2404542*r-1.5371385*e-.4985314*o),us(-.969266*r+1.8760108*e+.041556*o),us(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function xl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Wn={forward:xt,reverse:da,interpolate:function(i,e,r){return{l:Bt(i.l,e.l,r),a:Bt(i.a,e.a,r),b:Bt(i.b,e.b,r),alpha:Bt(i.alpha,e.alpha,r)}}},Hn={forward:function(i){const{l:e,a:r,b:o}=xt(i),c=Math.atan2(o,r)*yl;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*_l,r=i.c;return da({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:xl(i.h,e.h,r),c:Bt(i.c,e.c,r),l:Bt(i.l,e.l,r),alpha:Bt(i.alpha,e.alpha,r)}}};var pa=Object.freeze({__proto__:null,lab:Wn,hcl:Hn});class zi{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of h)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=ds(r,e.base,o,c);else if(e.name==="linear")h=ds(r,1,o,c);else if(e.name==="cubic-bezier"){const p=e.controlPoints;h=new ye(p[0],p[1],p[2],p[3]).solve(ds(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...p]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Se),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=ai:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],E=p[x+1],A=x+3,z=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(m.length&&m[m.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const P=r.parse(E,z,g);if(!P)return null;g=g||P.type,m.push([w,P])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new zi(g,o,c,h,m):r.error(`Type ${St(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const p=Io(r,c),m=zi.interpolationFactor(this.interpolation,c,r[p],r[p+1]),g=o[p].evaluate(e),x=o[p+1].evaluate(e);return this.operator==="interpolate"?Xn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?Hn.reverse(Hn.interpolate(Hn.forward(g),Hn.forward(x),m)):Wn.reverse(Wn.interpolate(Wn.forward(g),Wn.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ds(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Ao{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const p=c&&h.some(m=>tr(c,m.type));return new Ao(p?Je:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof J&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Mo{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const p=e[h];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,h);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([p,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Mo(o,c):null}outputDefined(){return this.result.outputDefined()}}class ps{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Se),c=r.parse(e[2],2,gi(r.expectedType||Je));return o&&c?new ps(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new De(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new De(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new De(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class fs{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);return o&&c?jr(o.type,[Ye,et,Se,kr,Je])?new fs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${St(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${St(ae(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class zo{constructor(e,r,o){this.type=Se,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);if(!o||!c)return null;if(!jr(o.type,[Ye,et,Se,kr,Je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new zo(o,c,h):null}return new zo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Xr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${St(ae(r))} instead.`);if(!Xr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${St(ae(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ms{constructor(e,r,o,c,h,p){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const E=e[x+1];Array.isArray(w)||(w=[w]);const A=r.concat(x);if(w.length===0)return A.error("Expected at least one branch label.");for(const P of w){if(typeof P!="number"&&typeof P!="string")return A.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return A.error("Numeric branch labels must be integer values.");if(o){if(A.checkSubtype(o,ae(P)))return null}else o=ae(P);if(h[String(P)]!==void 0)return A.error("Branch labels must be unique.");h[String(P)]=p.length}const z=r.parse(E,x,c);if(!z)return null;c=c||z.type,p.push(z)}const m=r.parse(e[1],1,Je);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new ms(o,c,m,h,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(ae(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class gs{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let p=1;p<e.length-1;p+=2){const m=r.parse(e[p],p,Ye);if(!m)return null;const g=r.parse(e[p+1],p+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new gs(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Po{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Se);if(!o||!c)return null;if(!jr(o.type,[gi(Je),et,Je]))return r.error(`Expected first argument to be of type array or string, but found ${St(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Se);return h?new Po(o.type,o,c,h):null}return new Po(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Xr(r,["string","array"]))throw new De(`Expected first argument to be of type array or string, but found ${St(ae(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function fa(i,e){return i==="=="||i==="!="?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 ma(i,e,r,o){return o.compare(e,r)===0}function En(i,e,r){const o=i!=="=="&&i!=="!=";return class Sh{constructor(h,p,m){this.type=Ye,this.lhs=h,this.rhs=p,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||p.type.kind==="value"}static parse(h,p){if(h.length!==3&&h.length!==4)return p.error("Expected two or three arguments.");const m=h[0];let g=p.parse(h[1],1,Je);if(!g)return null;if(!fa(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${St(g.type)}'.`);let x=p.parse(h[2],2,Je);if(!x)return null;if(!fa(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${St(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${St(g.type)}' and '${St(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new We(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new We(g.type,[x])));let w=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(h[3],3,gr),!w)return null}return new Sh(g,x,w)}evaluate(h){const p=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new De(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!=="string"||x.kind!=="string")return e(h,p,m)}return this.collator?r(h,p,m,this.collator.evaluate(h)):e(h,p,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const vl=En("==",function(i,e,r){return e===r},ma),bl=En("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!ma(0,e,r,o)}),wl=En("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Tl=En(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),El=En("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Sl=En(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class _s{constructor(e,r,o,c,h){this.type=et,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Se);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,et),!h))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,et),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Se),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Se),!g)?null:new _s(o,h,p,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.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.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ko{constructor(e){this.type=Qt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let p=1;p<=e.length-1;++p){const m=e[p];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Se),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,gi(et)),!x))return null;let w=null;if(m["text-color"]&&(w=r.parse(m["text-color"],1,ai),!w))return null;const E=c[c.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[p],1,Je);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new ko(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return ae(o)===jt?new K("",o,null,null,null):new K(Oe(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ys{constructor(e){this.type=jt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,et);return o?new ys(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class xs{constructor(e){this.type=Se,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${St(o.type)} instead.`):new xs(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new De(`Expected value to be of type string or array, but found ${St(ae(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Sn={"==":vl,"!=":bl,">":Tl,"<":wl,">=":Sl,"<=":El,array:We,at:ps,boolean:We,case:gs,coalesce:Ao,collator:ei,format:ko,image:ys,in:fs,"index-of":zo,interpolate:zi,"interpolate-hcl":zi,"interpolate-lab":zi,length:xs,let:Mo,literal:$e,match:ms,number:We,"number-format":_s,object:We,slice:Po,step:jn,string:We,"to-boolean":Ke,"to-color":Ke,"to-number":Ke,"to-string":Ke,var:So,within:Hr};function ga(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,p=le(e,r,o,h);if(p)throw new De(p);return new L(e/255*h,r/255*h,o/255*h,h)}function _a(i,e){return i in e}function Do(i,e){const r=e[i];return r===void 0?null:r}function Kr(i){return{type:i}}function ya(i){return{result:"success",value:i}}function In(i){return{result:"error",value:i}}function Dt(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function xa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ct(i){return!!i.expression&&i.expression.interpolated}function vt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Pt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ft(i){return i}function Kn(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(ct(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?L.parse:j.parse;(i=ji({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!pa[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let p,m,g;if(h==="exponential")p=va;else if(h==="interval")p=Cl;else if(h==="categorical"){p=Il,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);p=Al}if(o){const x={},w=[];for(let z=0;z<i.stops.length;z++){const P=i.stops[z],q=P[0].zoom;x[q]===void 0&&(x[q]={zoom:q,type:i.type,property:i.property,default:i.default,stops:[]},w.push(q)),x[q].stops.push([P[0].value,P[1]])}const E=[];for(const z of w)E.push([x[z].zoom,Kn(x[z],e)]);const A={name:"linear"};return{kind:"composite",interpolationType:A,interpolationFactor:zi.interpolationFactor.bind(void 0,A),zoomStops:E.map(z=>z[0]),evaluate:({zoom:z},P)=>va({stops:E,base:i.base},e,z).evaluate(z,P)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:zi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>p(i,e,w,m,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?Cn(i.default,e.default):p(i,e,E,m,g)}}}function Cn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Il(i,e,r,o,c){return Cn(typeof r===c?o[r]:void 0,i.default,e.default)}function Cl(i,e,r){if(vt(r)!=="number")return Cn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=Io(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function va(i,e,r){const o=i.base!==void 0?i.base:1;if(vt(r)!=="number")return Cn(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=Io(i.stops.map(w=>w[0]),r),p=function(w,E,A,z){const P=z-A,q=w-A;return P===0?0:E===1?q/P:(Math.pow(E,q)-1)/(Math.pow(E,P)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Xn[e.type]||Ft;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=pa[i.colorSpace];x=(E,A)=>w.reverse(w.interpolate(w.forward(E),w.forward(A),p))}return typeof m.evaluate=="function"?{evaluate(...w){const E=m.evaluate.apply(void 0,w),A=g.evaluate.apply(void 0,w);if(E!==void 0&&A!==void 0)return x(E,A,p)}}:x(m,g,p)}function Al(i,e,r){switch(e.type){case"color":r=L.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=j.parse(r);break;default:vt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Cn(r,i.default,e.default)}Ct.register(Sn,{error:[{kind:"error"},[et],(i,[e])=>{throw new De(e.evaluate(i))}],typeof:[et,[Je],(i,[e])=>St(ae(e.evaluate(i)))],"to-rgba":[gi(Se,4),[ai],(i,[e])=>e.evaluate(i).toArray()],rgb:[ai,[Se,Se,Se],ga],rgba:[ai,[Se,Se,Se,Se],ga],has:{type:Ye,overloads:[[[et],(i,[e])=>_a(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>_a(e.evaluate(i),r.evaluate(i))]]},get:{type:Je,overloads:[[[et],(i,[e])=>Do(e.evaluate(i),i.properties())],[[et,Dr],(i,[e,r])=>Do(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Je,[et],(i,[e])=>Do(e.evaluate(i),i.featureState||{})],properties:[Dr,[],i=>i.properties()],"geometry-type":[et,[],i=>i.geometryType()],id:[Je,[],i=>i.id()],zoom:[Se,[],i=>i.globals.zoom],"heatmap-density":[Se,[],i=>i.globals.heatmapDensity||0],"line-progress":[Se,[],i=>i.globals.lineProgress||0],accumulated:[Je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Se,Kr(Se),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Se,Kr(Se),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Se,overloads:[[[Se,Se],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Se],(i,[e])=>-e.evaluate(i)]]},"/":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Se,[Se,Se],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Se,[],()=>Math.LN2],pi:[Se,[],()=>Math.PI],e:[Se,[],()=>Math.E],"^":[Se,[Se,Se],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Se,[Se],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))],log2:[Se,[Se],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Se,[Se],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Se,[Se],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Se,[Se],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Se,[Se],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Se,[Se],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Se,[Se],(i,[e])=>Math.atan(e.evaluate(i))],min:[Se,Kr(Se),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Se,Kr(Se),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Se,[Se],(i,[e])=>Math.abs(e.evaluate(i))],round:[Se,[Se],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Se,[Se],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Se,[Se],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[et,Je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Je],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[et],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Ye,[Je],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[gi(et)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[gi(Je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[et,gi(Je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[et,gi(Je)],(i,[e,r])=>function(o,c,h,p){for(;h<=p;){const m=h+p>>1;if(c[m]===o)return!0;c[m]>o?p=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Kr(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[et],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[et,[et],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[et,[et],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[et,Kr(Je),(i,e)=>e.map(r=>Oe(r.evaluate(i))).join("")],"resolved-locale":[et,[gr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Lo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new gt,this._defaultValue=r?function(o){return o.type==="color"&&Pt(o.default)?new L(0,0,0,0):o.type==="color"?L.parse(o.default)||null:o.type==="padding"?j.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new De(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Jn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Sn}function Yn(i,e){const r=new Tn(Sn,[],e?function(c){const h={color:ai,string:et,number:Se,enum:et,boolean:Ye,formatted:Qt,padding:yn,resolvedImage:jt};return c.type==="array"?gi(h[c.value]||Je,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?ya(new Lo(o,e)):In(r.errors)}class Qn{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!wn(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}}class vs{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!wn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}interpolationFactor(e,r,o){return this.interpolationType?zi.interpolationFactor(this.interpolationType,e,r,o):0}}function ba(i,e){const r=Yn(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Zn(o);if(!c&&!Dt(e))return In([new Ai("","data expressions not supported")]);const h=Eo(o,["zoom"]);if(!h&&!xa(e))return In([new Ai("","zoom expressions not supported")]);const p=Bo(o);return p||h?p instanceof Ai?In([p]):p instanceof zi&&!ct(e)?In([new Ai("",'"interpolate" expressions cannot be used with this property')]):ya(p?new vs(c?"camera":"composite",r.value,p.labels,p instanceof zi?p.interpolation:void 0):new Qn(c?"constant":"source",r.value)):In([new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ro{constructor(e,r){this._parameters=e,this._specification=r,ji(this,Kn(this._parameters,this._specification))}static deserialize(e){return new Ro(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Bo(i){let e=null;if(i instanceof Mo)e=Bo(i.result);else if(i instanceof Ao){for(const r of i.args)if(e=Bo(r),e)break}else(i instanceof jn||i instanceof zi)&&i.input instanceof Ct&&i.input.name==="zoom"&&(e=i);return e instanceof Ai||i.eachChild(r=>{const o=Bo(r);o instanceof Ai?e=o:!e&&o?e=new Ai("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Ai("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Xi(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,p=i.styleSpec;let m=[];const g=vt(r);if(g!=="object")return[new Ae(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=o[w]||o["*"];let A;if(c[w])A=c[w];else if(o[w])A=ki;else if(c["*"])A=c["*"];else{if(!o["*"]){m.push(new Ae(e,r[x],`unknown property "${x}"`));continue}A=ki}m=m.concat(A({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:h,styleSpec:p,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Ae(e,r,`missing required property "${x}"`));return m}function wa(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,p=i.arrayElementValidator||ki;if(vt(e)!=="array")return[new Ae(h,e,`array expected, ${vt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ae(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ae(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),vt(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function bs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=vt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ae(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Ae(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ae(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function Ta(i){const e=i.valueSpec,r=ft(i.value.type);let o,c,h,p={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=vt(i.value.stops)==="array"&&vt(i.value.stops[0])==="array"&&vt(i.value.stops[0][0])==="object",w=Xi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new Ae(z.key,z.value,'identity function may not have a "stops" property')];let P=[];const q=z.value;return P=P.concat(wa({key:z.key,value:q,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:E})),vt(q)==="array"&&q.length===0&&P.push(new Ae(z.key,q,"array must have at least one stop")),P},default:function(z){return ki({key:z.key,value:z.value,valueSpec:e,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&m&&w.push(new Ae(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ae(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!ct(i.valueSpec)&&w.push(new Ae(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Dt(i.valueSpec)?w.push(new Ae(i.key,i.value,"property functions not supported")):m&&!xa(i.valueSpec)&&w.push(new Ae(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Ae(i.key,i.value,'"property" property is required')),w;function E(z){let P=[];const q=z.value,V=z.key;if(vt(q)!=="array")return[new Ae(V,q,`array expected, ${vt(q)} found`)];if(q.length!==2)return[new Ae(V,q,`array length 2 expected, length ${q.length} found`)];if(x){if(vt(q[0])!=="object")return[new Ae(V,q,`object expected, ${vt(q[0])} found`)];if(q[0].zoom===void 0)return[new Ae(V,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new Ae(V,q,"object stop key must have value")];if(h&&h>ft(q[0].zoom))return[new Ae(V,q[0].zoom,"stop zoom values must appear in ascending order")];ft(q[0].zoom)!==h&&(h=ft(q[0].zoom),c=void 0,p={}),P=P.concat(Xi({key:`${V}[0]`,value:q[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:bs,value:A}}))}else P=P.concat(A({key:`${V}[0]`,value:q[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},q));return Jn(Ui(q[1]))?P.concat([new Ae(`${V}[1]`,q[1],"expressions are not allowed in function stops.")]):P.concat(ki({key:`${V}[1]`,value:q[1],valueSpec:e,style:z.style,styleSpec:z.styleSpec}))}function A(z,P){const q=vt(z.value),V=ft(z.value),ee=z.value!==null?z.value:P;if(o){if(q!==o)return[new Ae(z.key,ee,`${q} stop domain type must match previous stop domain type ${o}`)]}else o=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new Ae(z.key,ee,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&r!=="categorical"){let se=`number expected, ${q} found`;return Dt(e)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(z.key,ee,se)]}return r!=="categorical"||q!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&q==="number"&&c!==void 0&&V<c?[new Ae(z.key,ee,"stop domain values must appear in ascending order")]:(c=V,r==="categorical"&&V in p?[new Ae(z.key,ee,"stop domain values must be unique")]:(p[V]=!0,[])):[new Ae(z.key,ee,`integer expected, found ${V}`)]}}function Jr(i){const e=(i.expressionContext==="property"?ba:Yn)(Ui(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Ae(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ae(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!wn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!wn(r))return[new Ae(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Eo(r,["zoom","feature-state"]))return[new Ae(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Zn(r))return[new Ae(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function eo(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(ft(r))===-1&&c.push(new Ae(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(ft(r))===-1&&c.push(new Ae(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function An(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!An(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Ml={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};An(i)||(i=to(i));const e=Yn(i,Ml);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:Sa(i)}}function Ea(i,e){return i<e?-1:i>e?1:0}function Sa(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Sa(i[e]))return!0;return!1}function to(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?ws(i[1],i[2],"=="):e==="!="?Mn(ws(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ws(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(to))):e==="all"?["all"].concat(i.slice(1).map(to)):e==="none"?["all"].concat(i.slice(1).map(to).map(Mn)):e==="in"?Oo(i[1],i.slice(2)):e==="!in"?Mn(Oo(i[1],i.slice(2))):e==="has"?io(i[1]):e==="!has"?Mn(io(i[1])):e!=="within"||i;var r}function ws(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Oo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Ea)]]:["filter-in-small",i,["literal",e]]}}function io(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Mn(i){return["!",i]}function ro(i){return An(Ui(i.value))?Jr(ji({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ia(i)}function Ia(i){const e=i.value,r=i.key;if(vt(e)!=="array")return[new Ae(r,e,`array expected, ${vt(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Ae(r,e,"filter array must have at least 1 element")];switch(h=h.concat(eo({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),ft(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ft(e[1])==="$type"&&h.push(new Ae(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Ae(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=vt(e[1]),c!=="string"&&h.push(new Ae(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let p=2;p<e.length;p++)c=vt(e[p]),ft(e[1])==="$type"?h=h.concat(eo({key:`${r}[${p}]`,value:e[p],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Ae(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)h=h.concat(Ia({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=vt(e[1]),e.length!==2?h.push(new Ae(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Ae(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=vt(e[1]),e.length!==2?h.push(new Ae(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Ae(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function no(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,p=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=p.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return ki({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[p];if(!x)return[new Ae(r,h,`unknown property "${p}"`)];let w;if(vt(h)==="string"&&Dt(x)&&!x.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new Ae(r,h,`"${p}" does not support interpolation syntax
|
|
10
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const E=[];return i.layerType==="symbol"&&(p==="text-field"&&o&&!o.glyphs&&E.push(new Ae(r,h,'use of "text-field" requires a style "glyphs" property')),p==="text-font"&&Pt(Ui(h))&&ft(h.type)==="identity"&&E.push(new Ae(r,h,'"text-font" does not support identity functions'))),E.concat(ki({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:p}))}function Ca(i){return no(i,"paint")}function Aa(i){return no(i,"layout")}function Ma(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Ae(o,r,'either "type" or "ref" is required'));let p=ft(r.type);const m=ft(r.ref);if(r.id){const g=ft(r.id);for(let x=0;x<i.arrayIndex;x++){const w=c.layers[x];ft(w.id)===g&&e.push(new Ae(o,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Ae(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{ft(x.id)===m&&(g=x)}),g?g.ref?e.push(new Ae(o,r.ref,"ref cannot reference another ref layer")):p=ft(g.type):e.push(new Ae(o,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&ft(g.type);g?x==="vector"&&p==="raster"?e.push(new Ae(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new Ae(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Ae(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Ae(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ae(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ae(o,r.source,`source "${r.source}" not found`))}else e.push(new Ae(o,r,'missing required property "source"'));return e=e.concat(Xi({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ki({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:ro,layout:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Aa(ji({layerType:p},x))}}),paint:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ca(ji({layerType:p},x))}})}})),e}function zn(i){const e=i.value,r=i.key,o=vt(e);return o!=="string"?[new Ae(r,e,`string expected, ${o} found`)]:[]}const za={promoteId:function({key:i,value:e}){if(vt(e)==="string")return zn({key:i,value:e});{const r=[];for(const o in e)r.push(...zn({key:`${i}.${o}`,value:e[o]}));return r}}};function oo(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Ae(r,e,'"type" is required')];const h=ft(e.type);let p;switch(h){case"vector":case"raster":case"raster-dem":return p=Xi({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:za}),p;case"geojson":if(p=Xi({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:za}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],w=typeof g=="string"?[g,["accumulated"],["get",m]]:g;p.push(...Jr({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),p.push(...Jr({key:`${r}.${m}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return p;case"video":return Xi({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return Xi({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Ae(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return eo({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function so(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const p=vt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ae("light",e,`object expected, ${p} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?ki({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?ki({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ae(m,e[m],`unknown property "${m}"`)])}return h}function Pi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const p=vt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ae("terrain",e,`object expected, ${p} found`)]),h;for(const m in e)h=h.concat(o[m]?ki({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ae(m,e[m],`unknown property "${m}"`)]);return h}const ao={"*":()=>[],array:wa,boolean:function(i){const e=i.value,r=i.key,o=vt(e);return o!=="boolean"?[new Ae(r,e,`boolean expected, ${o} found`)]:[]},number:bs,color:function(i){const e=i.key,r=i.value,o=vt(r);return o!=="string"?[new Ae(e,r,`color expected, ${o} found`)]:vn(r)===null?[new Ae(e,r,`color expected, "${r}" found`)]:[]},constants:Zr,enum:eo,filter:ro,function:Ta,layer:Ma,object:Xi,source:oo,light:so,terrain:Pi,string:zn,formatted:function(i){return zn(i).length===0?[]:Jr(i)},resolvedImage:function(i){return zn(i).length===0?[]:Jr(i)},padding:function(i){const e=i.key,r=i.value;if(vt(r)==="array"){if(r.length<1||r.length>4)return[new Ae(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(ki({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return bs({key:e,value:r,valueSpec:{}})}};function ki(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Pt(ft(e))?Ta(i):r.expression&&Jn(Ui(e))?Jr(i):r.type&&ao[r.type]?ao[r.type](i):Xi(ji({},i,{valueSpec:r.type?o[r.type]:r}))}function zl(i){const e=i.value,r=i.key,o=zn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Ae(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Ae(r,e,'"glyphs" url must include a "{range}" token'))),o}function Lr(i,e=de){let r=[];return r=r.concat(ki({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:zl,"*":()=>[]}})),i.constants&&(r=r.concat(Zr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Pa(r)}function Pa(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function _r(i){return function(...e){return Pa(i.apply(this,e))}}Lr.source=_r(oo),Lr.light=_r(so),Lr.terrain=_r(Pi),Lr.layer=_r(Ma),Lr.filter=_r(ro),Lr.paintProperty=_r(Ca),Lr.layoutProperty=_r(Aa);const lo=Lr,Ts=lo.light,Pl=lo.paintProperty,kl=lo.layoutProperty;function Uo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new _n(new Error(o.message))),r=!0;return r}class co{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(o=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];c.push(x===w?null:p.subarray(x,w))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,p){this.cells[h].push(p)}query(e,r,o,c,h){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,p,m,g){const x=this.cells[h];if(x!==null){const w=this.keys,E=this.bboxes;for(let A=0;A<x.length;A++){const z=x[A];if(m[z]===void 0){const P=4*z;(g?g(E[P+0],E[P+1],E[P+2],E[P+3]):e<=E[P+2]&&r<=E[P+3]&&o>=E[P+0]&&c>=E[P+1])?(m[z]=!0,p.push(w[z])):m[z]=!1}}}}_forEachCell(e,r,o,c,h,p,m,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(o),A=this._convertToCellCoord(c);for(let z=x;z<=E;z++)for(let P=w;P<=A;P++){const q=this.d*P+z;if((!g||g(this._convertFromCellCoord(z),this._convertFromCellCoord(P),this._convertFromCellCoord(z+1),this._convertFromCellCoord(P+1)))&&h.call(this,e,r,o,c,q,p,m,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let p=0;p<this.cells.length;p++)o+=this.cells[p].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let p=0;p<e.length;p++){const m=e[p];c[3+p]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new co(e.buffer)}}const yr={};function Fe(i,e,r={}){if(yr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),yr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",co),Fe("Color",L),Fe("Error",Error),Fe("AJAXError",Ci),Fe("ResolvedImage",J),Fe("StylePropertyFunction",Ro),Fe("StyleExpression",Lo,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",vs),Fe("ZoomConstantExpression",Qn),Fe("CompoundExpression",Ct,{omit:["_evaluate"]});for(const i in Sn)Sn[i]._classRegistryKey||Fe(`Expression_${i}`,Sn[i]);function ka(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Yr(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(ka(i)||Er(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(Yr(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!yr[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||yr[o].omit.indexOf(h)>=0)continue;const p=i[h];c[h]=yr[o].shallow.indexOf(h)>=0?p:Yr(p,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Rr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||ka(i)||Er(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Rr);if(typeof i=="object"){const e=i.$name||"Object";if(!yr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=yr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=yr[e].shallow.indexOf(c)>=0?h:Rr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Es{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const ze={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function $o(i){for(const e of i)if(Is(e.charCodeAt(0)))return!0;return!1}function Dl(i){for(const e of i)if(!Ss(e.charCodeAt(0)))return!1;return!0}function Ss(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Is(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function Da(i){return!(Is(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["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)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["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)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function La(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Ll(i,e){return!(!e&&La(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function Ra(i){for(const e of i)if(La(e.charCodeAt(0)))return!0;return!1}const Cs="deferred",As="loading",Ms="loaded";let zs=null,bi="unavailable",Br=null;const Ba=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(bi="error"),zs&&zs(i)};function Pn(){Ps.fire(new fr("pluginStateChange",{pluginStatus:bi,pluginURL:Br}))}const Ps=new mr,uo=function(){return bi},Fa=function(){if(bi!==Cs||!Br)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");bi=As,Pn(),Br&&gn({url:Br},i=>{i?Ba(i):(bi=Ms,Pn())})},$i={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>bi===Ms||$i.applyArabicShaping!=null,isLoading:()=>bi===As,setState(i){if(!si())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");bi=i.pluginStatus,Br=i.pluginURL},isParsed(){if(!si())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return $i.applyArabicShaping!=null&&$i.processBidirectionalText!=null&&$i.processStyledBidirectionalText!=null},getPluginURL(){if(!si())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Br}};class Ot{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Es,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!Ll(c.charCodeAt(0),o))return!1;return!0}(e,$i.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class ho{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Pt(o))return new Ro(o,c);if(Jn(o)){const h=ba(o,c);if(h.result==="error")throw new Error(h.value.map(p=>`${p.key}: ${p.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=L.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=j.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Vo{constructor(e){this.property=e,this.value=new ho(e,void 0)}transitioned(e,r){return new Ua(this.property,this.value,r,nt({},e.transition,this.transition),e.now)}untransitioned(){return new Ua(this.property,this.value,null,{},0)}}class Oa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return yt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].value=new ho(this._values[e].property,r===null?void 0:yt(r))}getTransition(e){return yt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Vo(this._values[e].property)),this._values[e].transition=yt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new $a(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new $a(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Ua{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),p=this.prior;if(p){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return p.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(m))}}return h}}class $a{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Rl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return yt(this._values[e].value)}setValue(e,r){this._values[e]=new ho(this._values[e].property,r===null?void 0:yt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new po(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class ir{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class po{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=Xn[this.specification.type];return c?c(e,r,o):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new ir(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ir(this,{kind:"constant",value:void 0},e.parameters);const c=Xn[this.specification.type];return c?new ir(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,p){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,p)}}class kn extends je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new ir(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),p=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(p,p,p,r);return new ir(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ir(this,{kind:"constant",value:h},r)}return new ir(this,e.expression,r)}evaluate(e,r,o,c,h,p){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,p);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class ks{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Ot(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Ot(Math.floor(r.zoom),r)),e.expression.evaluate(new Ot(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Fr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class li{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new ho(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Vo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Fe("DataDrivenProperty",je),Fe("DataConstantProperty",Ve),Fe("CrossFadedDataDrivenProperty",kn),Fe("CrossFadedProperty",ks),Fe("ColorRampProperty",Fr);const Or="-transition";class rr extends mr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Rl(r.layout)),r.paint)){this._transitionablePaint=new Oa(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new po(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(kl,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Or)?this._transitionablePaint.getTransition(e.slice(0,-Or.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Pl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Or))return this._transitionablePaint.setTransition(e.slice(0,-Or.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,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,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),at(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Uo(this,e.call(lo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:de,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ir&&Dt(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Va={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ur{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Gt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Xt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Va[c.type].BYTES_PER_ELEMENT,p=r=Ds(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:p}}),size:Ds(r,Math.max(o,e)),alignment:e}}function Ds(i,e){return Math.ceil(i/e)*e}class Qr extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}Qr.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",Qr);class l extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=o,this.int16[p+2]=c,this.int16[p+3]=h,e}}l.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",l);class t extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",t);class n extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=p,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",n);class s extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",s);class u extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,o,c,h,p,m,g,x,w)}emplace(e,r,o,c,h,p,m,g,x,w,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=o,this.uint16[A+2]=c,this.uint16[A+3]=h,this.uint16[A+4]=p,this.uint16[A+5]=m,this.uint16[A+6]=g,this.uint16[A+7]=x,this.uint16[A+8]=w,this.uint16[A+9]=E,e}}u.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",u);class d extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,o,c,h,p,m,g,x,w,E,A)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,z){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=o,this.int16[P+2]=c,this.int16[P+3]=h,this.uint16[P+4]=p,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=E,this.int16[P+10]=A,this.int16[P+11]=z,e}}d.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",d);class f extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",f);class _ extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",_);class y extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,o,c,h,p,m,g,x)}emplace(e,r,o,c,h,p,m,g,x,w){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=o,this.int16[E+2]=c,this.int16[E+3]=h,this.int16[E+4]=p,this.int16[E+5]=m,this.uint32[A+3]=g,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}y.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",y);class v extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",v);class T extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,c,h)}emplace(e,r,o,c,h,p){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=p,e}}T.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",T);class I extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=12*e,m=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}I.prototype.bytesPerElement=12,Fe("StructArrayLayout2ub2f12",I);class M extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}M.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",M);class U extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee){const se=this.length;return this.resize(se+1),this.emplace(se,e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee,se){const Q=24*e,re=12*e,_e=48*e;return this.int16[Q+0]=r,this.int16[Q+1]=o,this.uint16[Q+2]=c,this.uint16[Q+3]=h,this.uint32[re+2]=p,this.uint32[re+3]=m,this.uint32[re+4]=g,this.uint16[Q+10]=x,this.uint16[Q+11]=w,this.uint16[Q+12]=E,this.float32[re+7]=A,this.float32[re+8]=z,this.uint8[_e+36]=P,this.uint8[_e+37]=q,this.uint8[_e+38]=V,this.uint32[re+10]=ee,this.int16[Q+22]=se,e}}U.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",U);class F extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee,se,Q,re,_e,me,Be,Ue,Pe,Ce,Te,ke){const Me=this.length;return this.resize(Me+1),this.emplace(Me,e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee,se,Q,re,_e,me,Be,Ue,Pe,Ce,Te,ke)}emplace(e,r,o,c,h,p,m,g,x,w,E,A,z,P,q,V,ee,se,Q,re,_e,me,Be,Ue,Pe,Ce,Te,ke,Me){const we=34*e,qe=17*e;return this.int16[we+0]=r,this.int16[we+1]=o,this.int16[we+2]=c,this.int16[we+3]=h,this.int16[we+4]=p,this.int16[we+5]=m,this.int16[we+6]=g,this.int16[we+7]=x,this.uint16[we+8]=w,this.uint16[we+9]=E,this.uint16[we+10]=A,this.uint16[we+11]=z,this.uint16[we+12]=P,this.uint16[we+13]=q,this.uint16[we+14]=V,this.uint16[we+15]=ee,this.uint16[we+16]=se,this.uint16[we+17]=Q,this.uint16[we+18]=re,this.uint16[we+19]=_e,this.uint16[we+20]=me,this.uint16[we+21]=Be,this.uint16[we+22]=Ue,this.uint32[qe+12]=Pe,this.float32[qe+13]=Ce,this.float32[qe+14]=Te,this.float32[qe+15]=ke,this.float32[qe+16]=Me,e}}F.prototype.bytesPerElement=68,Fe("StructArrayLayout8i15ui1ul4f68",F);class O extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}O.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",O);class H extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}H.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",H);class Y extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}Y.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",Y);class te extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",te);class $ extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}$.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",$);class oe extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=o,this.float32[p+2]=c,this.float32[p+3]=h,e}}oe.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",oe);class ie extends Ur{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new He(this.anchorPointX,this.anchorPointY)}}ie.prototype.size=20;class ue extends y{get(e){return new ie(this,e)}}Fe("CollisionBoxArray",ue);class he extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}he.prototype.size=48;class ve extends U{get(e){return new he(this,e)}}Fe("PlacedSymbolArray",ve);class ce extends Ur{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}ce.prototype.size=68;class Le extends F{get(e){return new ce(this,e)}}Fe("SymbolInstanceArray",Le);class Ie extends O{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Ie);class Re extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Re);class Qe extends Ur{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]}}Qe.prototype.size=8;class it extends Y{get(e){return new Qe(this,e)}}Fe("FeatureIndexArray",it);class Ge extends Qr{}class wt extends Qr{}class Tt extends Qr{}class dt extends t{}class _t extends n{}class It extends s{}class ti extends u{}class nr extends d{}class Wi extends f{}class or extends _{}class $r extends v{}class Vi extends I{}class wi extends M{}class xr extends te{}const No=Xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Kt}=No;class st{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>st.MAX_VERTEX_ARRAY_LENGTH&&Et(`Max vertices per segment is ${st.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>st.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new st([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function bt(i,e){return 256*(i=ne(Math.floor(i),0,255))+ne(Math.floor(e),0,255)}st.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",st);const ii=Xt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ri={exports:{}},Ut={exports:{}};Ut.exports=function(i,e){var r,o,c,h,p,m,g,x;for(o=i.length-(r=3&i.length),c=e,p=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Ni={exports:{}};Ni.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var en=Ut.exports,Ls=Ni.exports;ri.exports=en,ri.exports.murmur3=en,ri.exports.murmur2=Ls;class Dn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Na(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Na(e);let o=0,c=this.ids.length-1;for(;o<c;){const p=o+c>>1;this.ids[p]>=r?c=p:o=p+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Rs(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new Dn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Na(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ri.exports(String(i))}function Rs(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,p=o+1;for(;;){do h++;while(i[h]<c);do p--;while(i[p]>c);if(h>=p)break;Vr(i,h,p),Vr(e,3*h,3*p),Vr(e,3*h+1,3*p+1),Vr(e,3*h+2,3*p+2)}p-r<o-p?(Rs(i,e,r,p),r=p+1):(Rs(i,e,p+1,o),o=p)}}function Vr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Fe("FeaturePositionMap",Dn);class tn{constructor(e,r){this.gl=e.gl,this.location=r}}class rn extends tn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Go extends tn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Lc extends tn{constructor(e,r){super(e,r),this.current=L.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Vh=new Float32Array(16);function Bl(i){return[bt(255*i.r,255*i.g),bt(255*i.b,255*i.a)]}class Bs{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Lc(e,r):new rn(e,r)}}class qo{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Go(e,r):new rn(e,r)}}class nn{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Ot(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Bl(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,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.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class vr{constructor(e,r,o,c,h,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,o,c,h){const p=this.expression.evaluate(new Ot(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Ot(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),p=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,p)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Bl(o),p=Bl(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],p[0],p[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}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))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=ne(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new rn(e,r)}}class Ln{constructor(e,r,o,c,h,p){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:p,max:m}=o,g=c[h],x=c[p],w=c[m];if(g&&x&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ii.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ii.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Rc{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const p=e.paint.get(h);if(!(p instanceof ir&&Dt(p.property.specification)))continue;const m=Nh(h,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,E=p.property.specification["property-type"],A=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=A?new qo(g.value,m):new Bs(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||A){const z=Bc(h,x,"source");this.binders[h]=A?new Ln(g,x,w,r,z,e.id):new nn(g,m,x,z),c.push(`/a_${h}`)}else{const z=Bc(h,x,"composite");this.binders[h]=new vr(g,m,x,w,r,z),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof nn||r instanceof vr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const p in this.binders){const m=this.binders[p];(m instanceof nn||m instanceof vr||m instanceof Ln)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof qo&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let p=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const w=o.feature(x.index);for(const E in this.binders){const A=this.binders[E];if((A instanceof nn||A instanceof vr||A instanceof Ln)&&A.expression.isStateDependent===!0){const z=c.paint.get(E);A.expression=z.value,A.updatePaintArray(x.start,x.end,w,e[m],h),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Bs||o instanceof qo)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof nn||o instanceof vr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof Ln)for(let c=0;c<ii.members.length;c++)e.push(ii.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Bs||o instanceof qo||o instanceof vr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Bs||h instanceof qo||h instanceof vr){for(const p of h.uniformNames)if(r[p]){const m=h.getBinding(e,r[p],p);o.push({name:p,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:p,binding:m}of r)this.binders[p].setUniform(m,c,o.get(p),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof Ln){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof nn||o instanceof vr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof nn||o instanceof vr||o instanceof Ln)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof nn||r instanceof vr||r instanceof Ln)&&r.destroy()}}}class fo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new Rc(c,r,o);this.needsUpload=!1,this._featureMap=new Dn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,p);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Nh(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Bc(i,e,r){const o={color:{source:s,composite:oe},number:{source:O,composite:s}},c=function(h){return{"line-pattern":{source:ti,composite:ti},"fill-pattern":{source:ti,composite:ti},"fill-extrusion-pattern":{source:ti,composite:ti}}[h]}(i);return c&&c[r]||o[e][r]}Fe("ConstantBinder",Bs),Fe("CrossFadedConstantBinder",qo),Fe("SourceExpressionBinder",nn),Fe("CrossFadedCompositeBinder",Ln),Fe("CompositeExpressionBinder",vr),Fe("ProgramConfiguration",Rc,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",fo);var Jt=8192;const Fl=Math.pow(2,14)-1,Fc=-Fl-1;function mo(i){const e=Jt/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const p=c[h],m=Math.round(p.x*e),g=Math.round(p.y*e);p.x=ne(m,Fc,Fl),p.y=ne(g,Fc,Fl),(m<p.x||m>p.x+1||g<p.y||g>p.y+1)&&Et("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function go(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?mo(i):[]}}function Ga(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Ol{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new wt,this.indexArray=new wi,this.segments=new st,this.programConfigurations=new fo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let p=null,m=!1;c.type==="circle"&&(p=c.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,z=go(g,A);if(!this.layers[0]._featureFilter.filter(new Ot(this.zoom),z,o))continue;const P=m?p.evaluate(z,{},o):void 0,q={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:A?z.geometry:mo(g),patterns:{},sortKey:P};h.push(q)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:w,sourceLayerIndex:E}=g,A=e[w].feature;this.addFeature(g,x,w,o),r.featureIndex.insert(A,x,w,E,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Kt),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,c){for(const h of r)for(const p of h){const m=p.x,g=p.y;if(m<0||m>=Jt||g<0||g>=Jt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;Ga(this.layoutVertexArray,m,g,-1,-1),Ga(this.layoutVertexArray,m,g,1,-1),Ga(this.layoutVertexArray,m,g,1,1),Ga(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function Oc(i,e){for(let r=0;r<i.length;r++)if(Zo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Zo(i,e[r]))return!0;return!!Ul(i,e)}function Gh(i,e,r){return!!Zo(i,e)||!!$l(e,i,r)}function Uc(i,e){if(i.length===1)return Vc(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Zo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(Vc(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ul(i,e[r]))return!0;return!1}function qh(i,e,r){if(i.length>1){if(Ul(i,e))return!0;for(let o=0;o<e.length;o++)if($l(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if($l(i[o],e,r))return!0;return!1}function Ul(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Zh(o,c,e[h],e[h+1]))return!0}return!1}function Zh(i,e,r,o){return kt(i,r,o)!==kt(e,r,o)&&kt(i,e,r)!==kt(i,e,o)}function $l(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if($c(i,e[c-1],e[c])<o)return!0;return!1}function $c(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function Vc(i,e){let r,o,c,h=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Zo(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],p=i[c];h.y>e.y!=p.y>e.y&&e.x<(p.x-h.x)*(e.y-h.y)/(p.y-h.y)+h.x&&(r=!r)}return r}function jh(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=kt(i,e,r[0]);return h!==kt(i,e,r[1])||h!==kt(i,e,r[2])||h!==kt(i,e,r[3])}function Fs(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function qa(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Za(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=He.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(h));return p}Fe("CircleBucket",Ol,{omit:["layers"]});const Xh=new li({"circle-sort-key":new je(de.layout_circle["circle-sort-key"])});var Wh={paint:new li({"circle-radius":new je(de.paint_circle["circle-radius"]),"circle-color":new je(de.paint_circle["circle-color"]),"circle-blur":new je(de.paint_circle["circle-blur"]),"circle-opacity":new je(de.paint_circle["circle-opacity"]),"circle-translate":new Ve(de.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(de.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(de.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(de.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(de.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(de.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(de.paint_circle["circle-stroke-opacity"])}),layout:Xh},Ti=1e-6,Ei=typeof Float32Array<"u"?Float32Array:Array;function Nc(){var i=new Ei(9);return Ei!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Vl(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Gc(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],z=e[10],P=e[11],q=e[12],V=e[13],ee=e[14],se=e[15],Q=r[0],re=r[1],_e=r[2],me=r[3];return i[0]=Q*o+re*m+_e*E+me*q,i[1]=Q*c+re*g+_e*A+me*V,i[2]=Q*h+re*x+_e*z+me*ee,i[3]=Q*p+re*w+_e*P+me*se,i[4]=(Q=r[4])*o+(re=r[5])*m+(_e=r[6])*E+(me=r[7])*q,i[5]=Q*c+re*g+_e*A+me*V,i[6]=Q*h+re*x+_e*z+me*ee,i[7]=Q*p+re*w+_e*P+me*se,i[8]=(Q=r[8])*o+(re=r[9])*m+(_e=r[10])*E+(me=r[11])*q,i[9]=Q*c+re*g+_e*A+me*V,i[10]=Q*h+re*x+_e*z+me*ee,i[11]=Q*p+re*w+_e*P+me*se,i[12]=(Q=r[12])*o+(re=r[13])*m+(_e=r[14])*E+(me=r[15])*q,i[13]=Q*c+re*g+_e*A+me*V,i[14]=Q*h+re*x+_e*z+me*ee,i[15]=Q*p+re*w+_e*P+me*se,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Os,Hh=Gc;function qc(){var i=new Ei(3);return Ei!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function Zc(i,e,r){var o=new Ei(3);return o[0]=i,o[1]=e,o[2]=r,o}function ja(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*p,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*p,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*p,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*p,i}function jc(){var i=new Ei(4);return Ei!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Xc(i,e){const r=ja([],[i.x,i.y,0,1],e);return new He(r[0]/r[3],r[1]/r[3])}qc(),Os=new Ei(4),Ei!=Float32Array&&(Os[0]=0,Os[1]=0,Os[2]=0,Os[3]=0),qc(),Zc(1,0,0),Zc(0,1,0),jc(),jc(),Nc(),function(){var i;i=new Ei(2),Ei!=Float32Array&&(i[0]=0,i[1]=0)}();class Wc extends Ol{}Fe("HeatmapBucket",Wc,{omit:["layers"]});var Kh={paint:new li({"heatmap-radius":new je(de.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(de.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(de.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fr(de.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(de.paint_heatmap["heatmap-opacity"])})};function Nl(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function Hc(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=Nl({},{width:e,height:r},o);Gl(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function Gl(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,w=((o.y+g)*e.width+o.x)*h;for(let E=0;E<c.width*h;E++)m[w+E]=p[x+E]}return e}class Us{constructor(e,r){Nl(this,e,1,r)}resize(e){Hc(this,e,1)}clone(){return new Us({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Gl(e,r,o,c,h,1)}}class Hi{constructor(e,r){Nl(this,e,4,r)}resize(e){Hc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Hi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){Gl(e,r,o,c,h,4)}}function Kc(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new Hi({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(p,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[p+m+0]=Math.floor(255*x.r/x.a),c.data[p+m+1]=Math.floor(255*x.g/x.a),c.data[p+m+2]=Math.floor(255*x.b/x.a),c.data[p+m+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,m=0;p<o;++p,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:E,end:A}=i.clips[p];h(m,x,E*(1-w)+A*w)}else for(let p=0,m=0;p<r;p++,m+=4)h(0,m,p/(r-1));return c}Fe("AlphaImage",Us),Fe("RGBAImage",Hi);var Jh={paint:new li({"hillshade-illumination-direction":new Ve(de.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(de.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(de.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(de.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(de.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(de.paint_hillshade["hillshade-accent-color"])})};const Yh=Xt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Qh}=Yh;var Xa={exports:{}};function Wa(i,e,r){r=r||2;var o,c,h,p,m,g,x,w=e&&e.length,E=w?e[0]*r:i.length,A=Jc(i,0,E,r,!0),z=[];if(!A||A.next===A.prev)return z;if(w&&(A=function(q,V,ee,se){var Q,re,_e,me=[];for(Q=0,re=V.length;Q<re;Q++)(_e=Jc(q,V[Q]*se,Q<re-1?V[Q+1]*se:q.length,se,!1))===_e.next&&(_e.steiner=!0),me.push(ad(_e));for(me.sort(nd),Q=0;Q<me.length;Q++)ee=od(me[Q],ee);return ee}(i,e,A,r)),i.length>80*r){o=h=i[0],c=p=i[1];for(var P=r;P<E;P+=r)(m=i[P])<o&&(o=m),(g=i[P+1])<c&&(c=g),m>h&&(h=m),g>p&&(p=g);x=(x=Math.max(h-o,p-c))!==0?32767/x:0}return $s(A,z,r,o,c,x,0),z}function Jc(i,e,r,o,c){var h,p;if(c===jl(i,e,r,o)>0)for(h=e;h<r;h+=o)p=eu(h,i[h],i[h+1],p);else for(h=r-o;h>=e;h-=o)p=eu(h,i[h],i[h+1],p);return p&&Ha(p,p.next)&&(Ns(p),p=p.next),p}function _o(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!Ha(o,o.next)&&Zt(o.prev,o,o.next)!==0)o=o.next;else{if(Ns(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function $s(i,e,r,o,c,h,p){if(i){!p&&h&&function(w,E,A,z){var P=w;do P.z===0&&(P.z=ql(P.x,P.y,E,A,z)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(q){var V,ee,se,Q,re,_e,me,Be,Ue=1;do{for(ee=q,q=null,re=null,_e=0;ee;){for(_e++,se=ee,me=0,V=0;V<Ue&&(me++,se=se.nextZ);V++);for(Be=Ue;me>0||Be>0&&se;)me!==0&&(Be===0||!se||ee.z<=se.z)?(Q=ee,ee=ee.nextZ,me--):(Q=se,se=se.nextZ,Be--),re?re.nextZ=Q:q=Q,Q.prevZ=re,re=Q;ee=se}re.nextZ=null,Ue*=2}while(_e>1)}(P)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?td(i,o,c,h):ed(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Ns(i),i=g.next,x=g.next;else if((i=g)===x){p?p===1?$s(i=id(_o(i),e,r),e,r,o,c,h,2):p===2&&rd(i,e,r,o,c,h):$s(_o(i),e,r,o,c,h,1);break}}}function ed(i){var e=i.prev,r=i,o=i.next;if(Zt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,p=o.x,m=e.y,g=r.y,x=o.y,w=c<h?c<p?c:p:h<p?h:p,E=m<g?m<x?m:x:g<x?g:x,A=c>h?c>p?c:p:h>p?h:p,z=m>g?m>x?m:x:g>x?g:x,P=o.next;P!==e;){if(P.x>=w&&P.x<=A&&P.y>=E&&P.y<=z&&jo(c,m,h,g,p,x,P.x,P.y)&&Zt(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function td(i,e,r,o){var c=i.prev,h=i,p=i.next;if(Zt(c,h,p)>=0)return!1;for(var m=c.x,g=h.x,x=p.x,w=c.y,E=h.y,A=p.y,z=m<g?m<x?m:x:g<x?g:x,P=w<E?w<A?w:A:E<A?E:A,q=m>g?m>x?m:x:g>x?g:x,V=w>E?w>A?w:A:E>A?E:A,ee=ql(z,P,e,r,o),se=ql(q,V,e,r,o),Q=i.prevZ,re=i.nextZ;Q&&Q.z>=ee&&re&&re.z<=se;){if(Q.x>=z&&Q.x<=q&&Q.y>=P&&Q.y<=V&&Q!==c&&Q!==p&&jo(m,w,g,E,x,A,Q.x,Q.y)&&Zt(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,re.x>=z&&re.x<=q&&re.y>=P&&re.y<=V&&re!==c&&re!==p&&jo(m,w,g,E,x,A,re.x,re.y)&&Zt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Q&&Q.z>=ee;){if(Q.x>=z&&Q.x<=q&&Q.y>=P&&Q.y<=V&&Q!==c&&Q!==p&&jo(m,w,g,E,x,A,Q.x,Q.y)&&Zt(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;re&&re.z<=se;){if(re.x>=z&&re.x<=q&&re.y>=P&&re.y<=V&&re!==c&&re!==p&&jo(m,w,g,E,x,A,re.x,re.y)&&Zt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function id(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!Ha(c,h)&&Yc(c,o,o.next,h)&&Vs(c,h)&&Vs(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Ns(o),Ns(o.next),o=i=h),o=o.next}while(o!==i);return _o(o)}function rd(i,e,r,o,c,h){var p=i;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&ld(p,m)){var g=Qc(p,m);return p=_o(p,p.next),g=_o(g,g.next),$s(p,e,r,o,c,h,0),void $s(g,e,r,o,c,h,0)}m=m.next}p=p.next}while(p!==i)}function nd(i,e){return i.x-e.x}function od(i,e){var r=function(c,h){var p,m=h,g=c.x,x=c.y,w=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var E=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(E<=g&&E>w&&(w=E,p=m.x<m.next.x?m:m.next,E===g))return p}m=m.next}while(m!==h);if(!p)return null;var A,z=p,P=p.x,q=p.y,V=1/0;m=p;do g>=m.x&&m.x>=P&&g!==m.x&&jo(x<q?g:w,x,P,q,x<q?w:g,x,m.x,m.y)&&(A=Math.abs(x-m.y)/(g-m.x),Vs(m,c)&&(A<V||A===V&&(m.x>p.x||m.x===p.x&&sd(p,m)))&&(p=m,V=A)),m=m.next;while(m!==z);return p}(i,e);if(!r)return e;var o=Qc(r,i);return _o(o,o.next),_o(r,r.next)}function sd(i,e){return Zt(i.prev,i,e.prev)<0&&Zt(e.next,i,i.next)<0}function ql(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ad(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function jo(i,e,r,o,c,h,p,m){return(c-p)*(e-m)>=(i-p)*(h-m)&&(i-p)*(o-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(c-p)*(o-m)}function ld(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&Yc(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(Vs(i,e)&&Vs(e,i)&&function(r,o){var c=r,h=!1,p=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Zt(i.prev,i,e.prev)||Zt(i,e.prev,e))||Ha(i,e)&&Zt(i.prev,i,i.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function Ha(i,e){return i.x===e.x&&i.y===e.y}function Yc(i,e,r,o){var c=Ja(Zt(i,e,r)),h=Ja(Zt(i,e,o)),p=Ja(Zt(r,o,i)),m=Ja(Zt(r,o,e));return c!==h&&p!==m||!(c!==0||!Ka(i,r,e))||!(h!==0||!Ka(i,o,e))||!(p!==0||!Ka(r,i,o))||!(m!==0||!Ka(r,e,o))}function Ka(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Ja(i){return i>0?1:i<0?-1:0}function Vs(i,e){return Zt(i.prev,i,i.next)<0?Zt(i,e,i.next)>=0&&Zt(i,i.prev,e)>=0:Zt(i,e,i.prev)<0||Zt(i,i.next,e)<0}function Qc(i,e){var r=new Zl(i.i,i.x,i.y),o=new Zl(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function eu(i,e,r,o){var c=new Zl(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Ns(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Zl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function jl(i,e,r,o){for(var c=0,h=e,p=r-o;h<r;h+=o)c+=(i[p]-i[h])*(i[h+1]+i[p+1]),p=h;return c}function cd(i,e,r,o,c){tu(i,e,r||0,o||i.length-1,c||ud)}function tu(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,p=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(p-h/2<0?-1:1);tu(i,e,Math.max(r,Math.floor(e-p*g/h+x)),Math.min(o,Math.floor(e+(h-p)*g/h+x)),c)}var w=i[e],E=r,A=o;for(Gs(i,r,e),c(i[o],w)>0&&Gs(i,r,o);E<A;){for(Gs(i,E,A),E++,A--;c(i[E],w)<0;)E++;for(;c(i[A],w)>0;)A--}c(i[r],w)===0?Gs(i,r,A):Gs(i,++A,o),A<=e&&(r=A+1),e<=A&&(o=A-1)}}function Gs(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function ud(i,e){return i<e?-1:i>e?1:0}function Xl(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let p=0;p<r;p++){const m=ui(i[p]);m!==0&&(i[p].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[p]]):c.push(i[p]))}if(c&&o.push(c),e>1)for(let p=0;p<o.length;p++)o[p].length<=e||(cd(o[p],e,1,o[p].length-1,hd),o[p]=o[p].slice(0,e));return o}function hd(i,e){return e.area-i.area}function Wl(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const p=h.paint.get(`${i}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function Hl(i,e,r,o,c){const h=c.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),w=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,h[g]=!0,h[x]=!0,h[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}Xa.exports=Wa,Xa.exports.default=Wa,Wa.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(jl(i,0,c?e[0]*r:i.length,r));if(c)for(var p=0,m=e.length;p<m;p++)h-=Math.abs(jl(i,e[p]*r,p<m-1?e[p+1]*r:i.length,r));var g=0;for(p=0;p<o.length;p+=3){var x=o[p]*r,w=o[p+1]*r,E=o[p+2]*r;g+=Math.abs((i[x]-i[E])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[E+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},Wa.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var p=0;p<e;p++)r.vertices.push(i[c][h][p]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class Kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Tt,this.indexArray=new wi,this.indexArray2=new xr,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new st,this.segments2=new st,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Wl("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Ot(this.zoom),A,o))continue;const z=h?c.evaluate(A,{},o,r.availableImages):void 0,P={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:z};p.push(P)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Hl("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Qh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,o,c,h){for(const p of Xl(r,500)){let m=0;for(const z of p)m+=z.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],E=[];for(const z of p){if(z.length===0)continue;z!==p[0]&&E.push(w.length/2);const P=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),q=P.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(q+z.length-1,q),w.push(z[0].x),w.push(z[0].y);for(let V=1;V<z.length;V++)this.layoutVertexArray.emplaceBack(z[V].x,z[V].y),this.indexArray2.emplaceBack(q+V-1,q+V),w.push(z[V].x),w.push(z[V].y);P.vertexLength+=z.length,P.primitiveLength+=z.length}const A=Xa.exports(w,E);for(let z=0;z<A.length;z+=3)this.indexArray.emplaceBack(x+A[z],x+A[z+1],x+A[z+2]);g.vertexLength+=m,g.primitiveLength+=A.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Fe("FillBucket",Kl,{omit:["layers","patternFeatures"]});const dd=new li({"fill-sort-key":new je(de.layout_fill["fill-sort-key"])});var pd={paint:new li({"fill-antialias":new Ve(de.paint_fill["fill-antialias"]),"fill-opacity":new je(de.paint_fill["fill-opacity"]),"fill-color":new je(de.paint_fill["fill-color"]),"fill-outline-color":new je(de.paint_fill["fill-outline-color"]),"fill-translate":new Ve(de.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(de.paint_fill["fill-translate-anchor"]),"fill-pattern":new kn(de.paint_fill["fill-pattern"])}),layout:dd};const fd=Xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),md=Xt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:gd}=fd;var Rn={},_d=He,iu=Xo;function Xo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(yd,this,e)}function yd(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var p=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function xd(i){for(var e,r,o=0,c=0,h=i.length,p=h-1;c<h;p=c++)o+=((r=i[p]).x-(e=i[c]).x)*(e.y+r.y);return o}Xo.types=["Unknown","Point","LineString","Polygon"],Xo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,p=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),p+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new _d(h,p));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Xo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,p=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var w=i.readVarint();r=7&w,o=w>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<p&&(p=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,m,x]},Xo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Xo.types[this.type];function w(z){for(var P=0;P<z.length;P++){var q=z[P];z[P]=[360*(q.x+p)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(q.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(o=0;o<g.length;o++)E[o]=g[o][0];w(g=E);break;case 2:for(o=0;o<g.length;o++)w(g[o]);break;case 3:for(g=function(z){var P=z.length;if(P<=1)return[z];for(var q,V,ee=[],se=0;se<P;se++){var Q=xd(z[se]);Q!==0&&(V===void 0&&(V=Q<0),V===Q<0?(q&&ee.push(q),q=[z[se]]):q.push(z[se]))}return q&&ee.push(q),ee}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)w(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var A={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(A.id=this.id),A};var vd=iu,ru=nu;function nu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(bd,this,e),this.length=this._features.length}function bd(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var p=o.readVarint()>>3;c=p===1?o.readString():p===2?o.readFloat():p===3?o.readDouble():p===4?o.readVarint64():p===5?o.readVarint():p===6?o.readSVarint():p===7?o.readBoolean():null}return c}(r))}nu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new vd(this._pbf,e,this.extent,this._keys,this._values)};var wd=ru;function Td(i,e,r){if(i===3){var o=new wd(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Rn.VectorTile=function(i,e){this.layers=i.readFields(Td,{},e)},Rn.VectorTileFeature=iu,Rn.VectorTileLayer=ru;const Ed=Rn.VectorTileFeature.types,Jl=Math.pow(2,13);function qs(i,e,r,o,c,h,p,m){i.emplaceBack(e,r,2*Math.floor(o*Jl)+p,c*Jl*2,h*Jl*2,Math.round(m))}class Yl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new dt,this.centroidVertexArray=new Ge,this.indexArray=new wi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new st,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=Wl("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:p,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=go(c,g);if(!this.layers[0]._featureFilter.filter(new Ot(this.zoom),x,o))continue;const w={id:h,sourceLayerIndex:m,index:p,geometry:g?x.geometry:mo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Hl("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,o,{}),r.featureIndex.insert(c,w.geometry,p,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,md.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,c,h){const p={x:0,y:0,vertexCount:0};for(const m of Xl(r,500)){let g=0;for(const P of m)g+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of m){if(P.length===0||Id(P))continue;let q=0;for(let V=0;V<P.length;V++){const ee=P[V];if(V>=1){const se=P[V-1];if(!Sd(ee,se)){x.vertexLength+4>st.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Q=ee.sub(se)._perp()._unit(),re=se.dist(ee);q+re>32768&&(q=0),qs(this.layoutVertexArray,ee.x,ee.y,Q.x,Q.y,0,0,q),qs(this.layoutVertexArray,ee.x,ee.y,Q.x,Q.y,0,1,q),p.x+=2*ee.x,p.y+=2*ee.y,p.vertexCount+=2,q+=re,qs(this.layoutVertexArray,se.x,se.y,Q.x,Q.y,0,0,q),qs(this.layoutVertexArray,se.x,se.y,Q.x,Q.y,0,1,q),p.x+=2*se.x,p.y+=2*se.y,p.vertexCount+=2;const _e=x.vertexLength;this.indexArray.emplaceBack(_e,_e+2,_e+1),this.indexArray.emplaceBack(_e+1,_e+2,_e+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>st.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Ed[e.type]!=="Polygon")continue;const w=[],E=[],A=x.vertexLength;for(const P of m)if(P.length!==0){P!==m[0]&&E.push(w.length/2);for(let q=0;q<P.length;q++){const V=P[q];qs(this.layoutVertexArray,V.x,V.y,0,0,1,1,0),p.x+=V.x,p.y+=V.y,p.vertexCount+=1,w.push(V.x),w.push(V.y)}}const z=Xa.exports(w,E);for(let P=0;P<z.length;P+=3)this.indexArray.emplaceBack(A+z[P],A+z[P+2],A+z[P+1]);x.primitiveLength+=z.length/3,x.vertexLength+=g}for(let m=0;m<p.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(p.x/p.vertexCount),Math.floor(p.y/p.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function Sd(i,e){return i.x===e.x&&(i.x<0||i.x>Jt)||i.y===e.y&&(i.y<0||i.y>Jt)}function Id(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Jt)||i.every(e=>e.y<0)||i.every(e=>e.y>Jt)}Fe("FillExtrusionBucket",Yl,{omit:["layers","features"]});var Cd={paint:new li({"fill-extrusion-opacity":new Ve(de["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(de["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new kn(de["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(de["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(de["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(de["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Zs(i,e){return i.x*e.x+i.y*e.y}function ou(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],p=i[0],m=c.sub(o),g=h.sub(o),x=p.sub(o),w=Zs(m,m),E=Zs(m,g),A=Zs(g,g),z=Zs(x,m),P=Zs(x,g),q=w*A-E*E,V=(A*z-E*P)/q,ee=(w*P-E*z)/q,se=o.z*(1-V-ee)+c.z*V+h.z*ee;if(isFinite(se))return se}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const Ad=Xt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Md}=Ad,zd=Xt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Pd}=zd,kd=Rn.VectorTileFeature.types,Dd=Math.cos(Math.PI/180*37.5),su=Math.pow(2,14)/.5;class Ql{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new _t,this.layoutVertexArray2=new It,this.indexArray=new wi,this.programConfigurations=new fo(e.layers,e.zoom),this.segments=new st,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Wl("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,A=go(m,E);if(!this.layers[0]._featureFilter.filter(new Ot(this.zoom),A,o))continue;const z=h?c.evaluate(A,{},o):void 0,P={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?A.geometry:mo(m),patterns:{},sortKey:z};p.push(P)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=Hl("line",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}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,Pd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Md),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,m,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ee=0;ee<e.length-1;ee++)this.totalDistance+=e[ee].dist(e[ee+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=kd[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let A,z,P,q,V;this.e1=this.e2=-1,m&&(A=e[g-2],V=e[x].sub(A)._unit()._perp());for(let ee=x;ee<g;ee++){if(P=ee===g-1?m?e[x+1]:void 0:e[ee+1],P&&e[ee].equals(P))continue;V&&(q=V),A&&(z=A),A=e[ee],V=P?P.sub(A)._unit()._perp():q,q=q||V;let se=q.add(V);se.x===0&&se.y===0||se._unit();const Q=q.x*V.x+q.y*V.y,re=se.x*V.x+se.y*V.y,_e=re!==0?1/re:1/0,me=2*Math.sqrt(2-2*re),Be=re<Dd&&z&&P,Ue=q.x*V.y-q.y*V.x>0;if(Be&&ee>x){const Te=A.dist(z);if(Te>2*w){const ke=A.sub(A.sub(z)._mult(w/Te)._round());this.updateDistance(z,ke),this.addCurrentVertex(ke,q,0,0,E),z=ke}}const Pe=z&&P;let Ce=Pe?o:m?"butt":c;if(Pe&&Ce==="round"&&(_e<p?Ce="miter":_e<=2&&(Ce="fakeround")),Ce==="miter"&&_e>h&&(Ce="bevel"),Ce==="bevel"&&(_e>2&&(Ce="flipbevel"),_e<h&&(Ce="miter")),z&&this.updateDistance(z,A),Ce==="miter")se._mult(_e),this.addCurrentVertex(A,se,0,0,E);else if(Ce==="flipbevel"){if(_e>100)se=V.mult(-1);else{const Te=_e*q.add(V).mag()/q.sub(V).mag();se._perp()._mult(Te*(Ue?-1:1))}this.addCurrentVertex(A,se,0,0,E),this.addCurrentVertex(A,se.mult(-1),0,0,E)}else if(Ce==="bevel"||Ce==="fakeround"){const Te=-Math.sqrt(_e*_e-1),ke=Ue?Te:0,Me=Ue?0:Te;if(z&&this.addCurrentVertex(A,q,ke,Me,E),Ce==="fakeround"){const we=Math.round(180*me/Math.PI/20);for(let qe=1;qe<we;qe++){let Ne=qe/we;if(Ne!==.5){const Lt=Ne-.5;Ne+=Ne*Lt*(Ne-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*Lt*Lt+(.848013+Q*(.215638*Q-1.06021)))}const rt=V.sub(q)._mult(Ne)._add(q)._unit()._mult(Ue?-1:1);this.addHalfVertex(A,rt.x,rt.y,!1,Ue,0,E)}}P&&this.addCurrentVertex(A,V,-ke,-Me,E)}else if(Ce==="butt")this.addCurrentVertex(A,se,0,0,E);else if(Ce==="square"){const Te=z?1:-1;this.addCurrentVertex(A,se,Te,Te,E)}else Ce==="round"&&(z&&(this.addCurrentVertex(A,q,0,0,E),this.addCurrentVertex(A,q,1,1,E,!0)),P&&(this.addCurrentVertex(A,V,-1,-1,E,!0),this.addCurrentVertex(A,V,0,0,E)));if(Be&&ee<g-1){const Te=A.dist(P);if(Te>2*w){const ke=A.add(P.sub(A)._mult(w/Te)._round());this.updateDistance(A,ke),this.addCurrentVertex(ke,V,0,0,E),A=ke}}}}addCurrentVertex(e,r,o,c,h,p=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,p,!1,o,h),this.addHalfVertex(e,m,g,p,!0,-c,h),this.distance>su/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,p))}addHalfVertex({x:e,y:r},o,c,h,p,m,g){const x=.5*(this.lineClips?this.scaledDistance*(su-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(p?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Fe("LineBucket",Ql,{omit:["layers","patternFeatures"]});const Ld=new li({"line-cap":new Ve(de.layout_line["line-cap"]),"line-join":new je(de.layout_line["line-join"]),"line-miter-limit":new Ve(de.layout_line["line-miter-limit"]),"line-round-limit":new Ve(de.layout_line["line-round-limit"]),"line-sort-key":new je(de.layout_line["line-sort-key"])});var au={paint:new li({"line-opacity":new je(de.paint_line["line-opacity"]),"line-color":new je(de.paint_line["line-color"]),"line-translate":new Ve(de.paint_line["line-translate"]),"line-translate-anchor":new Ve(de.paint_line["line-translate-anchor"]),"line-width":new je(de.paint_line["line-width"]),"line-gap-width":new je(de.paint_line["line-gap-width"]),"line-offset":new je(de.paint_line["line-offset"]),"line-blur":new je(de.paint_line["line-blur"]),"line-dasharray":new ks(de.paint_line["line-dasharray"]),"line-pattern":new kn(de.paint_line["line-pattern"]),"line-gradient":new Fr(de.paint_line["line-gradient"])}),layout:Ld};const lu=new class extends je{possiblyEvaluate(i,e){return e=new Ot(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=nt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(au.paint.properties["line-width"].specification);function cu(i,e){return e>0?e+2*i:i}lu.useIntegerZoom=!0;const Rd=Xt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Bd=Xt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Xt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Fd=Xt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Xt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const uu=Xt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Od=Xt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ud(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,p){const m=h.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),$i.applyArabicShaping&&(c=$i.applyArabicShaping(c)),c}(o.text,e,r)}),i}Xt([{name:"triangle",components:3,type:"Uint16"}]),Xt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Xt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Xt([{type:"Float32",name:"offsetX"}]),Xt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const js={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var ci=24,ec=Mt,hu=function(i,e,r,o,c){var h,p,m=8*c-o-1,g=(1<<m)-1,x=g>>1,w=-7,E=r?c-1:0,A=r?-1:1,z=i[e+E];for(E+=A,h=z&(1<<-w)-1,z>>=-w,w+=m;w>0;h=256*h+i[e+E],E+=A,w-=8);for(p=h&(1<<-w)-1,h>>=-w,w+=o;w>0;p=256*p+i[e+E],E+=A,w-=8);if(h===0)h=1-x;else{if(h===g)return p?NaN:1/0*(z?-1:1);p+=Math.pow(2,o),h-=x}return(z?-1:1)*p*Math.pow(2,h-o)},du=function(i,e,r,o,c,h){var p,m,g,x=8*h-c-1,w=(1<<x)-1,E=w>>1,A=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=o?0:h-1,P=o?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(p++,g/=2),p+E>=w?(m=0,p=w):p+E>=1?(m=(e*g-1)*Math.pow(2,c),p+=E):(m=e*Math.pow(2,E-1)*Math.pow(2,c),p=0));c>=8;i[r+z]=255&m,z+=P,m/=256,c-=8);for(p=p<<c|m,x+=c;x>0;i[r+z]=255&p,z+=P,p/=256,x-=8);i[r+z-P]|=128*q};function Mt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Mt.Varint=0,Mt.Fixed64=1,Mt.Bytes=2,Mt.Fixed32=5;var Bn,tc=4294967296,pu=1/tc,fu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function on(i){return i.type===Mt.Bytes?i.readVarint()+i.pos:i.pos+1}function Wo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function mu(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function $d(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Nd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Gd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function qd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Zd(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function jd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Xd(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Wd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Ya(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Ho(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function gu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Hd(i,e,r){i===1&&r.readMessage(Kd,e)}function Kd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:p,left:m,top:g,advance:x}=r.readMessage(Jd,{});e.push({id:o,bitmap:new Us({width:h+6,height:p+6},c),metrics:{width:h,height:p,left:m,top:g,advance:x}})}}function Jd(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function _u(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const p of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,h=Math.max(h,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===g.w&&p.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(o.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:c,h,fill:e/(c*h)||0}}Mt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Ya(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=gu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ya(this.buf,this.pos)+Ya(this.buf,this.pos+4)*tc;return this.pos+=8,i},readSFixed64:function(){var i=Ya(this.buf,this.pos)+gu(this.buf,this.pos+4)*tc;return this.pos+=8,i},readFloat:function(){var i=hu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=hu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,p){var m,g,x=p.buf;if(m=(112&(g=x[p.pos++]))>>4,g<128||(m|=(127&(g=x[p.pos++]))<<3,g<128)||(m|=(127&(g=x[p.pos++]))<<10,g<128)||(m|=(127&(g=x[p.pos++]))<<17,g<128)||(m|=(127&(g=x[p.pos++]))<<24,g<128)||(m|=(1&(g=x[p.pos++]))<<31,g<128))return Wo(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&fu?function(r,o,c){return fu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",p=o;p<c;){var m,g,x,w=r[p],E=null,A=w>239?4:w>223?3:w>191?2:1;if(p+A>c)break;A===1?w<128&&(E=w):A===2?(192&(m=r[p+1]))==128&&(E=(31&w)<<6|63&m)<=127&&(E=null):A===3?(g=r[p+2],(192&(m=r[p+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&m)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[p+2],x=r[p+3],(192&(m=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((E=(15&w)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,h+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),h+=String.fromCharCode(E),p+=A}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Mt.Bytes)return i.push(this.readVarint(e));var r=on(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSVarint());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Mt.Bytes)return i.push(this.readBoolean());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFloat());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Mt.Bytes)return i.push(this.readDouble());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSFixed32());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Mt.Bytes)return i.push(this.readFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Mt.Bytes)return i.push(this.readSFixed64());var e=on(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Mt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Mt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Mt.Fixed32)this.pos+=4;else{if(e!==Mt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Ho(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*pu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Ho(this.buf,-1&i,this.pos),Ho(this.buf,Math.floor(i*pu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,p,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,p){var m=(7&h)<<4;p.buf[p.pos++]|=m|((h>>>=3)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var p,m,g=0;g<c.length;g++){if((p=c.charCodeAt(g))>55295&&p<57344){if(!m){p>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=p;continue}if(p<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);p<128?o[h++]=p:(p<2048?o[h++]=p>>6|192:(p<65536?o[h++]=p>>12|224:(o[h++]=p>>18|240,o[h++]=p>>12&63|128),o[h++]=p>>6&63|128),o[h++]=63&p|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&mu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),du(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),du(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&mu(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Mt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,qd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Nd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Gd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Zd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,jd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Xd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Wd,e)},writeBytesField:function(i,e){this.writeTag(i,Mt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Mt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Mt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Mt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Mt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Mt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class ic{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:p}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=p,this.version=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class yu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:p,h:m}=_u(h),g=new Hi({width:p||1,height:m||1});for(const x in e){const w=e[x],E=o[x].paddedRect;Hi.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const x in r){const w=r[x],E=c[x].paddedRect,A=E.x+1,z=E.y+1,P=w.data.width,q=w.data.height;Hi.copy(w.data,g,{x:0,y:0},{x:A,y:z},w.data),Hi.copy(w.data,g,{x:0,y:q-1},{x:A,y:z-1},{width:P,height:1}),Hi.copy(w.data,g,{x:0,y:0},{x:A,y:z+q},{width:P,height:1}),Hi.copy(w.data,g,{x:P-1,y:0},{x:A-1,y:z},{width:1,height:q}),Hi.copy(w.data,g,{x:0,y:0},{x:A+P,y:z},{width:1,height:q})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],p={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(p),r[c]=new ic(p,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Fe("ImagePosition",ic),Fe("ImageAtlas",yu),a.WritingMode=void 0,(Bn=a.WritingMode||(a.WritingMode={}))[Bn.none=0]="none",Bn[Bn.horizontal=1]="horizontal",Bn[Bn.vertical=2]="vertical",Bn[Bn.horizontalOnly=3]="horizontalOnly";const Qa=-17;class Xs{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Xs;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Xs;return r.imageName=e,r}}class Ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new Ko;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&Da(c)&&!js[e[o+1]]||h&&Da(h)&&!js[e[o-1]]||!js[e[o]]?e[o]:js[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&tl[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&tl[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new Ko;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Xs.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Et("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Xs.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Et("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function el(i,e,r,o,c,h,p,m,g,x,w,E,A,z,P,q){const V=Ko.fromFeature(i,c);let ee;E===a.WritingMode.vertical&&V.verticalizePunctuation();const{processBidirectionalText:se,processStyledBidirectionalText:Q}=$i;if(se&&V.sections.length===1){ee=[];const me=se(V.toString(),rc(V,x,h,e,o,z,P));for(const Be of me){const Ue=new Ko;Ue.text=Be,Ue.sections=V.sections;for(let Pe=0;Pe<Be.length;Pe++)Ue.sectionIndex.push(0);ee.push(Ue)}}else if(Q){ee=[];const me=Q(V.text,V.sectionIndex,rc(V,x,h,e,o,z,P));for(const Be of me){const Ue=new Ko;Ue.text=Be[0],Ue.sectionIndex=Be[1],Ue.sections=V.sections,ee.push(Ue)}}else ee=function(me,Be){const Ue=[],Pe=me.text;let Ce=0;for(const Te of Be)Ue.push(me.substring(Ce,Te)),Ce=Te;return Ce<Pe.length&&Ue.push(me.substring(Ce,Pe.length)),Ue}(V,rc(V,x,h,e,o,z,P));const re=[],_e={positionedLines:re,text:V.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(me,Be,Ue,Pe,Ce,Te,ke,Me,we,qe,Ne,rt){let Lt=0,$t=Qa,Yt=0,Ji=0;const di=Me==="right"?1:Me==="left"?0:.5;let Wt=0;for(const Ht of Ce){Ht.trim();const fi=Ht.getMaxScale(),yi=(fi-1)*ci,Si={positionedGlyphs:[],lineOffset:0};me.positionedLines[Wt]=Si;const Li=Si.positionedGlyphs;let Ri=0;if(!Ht.length()){$t+=Te,++Wt;continue}for(let oi=0;oi<Ht.length();oi++){const lt=Ht.getSection(oi),Gi=Ht.getSectionIndex(oi),mi=Ht.getCharCode(oi);let xi=0,sr=null,br=null,wr=null,an=ci;const ar=!(we===a.WritingMode.horizontal||!Ne&&!Is(mi)||Ne&&(tl[mi]||(ni=mi,ze.Arabic(ni)||ze["Arabic Supplement"](ni)||ze["Arabic Extended-A"](ni)||ze["Arabic Presentation Forms-A"](ni)||ze["Arabic Presentation Forms-B"](ni))));if(lt.imageName){const Yi=Pe[lt.imageName];if(!Yi)continue;wr=lt.imageName,me.iconsInText=me.iconsInText||!0,br=Yi.paddedRect;const Bi=Yi.displaySize;lt.scale=lt.scale*ci/rt,sr={width:Bi[0],height:Bi[1],left:1,top:-3,advance:ar?Bi[1]:Bi[0]},xi=yi+(ci-Bi[1]*lt.scale),an=sr.advance;const ln=ar?Bi[0]*lt.scale-ci*fi:Bi[1]*lt.scale-ci*fi;ln>0&&ln>Ri&&(Ri=ln)}else{const Yi=Ue[lt.fontStack],Bi=Yi&&Yi[mi];if(Bi&&Bi.rect)br=Bi.rect,sr=Bi.metrics;else{const ln=Be[lt.fontStack],Ks=ln&&ln[mi];if(!Ks)continue;sr=Ks.metrics}xi=(fi-lt.scale)*ci}ar?(me.verticalizable=!0,Li.push({glyph:mi,imageName:wr,x:Lt,y:$t+xi,vertical:ar,scale:lt.scale,fontStack:lt.fontStack,sectionIndex:Gi,metrics:sr,rect:br}),Lt+=an*lt.scale+qe):(Li.push({glyph:mi,imageName:wr,x:Lt,y:$t+xi,vertical:ar,scale:lt.scale,fontStack:lt.fontStack,sectionIndex:Gi,metrics:sr,rect:br}),Lt+=sr.advance*lt.scale+qe)}Li.length!==0&&(Yt=Math.max(Lt-qe,Yt),ep(Li,0,Li.length-1,di,Ri)),Lt=0;const Vt=Te*fi+Ri;Si.lineOffset=Math.max(Ri,yi),$t+=Vt,Ji=Math.max(Vt,Ji),++Wt}var ni;const pi=$t-Qa,{horizontalAlign:_i,verticalAlign:Di}=nc(ke);(function(Ht,fi,yi,Si,Li,Ri,Vt,oi,lt){const Gi=(fi-yi)*Li;let mi=0;mi=Ri!==Vt?-oi*Si-Qa:(-Si*lt+.5)*Vt;for(const xi of Ht)for(const sr of xi.positionedGlyphs)sr.x+=Gi,sr.y+=mi})(me.positionedLines,di,_i,Di,Yt,Ji,Te,pi,Ce.length),me.top+=-Di*pi,me.bottom=me.top+pi,me.left+=-_i*Yt,me.right=me.left+Yt}(_e,e,r,o,ee,p,m,g,E,x,A,q),!function(me){for(const Be of me)if(Be.positionedGlyphs.length!==0)return!1;return!0}(re)&&_e}const tl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yd={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 xu(i,e,r,o,c,h){if(e.imageName){const p=o[e.imageName];return p?p.displaySize[0]*e.scale*ci/h+c:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+c:0}}function vu(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function Qd(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function bu(i,e,r,o,c,h){let p=null,m=vu(e,r,c,h);for(const g of o){const x=vu(e-g.x,r,c,h)+g.badness;x<=m&&(p=g,m=x)}return{index:i,x:e,priorBreak:p,badness:m}}function wu(i){return i?wu(i.priorBreak).concat(i.index):[]}function rc(i,e,r,o,c,h,p){if(h!=="point")return[];if(!i)return[];const m=[],g=function(A,z,P,q,V,ee){let se=0;for(let Q=0;Q<A.length();Q++){const re=A.getSection(Q);se+=xu(A.getCharCode(Q),re,q,V,z,ee)}return se/Math.max(1,Math.ceil(se/P))}(i,e,r,o,c,p),x=i.text.indexOf("\u200B")>=0;let w=0;for(let A=0;A<i.length();A++){const z=i.getSection(A),P=i.getCharCode(A);if(tl[P]||(w+=xu(P,z,o,c,e,p)),A<i.length()-1){const q=!((E=P)<11904||!(ze["Bopomofo Extended"](E)||ze.Bopomofo(E)||ze["CJK Compatibility Forms"](E)||ze["CJK Compatibility Ideographs"](E)||ze["CJK Compatibility"](E)||ze["CJK Radicals Supplement"](E)||ze["CJK Strokes"](E)||ze["CJK Symbols and Punctuation"](E)||ze["CJK Unified Ideographs Extension A"](E)||ze["CJK Unified Ideographs"](E)||ze["Enclosed CJK Letters and Months"](E)||ze["Halfwidth and Fullwidth Forms"](E)||ze.Hiragana(E)||ze["Ideographic Description Characters"](E)||ze["Kangxi Radicals"](E)||ze["Katakana Phonetic Extensions"](E)||ze.Katakana(E)||ze["Vertical Forms"](E)||ze["Yi Radicals"](E)||ze["Yi Syllables"](E)));(Yd[P]||q||z.imageName)&&m.push(bu(A+1,w,g,m,Qd(P,i.getCharCode(A+1),q&&x),!1))}}var E;return wu(bu(i.length(),w,g,m,0,!0))}function nc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function ep(i,e,r,o,c){if(!o&&!c)return;const h=i[r],p=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=c}function tp(i,e,r){const{horizontalAlign:o,verticalAlign:c}=nc(r),h=e[0]-i.displaySize[0]*o,p=e[1]-i.displaySize[1]*c;return{image:i,top:p,bottom:p+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function Tu(i,e,r,o,c,h){const p=i.image;let m;if(p.content){const V=p.content,ee=p.pixelRatio||1;m=[V[0]/ee,V[1]/ee,p.displaySize[0]-V[2]/ee,p.displaySize[1]-V[3]/ee]}const g=e.left*h,x=e.right*h;let w,E,A,z;r==="width"||r==="both"?(z=c[0]+g-o[3],E=c[0]+x+o[1]):(z=c[0]+(g+x-p.displaySize[0])/2,E=z+p.displaySize[0]);const P=e.top*h,q=e.bottom*h;return r==="height"||r==="both"?(w=c[1]+P-o[0],A=c[1]+q+o[2]):(w=c[1]+(P+q-p.displaySize[1])/2,A=w+p.displaySize[1]),{image:p,top:w,right:E,bottom:A,left:z,collisionPadding:m}}const sn=128;function Eu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ot(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<o.length&&o[p]<i+1;)p++;p=Math.min(o.length-1,p);const m=o[h],g=o[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Ot(m)),maxSize:r.evaluate(new Ot(g)),interpolationType:c}}}class Fn extends He{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Fn(this.x,this.y,this.angle,this.segment)}}function Su(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(h),h=i[p]}m+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;m<r/2;){const w=i[p],E=i[p+1];if(!E)return!1;let A=i[p-1].angleTo(w)-w.angleTo(E);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:A}),x+=A;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;p++,m+=w.dist(E)}return!0}function Iu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Cu(i,e,r){return i?.6*e*r:0}function Au(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function ip(i,e,r,o,c,h){const p=Cu(r,c,h),m=Au(r,o)*h;let g=0;const x=Iu(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],A=i[w+1],z=E.dist(A);if(g+z>x){const P=(x-g)/z,q=Bt(E.x,A.x,P),V=Bt(E.y,A.y,P),ee=new Fn(q,V,A.angleTo(E),w);return ee._round(),!p||Su(i,ee,m,p,e)?ee:void 0}g+=z}}function rp(i,e,r,o,c,h,p,m,g){const x=Cu(o,h,p),w=Au(o,c),E=w*p,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Mu(i,A?e/2*m%e:(w/2+2*h)*p*m%e,e,x,r,E,A,!1,g)}function Mu(i,e,r,o,c,h,p,m,g){const x=h/2,w=Iu(i);let E=0,A=e-r,z=[];for(let P=0;P<i.length-1;P++){const q=i[P],V=i[P+1],ee=q.dist(V),se=V.angleTo(q);for(;A+r<E+ee;){A+=r;const Q=(A-E)/ee,re=Bt(q.x,V.x,Q),_e=Bt(q.y,V.y,Q);if(re>=0&&re<g&&_e>=0&&_e<g&&A-x>=0&&A+x<=w){const me=new Fn(re,_e,se,P);me._round(),o&&!Su(i,me,h,o,c)||z.push(me)}}E+=ee}return m||z.length||p||(z=Mu(i,E/2,r,o,c,h,p,!0,g)),z}function zu(i,e,r,o,c){const h=[];for(let p=0;p<i.length;p++){const m=i[p];let g;for(let x=0;x<m.length-1;x++){let w=m[x],E=m[x+1];w.x<e&&E.x<e||(w.x<e?w=new He(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new He(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new He(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new He(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=o&&E.x>=o||(w.x>=o?w=new He(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=o&&(E=new He(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=c&&E.y>=c||(w.y>=c?w=new He(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round():E.y>=c&&(E=new He(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round()),g&&w.equals(g[g.length-1])||(g=[w],h.push(g)),g.push(E)))))}}return h}function Pu(i,e,r,o){const c=[],h=i.image,p=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,E=h.stretchX||[[0,m]],A=h.stretchY||[[0,g]],z=(Te,ke)=>Te+ke[1]-ke[0],P=E.reduce(z,0),q=A.reduce(z,0),V=m-P,ee=g-q;let se=0,Q=P,re=0,_e=q,me=0,Be=V,Ue=0,Pe=ee;if(h.content&&o){const Te=h.content;se=il(E,0,Te[0]),re=il(A,0,Te[1]),Q=il(E,Te[0],Te[2]),_e=il(A,Te[1],Te[3]),me=Te[0]-se,Ue=Te[1]-re,Be=Te[2]-Te[0]-Q,Pe=Te[3]-Te[1]-_e}const Ce=(Te,ke,Me,we)=>{const qe=rl(Te.stretch-se,Q,x,i.left),Ne=nl(Te.fixed-me,Be,Te.stretch,P),rt=rl(ke.stretch-re,_e,w,i.top),Lt=nl(ke.fixed-Ue,Pe,ke.stretch,q),$t=rl(Me.stretch-se,Q,x,i.left),Yt=nl(Me.fixed-me,Be,Me.stretch,P),Ji=rl(we.stretch-re,_e,w,i.top),di=nl(we.fixed-Ue,Pe,we.stretch,q),Wt=new He(qe,rt),ni=new He($t,rt),pi=new He($t,Ji),_i=new He(qe,Ji),Di=new He(Ne/p,Lt/p),Ht=new He(Yt/p,di/p),fi=e*Math.PI/180;if(fi){const Li=Math.sin(fi),Ri=Math.cos(fi),Vt=[Ri,-Li,Li,Ri];Wt._matMult(Vt),ni._matMult(Vt),_i._matMult(Vt),pi._matMult(Vt)}const yi=Te.stretch+Te.fixed,Si=ke.stretch+ke.fixed;return{tl:Wt,tr:ni,bl:_i,br:pi,tex:{x:h.paddedRect.x+1+yi,y:h.paddedRect.y+1+Si,w:Me.stretch+Me.fixed-yi,h:we.stretch+we.fixed-Si},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Di,pixelOffsetBR:Ht,minFontScaleX:Be/p/x,minFontScaleY:Pe/p/w,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Te=ku(E,V,P),ke=ku(A,ee,q);for(let Me=0;Me<Te.length-1;Me++){const we=Te[Me],qe=Te[Me+1];for(let Ne=0;Ne<ke.length-1;Ne++)c.push(Ce(we,ke[Ne],qe,ke[Ne+1]))}}else c.push(Ce({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function il(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function ku(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const p=o[o.length-1];o.push({fixed:c-p.stretch,stretch:p.stretch}),o.push({fixed:c-p.stretch,stretch:p.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function rl(i,e,r,o){return i/e*r+o}function nl(i,e,r,o){return i-e*r/o}Fe("Anchor",Fn);class ol{constructor(e,r,o,c,h,p,m,g,x,w){if(this.boxStartIndex=e.length,x){let E=p.top,A=p.bottom;const z=p.collisionPadding;z&&(E-=z[1],A+=z[3]);let P=A-E;P>0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let E=p.top*m-g[0],A=p.bottom*m+g[2],z=p.left*m-g[3],P=p.right*m+g[1];const q=p.collisionPadding;if(q&&(z-=q[0]*m,E-=q[1]*m,P+=q[2]*m,A+=q[3]*m),w){const V=new He(z,E),ee=new He(P,E),se=new He(z,A),Q=new He(P,A),re=w*Math.PI/180;V._rotate(re),ee._rotate(re),se._rotate(re),Q._rotate(re),z=Math.min(V.x,ee.x,se.x,Q.x),P=Math.max(V.x,ee.x,se.x,Q.x),E=Math.min(V.y,ee.y,se.y,Q.y),A=Math.max(V.y,ee.y,se.y,Q.y)}e.emplaceBack(r.x,r.y,z,E,P,A,o,c,h)}this.boxEndIndex=e.length}}class np{constructor(e=[],r=op){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,p=r[h];if(o(c,p)>=0)break;r[e]=p,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let p=1+(e<<1),m=r[p];const g=p+1;if(g<this.length&&o(r[g],m)<0&&(p=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=p}r[e]=h}}function op(i,e){return i<e?-1:i>e?1:0}function sp(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,p=-1/0;const m=i[0];for(let z=0;z<m.length;z++){const P=m[z];(!z||P.x<o)&&(o=P.x),(!z||P.y<c)&&(c=P.y),(!z||P.x>h)&&(h=P.x),(!z||P.y>p)&&(p=P.y)}const g=Math.min(h-o,p-c);let x=g/2;const w=new np([],ap);if(g===0)return new He(o,c);for(let z=o;z<h;z+=g)for(let P=c;P<p;P+=g)w.push(new Jo(z+x,P+x,x,i));let E=function(z){let P=0,q=0,V=0;const ee=z[0];for(let se=0,Q=ee.length,re=Q-1;se<Q;re=se++){const _e=ee[se],me=ee[re],Be=_e.x*me.y-me.x*_e.y;q+=(_e.x+me.x)*Be,V+=(_e.y+me.y)*Be,P+=3*Be}return new Jo(q/P,V/P,0,z)}(i),A=w.length;for(;w.length;){const z=w.pop();(z.d>E.d||!E.d)&&(E=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,A)),z.max-E.d<=e||(x=z.h/2,w.push(new Jo(z.p.x-x,z.p.y-x,x,i)),w.push(new Jo(z.p.x+x,z.p.y-x,x,i)),w.push(new Jo(z.p.x-x,z.p.y+x,x,i)),w.push(new Jo(z.p.x+x,z.p.y+x,x,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function ap(i,e){return e.max-i.max}function Jo(i,e,r,o){this.p=new He(i,e),this.h=r,this.d=function(c,h){let p=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let w=0,E=x.length,A=E-1;w<E;A=w++){const z=x[w],P=x[A];z.y>c.y!=P.y>c.y&&c.x<(P.x-z.x)*(c.y-z.y)/(P.y-z.y)+z.x&&(p=!p),m=Math.min(m,$c(c,z,P))}}return(p?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const oc=Number.POSITIVE_INFINITY;function Du(i,e){return e[1]!==oc?function(r,o,c){let h=0,p=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,p]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const p=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=p-7;break;case"bottom-right":case"bottom-left":h=7-p;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function sc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function lp(i,e,r,o,c,h,p,m,g,x,w){let E=h.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const A=i.layers[0].layout,z=A.get("icon-offset").evaluate(e,{},w),P=Ru(r.horizontal),q=p/24,V=i.tilePixelRatio*q,ee=i.tilePixelRatio*E/24,se=i.tilePixelRatio*m,Q=i.tilePixelRatio*A.get("symbol-spacing"),re=A.get("text-padding")*i.tilePixelRatio,_e=function(we,qe,Ne,rt=1){const Lt=we.get("icon-padding").evaluate(qe,{},Ne),$t=Lt&&Lt.values;return[$t[0]*rt,$t[1]*rt,$t[2]*rt,$t[3]*rt]}(A,e,w,i.tilePixelRatio),me=A.get("text-max-angle")/180*Math.PI,Be=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Ue=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Pe=A.get("symbol-placement"),Ce=Q/2,Te=A.get("icon-text-fit");let ke;o&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ke=Tu(o,r.vertical,Te,A.get("icon-text-fit-padding"),z,q)),P&&(o=Tu(o,P,Te,A.get("icon-text-fit-padding"),z,q)));const Me=(we,qe)=>{qe.x<0||qe.x>=Jt||qe.y<0||qe.y>=Jt||function(Ne,rt,Lt,$t,Yt,Ji,di,Wt,ni,pi,_i,Di,Ht,fi,yi,Si,Li,Ri,Vt,oi,lt,Gi,mi,xi,sr){const br=Ne.addToLineVertexArray(rt,Lt);let wr,an,ar,Yi,Bi=0,ln=0,Ks=0,Ju=0,gc=-1,_c=-1;const cn={};let Yu=ri.exports(""),yc=0,xc=0;if(Wt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[yc,xc]=Wt.layout.get("text-offset").evaluate(lt,{},xi).map(Fi=>Fi*ci):(yc=Wt.layout.get("text-radial-offset").evaluate(lt,{},xi)*ci,xc=oc),Ne.allowVerticalPlacement&&$t.vertical){const Fi=Wt.layout.get("text-rotate").evaluate(lt,{},xi)+90;ar=new ol(ni,rt,pi,_i,Di,$t.vertical,Ht,fi,yi,Fi),di&&(Yi=new ol(ni,rt,pi,_i,Di,di,Li,Ri,yi,Fi))}if(Yt){const Fi=Wt.layout.get("icon-rotate").evaluate(lt,{}),Nr=Wt.layout.get("icon-text-fit")!=="none",Js=Pu(Yt,Fi,mi,Nr),Ys=di?Pu(di,Fi,mi,Nr):void 0;an=new ol(ni,rt,pi,_i,Di,Yt,Li,Ri,!1,Fi),Bi=4*Js.length;const th=Ne.iconSizeData;let xo=null;th.kind==="source"?(xo=[sn*Wt.layout.get("icon-size").evaluate(lt,{})],xo[0]>On&&Et(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):th.kind==="composite"&&(xo=[sn*Gi.compositeIconSizes[0].evaluate(lt,{},xi),sn*Gi.compositeIconSizes[1].evaluate(lt,{},xi)],(xo[0]>On||xo[1]>On)&&Et(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ne.addSymbols(Ne.icon,Js,xo,oi,Vt,lt,a.WritingMode.none,rt,br.lineStartIndex,br.lineLength,-1,xi),gc=Ne.icon.placedSymbolArray.length-1,Ys&&(ln=4*Ys.length,Ne.addSymbols(Ne.icon,Ys,xo,oi,Vt,lt,a.WritingMode.vertical,rt,br.lineStartIndex,br.lineLength,-1,xi),_c=Ne.icon.placedSymbolArray.length-1)}const Qu=Object.keys($t.horizontal);for(const Fi of Qu){const Nr=$t.horizontal[Fi];if(!wr){Yu=ri.exports(Nr.text);const Ys=Wt.layout.get("text-rotate").evaluate(lt,{},xi);wr=new ol(ni,rt,pi,_i,Di,Nr,Ht,fi,yi,Ys)}const Js=Nr.positionedLines.length===1;if(Ks+=Lu(Ne,rt,Nr,Ji,Wt,yi,lt,Si,br,$t.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,Js?Qu:[Fi],cn,gc,Gi,xi),Js)break}$t.vertical&&(Ju+=Lu(Ne,rt,$t.vertical,Ji,Wt,yi,lt,Si,br,a.WritingMode.vertical,["vertical"],cn,_c,Gi,xi));const bp=wr?wr.boxStartIndex:Ne.collisionBoxArray.length,wp=wr?wr.boxEndIndex:Ne.collisionBoxArray.length,Tp=ar?ar.boxStartIndex:Ne.collisionBoxArray.length,Ep=ar?ar.boxEndIndex:Ne.collisionBoxArray.length,Sp=an?an.boxStartIndex:Ne.collisionBoxArray.length,Ip=an?an.boxEndIndex:Ne.collisionBoxArray.length,Cp=Yi?Yi.boxStartIndex:Ne.collisionBoxArray.length,Ap=Yi?Yi.boxEndIndex:Ne.collisionBoxArray.length;let Tr=-1;const ul=(Fi,Nr)=>Fi&&Fi.circleDiameter?Math.max(Fi.circleDiameter,Nr):Nr;Tr=ul(wr,Tr),Tr=ul(ar,Tr),Tr=ul(an,Tr),Tr=ul(Yi,Tr);const eh=Tr>-1?1:0;eh&&(Tr*=sr/ci),Ne.glyphOffsetArray.length>=Yo.MAX_GLYPHS&&Et("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),lt.sortKey!==void 0&&Ne.addToSortKeyRanges(Ne.symbolInstances.length,lt.sortKey),Ne.symbolInstances.emplaceBack(rt.x,rt.y,cn.right>=0?cn.right:-1,cn.center>=0?cn.center:-1,cn.left>=0?cn.left:-1,cn.vertical||-1,gc,_c,Yu,bp,wp,Tp,Ep,Sp,Ip,Cp,Ap,pi,Ks,Ju,Bi,ln,eh,0,Ht,yc,xc,Tr)}(i,qe,we,r,o,c,ke,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,V,[re,re,re,re],Be,g,se,_e,Ue,z,e,h,x,w,p)};if(Pe==="line")for(const we of zu(e.geometry,0,0,Jt,Jt)){const qe=rp(we,Q,me,r.vertical||P,o,24,ee,i.overscaling,Jt);for(const Ne of qe){const rt=P;rt&&cp(i,rt.text,Ce,Ne)||Me(we,Ne)}}else if(Pe==="line-center"){for(const we of e.geometry)if(we.length>1){const qe=ip(we,me,r.vertical||P,o,24,ee);qe&&Me(we,qe)}}else if(e.type==="Polygon")for(const we of Xl(e.geometry,0)){const qe=sp(we,16);Me(we[0],new Fn(qe.x,qe.y,0))}else if(e.type==="LineString")for(const we of e.geometry)Me(we,new Fn(we[0].x,we[0].y,0));else if(e.type==="Point")for(const we of e.geometry)for(const qe of we)Me([qe],new Fn(qe.x,qe.y,0))}const On=32640;function Lu(i,e,r,o,c,h,p,m,g,x,w,E,A,z,P){const q=function(se,Q,re,_e,me,Be,Ue,Pe){const Ce=_e.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,Te=[];for(const ke of Q.positionedLines)for(const Me of ke.positionedGlyphs){if(!Me.rect)continue;const we=Me.rect||{};let qe=4,Ne=!0,rt=1,Lt=0;const $t=(me||Pe)&&Me.vertical,Yt=Me.metrics.advance*Me.scale/2;if(Pe&&Q.verticalizable){const Vt=(Me.scale-1)*ci,oi=(ci-Me.metrics.width*Me.scale)/2;Lt=ke.lineOffset/2-(Me.imageName?-oi:Vt)}if(Me.imageName){const Vt=Ue[Me.imageName];Ne=Vt.sdf,rt=Vt.pixelRatio,qe=1/rt}const Ji=me?[Me.x+Yt,Me.y]:[0,0];let di=me?[0,0]:[Me.x+Yt+re[0],Me.y+re[1]-Lt],Wt=[0,0];$t&&(Wt=di,di=[0,0]);const ni=(Me.metrics.left-qe)*Me.scale-Yt+di[0],pi=(-Me.metrics.top-qe)*Me.scale+di[1],_i=ni+we.w*Me.scale/rt,Di=pi+we.h*Me.scale/rt,Ht=new He(ni,pi),fi=new He(_i,pi),yi=new He(ni,Di),Si=new He(_i,Di);if($t){const Vt=new He(-Yt,Yt-Qa),oi=-Math.PI/2,lt=12-Yt,Gi=new He(22-lt,-(Me.imageName?lt:0)),mi=new He(...Wt);Ht._rotateAround(oi,Vt)._add(Gi)._add(mi),fi._rotateAround(oi,Vt)._add(Gi)._add(mi),yi._rotateAround(oi,Vt)._add(Gi)._add(mi),Si._rotateAround(oi,Vt)._add(Gi)._add(mi)}if(Ce){const Vt=Math.sin(Ce),oi=Math.cos(Ce),lt=[oi,-Vt,Vt,oi];Ht._matMult(lt),fi._matMult(lt),yi._matMult(lt),Si._matMult(lt)}const Li=new He(0,0),Ri=new He(0,0);Te.push({tl:Ht,tr:fi,bl:yi,br:Si,tex:we,writingMode:Q.writingMode,glyphOffset:Ji,sectionIndex:Me.sectionIndex,isSDF:Ne,pixelOffsetTL:Li,pixelOffsetBR:Ri,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,m,c,h,p,o,i.allowVerticalPlacement),V=i.textSizeData;let ee=null;V.kind==="source"?(ee=[sn*c.layout.get("text-size").evaluate(p,{})],ee[0]>On&&Et(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):V.kind==="composite"&&(ee=[sn*z.compositeTextSizes[0].evaluate(p,{},P),sn*z.compositeTextSizes[1].evaluate(p,{},P)],(ee[0]>On||ee[1]>On)&&Et(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,q,ee,m,h,p,x,e,g.lineStartIndex,g.lineLength,A,P);for(const se of w)E[se]=i.text.placedSymbolArray.length-1;return 4*q.length}function Ru(i){for(const e in i)return i[e];return null}function cp(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let p=h.length-1;p>=0;p--)if(o.dist(h[p])<r)return!0}else c[e]=[];return c[e].push(o),!1}const up=Rn.VectorTileFeature.types,hp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sl(i,e,r,o,c,h,p,m,g,x,w,E,A){const z=m?Math.min(On,Math.round(m[0])):0,P=m?Math.min(On,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,p,(z<<1)+(g?1:0),P,16*x,16*w,256*E,256*A)}function ac(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function dp(i){for(const e of i.sections)if(Ra(e.text))return!0;return!1}class lc{constructor(e){this.layoutVertexArray=new nr,this.indexArray=new wi,this.programConfigurations=e,this.segments=new st,this.dynamicLayoutVertexArray=new Wi,this.opacityVertexArray=new or,this.placedSymbolArray=new ve}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Bd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,hp,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&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())}}Fe("SymbolBuffers",lc);class cc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new st,this.collisionVertexArray=new Vi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Fd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",cc);class Yo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Vl([]),this.placementViewportMatrix=Vl([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Eu(this.zoom,r["text-size"]),this.iconSizeData=Eu(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=hc(o,"text-overlap","text-allow-overlap")!=="never"||hc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(p=>a.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new lc(new fo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new lc(new fo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ie,this.lineVertexArray=new Re,this.symbolInstances=new Le}calculateGlyphDependencies(e,r,o,c,h){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(o||c)&&h){const m=js[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,p=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const A=r.iconDependencies,z=r.glyphDependencies,P=r.availableImages,q=new Ot(this.zoom);for(const{feature:V,id:ee,index:se,sourceLayerIndex:Q}of e){const re=c._featureFilter.needGeometry,_e=go(V,re);if(!c._featureFilter.filter(q,_e,o))continue;let me,Be;if(re||(_e.geometry=mo(V)),x){const Pe=c.getValueAndResolveTokens("text-field",_e,o,P),Ce=W.factory(Pe);dp(Ce)&&(this.hasRTLText=!0),(!this.hasRTLText||uo()==="unavailable"||this.hasRTLText&&$i.isParsed())&&(me=Ud(Ce,c,_e))}if(w){const Pe=c.getValueAndResolveTokens("icon-image",_e,o,P);Be=Pe instanceof J?Pe:J.fromString(Pe)}if(!me&&!Be)continue;const Ue=this.sortFeaturesByKey?E.evaluate(_e,{},o):void 0;if(this.features.push({id:ee,text:me,icon:Be,index:se,sourceLayerIndex:Q,geometry:_e.geometry,properties:V.properties,type:up[V.type],sortKey:Ue}),Be&&(A[Be.name]=!0),me){const Pe=p.evaluate(_e,{},o).join(","),Ce=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Te of me.sections)if(Te.image)A[Te.image.name]=!0;else{const ke=$o(me.toString()),Me=Te.fontStack||Pe,we=z[Me]=z[Me]||{};this.calculateGlyphDependencies(Te.text,we,Ce,this.allowVerticalPlacement,ke)}}}h.get("symbol-placement")==="line"&&(this.features=function(V){const ee={},se={},Q=[];let re=0;function _e(Pe){Q.push(V[Pe]),re++}function me(Pe,Ce,Te){const ke=se[Pe];return delete se[Pe],se[Ce]=ke,Q[ke].geometry[0].pop(),Q[ke].geometry[0]=Q[ke].geometry[0].concat(Te[0]),ke}function Be(Pe,Ce,Te){const ke=ee[Ce];return delete ee[Ce],ee[Pe]=ke,Q[ke].geometry[0].shift(),Q[ke].geometry[0]=Te[0].concat(Q[ke].geometry[0]),ke}function Ue(Pe,Ce,Te){const ke=Te?Ce[0][Ce[0].length-1]:Ce[0][0];return`${Pe}:${ke.x}:${ke.y}`}for(let Pe=0;Pe<V.length;Pe++){const Ce=V[Pe],Te=Ce.geometry,ke=Ce.text?Ce.text.toString():null;if(!ke){_e(Pe);continue}const Me=Ue(ke,Te),we=Ue(ke,Te,!0);if(Me in se&&we in ee&&se[Me]!==ee[we]){const qe=Be(Me,we,Te),Ne=me(Me,we,Q[qe].geometry);delete ee[Me],delete se[we],se[Ue(ke,Q[Ne].geometry,!0)]=Ne,Q[qe].geometry=null}else Me in se?me(Me,we,Te):we in ee?Be(Me,we,Te):(_e(Pe),ee[Me]=re-1,se[we]=re-1)}return Q.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,ee)=>V.sortKey-ee.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=p[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,p,m,g,x,w,E,A){const z=e.indexArray,P=e.layoutVertexArray,q=e.segments.prepareSegment(4*r.length,P,z,this.canOverlap?p.sortKey:void 0),V=this.glyphOffsetArray.length,ee=q.vertexLength,se=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,Q=p.text&&p.text.sections;for(let re=0;re<r.length;re++){const{tl:_e,tr:me,bl:Be,br:Ue,tex:Pe,pixelOffsetTL:Ce,pixelOffsetBR:Te,minFontScaleX:ke,minFontScaleY:Me,glyphOffset:we,isSDF:qe,sectionIndex:Ne}=r[re],rt=q.vertexLength,Lt=we[1];sl(P,g.x,g.y,_e.x,Lt+_e.y,Pe.x,Pe.y,o,qe,Ce.x,Ce.y,ke,Me),sl(P,g.x,g.y,me.x,Lt+me.y,Pe.x+Pe.w,Pe.y,o,qe,Te.x,Ce.y,ke,Me),sl(P,g.x,g.y,Be.x,Lt+Be.y,Pe.x,Pe.y+Pe.h,o,qe,Ce.x,Te.y,ke,Me),sl(P,g.x,g.y,Ue.x,Lt+Ue.y,Pe.x+Pe.w,Pe.y+Pe.h,o,qe,Te.x,Te.y,ke,Me),ac(e.dynamicLayoutVertexArray,g,se),z.emplaceBack(rt,rt+1,rt+2),z.emplaceBack(rt+1,rt+2,rt+3),q.vertexLength+=4,q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(we[0]),re!==r.length-1&&Ne===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(P.length,p,p.index,{},A,Q&&Q[Ne])}e.placedSymbolArray.emplaceBack(g.x,g.y,V,this.glyphOffsetArray.length-V,ee,x,w,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,E)}_addCollisionDebugVertex(e,r,o,c,h,p){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,o,c,h,p,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,w=h.layoutVertexArray,E=h.collisionVertexArray,A=m.anchorX,z=m.anchorY;this._addCollisionDebugVertex(w,E,p,A,z,new He(e,r)),this._addCollisionDebugVertex(w,E,p,A,z,new He(o,r)),this._addCollisionDebugVertex(w,E,p,A,z,new He(o,c)),this._addCollisionDebugVertex(w,E,p,A,z,new He(e,c)),g.vertexLength+=4;const P=h.indexArray;P.emplaceBack(x,x+1),P.emplaceBack(x+1,x+2),P.emplaceBack(x+2,x+3),P.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const p=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new cc($r,uu.members,xr),this.iconCollisionBox=new cc($r,uu.members,xr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,p,m,g,x){const w={};for(let E=r;E<o;E++){const A=e.get(E);w.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.textFeatureIndex=A.featureIndex;break}for(let E=c;E<h;E++){const A=e.get(E);w.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalTextFeatureIndex=A.featureIndex;break}for(let E=p;E<m;E++){const A=e.get(E);w.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.iconFeatureIndex=A.featureIndex;break}for(let E=g;E<x;E++){const A=e.get(E);w.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},w.verticalIconFeatureIndex=A.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);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}addIndicesForPlacedSymbol(e,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return p.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),p}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,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 r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,p)=>{c>=0&&p.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Fe("SymbolBucket",Yo,{omit:["layers","collisionBoxArray","features","compareText"]}),Yo.MAX_GLYPHS=65535,Yo.addDynamicAttributes=ac;const pp=new li({"symbol-placement":new Ve(de.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(de.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(de.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(de.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(de.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(de.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(de.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(de.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(de.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(de.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(de.layout_symbol["icon-size"]),"icon-text-fit":new Ve(de.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(de.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(de.layout_symbol["icon-image"]),"icon-rotate":new je(de.layout_symbol["icon-rotate"]),"icon-padding":new je(de.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(de.layout_symbol["icon-keep-upright"]),"icon-offset":new je(de.layout_symbol["icon-offset"]),"icon-anchor":new je(de.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(de.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(de.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(de.layout_symbol["text-rotation-alignment"]),"text-field":new je(de.layout_symbol["text-field"]),"text-font":new je(de.layout_symbol["text-font"]),"text-size":new je(de.layout_symbol["text-size"]),"text-max-width":new je(de.layout_symbol["text-max-width"]),"text-line-height":new Ve(de.layout_symbol["text-line-height"]),"text-letter-spacing":new je(de.layout_symbol["text-letter-spacing"]),"text-justify":new je(de.layout_symbol["text-justify"]),"text-radial-offset":new je(de.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(de.layout_symbol["text-variable-anchor"]),"text-anchor":new je(de.layout_symbol["text-anchor"]),"text-max-angle":new Ve(de.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(de.layout_symbol["text-writing-mode"]),"text-rotate":new je(de.layout_symbol["text-rotate"]),"text-padding":new Ve(de.layout_symbol["text-padding"]),"text-keep-upright":new Ve(de.layout_symbol["text-keep-upright"]),"text-transform":new je(de.layout_symbol["text-transform"]),"text-offset":new je(de.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(de.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(de.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(de.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(de.layout_symbol["text-optional"])});var uc={paint:new li({"icon-opacity":new je(de.paint_symbol["icon-opacity"]),"icon-color":new je(de.paint_symbol["icon-color"]),"icon-halo-color":new je(de.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(de.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(de.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(de.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(de.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(de.paint_symbol["text-opacity"]),"text-color":new je(de.paint_symbol["text-color"],{runtimeType:ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(de.paint_symbol["text-halo-color"]),"text-halo-width":new je(de.paint_symbol["text-halo-width"]),"text-halo-blur":new je(de.paint_symbol["text-halo-blur"]),"text-translate":new Ve(de.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(de.paint_symbol["text-translate-anchor"])}),layout:pp};class Bu{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:kr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.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}}Fe("FormatSectionOverride",Bu,{omit:["defaultValue"]});class al extends rr{constructor(e){super(e,uc)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||Jn(p.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in m?String(m[w]):"")}(r.properties,h)}createBucket(e){return new Yo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of uc.paint.overridableProperties){if(!al.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new Bu(r),c=new Lo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Qn("source",c):new vs("composite",c,r.value.zoomStops),this.paint._values[e]=new ir(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&al.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=uc.paint.properties[r];let h=!1;const p=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof W)p(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof $e&&ae(x.value)===Qt?p(x.value.sections):x instanceof ko?p(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function hc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var fp={paint:new li({"background-color":new Ve(de.paint_background["background-color"]),"background-pattern":new ks(de.paint_background["background-pattern"]),"background-opacity":new Ve(de.paint_background["background-opacity"])})},mp={paint:new li({"raster-opacity":new Ve(de.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(de.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(de.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(de.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(de.paint_raster["raster-saturation"]),"raster-contrast":new Ve(de.paint_raster["raster-contrast"]),"raster-resampling":new Ve(de.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(de.paint_raster["raster-fade-duration"])})};class gp extends rr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const _p={circle:class extends rr{constructor(i){super(i,Wh)}createBucket(i){return new Ol(i)}queryRadius(i){const e=i;return Fs("circle-radius",this,e)+Fs("circle-stroke-width",this,e)+qa(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Za(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,p),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(z,P){return z.map(q=>Xc(q,P))}(g,m),A=w?x*p:x;for(const z of o)for(const P of z){const q=w?P:Xc(P,m);let V=A;const ee=ja([],[P.x,P.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?V*=ee[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(V*=h.cameraToCenterDistance/ee[3]),Gh(E,q,V))return!0}return!1}},heatmap:class extends rr{constructor(i){super(i,Kh),this._updateColorRamp()}createBucket(i){return new Wc(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Kc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends rr{constructor(i){super(i,Jh)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends rr{constructor(i){super(i,pd)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Kl(i)}queryRadius(){return qa(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){return Uc(Za(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,p),o)}isTileClipped(){return!0}},"fill-extrusion":class extends rr{constructor(i){super(i,Cd)}createBucket(i){return new Yl(i)}queryRadius(){return qa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Za(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,p),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(z,P,q,V){const ee=[];for(const se of z){const Q=[se.x,se.y,0,1];ja(Q,Q,P),ee.push(new He(Q[0]/Q[3],Q[1]/Q[3]))}return ee}(g,m),A=function(z,P,q,V){const ee=[],se=[],Q=V[8]*P,re=V[9]*P,_e=V[10]*P,me=V[11]*P,Be=V[8]*q,Ue=V[9]*q,Pe=V[10]*q,Ce=V[11]*q;for(const Te of z){const ke=[],Me=[];for(const we of Te){const qe=we.x,Ne=we.y,rt=V[0]*qe+V[4]*Ne+V[12],Lt=V[1]*qe+V[5]*Ne+V[13],$t=V[2]*qe+V[6]*Ne+V[14],Yt=V[3]*qe+V[7]*Ne+V[15],Ji=$t+_e,di=Yt+me,Wt=rt+Be,ni=Lt+Ue,pi=$t+Pe,_i=Yt+Ce,Di=new He((rt+Q)/di,(Lt+re)/di);Di.z=Ji/di,ke.push(Di);const Ht=new He(Wt/_i,ni/_i);Ht.z=pi/_i,Me.push(Ht)}ee.push(ke),se.push(Me)}return[ee,se]}(o,w,x,m);return function(z,P,q){let V=1/0;Uc(q,P)&&(V=ou(q,P[0]));for(let ee=0;ee<P.length;ee++){const se=P[ee],Q=z[ee];for(let re=0;re<se.length-1;re++){const _e=se[re],me=[_e,se[re+1],Q[re+1],Q[re],_e];Oc(q,me)&&(V=Math.min(V,ou(q,me)))}}return V!==1/0&&V}(A[0],A[1],E)}},line:class extends rr{constructor(i){super(i,au),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=lu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Ql(i)}queryRadius(i){const e=i,r=cu(Fs("line-width",this,e),Fs("line-gap-width",this,e)),o=Fs("line-offset",this,e);return r/2+Math.abs(o)+qa(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){const m=Za(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,p),g=p/2*cu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(w,E){const A=[];for(let z=0;z<w.length;z++){const P=w[z],q=[];for(let V=0;V<P.length;V++){const ee=P[V-1],se=P[V],Q=P[V+1],re=V===0?new He(0,0):se.sub(ee)._unit()._perp(),_e=V===P.length-1?new He(0,0):Q.sub(se)._unit()._perp(),me=re._add(_e)._unit(),Be=me.x*_e.x+me.y*_e.y;Be!==0&&me._mult(1/Be),q.push(me._mult(E)._add(se))}A.push(q)}return A}(o,x*p)),function(w,E,A){for(let z=0;z<E.length;z++){const P=E[z];if(w.length>=3){for(let q=0;q<P.length;q++)if(Zo(w,P[q]))return!0}if(qh(w,P,A))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:al,background:class extends rr{constructor(i){super(i,fp)}},raster:class extends rr{constructor(i){super(i,mp)}}};class yp{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(){delete this._channel,this._callback=()=>{}}}const Fu=63710088e-1;class qt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new qt(ht(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return Fu*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new yo(new qt(this.lng-o,this.lat-r),new qt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof qt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new qt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new qt(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 yo{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):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 qt?new qt(e.lng,e.lat):qt.convert(e),this}setSouthWest(e){return this._sw=e instanceof qt?new qt(e.lng,e.lat):qt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof qt)c=e,h=e;else{if(!(e instanceof yo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(yo.convert(e)):this.extend(qt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new qt(c.lng,c.lat),this._ne=new qt(h.lng,h.lat)),this}getCenter(){return new qt((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 qt(this.getWest(),this.getNorth())}getSouthEast(){return new qt(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:r,lat:o}=qt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof yo?e:e&&new yo(e)}}const Ou=2*Math.PI*Fu;function Uu(i){return Ou*Math.cos(i*Math.PI/180)}function $u(i){return(180+i)/360}function Vu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Nu(i,e){return i/Uu(e)}function dc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ll{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=qt.convert(e);return new ll($u(o.lng),Vu(o.lat),Nu(r,o.lat))}toLngLat(){return new qt(360*this.x-180,dc(this.y))}toAltitude(){return this.z*Uu(dc(this.y))}meterInMercatorCoordinateUnits(){return 1/Ou*(e=dc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Gu(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class pc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=Ws(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(p=this.y,m=this.z,g=Gu(256*(h=this.x),256*(p=Math.pow(2,m)-p-1),m),x=Gu(256*(h+1),256*(p+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,p,m,g,x;const w=function(E,A,z){let P,q="";for(let V=E;V>0;V--)P=1<<V-1,q+=(A&P?1:0)+(z&P?2:0);return q}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new He((e.x*r-this.x)*Jt,(e.y*r-this.y)*Jt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class qu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ws(e,r.z,r.z,r.x,r.y)}}class Ki{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new pc(o,+c,+h),this.key=Ws(r,e,o,c,h)}clone(){return new Ki(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Ki(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ki(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Ws(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ws(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Ki(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new Ki(r,this.wrap,r,o,c),new Ki(r,this.wrap,r,o+1,c),new Ki(r,this.wrap,r,o,c+1),new Ki(r,this.wrap,r,o+1,c+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 Ki(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ki(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 qu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ll(e.x-this.wrap,e.y))}}function Ws(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",pc),Fe("OverscaledTileID",Ki,{omit:["posMatrix"]});class Zu{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void Et(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let p=0;p<c;p++){const m=this.get(h,p);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new Hi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,p=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,x=-o*this.dim;for(let w=p;w<m;w++)for(let E=c;E<h;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+x)]}}Fe("DEMData",Zu);class ju{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Xu{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Wu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new co(Jt,16,0),this.grid3D=new co(Jt,16,0),this.featureIndexArray=new it,this.promoteId=r}insert(e,r,o,c,h,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],E=[1/0,1/0,-1/0,-1/0];for(let A=0;A<w.length;A++){const z=w[A];E[0]=Math.min(E[0],z.x),E[1]=Math.min(E[1],z.y),E[2]=Math.max(E[2],z.x),E[3]=Math.max(E[3],z.y)}E[0]<Jt&&E[1]<Jt&&E[2]>=0&&E[3]>=0&&g.insert(m,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rn.VectorTile(new ec(this.rawTileData)).layers,this.sourceLayerCoder=new ju(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},p=Jt/e.tileSize/e.scale,m=Fo(h.filter),g=e.queryGeometry,x=e.queryPadding*p,w=Ku(g),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),A=Ku(e.cameraQueryGeometry),z=this.grid3D.query(A.minX-x,A.minY-x,A.maxX+x,A.maxY+x,(V,ee,se,Q)=>function(re,_e,me,Be,Ue){for(const Ce of re)if(_e<=Ce.x&&me<=Ce.y&&Be>=Ce.x&&Ue>=Ce.y)return!0;const Pe=[new He(_e,me),new He(_e,Ue),new He(Be,Ue),new He(Be,me)];if(re.length>2){for(const Ce of Pe)if(Zo(re,Ce))return!0}for(let Ce=0;Ce<re.length-1;Ce++)if(jh(re[Ce],re[Ce+1],Pe))return!0;return!1}(e.cameraQueryGeometry,V-x,ee-x,se+x,Q+x));for(const V of z)E.push(V);E.sort(xp);const P={};let q;for(let V=0;V<E.length;V++){const ee=E[V];if(ee===q)continue;q=ee;const se=this.featureIndexArray.get(ee);let Q=null;this.loadMatchingFeature(P,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,m,h.layers,h.availableImages,r,o,c,(re,_e,me)=>(Q||(Q=mo(re)),_e.queryIntersectsFeature(g,re,me,Q,this.z,e.transform,p,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,o,c,h,p,m,g,x,w,E){const A=this.bucketLayerIDs[r];if(p&&!function(V,ee){for(let se=0;se<V.length;se++)if(ee.indexOf(V[se])>=0)return!0;return!1}(p,A))return;const z=this.sourceLayerCoder.decode(o),P=this.vtLayers[z].feature(c);if(h.needGeometry){const V=go(P,!0);if(!h.filter(new Ot(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!h.filter(new Ot(this.tileID.overscaledZ),P))return;const q=this.getId(P,z);for(let V=0;V<A.length;V++){const ee=A[V];if(p&&p.indexOf(ee)<0)continue;const se=g[ee];if(!se)continue;let Q={};q&&w&&(Q=w.getState(se.sourceLayer||"_geojsonTileLayer",q));const re=nt({},x[ee]);re.paint=Hu(re.paint,se.paint,P,Q,m),re.layout=Hu(re.layout,se.layout,P,Q,m);const _e=!E||E(P,se,Q);if(!_e)continue;const me=new Xu(P,this.z,this.x,this.y,q);me.layer=re;let Be=e[ee];Be===void 0&&(Be=e[ee]=[]),Be.push({featureIndex:c,feature:me,intersectionZ:_e})}}lookupSymbolFeatures(e,r,o,c,h,p,m,g){const x={};this.loadVTLayers();const w=Fo(h);for(const E of e)this.loadMatchingFeature(x,o,c,E,w,p,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function Hu(i,e,r,o,c){return zt(i,(h,p)=>{const m=e instanceof po?e.get(p):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function Ku(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function xp(i,e){return e-i}var fc;Fe("FeatureIndex",Wu,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(fc=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",fc.load="load",fc.fullLoad="fullLoad";let cl=null,Hs=[];const mc=1e3/30,vp={mark(i){performance.mark(i)},frame(i){const e=i;cl!=null&&Hs.push(e-cl),cl=e},clearMetrics(){cl=null,Hs=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=Hs.length,o=1/(Hs.reduce((h,p)=>h+p,0)/r/1e3),c=Hs.filter(h=>h>mc).reduce((h,p)=>h+(p-mc)/mc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Ci,a.ARRAY_TYPE=Ei,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},ot(["receive","process"],this),this.invoker=new yp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=si()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const p=un(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:Yr(e,p)},p),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else si()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Rr(e.error)):r(null,Rr(e.data)))}else{let r=!1;const o=un(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?Yr(m):null,data:Yr(g,o)},o)}:m=>{r=!0};let h=null;const p=Rr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=Us,a.CanonicalTileID=pc,a.CollisionBoxArray=ue,a.CollisionCircleLayoutArray=class extends T{},a.Color=L,a.DEMData=Zu,a.DataConstantProperty=Ve,a.DictionaryCoder=ju,a.EXTENT=Jt,a.ErrorEvent=_n,a.EvaluationParameters=Ot,a.Event=fr,a.Evented=mr,a.FeatureIndex=Wu,a.FillBucket=Kl,a.FillExtrusionBucket=Yl,a.GeoJSONFeature=Xu,a.ImageAtlas=yu,a.ImagePosition=ic,a.LineBucket=Ql,a.LineStripIndexArray=class extends ${},a.LngLat=qt,a.LngLatBounds=yo,a.MercatorCoordinate=ll,a.ONE_EM=ci,a.OverscaledTileID=Ki,a.PerformanceUtils=vp,a.PosArray=Ge,a.Properties=li,a.QuadTriangleArray=class extends M{},a.RGBAImage=Hi,a.RasterBoundsArray=class extends l{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=dr,a.SegmentVector=st,a.SymbolBucket=Yo,a.Transitionable=Oa,a.TriangleIndexArray=wi,a.Uniform1f=rn,a.Uniform1i=class extends tn{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends tn{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=Go,a.UniformColor=Lc,a.UniformMatrix4f=class extends tn{constructor(i,e){super(i,e),this.current=Vh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=qu,a.ValidationError=Ae,a.ZoomHistory=Es,a.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},a.addDynamicAttributes=ac,a.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((p,m)=>{e(p,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},a.bezier=Ee,a.bindAll=ot,a.cacheEntryPossiblyAdded=function(i){Qi++,Qi>dn&&(i.getActor().send("enforceCacheSizeLimit",hn),Qi=0)},a.clamp=ne,a.clearTileCache=function(i){const e=caches.delete(qi);i&&e.catch(i).then(()=>i())},a.clipLine=zu,a.clone=function(i){var e=new Ei(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},a.clone$1=yt,a.clone$2=function(i){var e=new Ei(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=Od,a.config=hr,a.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.create=function(){var i=new Ei(16);return Ei!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.create$1=Nc,a.createExpression=Yn,a.createFilter=Fo,a.createLayout=Xt,a.createStyleLayer=function(i){return i.type==="custom"?new gp(i):new _p[i.type](i)},a.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],p=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*p-o*g,i[2]=o*m-c*p,i},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=be,a.emitValidationErrors=Uo,a.enforceCacheSizeLimit=function(i){pn(),Zi&&Zi.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],p=i[4],m=i[5],g=i[6],x=i[7],w=i[8],E=i[9],A=i[10],z=i[11],P=i[12],q=i[13],V=i[14],ee=i[15],se=e[0],Q=e[1],re=e[2],_e=e[3],me=e[4],Be=e[5],Ue=e[6],Pe=e[7],Ce=e[8],Te=e[9],ke=e[10],Me=e[11],we=e[12],qe=e[13],Ne=e[14],rt=e[15];return Math.abs(r-se)<=Ti*Math.max(1,Math.abs(r),Math.abs(se))&&Math.abs(o-Q)<=Ti*Math.max(1,Math.abs(o),Math.abs(Q))&&Math.abs(c-re)<=Ti*Math.max(1,Math.abs(c),Math.abs(re))&&Math.abs(h-_e)<=Ti*Math.max(1,Math.abs(h),Math.abs(_e))&&Math.abs(p-me)<=Ti*Math.max(1,Math.abs(p),Math.abs(me))&&Math.abs(m-Be)<=Ti*Math.max(1,Math.abs(m),Math.abs(Be))&&Math.abs(g-Ue)<=Ti*Math.max(1,Math.abs(g),Math.abs(Ue))&&Math.abs(x-Pe)<=Ti*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(w-Ce)<=Ti*Math.max(1,Math.abs(w),Math.abs(Ce))&&Math.abs(E-Te)<=Ti*Math.max(1,Math.abs(E),Math.abs(Te))&&Math.abs(A-ke)<=Ti*Math.max(1,Math.abs(A),Math.abs(ke))&&Math.abs(z-Me)<=Ti*Math.max(1,Math.abs(z),Math.abs(Me))&&Math.abs(P-we)<=Ti*Math.max(1,Math.abs(P),Math.abs(we))&&Math.abs(q-qe)<=Ti*Math.max(1,Math.abs(q),Math.abs(qe))&&Math.abs(V-Ne)<=Ti*Math.max(1,Math.abs(V),Math.abs(Ne))&&Math.abs(ee-rt)<=Ti*Math.max(1,Math.abs(ee),Math.abs(rt))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/sn:i.kind==="composite"?Bt(o/sn,c/sn,r):e},a.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:p}=i,m=c?ne(zi.interpolationFactor(c,e,h,p),0,1):0;i.kind==="camera"?o=Bt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=Du,a.evented=Ps,a.exported=Sr,a.exported$1=Ir,a.extend=nt,a.filterObject=at,a.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},a.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.getAnchorAlignment=nc,a.getAnchorJustification=sc,a.getArrayBuffer=gn,a.getImage=Pr,a.getJSON=function(i,e){return mn(nt(i,{type:"json"}),e)},a.getOverlapMode=hc,a.getRTLTextPluginStatus=uo,a.getReferrer=Vn,a.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Nn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=Vl,a.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],w=e[8],E=e[9],A=e[10],z=e[11],P=e[12],q=e[13],V=e[14],ee=e[15],se=r*m-o*p,Q=r*g-c*p,re=r*x-h*p,_e=o*g-c*m,me=o*x-h*m,Be=c*x-h*g,Ue=w*q-E*P,Pe=w*V-A*P,Ce=w*ee-z*P,Te=E*V-A*q,ke=E*ee-z*q,Me=A*ee-z*V,we=se*Me-Q*ke+re*Te+_e*Ce-me*Pe+Be*Ue;return we?(i[0]=(m*Me-g*ke+x*Te)*(we=1/we),i[1]=(c*ke-o*Me-h*Te)*we,i[2]=(q*Be-V*me+ee*_e)*we,i[3]=(A*me-E*Be-z*_e)*we,i[4]=(g*Ce-p*Me-x*Pe)*we,i[5]=(r*Me-c*Ce+h*Pe)*we,i[6]=(V*re-P*Be-ee*Q)*we,i[7]=(w*Be-A*re+z*Q)*we,i[8]=(p*ke-m*Ce+x*Ue)*we,i[9]=(o*Ce-r*ke-h*Ue)*we,i[10]=(P*me-q*re+ee*se)*we,i[11]=(E*re-w*me-z*se)*we,i[12]=(m*Pe-p*Te-g*Ue)*we,i[13]=(r*Te-o*Pe+c*Ue)*we,i[14]=(q*Q-P*_e-V*se)*we,i[15]=(w*_e-E*Q+A*se)*we,i):null},a.isImageBitmap=Er,a.isSafari=un,a.isWorker=si,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){$i.isLoading()||$i.isLoaded()||uo()!=="deferred"||Fa()},a.makeRequest=mn,a.mapObject=zt,a.mercatorXfromLng=$u,a.mercatorYfromLat=Vu,a.mercatorZfromAltitude=Nu,a.mul=Hh,a.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},a.multiply=Gc,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},a.number=Bt,a.ortho=function(i,e,r,o,c,h,p){var m=1/(e-r),g=1/(o-c),x=1/(h-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(p+h)*x,i[15]=1,i},a.parseCacheControl=wo,a.parseGlyphPbf=function(i){return new ec(i).readFields(Hd,[])},a.pbf=ec,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Jt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Ot(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Ot(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Ot(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Ot(g),i.canonical),r["text-size"].possiblyEvaluate(new Ot(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Ot(g),i.canonical),r["icon-size"].possiblyEvaluate(new Ot(x),i.canonical)]}const c=e.get("text-line-height")*ci,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",p=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=m.evaluate(g,{},i.canonical),E=o.layoutTextSize.evaluate(g,{},i.canonical),A=o.layoutIconSize.evaluate(g,{},i.canonical),z={horizontal:{},vertical:void 0},P=g.text;let q,V=[0,0];if(P){const Q=P.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ci,_e=Dl(Q)?re:0,me=e.get("text-anchor").evaluate(g,{},i.canonical),Be=e.get("text-variable-anchor");if(!Be){const ke=e.get("text-radial-offset").evaluate(g,{},i.canonical);V=ke?Du(me,[ke*ci,oc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Me=>Me*ci)}let Ue=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ce=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ci:0,Te=()=>{i.bucket.allowVerticalPlacement&&$o(Q)&&(z.vertical=el(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,me,"left",_e,V,a.WritingMode.vertical,!0,Pe,E,w))};if(!h&&Be){const ke=Ue==="auto"?Be.map(we=>sc(we)):[Ue];let Me=!1;for(let we=0;we<ke.length;we++){const qe=ke[we];if(!z.horizontal[qe])if(Me)z.horizontal[qe]=z.horizontal[0];else{const Ne=el(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,"center",qe,_e,V,a.WritingMode.horizontal,!1,Pe,E,w);Ne&&(z.horizontal[qe]=Ne,Me=Ne.positionedLines.length===1)}}Te()}else{Ue==="auto"&&(Ue=sc(me));const ke=el(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,me,Ue,_e,V,a.WritingMode.horizontal,!1,Pe,E,w);ke&&(z.horizontal[Ue]=ke),Te(),$o(Q)&&h&&p&&(z.vertical=el(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ce,c,me,Ue,_e,V,a.WritingMode.vertical,!1,Pe,E,w))}}let ee=!1;if(g.icon&&g.icon.name){const Q=i.imageMap[g.icon.name];Q&&(q=tp(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),ee=!!Q.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ee:i.bucket.sdfIcons!==ee&&Et("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Q.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const se=Ru(z.horizontal)||z.vertical;i.bucket.iconsInText=!!se&&se.iconsInText,(se||q)&&lp(i.bucket,g,z,q,i.imageMap,o,E,A,V,ee,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.perspective=function(i,e,r,o,c){var h,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},a.plugin=$i,a.pointGeometry=He,a.polygonIntersectsPolygon=Oc,a.potpack=_u,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=Fe,a.registerForPluginStateChange=function(i){return i({pluginStatus:bi,pluginURL:Br}),Ps.on("pluginStateChange",i),i},a.renderColorRamp=Kc,a.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],w=e[9],E=e[10],A=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=p*c+w*o,i[6]=m*c+E*o,i[7]=g*c+A*o,i[8]=x*c-h*o,i[9]=w*c-p*o,i[10]=E*c-m*o,i[11]=A*c-g*o,i},a.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],p=e[1],m=e[2],g=e[3],x=e[4],w=e[5],E=e[6],A=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=p*c+w*o,i[2]=m*c+E*o,i[3]=g*c+A*o,i[4]=x*c-h*o,i[5]=w*c-p*o,i[6]=E*c-m*o,i[7]=A*c-g*o,i},a.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){hn=i,dn=e},a.setRTLTextPlugin=function(i,e,r=!1){if(bi===Cs||bi===As||bi===Ms)throw new Error("setRTLTextPlugin cannot be called multiple times.");Br=Sr.resolveURL(i),bi=Cs,zs=e,Pn(),r||Fa()},a.spec=de,a.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},a.toEvaluationFeature=go,a.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},a.transformMat4=ja,a.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},a.translate=function(i,e,r){var o,c,h,p,m,g,x,w,E,A,z,P,q=r[0],V=r[1],ee=r[2];return e===i?(i[12]=e[0]*q+e[4]*V+e[8]*ee+e[12],i[13]=e[1]*q+e[5]*V+e[9]*ee+e[13],i[14]=e[2]*q+e[6]*V+e[10]*ee+e[14],i[15]=e[3]*q+e[7]*V+e[11]*ee+e[15]):(c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],A=e[9],z=e[10],P=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=p,i[4]=m,i[5]=g,i[6]=x,i[7]=w,i[8]=E,i[9]=A,i[10]=z,i[11]=P,i[12]=o*q+m*V+E*ee+e[12],i[13]=c*q+g*V+A*ee+e[13],i[14]=h*q+x*V+z*ee+e[14],i[15]=p*q+w*V+P*ee+e[15]),i},a.triggerPluginCompletionEvent=Ba,a.unicodeBlockLookup=ze,a.uniqueId=function(){return Xe++},a.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},a.validateLight=Ts,a.validateStyle=lo,a.vectorTile=Rn,a.warnOnce=Et,a.wrap=ht}),X(["./shared"],function(a){function ye(B){const b=typeof B;if(b==="number"||b==="boolean"||b==="string"||B==null)return JSON.stringify(B);if(Array.isArray(B)){let L="[";for(const Z of B)L+=`${ye(Z)},`;return`${L}]`}const S=Object.keys(B).sort();let D="{";for(let L=0;L<S.length;L++)D+=`${JSON.stringify(S[L])}:${ye(B[S[L]])},`;return`${D}}`}function pe(B){let b="";for(const S of a.refProperties)b+=`/${ye(B[S])}`;return b}class Ee{constructor(b){this.keyCache={},b&&this.replace(b)}replace(b){this._layerConfigs={},this._layers={},this.update(b,[])}update(b,S){for(const L of b){this._layerConfigs[L.id]=L;const Z=this._layers[L.id]=a.createStyleLayer(L);Z._featureFilter=a.createFilter(Z.filter),this.keyCache[L.id]&&delete this.keyCache[L.id]}for(const L of S)delete this.keyCache[L],delete this._layerConfigs[L],delete this._layers[L];this.familiesBySource={};const D=function(L,Z){const K={};for(let j=0;j<L.length;j++){const J=Z&&Z[L[j].id]||pe(L[j]);Z&&(Z[L[j].id]=J);let le=K[J];le||(le=K[J]=[]),le.push(L[j])}const W=[];for(const j in K)W.push(K[j]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const L of D){const Z=L.map(xe=>this._layers[xe.id]),K=Z[0];if(K.visibility==="none")continue;const W=K.source||"";let j=this.familiesBySource[W];j||(j=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let le=j[J];le||(le=j[J]=[]),le.push(Z)}}}class be{constructor(b){const S={},D=[];for(const W in b){const j=b[W],J=S[W]={};for(const le in j){const xe=j[+le];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const ae={x:0,y:0,w:xe.bitmap.width+2,h:xe.bitmap.height+2};D.push(ae),J[le]={rect:ae,metrics:xe.metrics}}}const{w:L,h:Z}=a.potpack(D),K=new a.AlphaImage({width:L||1,height:Z||1});for(const W in b){const j=b[W];for(const J in j){const le=j[+J];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const xe=S[W][J].rect;a.AlphaImage.copy(le.bitmap,K,{x:0,y:0},{x:xe.x+1,y:xe.y+1},le.bitmap)}}this.image=K,this.positions=S}}a.register("GlyphAtlas",be);class ne{constructor(b){this.tileID=new a.OverscaledTileID(b.tileID.overscaledZ,b.tileID.wrap,b.tileID.canonical.z,b.tileID.canonical.x,b.tileID.canonical.y),this.uid=b.uid,this.zoom=b.zoom,this.pixelRatio=b.pixelRatio,this.tileSize=b.tileSize,this.source=b.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=b.showCollisionBoxes,this.collectResourceTiming=!!b.collectResourceTiming,this.returnDependencies=!!b.returnDependencies,this.promoteId=b.promoteId}parse(b,S,D,L,Z){this.status="parsing",this.data=b,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(b.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const j={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},le=S.familiesBySource[this.source];for(const Ke in le){const tt=b.layers[Ke];if(!tt)continue;tt.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const gt=K.encode(Ke),Ct=[];for(let ei=0;ei<tt.length;ei++){const Rt=tt.feature(ei),hi=W.getId(Rt,Ke);Ct.push({feature:Rt,id:hi,index:ei,sourceLayerIndex:gt})}for(const ei of le[Ke]){const Rt=ei[0];Rt.source!==this.source&&a.warnOnce(`layer.source = ${Rt.source} does not equal this.source = ${this.source}`),Rt.minzoom&&this.zoom<Math.floor(Rt.minzoom)||Rt.maxzoom&&this.zoom>=Rt.maxzoom||Rt.visibility!=="none"&&(ht(ei,this.zoom,D),(j[Rt.id]=Rt.createBucket({index:W.bucketLayerIDs.length,layers:ei,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:gt,sourceID:this.source})).populate(Ct,J,this.tileID.canonical),W.bucketLayerIDs.push(ei.map(hi=>hi.id)))}}let xe,ae,Oe,$e;const De=a.mapObject(J.glyphDependencies,Ke=>Object.keys(Ke).map(Number));Object.keys(De).length?L.send("getGlyphs",{uid:this.uid,stacks:De},(Ke,tt)=>{xe||(xe=Ke,ae=tt,mt.call(this))}):ae={};const Ze=Object.keys(J.iconDependencies);Ze.length?L.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"},(Ke,tt)=>{xe||(xe=Ke,Oe=tt,mt.call(this))}):Oe={};const We=Object.keys(J.patternDependencies);function mt(){if(xe)return Z(xe);if(ae&&Oe&&$e){const Ke=new be(ae),tt=new a.ImageAtlas(Oe,$e);for(const gt in j){const Ct=j[gt];Ct instanceof a.SymbolBucket?(ht(Ct.layers,this.zoom,D),a.performSymbolLayout({bucket:Ct,glyphMap:ae,glyphPositions:Ke.positions,imageMap:Oe,imagePositions:tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Ct.hasPattern&&(Ct instanceof a.LineBucket||Ct instanceof a.FillBucket||Ct instanceof a.FillExtrusionBucket)&&(ht(Ct.layers,this.zoom,D),Ct.addFeatures(J,this.tileID.canonical,tt.patternPositions))}this.status="done",Z(null,{buckets:Object.values(j).filter(gt=>!gt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ke.image,imageAtlas:tt,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?Oe:null,glyphPositions:this.returnDependencies?Ke.positions:null})}}We.length?L.send("getImages",{icons:We,source:this.source,tileID:this.tileID,type:"patterns"},(Ke,tt)=>{xe||(xe=Ke,$e=tt,mt.call(this))}):$e={},mt.call(this)}}function ht(B,b,S){const D=new a.EvaluationParameters(b);for(const L of B)L.recalculate(D,S)}function nt(B,b){const S=a.getArrayBuffer(B.request,(D,L,Z,K)=>{D?b(D):L&&b(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(L)),rawData:L,cacheControl:Z,expires:K})});return()=>{S.cancel(),b()}}class Xe{constructor(b,S,D,L){this.actor=b,this.layerIndex=S,this.availableImages=D,this.loadVectorData=L||nt,this.loading={},this.loaded={}}loadTile(b,S){const D=b.uid;this.loading||(this.loading={});const L=!!(b&&b.request&&b.request.collectResourceTiming)&&new a.RequestPerformance(b.request),Z=this.loading[D]=new ne(b);Z.abort=this.loadVectorData(b,(K,W)=>{if(delete this.loading[D],K||!W)return Z.status="done",this.loaded[D]=Z,S(K);const j=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const le={};if(L){const xe=L.finish();xe&&(le.resourceTiming=JSON.parse(JSON.stringify(xe)))}Z.vectorTile=W.vectorTile,Z.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(xe,ae)=>{if(xe||!ae)return S(xe);S(null,a.extend({rawTileData:j.slice(0)},ae,J,le))}),this.loaded=this.loaded||{},this.loaded[D]=Z})}reloadTile(b,S){const D=this.loaded,L=b.uid,Z=this;if(D&&D[L]){const K=D[L];K.showCollisionBoxes=b.showCollisionBoxes;const W=(j,J)=>{const le=K.reloadCallback;le&&(delete K.reloadCallback,K.parse(K.vectorTile,Z.layerIndex,this.availableImages,Z.actor,le)),S(j,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(b,S){const D=this.loading,L=b.uid;D&&D[L]&&D[L].abort&&(D[L].abort(),delete D[L]),S()}removeTile(b,S){const D=this.loaded,L=b.uid;D&&D[L]&&delete D[L],S()}}class ot{constructor(){this.loaded={}}loadTile(b,S){const{uid:D,encoding:L,rawImageData:Z}=b,K=a.isImageBitmap(Z)?this.getImageData(Z):Z,W=new a.DEMData(D,K,L);this.loaded=this.loaded||{},this.loaded[D]=W,S(null,W)}getImageData(b){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const S=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:S.width,height:S.height},S.data)}removeTile(b){const S=this.loaded,D=b.uid;S&&S[D]&&delete S[D]}}var zt=function B(b,S){var D,L=b&&b.type;if(L==="FeatureCollection")for(D=0;D<b.features.length;D++)B(b.features[D],S);else if(L==="GeometryCollection")for(D=0;D<b.geometries.length;D++)B(b.geometries[D],S);else if(L==="Feature")B(b.geometry,S);else if(L==="Polygon")at(b.coordinates,S);else if(L==="MultiPolygon")for(D=0;D<b.coordinates.length;D++)at(b.coordinates[D],S);return b};function at(B,b){if(B.length!==0){yt(B[0],b);for(var S=1;S<B.length;S++)yt(B[S],!b)}}function yt(B,b){for(var S=0,D=0,L=0,Z=B.length,K=Z-1;L<Z;K=L++){var W=(B[L][0]-B[K][0])*(B[K][1]+B[L][1]),j=S+W;D+=Math.abs(S)>=Math.abs(W)?S-j+W:W-j+S,S=j}S+D>=0!=!!b&&B.reverse()}const Nt=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Et{constructor(b){this._feature=b,this.extent=a.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(this._feature.type===1){const b=[];for(const S of this._feature.geometry)b.push([new a.pointGeometry(S[0],S[1])]);return b}{const b=[];for(const S of this._feature.geometry){const D=[];for(const L of S)D.push(new a.pointGeometry(L[0],L[1]));b.push(D)}return b}}toGeoJSON(b,S,D){return Nt.call(this,b,S,D)}}class kt{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(b){return new Et(this._features[b])}}var ui={exports:{}},si=a.pointGeometry,wo=a.vectorTile.VectorTileFeature,lr=Gr;function Gr(B,b){this.options=b||{},this.features=B,this.length=B.length}function cr(B,b){this.id=typeof B.id=="number"?B.id:void 0,this.type=B.type,this.rawGeometry=B.type===1?[B.geometry]:B.geometry,this.properties=B.tags,this.extent=b||4096}Gr.prototype.feature=function(B){return new cr(this.features[B],this.options.extent)},cr.prototype.loadGeometry=function(){var B=this.rawGeometry;this.geometry=[];for(var b=0;b<B.length;b++){for(var S=B[b],D=[],L=0;L<S.length;L++)D.push(new si(S[L][0],S[L][1]));this.geometry.push(D)}return this.geometry},cr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var B=this.geometry,b=1/0,S=-1/0,D=1/0,L=-1/0,Z=0;Z<B.length;Z++)for(var K=B[Z],W=0;W<K.length;W++){var j=K[W];b=Math.min(b,j.x),S=Math.max(S,j.x),D=Math.min(D,j.y),L=Math.max(L,j.y)}return[b,D,S,L]},cr.prototype.toGeoJSON=wo.prototype.toGeoJSON;var un=a.pbf,Er=lr;function Sr(B){var b=new un;return function(S,D){for(var L in S.layers)D.writeMessage(3,He,S.layers[L])}(B,b),b.finish()}function He(B,b){var S;b.writeVarintField(15,B.version||1),b.writeStringField(1,B.name||""),b.writeVarintField(5,B.extent||4096);var D={keys:[],values:[],keycache:{},valuecache:{}};for(S=0;S<B.length;S++)D.feature=B.feature(S),b.writeMessage(2,ur,D);var L=D.keys;for(S=0;S<L.length;S++)b.writeStringField(3,L[S]);var Z=D.values;for(S=0;S<Z.length;S++)b.writeMessage(4,hn,Z[S])}function ur(B,b){var S=B.feature;S.id!==void 0&&b.writeVarintField(1,S.id),b.writeMessage(2,hr,B),b.writeVarintField(3,S.type),b.writeMessage(4,qr,S)}function hr(B,b){var S=B.feature,D=B.keys,L=B.values,Z=B.keycache,K=B.valuecache;for(var W in S.properties){var j=S.properties[W],J=Z[W];if(j!==null){J===void 0&&(D.push(W),Z[W]=J=D.length-1),b.writeVarint(J);var le=typeof j;le!=="string"&&le!=="boolean"&&le!=="number"&&(j=JSON.stringify(j));var xe=le+":"+j,ae=K[xe];ae===void 0&&(L.push(j),K[xe]=ae=L.length-1),b.writeVarint(ae)}}}function qi(B,b){return(b<<3)+(7&B)}function Zi(B){return B<<1^B>>31}function qr(B,b){for(var S=B.loadGeometry(),D=B.type,L=0,Z=0,K=S.length,W=0;W<K;W++){var j=S[W],J=1;D===1&&(J=j.length),b.writeVarint(qi(1,J));for(var le=D===3?j.length-1:j.length,xe=0;xe<le;xe++){xe===1&&D!==1&&b.writeVarint(qi(2,le-1));var ae=j[xe].x-L,Oe=j[xe].y-Z;b.writeVarint(Zi(ae)),b.writeVarint(Zi(Oe)),L+=ae,Z+=Oe}D===3&&b.writeVarint(qi(7,1))}}function hn(B,b){var S=typeof B;S==="string"?b.writeStringField(1,B):S==="boolean"?b.writeBooleanField(7,B):S==="number"&&(B%1!=0?b.writeDoubleField(3,B):B<0?b.writeSVarintField(6,B):b.writeVarintField(5,B))}function dn(B,b,S,D,L,Z){if(L-D<=S)return;const K=D+L>>1;pn(B,b,K,D,L,Z%2),dn(B,b,S,D,K-1,Z+1),dn(B,b,S,K+1,L,Z+1)}function pn(B,b,S,D,L,Z){for(;L>D;){if(L-D>600){const J=L-D+1,le=S-D+1,xe=Math.log(J),ae=.5*Math.exp(2*xe/3),Oe=.5*Math.sqrt(xe*ae*(J-ae)/J)*(le-J/2<0?-1:1);pn(B,b,S,Math.max(D,Math.floor(S-le*ae/J+Oe)),Math.min(L,Math.floor(S+(J-le)*ae/J+Oe)),Z)}const K=b[2*S+Z];let W=D,j=L;for(Qi(B,b,D,S),b[2*L+Z]>K&&Qi(B,b,D,L);W<j;){for(Qi(B,b,W,j),W++,j--;b[2*W+Z]<K;)W++;for(;b[2*j+Z]>K;)j--}b[2*D+Z]===K?Qi(B,b,D,j):(j++,Qi(B,b,j,L)),j<=S&&(D=j+1),S<=j&&(L=j-1)}}function Qi(B,b,S,D){Ir(B,S,D),Ir(b,2*S,2*D),Ir(b,2*S+1,2*D+1)}function Ir(B,b,S){const D=B[b];B[b]=B[S],B[S]=D}function Cr(B,b,S,D){const L=B-S,Z=b-D;return L*L+Z*Z}ui.exports=Sr,ui.exports.fromVectorTileJs=Sr,ui.exports.fromGeojsonVt=function(B,b){b=b||{};var S={};for(var D in B)S[D]=new Er(B[D].features,b),S[D].name=D,S[D].version=b.version,S[D].extent=b.extent;return Sr({layers:S})},ui.exports.GeoJSONWrapper=Er;const Ar=B=>B[0],vi=B=>B[1];class fn{constructor(b,S=Ar,D=vi,L=64,Z=Float64Array){this.nodeSize=L,this.points=b;const K=b.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(b.length),j=this.coords=new Z(2*b.length);for(let J=0;J<b.length;J++)W[J]=J,j[2*J]=S(b[J]),j[2*J+1]=D(b[J]);dn(W,j,L,0,W.length-1,0)}range(b,S,D,L){return function(Z,K,W,j,J,le,xe){const ae=[0,Z.length-1,0],Oe=[];let $e,De;for(;ae.length;){const Ze=ae.pop(),We=ae.pop(),mt=ae.pop();if(We-mt<=xe){for(let gt=mt;gt<=We;gt++)$e=K[2*gt],De=K[2*gt+1],$e>=W&&$e<=J&&De>=j&&De<=le&&Oe.push(Z[gt]);continue}const Ke=Math.floor((mt+We)/2);$e=K[2*Ke],De=K[2*Ke+1],$e>=W&&$e<=J&&De>=j&&De<=le&&Oe.push(Z[Ke]);const tt=(Ze+1)%2;(Ze===0?W<=$e:j<=De)&&(ae.push(mt),ae.push(Ke-1),ae.push(tt)),(Ze===0?J>=$e:le>=De)&&(ae.push(Ke+1),ae.push(We),ae.push(tt))}return Oe}(this.ids,this.coords,b,S,D,L,this.nodeSize)}within(b,S,D){return function(L,Z,K,W,j,J){const le=[0,L.length-1,0],xe=[],ae=j*j;for(;le.length;){const Oe=le.pop(),$e=le.pop(),De=le.pop();if($e-De<=J){for(let tt=De;tt<=$e;tt++)Cr(Z[2*tt],Z[2*tt+1],K,W)<=ae&&xe.push(L[tt]);continue}const Ze=Math.floor((De+$e)/2),We=Z[2*Ze],mt=Z[2*Ze+1];Cr(We,mt,K,W)<=ae&&xe.push(L[Ze]);const Ke=(Oe+1)%2;(Oe===0?K-j<=We:W-j<=mt)&&(le.push(De),le.push(Ze-1),le.push(Ke)),(Oe===0?K+j>=We:W+j>=mt)&&(le.push(Ze+1),le.push($e),le.push(Ke))}return xe}(this.ids,this.coords,b,S,D,this.nodeSize)}}const $n={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:B=>B},dr=Math.fround||(Ci=new Float32Array(1),B=>(Ci[0]=+B,Ci[0]));var Ci;class Vn{constructor(b){this.options=Pr(Object.create($n),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:S,minZoom:D,maxZoom:L,nodeSize:Z}=this.options;S&&console.time("total time");const K=`prepare ${b.length} points`;S&&console.time(K),this.points=b;let W=[];for(let j=0;j<b.length;j++)b[j].geometry&&W.push(mn(b[j],j));this.trees[L+1]=new fn(W,Gn,pr,Z,Float32Array),S&&console.timeEnd(K);for(let j=L;j>=D;j--){const J=+Date.now();W=this._cluster(W,j),this.trees[j]=new fn(W,Gn,pr,Z,Float32Array),S&&console.log("z%d: %d clusters in %dms",j,W.length,+Date.now()-J)}return S&&console.timeEnd("total time"),this}getClusters(b,S){let D=((b[0]+180)%360+360)%360-180;const L=Math.max(-90,Math.min(90,b[1]));let Z=b[2]===180?180:((b[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)D=-180,Z=180;else if(D>Z){const le=this.getClusters([D,L,180,K],S),xe=this.getClusters([-180,L,Z,K],S);return le.concat(xe)}const W=this.trees[this._limitZoom(S)],j=W.range(pt(D),er(K),pt(Z),er(L)),J=[];for(const le of j){const xe=W.points[le];J.push(xe.numPoints?gn(xe):this.points[xe.index])}return J}getChildren(b){const S=this._getOriginId(b),D=this._getOriginZoom(b),L="No cluster with the specified id.",Z=this.trees[D];if(!Z)throw new Error(L);const K=Z.points[S];if(!K)throw new Error(L);const W=this.options.radius/(this.options.extent*Math.pow(2,D-1)),j=Z.within(K.x,K.y,W),J=[];for(const le of j){const xe=Z.points[le];xe.parentId===b&&J.push(xe.numPoints?gn(xe):this.points[xe.index])}if(J.length===0)throw new Error(L);return J}getLeaves(b,S,D){const L=[];return this._appendLeaves(L,b,S=S||10,D=D||0,0),L}getTile(b,S,D){const L=this.trees[this._limitZoom(b)],Z=Math.pow(2,b),{extent:K,radius:W}=this.options,j=W/K,J=(D-j)/Z,le=(D+1+j)/Z,xe={features:[]};return this._addTileFeatures(L.range((S-j)/Z,J,(S+1+j)/Z,le),L.points,S,D,Z,xe),S===0&&this._addTileFeatures(L.range(1-j/Z,J,1,le),L.points,Z,D,Z,xe),S===Z-1&&this._addTileFeatures(L.range(0,J,j/Z,le),L.points,-1,D,Z,xe),xe.features.length?xe:null}getClusterExpansionZoom(b){let S=this._getOriginZoom(b)-1;for(;S<=this.options.maxZoom;){const D=this.getChildren(b);if(S++,D.length!==1)break;b=D[0].properties.cluster_id}return S}_appendLeaves(b,S,D,L,Z){const K=this.getChildren(S);for(const W of K){const j=W.properties;if(j&&j.cluster?Z+j.point_count<=L?Z+=j.point_count:Z=this._appendLeaves(b,j.cluster_id,D,L,Z):Z<L?Z++:b.push(W),b.length===D)break}return Z}_addTileFeatures(b,S,D,L,Z,K){for(const W of b){const j=S[W],J=j.numPoints;let le,xe,ae;if(J)le=Nn(j),xe=j.x,ae=j.y;else{const De=this.points[j.index];le=De.properties,xe=pt(De.geometry.coordinates[0]),ae=er(De.geometry.coordinates[1])}const Oe={type:1,geometry:[[Math.round(this.options.extent*(xe*Z-D)),Math.round(this.options.extent*(ae*Z-L))]],tags:le};let $e;J?$e=j.id:this.options.generateId?$e=j.index:this.points[j.index].id&&($e=this.points[j.index].id),$e!==void 0&&(Oe.id=$e),K.features.push(Oe)}}_limitZoom(b){return Math.max(this.options.minZoom,Math.min(Math.floor(+b),this.options.maxZoom+1))}_cluster(b,S){const D=[],{radius:L,extent:Z,reduce:K,minPoints:W}=this.options,j=L/(Z*Math.pow(2,S));for(let J=0;J<b.length;J++){const le=b[J];if(le.zoom<=S)continue;le.zoom=S;const xe=this.trees[S+1],ae=xe.within(le.x,le.y,j),Oe=le.numPoints||1;let $e=Oe;for(const De of ae){const Ze=xe.points[De];Ze.zoom>S&&($e+=Ze.numPoints||1)}if($e>Oe&&$e>=W){let De=le.x*Oe,Ze=le.y*Oe,We=K&&Oe>1?this._map(le,!0):null;const mt=(J<<5)+(S+1)+this.points.length;for(const Ke of ae){const tt=xe.points[Ke];if(tt.zoom<=S)continue;tt.zoom=S;const gt=tt.numPoints||1;De+=tt.x*gt,Ze+=tt.y*gt,tt.parentId=mt,K&&(We||(We=this._map(le,!0)),K(We,this._map(tt)))}le.parentId=mt,D.push(Mr(De/$e,Ze/$e,mt,$e,We))}else if(D.push(le),$e>1)for(const De of ae){const Ze=xe.points[De];Ze.zoom<=S||(Ze.zoom=S,D.push(Ze))}}return D}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,S){if(b.numPoints)return S?Pr({},b.properties):b.properties;const D=this.points[b.index].properties,L=this.options.map(D);return S&&L===D?Pr({},L):L}}function Mr(B,b,S,D,L){return{x:dr(B),y:dr(b),zoom:1/0,id:S,parentId:-1,numPoints:D,properties:L}}function mn(B,b){const[S,D]=B.geometry.coordinates;return{x:dr(pt(S)),y:dr(er(D)),zoom:1/0,index:b,parentId:-1}}function gn(B){return{type:"Feature",id:B.id,properties:Nn(B),geometry:{type:"Point",coordinates:[(b=B.x,360*(b-.5)),zr(B.y)]}};var b}function Nn(B){const b=B.numPoints,S=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return Pr(Pr({},B.properties),{cluster:!0,cluster_id:B.id,point_count:b,point_count_abbreviated:S})}function pt(B){return B/360+.5}function er(B){const b=Math.sin(B*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function zr(B){const b=(180-360*B)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function Pr(B,b){for(const S in b)B[S]=b[S];return B}function Gn(B){return B.x}function pr(B){return B.y}function fr(B,b,S,D){for(var L,Z=D,K=S-b>>1,W=S-b,j=B[b],J=B[b+1],le=B[S],xe=B[S+1],ae=b+3;ae<S;ae+=3){var Oe=_n(B[ae],B[ae+1],j,J,le,xe);if(Oe>Z)L=ae,Z=Oe;else if(Oe===Z){var $e=Math.abs(ae-K);$e<W&&(L=ae,W=$e)}}Z>D&&(L-b>3&&fr(B,b,L,D),B[L+2]=Z,S-L>3&&fr(B,L,S,D))}function _n(B,b,S,D,L,Z){var K=L-S,W=Z-D;if(K!==0||W!==0){var j=((B-S)*K+(b-D)*W)/(K*K+W*W);j>1?(S=L,D=Z):j>0&&(S+=K*j,D+=W*j)}return(K=B-S)*K+(W=b-D)*W}function mr(B,b,S,D){var L={id:B===void 0?null:B,type:b,geometry:S,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Z){var K=Z.geometry,W=Z.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")de(Z,K);else if(W==="Polygon"||W==="MultiLineString")for(var j=0;j<K.length;j++)de(Z,K[j]);else if(W==="MultiPolygon")for(j=0;j<K.length;j++)for(var J=0;J<K[j].length;J++)de(Z,K[j][J])}(L),L}function de(B,b){for(var S=0;S<b.length;S+=3)B.minX=Math.min(B.minX,b[S]),B.minY=Math.min(B.minY,b[S+1]),B.maxX=Math.max(B.maxX,b[S]),B.maxY=Math.max(B.maxY,b[S+1])}function Ae(B,b,S,D){if(b.geometry){var L=b.geometry.coordinates,Z=b.geometry.type,K=Math.pow(S.tolerance/((1<<S.maxZoom)*S.extent),2),W=[],j=b.id;if(S.promoteId?j=b.properties[S.promoteId]:S.generateId&&(j=D||0),Z==="Point")Zr(L,W);else if(Z==="MultiPoint")for(var J=0;J<L.length;J++)Zr(L[J],W);else if(Z==="LineString")ji(L,W,K,!1);else if(Z==="MultiLineString"){if(S.lineMetrics){for(J=0;J<L.length;J++)ji(L[J],W=[],K,!1),B.push(mr(j,"LineString",W,b.properties));return}ft(L,W,K,!1)}else if(Z==="Polygon")ft(L,W,K,!0);else{if(Z!=="MultiPolygon"){if(Z==="GeometryCollection"){for(J=0;J<b.geometry.geometries.length;J++)Ae(B,{id:j,geometry:b.geometry.geometries[J],properties:b.properties},S,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<L.length;J++){var le=[];ft(L[J],le,K,!0),W.push(le)}}B.push(mr(j,Z,W,b.properties))}}function Zr(B,b){b.push(Ui(B[0])),b.push(Ai(B[1])),b.push(0)}function ji(B,b,S,D){for(var L,Z,K=0,W=0;W<B.length;W++){var j=Ui(B[W][0]),J=Ai(B[W][1]);b.push(j),b.push(J),b.push(0),W>0&&(K+=D?(L*J-j*Z)/2:Math.sqrt(Math.pow(j-L,2)+Math.pow(J-Z,2))),L=j,Z=J}var le=b.length-3;b[2]=1,fr(b,0,le,S),b[le+2]=1,b.size=Math.abs(K),b.start=0,b.end=b.size}function ft(B,b,S,D){for(var L=0;L<B.length;L++){var Z=[];ji(B[L],Z,S,D),b.push(Z)}}function Ui(B){return B/360+.5}function Ai(B){var b=Math.sin(B*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function Mi(B,b,S,D,L,Z,K,W){if(D/=b,Z>=(S/=b)&&K<D)return B;if(K<S||Z>=D)return null;for(var j=[],J=0;J<B.length;J++){var le=B[J],xe=le.geometry,ae=le.type,Oe=L===0?le.minX:le.minY,$e=L===0?le.maxX:le.maxY;if(Oe>=S&&$e<D)j.push(le);else if(!($e<S||Oe>=D)){var De=[];if(ae==="Point"||ae==="MultiPoint")kr(xe,De,S,D,L);else if(ae==="LineString")Se(xe,De,S,D,L,!1,W.lineMetrics);else if(ae==="MultiLineString")Ye(xe,De,S,D,L,!1);else if(ae==="Polygon")Ye(xe,De,S,D,L,!0);else if(ae==="MultiPolygon")for(var Ze=0;Ze<xe.length;Ze++){var We=[];Ye(xe[Ze],We,S,D,L,!0),We.length&&De.push(We)}if(De.length){if(W.lineMetrics&&ae==="LineString"){for(Ze=0;Ze<De.length;Ze++)j.push(mr(le.id,ae,De[Ze],le.tags));continue}ae!=="LineString"&&ae!=="MultiLineString"||(De.length===1?(ae="LineString",De=De[0]):ae="MultiLineString"),ae!=="Point"&&ae!=="MultiPoint"||(ae=De.length===3?"Point":"MultiPoint"),j.push(mr(le.id,ae,De,le.tags))}}}return j.length?j:null}function kr(B,b,S,D,L){for(var Z=0;Z<B.length;Z+=3){var K=B[Z+L];K>=S&&K<=D&&(b.push(B[Z]),b.push(B[Z+1]),b.push(B[Z+2]))}}function Se(B,b,S,D,L,Z,K){for(var W,j,J=et(B),le=L===0?Dr:Je,xe=B.start,ae=0;ae<B.length-3;ae+=3){var Oe=B[ae],$e=B[ae+1],De=B[ae+2],Ze=B[ae+3],We=B[ae+4],mt=L===0?Oe:$e,Ke=L===0?Ze:We,tt=!1;K&&(W=Math.sqrt(Math.pow(Oe-Ze,2)+Math.pow($e-We,2))),mt<S?Ke>S&&(j=le(J,Oe,$e,Ze,We,S),K&&(J.start=xe+W*j)):mt>D?Ke<D&&(j=le(J,Oe,$e,Ze,We,D),K&&(J.start=xe+W*j)):ai(J,Oe,$e,De),Ke<S&&mt>=S&&(j=le(J,Oe,$e,Ze,We,S),tt=!0),Ke>D&&mt<=D&&(j=le(J,Oe,$e,Ze,We,D),tt=!0),!Z&&tt&&(K&&(J.end=xe+W*j),b.push(J),J=et(B)),K&&(xe+=W)}var gt=B.length-3;Oe=B[gt],$e=B[gt+1],De=B[gt+2],(mt=L===0?Oe:$e)>=S&&mt<=D&&ai(J,Oe,$e,De),gt=J.length-3,Z&>>=3&&(J[gt]!==J[0]||J[gt+1]!==J[1])&&ai(J,J[0],J[1],J[2]),J.length&&b.push(J)}function et(B){var b=[];return b.size=B.size,b.start=B.start,b.end=B.end,b}function Ye(B,b,S,D,L,Z){for(var K=0;K<B.length;K++)Se(B[K],b,S,D,L,Z,!1)}function ai(B,b,S,D){B.push(b),B.push(S),B.push(D)}function Dr(B,b,S,D,L,Z){var K=(Z-b)/(D-b);return B.push(Z),B.push(S+(L-S)*K),B.push(1),K}function Je(B,b,S,D,L,Z){var K=(Z-S)/(L-S);return B.push(b+(D-b)*K),B.push(Z),B.push(1),K}function gr(B,b){for(var S=[],D=0;D<B.length;D++){var L,Z=B[D],K=Z.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")L=Qt(Z.geometry,b);else if(K==="MultiLineString"||K==="Polygon"){L=[];for(var W=0;W<Z.geometry.length;W++)L.push(Qt(Z.geometry[W],b))}else if(K==="MultiPolygon")for(L=[],W=0;W<Z.geometry.length;W++){for(var j=[],J=0;J<Z.geometry[W].length;J++)j.push(Qt(Z.geometry[W][J],b));L.push(j)}S.push(mr(Z.id,K,L,Z.tags))}return S}function Qt(B,b){var S=[];S.size=B.size,B.start!==void 0&&(S.start=B.start,S.end=B.end);for(var D=0;D<B.length;D+=3)S.push(B[D]+b,B[D+1],B[D+2]);return S}function yn(B,b){if(B.transformed)return B;var S,D,L,Z=1<<B.z,K=B.x,W=B.y;for(S=0;S<B.features.length;S++){var j=B.features[S],J=j.geometry,le=j.type;if(j.geometry=[],le===1)for(D=0;D<J.length;D+=2)j.geometry.push(jt(J[D],J[D+1],b,Z,K,W));else for(D=0;D<J.length;D++){var xe=[];for(L=0;L<J[D].length;L+=2)xe.push(jt(J[D][L],J[D][L+1],b,Z,K,W));j.geometry.push(xe)}}return B.transformed=!0,B}function jt(B,b,S,D,L,Z){return[Math.round(S*(B*D-L)),Math.round(S*(b*D-Z))]}function gi(B,b,S,D,L){for(var Z=b===L.maxZoom?0:L.tolerance/((1<<b)*L.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:S,y:D,z:b,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<B.length;W++){K.numFeatures++,St(K,B[W],Z,L);var j=B[W].minX,J=B[W].minY,le=B[W].maxX,xe=B[W].maxY;j<K.minX&&(K.minX=j),J<K.minY&&(K.minY=J),le>K.maxX&&(K.maxX=le),xe>K.maxY&&(K.maxY=xe)}return K}function St(B,b,S,D){var L=b.geometry,Z=b.type,K=[];if(Z==="Point"||Z==="MultiPoint")for(var W=0;W<L.length;W+=3)K.push(L[W]),K.push(L[W+1]),B.numPoints++,B.numSimplified++;else if(Z==="LineString")xn(K,L,B,S,!1,!1);else if(Z==="MultiLineString"||Z==="Polygon")for(W=0;W<L.length;W++)xn(K,L[W],B,S,Z==="Polygon",W===0);else if(Z==="MultiPolygon")for(var j=0;j<L.length;j++){var J=L[j];for(W=0;W<J.length;W++)xn(K,J[W],B,S,!0,W===0)}if(K.length){var le=b.tags||null;if(Z==="LineString"&&D.lineMetrics){for(var xe in le={},b.tags)le[xe]=b.tags[xe];le.mapbox_clip_start=L.start/L.size,le.mapbox_clip_end=L.end/L.size}var ae={geometry:K,type:Z==="Polygon"||Z==="MultiPolygon"?3:Z==="LineString"||Z==="MultiLineString"?2:1,tags:le};b.id!==null&&(ae.id=b.id),B.features.push(ae)}}function xn(B,b,S,D,L,Z){var K=D*D;if(D>0&&b.size<(L?K:D))S.numPoints+=b.length/3;else{for(var W=[],j=0;j<b.length;j+=3)(D===0||b[j+2]>K)&&(S.numSimplified++,W.push(b[j]),W.push(b[j+1])),S.numPoints++;L&&function(J,le){for(var xe=0,ae=0,Oe=J.length,$e=Oe-2;ae<Oe;$e=ae,ae+=2)xe+=(J[ae]-J[$e])*(J[ae+1]+J[$e+1]);if(xe>0===le)for(ae=0,Oe=J.length;ae<Oe/2;ae+=2){var De=J[ae],Ze=J[ae+1];J[ae]=J[Oe-2-ae],J[ae+1]=J[Oe-1-ae],J[Oe-2-ae]=De,J[Oe-1-ae]=Ze}}(W,Z),B.push(W)}}function tr(B,b){var S=(b=this.options=function(L,Z){for(var K in Z)L[K]=Z[K];return L}(Object.create(this.options),b)).debug;if(S&&console.time("preprocess data"),b.maxZoom<0||b.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw new Error("promoteId and generateId cannot be used together.");var D=function(L,Z){var K=[];if(L.type==="FeatureCollection")for(var W=0;W<L.features.length;W++)Ae(K,L.features[W],Z,W);else Ae(K,L.type==="Feature"?L:{geometry:L},Z);return K}(B,b);this.tiles={},this.tileCoords=[],S&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",b.indexMaxZoom,b.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),D=function(L,Z){var K=Z.buffer/Z.extent,W=L,j=Mi(L,1,-1-K,K,0,-1,2,Z),J=Mi(L,1,1-K,2+K,0,-1,2,Z);return(j||J)&&(W=Mi(L,1,-K,1+K,0,-1,2,Z)||[],j&&(W=gr(j,1).concat(W)),J&&(W=W.concat(gr(J,-1)))),W}(D,b),D.length&&this.splitTile(D,0,0,0),S&&(D.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function jr(B,b,S){return 32*((1<<B)*S+b)+B}function Xr(B,b){const S=B.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const D=this._geoJSONIndex.getTile(S.z,S.x,S.y);if(!D)return b(null,null);const L=new kt(D.features);let Z=ui.exports(L);Z.byteOffset===0&&Z.byteLength===Z.buffer.byteLength||(Z=new Uint8Array(Z)),b(null,{vectorTile:L,rawData:Z.buffer})}tr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},tr.prototype.splitTile=function(B,b,S,D,L,Z,K){for(var W=[B,b,S,D],j=this.options,J=j.debug;W.length;){D=W.pop(),S=W.pop(),b=W.pop(),B=W.pop();var le=1<<b,xe=jr(b,S,D),ae=this.tiles[xe];if(!ae&&(J>1&&console.time("creation"),ae=this.tiles[xe]=gi(B,b,S,D,j),this.tileCoords.push({z:b,x:S,y:D}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,S,D,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd("creation"));var Oe="z"+b;this.stats[Oe]=(this.stats[Oe]||0)+1,this.total++}if(ae.source=B,L){if(b===j.maxZoom||b===L)continue;var $e=1<<L-b;if(S!==Math.floor(Z/$e)||D!==Math.floor(K/$e))continue}else if(b===j.indexMaxZoom||ae.numPoints<=j.indexMaxPoints)continue;if(ae.source=null,B.length!==0){J>1&&console.time("clipping");var De,Ze,We,mt,Ke,tt,gt=.5*j.buffer/j.extent,Ct=.5-gt,ei=.5+gt,Rt=1+gt;De=Ze=We=mt=null,Ke=Mi(B,le,S-gt,S+ei,0,ae.minX,ae.maxX,j),tt=Mi(B,le,S+Ct,S+Rt,0,ae.minX,ae.maxX,j),B=null,Ke&&(De=Mi(Ke,le,D-gt,D+ei,1,ae.minY,ae.maxY,j),Ze=Mi(Ke,le,D+Ct,D+Rt,1,ae.minY,ae.maxY,j),Ke=null),tt&&(We=Mi(tt,le,D-gt,D+ei,1,ae.minY,ae.maxY,j),mt=Mi(tt,le,D+Ct,D+Rt,1,ae.minY,ae.maxY,j),tt=null),J>1&&console.timeEnd("clipping"),W.push(De||[],b+1,2*S,2*D),W.push(Ze||[],b+1,2*S,2*D+1),W.push(We||[],b+1,2*S+1,2*D),W.push(mt||[],b+1,2*S+1,2*D+1)}}},tr.prototype.getTile=function(B,b,S){var D=this.options,L=D.extent,Z=D.debug;if(B<0||B>24)return null;var K=1<<B,W=jr(B,b=(b%K+K)%K,S);if(this.tiles[W])return yn(this.tiles[W],L);Z>1&&console.log("drilling down to z%d-%d-%d",B,b,S);for(var j,J=B,le=b,xe=S;!j&&J>0;)J--,le=Math.floor(le/2),xe=Math.floor(xe/2),j=this.tiles[jr(J,le,xe)];return j&&j.source?(Z>1&&console.log("found parent tile z%d-%d-%d",J,le,xe),Z>1&&console.time("drilling down"),this.splitTile(j.source,J,le,xe,B,b,S),Z>1&&console.timeEnd("drilling down"),this.tiles[W]?yn(this.tiles[W],L):null):null};class vn extends Xe{constructor(b,S,D,L){super(b,S,D,Xr),L&&(this.loadGeoJSON=L)}loadData(b,S){var D;(D=this._pendingRequest)===null||D===void 0||D.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const L=!!(b&&b.request&&b.request.collectResourceTiming)&&new a.RequestPerformance(b.request);this._pendingCallback=S,this._pendingRequest=this.loadGeoJSON(b,(Z,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,Z||!K)return S(Z);if(typeof K!="object")return S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{zt(K,!0);try{if(b.filter){const j=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(j.result==="error")throw new Error(j.value.map(le=>`${le.key}: ${le.message}`).join(", "));K={type:"FeatureCollection",features:K.features.filter(le=>j.value.evaluate({zoom:0},le))}}this._geoJSONIndex=b.cluster?new Vn(function({superclusterOptions:j,clusterProperties:J}){if(!J||!j)return j;const le={},xe={},ae={accumulated:null,zoom:0},Oe={properties:null},$e=Object.keys(J);for(const De of $e){const[Ze,We]=J[De],mt=a.createExpression(We),Ke=a.createExpression(typeof Ze=="string"?[Ze,["accumulated"],["get",De]]:Ze);le[De]=mt.value,xe[De]=Ke.value}return j.map=De=>{Oe.properties=De;const Ze={};for(const We of $e)Ze[We]=le[We].evaluate(ae,Oe);return Ze},j.reduce=(De,Ze)=>{Oe.properties=Ze;for(const We of $e)ae.accumulated=De[We],De[We]=xe[We].evaluate(ae,Oe)},j}(b)).load(K.features):function(j,J){return new tr(j,J)}(K,b.geojsonVtOptions)}catch(j){return S(j)}this.loaded={};const W={};if(L){const j=L.finish();j&&(W.resourceTiming={},W.resourceTiming[b.source]=JSON.parse(JSON.stringify(j)))}S(null,W)}})}reloadTile(b,S){const D=this.loaded;return D&&D[b.uid]?super.reloadTile(b,S):this.loadTile(b,S)}loadGeoJSON(b,S){if(b.request)return a.getJSON(b.request,S);if(typeof b.data=="string")try{S(null,JSON.parse(b.data))}catch(D){S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,S){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),S()}getClusterExpansionZoom(b,S){try{S(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(D){S(D)}}getClusterChildren(b,S){try{S(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(D){S(D)}}getClusterLeaves(b,S){try{S(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(D){S(D)}}}class Wr{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Xe,geojson:vn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(S,D)=>{if(this.workerSourceTypes[S])throw new Error(`Worker source with name "${S}" already registered.`);this.workerSourceTypes[S]=D},this.self.registerRTLTextPlugin=S=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=S.applyArabicShaping,a.plugin.processBidirectionalText=S.processBidirectionalText,a.plugin.processStyledBidirectionalText=S.processStyledBidirectionalText}}setReferrer(b,S){this.referrer=S}setImages(b,S,D){this.availableImages[b]=S;for(const L in this.workerSources[b]){const Z=this.workerSources[b][L];for(const K in Z)Z[K].availableImages=S}D()}setLayers(b,S,D){this.getLayerIndex(b).replace(S),D()}updateLayers(b,S,D){this.getLayerIndex(b).update(S.layers,S.removedIds),D()}loadTile(b,S,D){this.getWorkerSource(b,S.type,S.source).loadTile(S,D)}loadDEMTile(b,S,D){this.getDEMWorkerSource(b,S.source).loadTile(S,D)}reloadTile(b,S,D){this.getWorkerSource(b,S.type,S.source).reloadTile(S,D)}abortTile(b,S,D){this.getWorkerSource(b,S.type,S.source).abortTile(S,D)}removeTile(b,S,D){this.getWorkerSource(b,S.type,S.source).removeTile(S,D)}removeDEMTile(b,S){this.getDEMWorkerSource(b,S.source).removeTile(S)}removeSource(b,S,D){if(!this.workerSources[b]||!this.workerSources[b][S.type]||!this.workerSources[b][S.type][S.source])return;const L=this.workerSources[b][S.type][S.source];delete this.workerSources[b][S.type][S.source],L.removeSource!==void 0?L.removeSource(S,D):D()}loadWorkerSource(b,S,D){try{this.self.importScripts(S.url),D()}catch(L){D(L.toString())}}syncRTLPluginState(b,S,D){try{a.plugin.setState(S);const L=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&L!=null){this.self.importScripts(L);const Z=a.plugin.isParsed();D(Z?void 0:new Error(`RTL Text Plugin failed to import scripts from ${L}`),Z)}}catch(L){D(L.toString())}}getAvailableImages(b){let S=this.availableImages[b];return S||(S=[]),S}getLayerIndex(b){let S=this.layerIndexes[b];return S||(S=this.layerIndexes[b]=new Ee),S}getWorkerSource(b,S,D){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][S]||(this.workerSources[b][S]={}),!this.workerSources[b][S][D]){const L={send:(Z,K,W)=>{this.actor.send(Z,K,W,b)}};this.workerSources[b][S][D]=new this.workerSourceTypes[S](L,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][S][D]}getDEMWorkerSource(b,S){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][S]||(this.demWorkerSources[b][S]=new ot),this.demWorkerSources[b][S]}enforceCacheSizeLimit(b,S){a.enforceCacheSizeLimit(S)}}return a.isWorker()&&(self.worker=new Wr(self)),Wr}),X(["./shared"],function(a){var ye=pe;function pe(l){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,d=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(d);try{u=new Worker(f),s=!0}catch(_){s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var d=u.getImageData(0,0,1,1);return d&&d.width===s.width}()?(Ee[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Ee[n]=function(s){var u,d=function(f){var _=document.createElement("canvas"),y=Object.create(pe.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!d)return!1;try{u=d.createShader(d.VERTEX_SHADER)}catch(f){return!1}return!(!u||d.isContextLost())&&(d.shaderSource(u,"void main() {}"),d.compileShader(u),d.getShaderParameter(u,d.COMPILE_STATUS)===!0)}(n)),Ee[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(l)}var Ee={};function be(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!be(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!be(l[n],t[n]))return!1;return!0}return l===t}pe.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class ne{static testProp(t){if(!ne.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ne.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ne.docStyle&&ne.selectProp&&(ne.userSelect=ne.docStyle[ne.selectProp],ne.docStyle[ne.selectProp]="none")}static enableDrag(){ne.docStyle&&ne.selectProp&&(ne.docStyle[ne.selectProp]=ne.userSelect)}static setTransform(t,n){t.style[ne.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ne.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ne.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ne.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let d=0;d<n.length;d++)u.push(new a.pointGeometry(n[d].clientX-s.left-t.clientLeft,n[d].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ne.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ne.selectProp=ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ne.transformProp=ne.testProp(["transform","WebkitTransform"]);class ht{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(d){const f=d.match(nt);if(!f)throw new Error(`Unable to parse URL "${d}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(d){const f=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const nt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Xe{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:d}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===d||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,u,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:d}=u;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function ot(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class zt extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new a.Event("styleimagemissing",{id:u}));const d=this.images[u];d?s[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,hasRenderCallback:Boolean(d.userImage&&d.userImage.render)}:a.warnOnce(`Image "${u}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},d=new a.ImagePosition(u,s);this.patterns[t]={bin:u,position:d}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Xe(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const d in this.patterns)t.push(this.patterns[d].bin);const{w:n,h:s}=a.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const d in this.patterns){const{bin:f}=this.patterns[d],_=f.x+1,y=f.y+1,v=this.images[d].data,T=v.width,I=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:T,height:I}),a.RGBAImage.copy(v,u,{x:0,y:I-1},{x:_,y:y-1},{width:T,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+I},{width:T,height:1}),a.RGBAImage.copy(v,u,{x:T-1,y:0},{x:_-1,y},{width:1,height:I}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+T,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||a.warnOnce(`Image with ID: "${n}" was not found`),ot(s)&&this.updateImage(n,s)}}}const at=1e20;function yt(l,t,n,s,u,d,f,_,y){for(let v=t;v<t+s;v++)Nt(l,n*d+v,d,u,f,_,y);for(let v=n;v<n+u;v++)Nt(l,v*d+t,1,s,f,_,y)}function Nt(l,t,n,s,u,d,f){d[0]=0,f[0]=-at,f[1]=at,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const T=_*_;do{const I=d[y];v=(u[_]-u[I]+T-I*I)/(_-I)/2}while(v<=f[y]&&--y>-1);y++,d[y]=_,f[y]=v,f[y+1]=at}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=d[y],T=_-v;l[t+_*n]=u[v]+T*T}}class Et{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const d of t[u])s.push({stack:u,id:d});a.asyncAll(s,({stack:u,id:d},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:u,id:d,glyph:y});if(y=this._tinySDF(_,u,d),y)return _.glyphs[d]=y,void f(null,{stack:u,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:d,glyph:y});let T=_.requests[v];T||(T=_.requests[v]=[],Et.loadGlyphRange(u,v,this.url,this.requestManager,(I,M)=>{if(M){for(const U in M)this._doesCharSupportLocalGlyph(+U)||(_.glyphs[+U]=M[+U]);_.ranges[v]=!0}for(const U of T)U(I,M);delete _.requests[v]})),T.push((I,M)=>{I?f(I):M&&f(null,{stack:u,id:d,glyph:M[d]||null})})},(u,d)=>{if(u)n(u);else if(d){const f={};for(const{stack:_,id:y,glyph:v}of d)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let d=t.tinySDF;if(!d){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),d=t.tinySDF=new Et.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=d.draw(String.fromCharCode(s));return{id:s,bitmap:new a.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}Et.loadGlyphRange=function(l,t,n,s,u){const d=256*t,f=d+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${d}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const T={};for(const I of a.parseGlyphPbf(v))T[I.id]=I;u(null,T)}})},Et.TinySDF=class{constructor({fontSize:l=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:d="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${d} ${l}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:d}=this.ctx.measureText(l),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(d-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,T=y+2*this.buffer,I=Math.max(v*T,0),M=new Uint8ClampedArray(I),U={data:M,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return U;const{ctx:F,buffer:O,gridInner:H,gridOuter:Y}=this;F.clearRect(O,O,_,y),F.fillText(l,O,O+f);const te=F.getImageData(O,O,_,y);Y.fill(at,0,I),H.fill(0,0,I);for(let $=0;$<y;$++)for(let oe=0;oe<_;oe++){const ie=te.data[4*($*_+oe)+3]/255;if(ie===0)continue;const ue=($+O)*v+oe+O;if(ie===1)Y[ue]=0,H[ue]=at;else{const he=.5-ie;Y[ue]=he>0?he*he:0,H[ue]=he<0?he*he:0}}yt(Y,0,0,v,T,v,this.f,this.v,this.z),yt(H,O,O,_,y,v,this.f,this.v,this.z);for(let $=0;$<I;$++){const oe=Math.sqrt(Y[$])-Math.sqrt(H[$]);M[$]=Math.round(255-255*(oe/this.radius+this.cutoff))}return U}};const kt=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),ui="-transition";class si extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(kt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(ui)?this._transitionable.setTransition(s.slice(0,-ui.length),u):this._transitionable.setValue(s,u)}}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,n,s){return(!s||s.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class wo{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let d=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:d,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const T=t[v];d=y*s,y+=T,f=y*s,u.push({left:d,right:f,isDash:_,zeroLength:T===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let d=-s;d<=s;d++){const f=this.width*(this.nextRow+s+d);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const T=Math.abs(v-y.left),I=Math.abs(v-y.right),M=Math.min(T,I);let U;const F=d/s*(u+1);if(y.isDash){const O=u-Math.abs(F);U=Math.sqrt(M*M+O*O)}else U=u-Math.sqrt(M*M+F*F);this.data[f+v]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let d=0,f=t[d];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++d]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),T=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?T:-T)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.warnOnce("LineAtlas out of space"),null;let d=0;for(let _=0;_<t.length;_++)d+=t[_];if(d!==0){const _=this.width/d,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:d};return this.nextRow+=u,this.dirty=!0,f}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class lr{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const d=new lr.Actor(s[u],n,this.id);d.name=`Worker ${u}`,this.actors.push(d)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){a.asyncAll(this.actors,(u,d)=>{u.send(t,n,d)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Gr(l,t,n){const s=function(u,d){if(u)return n(u);if(d){const f=a.pick(a.extend(d,l),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(f.vectorLayers=d.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}lr.Actor=a.Actor;class cr{constructor(t,n,s){this.bounds=a.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(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]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<d&&t.y>=u&&t.y<f}}class un extends a.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,a.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function d(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Er extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Gr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new cr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),(u,d,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(d){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Xe(_,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Sr;class He extends Er{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(d,f){d&&(t.state="errored",n(d)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),function(d,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=a.isImageBitmap(f)&&(Sr==null&&(Sr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Sr)?f:a.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,d=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class ur extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=a.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,d)=>{if(this._pendingLoads--,this._removed||d&&d.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f=d.resourceTiming[this.id].slice(0)),u)return void this.fire(new a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,u,(d,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var hr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class qi extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const M of u)d=Math.min(d,M.x),f=Math.min(f,M.y),_=Math.max(_,M.x),y=Math.max(y,M.y);const v=Math.max(_-d,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),I=Math.pow(2,T);return new a.CanonicalTileID(T,Math.floor((d+_)/2*I),Math.floor((f+y)/2*I))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Xe(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Zi extends qi{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Xe(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class qr extends qi{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,hr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Xe(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const d=this.tiles[u];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const hn={vector:un,raster:Er,"raster-dem":He,geojson:ur,video:Zi,image:qi,canvas:qr};function dn(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function pn(l,t,n,s,u,d){const f=function(I,M,U){if(I)for(const F of I){const O=M[F];if(O&&O.source===U&&O.type==="fill-extrusion")return!0}else for(const F in M){const O=M[F];if(O.source===U&&O.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=d.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(Qi);const v=[];for(const I of y)v.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,n,l._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,u,d,_,dn(l.transform,I.tileID))});const T=function(I){const M={},U={};for(const F of I){const O=F.queryResults,H=F.wrappedTileID,Y=U[H]=U[H]||{};for(const te in O){const $=O[te],oe=Y[te]=Y[te]||{},ie=M[te]=M[te]||[];for(const ue of $)oe[ue.featureIndex]||(oe[ue.featureIndex]=!0,ie.push(ue))}}return M}(v);for(const I in T)T[I].forEach(M=>{const U=M.feature,F=l.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=F});return T}function Qi(l,t){const n=l.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Ir{constructor(t,n){this.tileID=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&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=function(u,d){const f={};if(!d)return f;for(const _ of u){const y=_.layerIds.map(v=>d.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const d=this.buckets[u];if(d instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const d=this.buckets[u];if(d instanceof a.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const d=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Xe(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Xe(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,d,f,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:d,scale:f,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),d=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[d];if(!f)return;const _=a.createFilter(n&&n.filter),{z:y,x:v,y:T}=this.tileID.canonical,I={z:y,x:v,y:T};for(let M=0;M<f.length;M++){const U=f.feature(M);if(_.needGeometry){const H=a.toEvaluationFeature(U,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),U))continue;const F=s.getId(U,d),O=new a.GeoJSONFeature(U,y,v,T,F);O.tile=I,t.push(O)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=a.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const d=this.expirationTime-n;d?this.expirationTime=s+Math.max(d,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const d=this.buckets[u],f=d.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;d.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const d of n)if(u[d])return!0}}return!1}}class Cr{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const d={value:n,timeout:void 0};if(s!==void 0&&(d.timeout=setTimeout(()=>{this.remove(t,d)},s)),this.data[u].push(d),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}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 n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),d=this.data[s][u];return this.data[s].splice(u,1),d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(d.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Ar{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},a.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==u&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const d in this.state[t][u])s[d]||(this.deletedStates[t][u][d]=null)}else for(const d in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][d]===null&&delete this.deletedStates[t][u][d]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=a.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const f in d)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const d={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),a.extend(this.state[u][f],this.stateChanges[u][f]),d[f]=this.state[u][f];s[u]=d}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const d={};if(this.deletedStates[u]===null)for(const f in this.state[u])d[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];d[f]=this.state[u][f]}s[u]=s[u]||{},a.extend(s[u],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class vi extends a.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,d,f,_){const y=new hn[d.type](u,d,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Cr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ar}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")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,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new a.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}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 n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(fn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const d=s.tileID,f=u.tileID,_=new a.pointGeometry(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new a.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(fn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}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,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const d=n[u];if(t.neighboringTiles&&t.neighboringTiles[d]){const f=this.getTileByID(d);s(t,f),s(f,t)}}function s(u,d){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=d.tileID.canonical.x-u.tileID.canonical.x;const _=d.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=d.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),d.dem&&u.dem&&(u.dem.backfillBorder(d.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const d in this._tiles){let f=this._tiles[d];if(u[d]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),d=this._getLoadedTile(u);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const d=this._tiles[u];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),s[d.tileID.key]=d}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new a.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),d=Math.max(u-vi.maxOverzooming,this._source.minzoom),f=Math.max(u+vi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const T of s)if(T.canonical.z>this._source.minzoom){const I=T.scaledTo(T.canonical.z-1);v[I.key]=I;const M=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));v[M.key]=M}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if($n(this._source.type)){const v={},T={},I=Object.keys(_);for(const M of I){const U=_[M],F=this._tiles[M];if(!F||F.fadeEndTime&&F.fadeEndTime<=a.exported.now())continue;const O=this.findLoadedParent(U,d);O&&(this._addTile(O.tileID),v[O.tileID.key]=O.tileID),T[M]=U}this._retainLoadedChildren(T,u,f,_);for(const M in v)_[M]||(this._coveredTiles[M]=!0,_[M]=v[M]);if(n){const M={},U={};for(const F of s)this._tiles[F.key].hasData()?M[F.key]=F:U[F.key]=F;for(const F in U){const O=U[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(M[O[0].key]=_[O[0].key]=O[0],M[O[1].key]=_[O[1].key]=O[1],M[O[2].key]=_[O[2].key]=O[2],M[O[3].key]=_[O[3].key]=O[3],delete U[F])}for(const F in U){const O=this.findLoadedParent(U[F],this._source.minzoom);if(O){M[O.tileID.key]=_[O.tileID.key]=O.tileID;for(const H in M)M[H].isChildOf(O.tileID)&&delete M[H]}}for(const F in this._tiles)M[F]||(this._coveredTiles[F]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const T=this._tiles[v];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},d=Math.max(n-vi.maxOverzooming,this._source.minzoom),f=Math.max(n+vi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const I=y.children(this._source.maxzoom)[0],M=this.getTile(I);if(M&&M.hasData()){s[I.key]=I;continue}}else{const I=y.children(this._source.maxzoom);if(s[I[0].key]&&s[I[1].key]&&s[I[2].key]&&s[I[3].key])continue}let T=v.wasRequested();for(let I=y.overscaledZ-1;I>=d;--I){const M=y.scaledTo(I);if(u[M.key]||(u[M.key]=!0,v=this.getTile(M),!v&&T&&(v=this._addTile(M)),v&&(s[M.key]=M,T=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const d=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(d),s)break;u=d}for(const d of n)this._loadedParentTiles[d]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Ir(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],d=this.transform;if(!d)return u;const f=s?d.getCameraQueryGeometry(t):t,_=t.map(F=>d.pointCoordinate(F,this.terrain)),y=f.map(F=>d.pointCoordinate(F,this.terrain)),v=this.getIds();let T=1/0,I=1/0,M=-1/0,U=-1/0;for(const F of y)T=Math.min(T,F.x),I=Math.min(I,F.y),M=Math.max(M,F.x),U=Math.max(U,F.y);for(let F=0;F<v.length;F++){const O=this._tiles[v[F]];if(O.holdingForFade())continue;const H=O.tileID,Y=Math.pow(2,d.zoom-O.tileID.overscaledZ),te=n*O.queryPadding*a.EXTENT/O.tileSize/Y,$=[H.getTilePoint(new a.MercatorCoordinate(T,I)),H.getTilePoint(new a.MercatorCoordinate(M,U))];if($[0].x-te<a.EXTENT&&$[0].y-te<a.EXTENT&&$[1].x+te>=0&&$[1].y+te>=0){const oe=_.map(ue=>H.getTilePoint(ue)),ie=y.map(ue=>H.getTilePoint(ue));u.push({tile:O,tileID:H,queryGeometry:oe,cameraQueryGeometry:ie,scale:Y})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if($n(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function fn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function $n(l){return l==="raster"||l==="image"||l==="video"}vi.maxOverzooming=10,vi.maxUnderzooming=3;const dr="mapboxgl_preloaded_worker_pool";class Ci{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ci.workerCount;)this.workers.push(new Worker(Qr.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[dr]}numActive(){return Object.keys(this.active).length}}const Vn=Math.floor(a.exported.hardwareConcurrency/2);let Mr;function mn(){return Mr||(Mr=new Ci),Mr}function gn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Nn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=gn(l[n],t[l[n].ref]));return l}Ci.workerCount=Math.max(Math.min(Vn,6),1);const pt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function er(l,t,n){n.push({command:pt.addSource,args:[l,t[l]]})}function zr(l,t,n){t.push({command:pt.removeSource,args:[l]}),n[l]=!0}function Pr(l,t,n,s){zr(l,n,s),er(l,t,n)}function Gn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!be(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!be(l[n][s],t[n][s]))return!1;return!0}function pr(l,t,n,s,u,d){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(be(l[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(l,f)&&(be(l[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}))}function fr(l){return l.id}function _n(l,t){return l[t.id]=t,l}class mr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=a.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const d=n-1,f=this._distances[d],_=s-f,y=_>0?(u-f)/_:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function de(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Ae{constructor(t,n,s){const u=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),d.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,d){this._forEachCell(n,s,u,d,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(d)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,d,f){this.boxCells[d].push(f)}_insertCircleCell(t,n,s,u,d,f){this.circleCells[d].push(f)}_query(t,n,s,u,d,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(d)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],I=this.circles[3*v+1],M=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-M,y1:I-M,x2:T+M,y2:I+M})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:d,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,d,f){return this._query(t,n,s,u,!0,d,f).length>0}hitTestCircle(t,n,s,u,d){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},d),T.length>0}_queryCell(t,n,s,u,d,f,_,y){const{seenUids:v,hitTest:T,overlapMode:I}=_,M=this.boxCells[d];if(M!==null){const F=this.bboxes;for(const O of M)if(!v.box[O]){v.box[O]=!0;const H=4*O,Y=this.boxKeys[O];if(t<=F[H+2]&&n<=F[H+3]&&s>=F[H+0]&&u>=F[H+1]&&(!y||y(Y))&&(!T||!de(I,Y.overlapMode))&&(f.push({key:Y,x1:F[H],y1:F[H+1],x2:F[H+2],y2:F[H+3]}),T))return!0}}const U=this.circleCells[d];if(U!==null){const F=this.circles;for(const O of U)if(!v.circle[O]){v.circle[O]=!0;const H=3*O,Y=this.circleKeys[O];if(this._circleAndRectCollide(F[H],F[H+1],F[H+2],t,n,s,u)&&(!y||y(Y))&&(!T||!de(I,Y.overlapMode))){const te=F[H],$=F[H+1],oe=F[H+2];if(f.push({key:Y,x1:te-oe,y1:$-oe,x2:te+oe,y2:$+oe}),T)return!0}}}return!1}_queryCellCircle(t,n,s,u,d,f,_,y){const{circle:v,seenUids:T,overlapMode:I}=_,M=this.boxCells[d];if(M!==null){const F=this.bboxes;for(const O of M)if(!T.box[O]){T.box[O]=!0;const H=4*O,Y=this.boxKeys[O];if(this._circleAndRectCollide(v.x,v.y,v.radius,F[H+0],F[H+1],F[H+2],F[H+3])&&(!y||y(Y))&&!de(I,Y.overlapMode))return f.push(!0),!0}}const U=this.circleCells[d];if(U!==null){const F=this.circles;for(const O of U)if(!T.circle[O]){T.circle[O]=!0;const H=3*O,Y=this.circleKeys[O];if(this._circlesCollide(F[H],F[H+1],F[H+2],v.x,v.y,v.radius)&&(!y||y(Y))&&!de(I,Y.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,d,f,_,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),M=this._convertToYCellCoord(u);for(let U=v;U<=I;U++)for(let F=T;F<=M;F++)if(d.call(this,t,n,s,u,this.xCellCount*F+U,f,_,y))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,n,s,u,d,f){const _=u-t,y=d-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,d,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const T=(_-d)/2,I=Math.abs(n-(d+T));if(I>T+s)return!1;if(v<=y||I<=T)return!0;const M=v-y,U=I-T;return M*M+U*U<=s*s}}function Zr(l,t,n,s,u){const d=a.create();return t?(a.scale(d,d,[1/u,1/u,1]),n||a.rotateZ(d,d,s.angle)):a.multiply(d,s.labelPlaneMatrix,l),d}function ji(l,t,n,s,u){if(t){const d=a.clone(l);return a.scale(d,d,[u,u,1]),n||a.rotateZ(d,d,-s.angle),d}return s.glCoordMatrix}function ft(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],gr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ui(l,t){return .5+l/t*.5}function Ai(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Mi(l,t,n,s,u,d,f,_,y,v){const T=s?l.textSizeData:l.iconSizeData,I=a.evaluateSizeForZoom(T,n.transform.zoom),M=[256/n.width*2+1,256/n.height*2+1],U=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;U.clear();const F=l.lineVertexArray,O=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Y=!1;for(let te=0;te<O.length;te++){const $=O.get(te);if($.hidden||$.writingMode===a.WritingMode.vertical&&!Y){Je($.numGlyphs,U);continue}let oe;if(Y=!1,v?(oe=[$.anchorX,$.anchorY,v($.anchorX,$.anchorY),1],a.transformMat4(oe,oe,t)):(oe=[$.anchorX,$.anchorY,0,1],gr(oe,oe,t)),!Ai(oe,M)){Je($.numGlyphs,U);continue}const ie=Ui(n.transform.cameraToCenterDistance,oe[3]),ue=a.evaluateSizeForFeature(T,I,$),he=f?ue/ie:ue*ie,ve=new a.pointGeometry($.anchorX,$.anchorY),ce=ft(ve,u,v).point,Le={},Ie=et($,he,!1,_,t,u,d,l.glyphOffsetArray,F,U,ce,ve,Le,H,y,v);Y=Ie.useVertical,(Ie.notEnoughRoom||Y||Ie.needsFlipping&&et($,he,!0,_,t,u,d,l.glyphOffsetArray,F,U,ce,ve,Le,H,y,v).notEnoughRoom)&&Je($.numGlyphs,U)}s?l.text.dynamicLayoutVertexBuffer.updateData(U):l.icon.dynamicLayoutVertexBuffer.updateData(U)}function kr(l,t,n,s,u,d,f,_,y,v,T,I,M){const U=_.glyphStartIndex+_.numGlyphs,F=_.lineStartIndex,O=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Y=t.getoffsetX(U-1),te=ai(l*H,n,s,u,d,f,_.segment,F,O,y,v,T,I,M);if(!te)return null;const $=ai(l*Y,n,s,u,d,f,_.segment,F,O,y,v,T,I,M);return $?{first:te,last:$}:null}function Se(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function et(l,t,n,s,u,d,f,_,y,v,T,I,M,U,F,O){const H=t/24,Y=l.lineOffsetX*H,te=l.lineOffsetY*H;let $;if(l.numGlyphs>1){const oe=l.glyphStartIndex+l.numGlyphs,ie=l.lineStartIndex,ue=l.lineStartIndex+l.lineLength,he=kr(H,_,Y,te,n,T,I,l,y,d,M,F,O);if(!he)return{notEnoughRoom:!0};const ve=ft(he.first.point,f,O).point,ce=ft(he.last.point,f,O).point;if(s&&!n){const Le=Se(l.writingMode,ve,ce,U);if(Le)return Le}$=[he.first];for(let Le=l.glyphStartIndex+1;Le<oe-1;Le++)$.push(ai(H*_.getoffsetX(Le),Y,te,n,T,I,l.segment,ie,ue,y,d,M,F,O));$.push(he.last)}else{if(s&&!n){const ie=ft(I,u,O).point,ue=l.lineStartIndex+l.segment+1,he=new a.pointGeometry(y.getx(ue),y.gety(ue)),ve=ft(he,u,O),ce=ve.signedDistanceFromCamera>0?ve.point:Ye(I,he,ie,1,u,O),Le=Se(l.writingMode,ie,ce,U);if(Le)return Le}const oe=ai(H*_.getoffsetX(l.glyphStartIndex),Y,te,n,T,I,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,d,M,F,O);if(!oe)return{notEnoughRoom:!0};$=[oe]}for(const oe of $)a.addDynamicAttributes(v,oe.point,oe.angle);return{}}function Ye(l,t,n,s,u,d){const f=ft(l.add(l.sub(t)._unit()),u,d).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function ai(l,t,n,s,u,d,f,_,y,v,T,I,M,U){const F=s?l-t:l+t;let O=F>0?1:-1,H=0;s&&(O*=-1,H=Math.PI),O<0&&(H+=Math.PI);let Y=O>0?_+f:_+f+1,te=u,$=u,oe=0,ie=0;const ue=Math.abs(F),he=[];for(;oe+ie<=ue;){if(Y+=O,Y<_||Y>=y)return null;if($=te,he.push(te),te=I[Y],te===void 0){const Re=new a.pointGeometry(v.getx(Y),v.gety(Y)),Qe=ft(Re,T,U);if(Qe.signedDistanceFromCamera>0)te=I[Y]=Qe.point;else{const it=Y-O;te=Ye(oe===0?d:new a.pointGeometry(v.getx(it),v.gety(it)),Re,$,ue-oe+1,T,U)}}oe+=ie,ie=$.dist(te)}const ve=(ue-oe)/ie,ce=te.sub($),Le=ce.mult(ve)._add($);Le._add(ce._unit()._perp()._mult(n*O));const Ie=H+Math.atan2(te.y-$.y,te.x-$.x);return he.push(Le),{point:Le,angle:M?Ie:0,path:he}}const Dr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Dr,3*s)}}function gr(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const Qt=100;class yn{constructor(t,n=new Ae(t.width+200,t.height+200,25),s=new Ae(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Qt,this.screenBottomBoundary=t.height+Qt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,d,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,T=t.y1*y+_.point.y,I=t.x2*y+_.point.x,M=t.y2*y+_.point.y;return!this.isInsideGrid(v,T,I,M)||n!=="always"&&this.grid.hitTest(v,T,I,M,n,d)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,T,I,M],offscreen:this.isOffscreen(v,T,I,M)}}placeCollisionCircles(t,n,s,u,d,f,_,y,v,T,I,M,U,F){const O=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Y=ft(H,f,F),te=Ui(this.transform.cameraToCenterDistance,Y.signedDistanceFromCamera),$=(T?d/te:d*te)/a.ONE_EM,oe=ft(H,_,F).point,ie=kr($,u,n.lineOffsetX*$,n.lineOffsetY*$,!1,oe,H,n,s,_,{},!1,F);let ue=!1,he=!1,ve=!0;if(ie){const ce=.5*M*te+U,Le=new a.pointGeometry(-100,-100),Ie=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Re=new mr,Qe=ie.first,it=ie.last;let Ge=[];for(let dt=Qe.path.length-1;dt>=1;dt--)Ge.push(Qe.path[dt]);for(let dt=1;dt<it.path.length;dt++)Ge.push(it.path[dt]);const wt=2.5*ce;if(y){const dt=Ge.map(_t=>ft(_t,y,F));Ge=dt.some(_t=>_t.signedDistanceFromCamera<=0)?[]:dt.map(_t=>_t.point)}let Tt=[];if(Ge.length>0){const dt=Ge[0].clone(),_t=Ge[0].clone();for(let It=1;It<Ge.length;It++)dt.x=Math.min(dt.x,Ge[It].x),dt.y=Math.min(dt.y,Ge[It].y),_t.x=Math.max(_t.x,Ge[It].x),_t.y=Math.max(_t.y,Ge[It].y);Tt=dt.x>=Le.x&&_t.x<=Ie.x&&dt.y>=Le.y&&_t.y<=Ie.y?[Ge]:_t.x<Le.x||dt.x>Ie.x||_t.y<Le.y||dt.y>Ie.y?[]:a.clipLine([Ge],Le.x,Le.y,Ie.x,Ie.y)}for(const dt of Tt){Re.reset(dt,.25*ce);let _t=0;_t=Re.length<=.5*ce?1:Math.ceil(Re.paddedLength/wt)+1;for(let It=0;It<_t;It++){const ti=It/Math.max(_t-1,1),nr=Re.lerp(ti),Wi=nr.x+Qt,or=nr.y+Qt;O.push(Wi,or,ce,0);const $r=Wi-ce,Vi=or-ce,wi=Wi+ce,xr=or+ce;if(ve=ve&&this.isOffscreen($r,Vi,wi,xr),he=he||this.isInsideGrid($r,Vi,wi,xr),t!=="always"&&this.grid.hitTestCircle(Wi,or,ce,t,I)&&(ue=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ue}}}}return{circles:!v&&ue||!he||te<this.perspectiveRatioCutoff?[]:O,offscreen:ve,collisionDetected:ue}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,d=-1/0,f=-1/0;for(const T of t){const I=new a.pointGeometry(T.x+Qt,T.y+Qt);s=Math.min(s,I.x),u=Math.min(u,I.y),d=Math.max(d,I.x),f=Math.max(f,I.y),n.push(I)}const _=this.grid.query(s,u,d,f).concat(this.ignoredGrid.query(s,u,d,f)),y={},v={};for(const T of _){const I=T.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const M=[new a.pointGeometry(T.x1,T.y1),new a.pointGeometry(T.x2,T.y1),new a.pointGeometry(T.x2,T.y2),new a.pointGeometry(T.x1,T.y2)];a.polygonIntersectsPolygon(n,M)&&(y[I.bucketInstanceId][I.featureIndex]=!0,v[I.bucketInstanceId]===void 0&&(v[I.bucketInstanceId]=[]),v[I.bucketInstanceId].push(I.featureIndex))}return v}insertCollisionBox(t,n,s,u,d,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,d,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let d;return u?(d=[n,s,u(n,s),1],a.transformMat4(d,d,t)):(d=[n,s,0,1],gr(d,d,t)),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Qt,(-d[1]/d[3]+1)/2*this.transform.height+Qt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,s,u){return s<Qt||t>=this.screenRightBoundary||u<Qt||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function jt(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class gi{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class St{constructor(t,n,s,u,d){this.text=new gi(t?t.text:null,n,s,d),this.icon=new gi(t?t.icon:null,n,u,d)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class xn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class tr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class jr{constructor(t,n,s,u,d){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=d}}class Xr{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function vn(l,t,n,s,u){const{horizontalAlign:d,verticalAlign:f}=a.getAnchorAlignment(l),_=-(d-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function Wr(l,t,n,s,u,d){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:T,anchorPointY:I}=l,M=new a.pointGeometry(t,n);return s&&M._rotate(u?d:-d),{x1:f+M.x,y1:y+M.y,x2:_+M.x,y2:v+M.y,anchorPointX:T,anchorPointY:I}}class B{constructor(t,n,s,u,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new yn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Xr(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const d=s.getBucket(n),f=s.latestFeatureIndex;if(!d||!f||n.id!==d.layerIds[0])return;const _=s.collisionBoxArray,y=d.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),T=s.tileSize/a.EXTENT,I=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),M=y.get("text-pitch-alignment")==="map",U=y.get("text-rotation-alignment")==="map",F=jt(s,1,this.transform.zoom),O=Zr(I,M,U,this.transform,F);let H=null;if(M){const te=ji(I,M,U,this.transform,F);H=a.multiply([],this.transform.labelPlaneMatrix,te)}this.retainedQueryData[d.bucketInstanceId]=new jr(d.bucketInstanceId,f,d.sourceLayerIndex,d.index,s.tileID);const Y={bucket:d,layout:y,posMatrix:I,textLabelPlaneMatrix:O,labelToScreenMatrix:H,scale:v,textPixelRatio:T,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(u)for(const te of d.sortKeyRanges){const{sortKey:$,symbolInstanceStart:oe,symbolInstanceEnd:ie}=te;t.push({sortKey:$,symbolInstanceStart:oe,symbolInstanceEnd:ie,parameters:Y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(t,n,s,u,d,f,_,y,v,T,I,M,U,F,O,H){const Y=[M.textOffset0,M.textOffset1],te=vn(t,s,u,Y,d),$=this.collisionIndex.placeCollisionBox(Wr(n,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,H);if((!O||this.collisionIndex.placeCollisionBox(Wr(O,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,H).box.length!==0)&&$.box.length>0){let oe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID].text&&(oe=this.prevPlacement.variableOffsets[M.crossTileID].anchor),M.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[M.crossTileID]={textOffset:Y,width:s,height:u,anchor:t,textBoxScale:d,prevAnchor:oe},this.markUsedJustification(U,t,M,F),U.allowVerticalPlacement&&(this.markUsedOrientation(U,F,M),this.placedOrientations[M.crossTileID]=F),{shift:te,placedGlyphBoxes:$}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:d,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:I,partiallyEvaluatedTextSize:M,collisionGroup:U}=t.parameters,F=d.get("text-optional"),O=d.get("icon-optional"),H=a.getOverlapMode(d,"text-overlap","text-allow-overlap"),Y=H==="always",te=a.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),$=te==="always",oe=d.get("text-rotation-alignment")==="map",ie=d.get("text-pitch-alignment")==="map",ue=d.get("icon-text-fit")!=="none",he=d.get("symbol-z-order")==="viewport-y",ve=Y&&($||!u.hasIconData()||O),ce=$&&(Y||!u.hasTextData()||F);!u.collisionArrays&&I&&u.deserializeCollisionBoxes(I);const Le=(Ie,Re)=>{if(n[Ie.crossTileID])return;if(T)return void(this.placements[Ie.crossTileID]=new xn(!1,!1,!1));let Qe=!1,it=!1,Ge=!0,wt=null,Tt={box:null,offscreen:null},dt={box:null,offscreen:null},_t=null,It=null,ti=null,nr=0,Wi=0,or=0;Re.textFeatureIndex?nr=Re.textFeatureIndex:Ie.useRuntimeCollisionCircles&&(nr=Ie.featureIndex),Re.verticalTextFeatureIndex&&(Wi=Re.verticalTextFeatureIndex);const $r=this.retainedQueryData[u.bucketInstanceId].tileID,Vi=this.terrain?(Kt,st)=>this.terrain.getElevation($r,Kt,st):null;for(const Kt of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const st=Re[Kt];st&&(st.elevation=Vi?Vi(st.anchorPointX,st.anchorPointY):0)}const wi=Re.textBox;if(wi){const Kt=bt=>{let ii=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!bt&&this.prevPlacement){const ri=this.prevPlacement.placedOrientations[Ie.crossTileID];ri&&(this.placedOrientations[Ie.crossTileID]=ri,ii=ri,this.markUsedOrientation(u,ii,Ie))}return ii},st=(bt,ii)=>{if(u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Re.verticalTextBox){for(const ri of u.writingModes)if(ri===a.WritingMode.vertical?(Tt=ii(),dt=Tt):Tt=bt(),Tt&&Tt.box&&Tt.box.length)break}else Tt=bt()};if(d.get("text-variable-anchor")){let bt=d.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ie.crossTileID]){const Ut=this.prevPlacement.variableOffsets[Ie.crossTileID];bt.indexOf(Ut.anchor)>0&&(bt=bt.filter(Ni=>Ni!==Ut.anchor),bt.unshift(Ut.anchor))}const ii=(Ut,Ni,en)=>{const Ls=Ut.x2-Ut.x1,Dn=Ut.y2-Ut.y1,Na=Ie.textBoxScale,Rs=ue&&te==="never"?Ni:null;let Vr={box:[],offscreen:!1};const tn=H!=="never"?2*bt.length:bt.length;for(let rn=0;rn<tn;++rn){const Go=this.attemptAnchorPlacement(bt[rn%bt.length],Ut,Ls,Dn,Na,oe,ie,v,f,U,rn>=bt.length?H:"never",Ie,u,en,Rs,Vi);if(Go&&(Vr=Go.placedGlyphBoxes,Vr&&Vr.box&&Vr.box.length)){Qe=!0,wt=Go.shift;break}}return Vr};st(()=>ii(wi,Re.iconBox,a.WritingMode.horizontal),()=>{const Ut=Re.verticalTextBox;return u.allowVerticalPlacement&&!(Tt&&Tt.box&&Tt.box.length)&&Ie.numVerticalGlyphVertices>0&&Ut?ii(Ut,Re.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Tt&&(Qe=Tt.box,Ge=Tt.offscreen);const ri=Kt(Tt&&Tt.box);if(!Qe&&this.prevPlacement){const Ut=this.prevPlacement.variableOffsets[Ie.crossTileID];Ut&&(this.variableOffsets[Ie.crossTileID]=Ut,this.markUsedJustification(u,Ut.anchor,Ie,ri))}}else{const bt=(ii,ri)=>{const Ut=this.collisionIndex.placeCollisionBox(ii,H,v,f,U.predicate,Vi);return Ut&&Ut.box&&Ut.box.length&&(this.markUsedOrientation(u,ri,Ie),this.placedOrientations[Ie.crossTileID]=ri),Ut};st(()=>bt(wi,a.WritingMode.horizontal),()=>{const ii=Re.verticalTextBox;return u.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&ii?bt(ii,a.WritingMode.vertical):{box:null,offscreen:null}}),Kt(Tt&&Tt.box&&Tt.box.length)}}if(_t=Tt,Qe=_t&&_t.box&&_t.box.length>0,Ge=_t&&_t.offscreen,Ie.useRuntimeCollisionCircles){const Kt=u.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),st=a.evaluateSizeForFeature(u.textSizeData,M,Kt),bt=d.get("text-padding");It=this.collisionIndex.placeCollisionCircles(H,Kt,u.lineVertexArray,u.glyphOffsetArray,st,f,_,y,s,ie,U.predicate,Ie.collisionCircleDiameter,bt,Vi),It.circles.length&&It.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),Qe=Y||It.circles.length>0&&!It.collisionDetected,Ge=Ge&&It.offscreen}if(Re.iconFeatureIndex&&(or=Re.iconFeatureIndex),Re.iconBox){const Kt=st=>{const bt=ue&&wt?Wr(st,wt.x,wt.y,oe,ie,this.transform.angle):st;return this.collisionIndex.placeCollisionBox(bt,te,v,f,U.predicate,Vi)};dt&&dt.box&&dt.box.length&&Re.verticalIconBox?(ti=Kt(Re.verticalIconBox),it=ti.box.length>0):(ti=Kt(Re.iconBox),it=ti.box.length>0),Ge=Ge&&ti.offscreen}const xr=F||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,No=O||Ie.numIconVertices===0;if(xr||No?No?xr||(it=it&&Qe):Qe=it&&Qe:it=Qe=it&&Qe,Qe&&_t&&_t.box&&this.collisionIndex.insertCollisionBox(_t.box,H,d.get("text-ignore-placement"),u.bucketInstanceId,dt&&dt.box&&Wi?Wi:nr,U.ID),it&&ti&&this.collisionIndex.insertCollisionBox(ti.box,te,d.get("icon-ignore-placement"),u.bucketInstanceId,or,U.ID),It&&(Qe&&this.collisionIndex.insertCollisionCircles(It.circles,H,d.get("text-ignore-placement"),u.bucketInstanceId,nr,U.ID),s)){const Kt=u.bucketInstanceId;let st=this.collisionCircleArrays[Kt];st===void 0&&(st=this.collisionCircleArrays[Kt]=new tr);for(let bt=0;bt<It.circles.length;bt+=4)st.circles.push(It.circles[bt+0]),st.circles.push(It.circles[bt+1]),st.circles.push(It.circles[bt+2]),st.circles.push(It.collisionDetected?1:0)}if(Ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ie.crossTileID]=new xn(Qe||ve,it||ce,Ge||u.justReloaded),n[Ie.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=u.getSortedSymbolIndexes(this.transform.angle);for(let Re=Ie.length-1;Re>=0;--Re){const Qe=Ie[Re];Le(u.symbolInstances.get(Qe),u.collisionArrays[Qe])}}else for(let Ie=t.symbolInstanceStart;Ie<t.symbolInstanceEnd;Ie++)Le(u.symbolInstances.get(Ie),u.collisionArrays[Ie]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ie=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ie.invProjMatrix,f),Ie.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let d;d=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=d>=0&&_!==d?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,d=n===a.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=d[y];T?(this.opacities[y]=new St(T,u,v.text,v.icon),s=s||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new St(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in d){const v=d[y];if(!this.opacities[y]){const T=new St(v,u,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const d=u.getBucket(t);d&&u.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){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 u=t.layers[0].layout,d=new St(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",T=u.get("text-pitch-alignment")==="map",I=u.get("icon-text-fit")!=="none",M=new St(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const U=(F,O,H)=>{for(let Y=0;Y<O/4;Y++)F.opacityVertexArray.emplaceBack(H)};for(let F=0;F<t.symbolInstances.length;F++){const O=t.symbolInstances.get(F),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Y,crossTileID:te}=O;let $=this.opacities[te];n[te]?$=d:$||($=M,this.opacities[te]=$),n[te]=!0;const oe=O.numIconVertices>0,ie=this.placedOrientations[O.crossTileID],ue=ie===a.WritingMode.vertical,he=ie===a.WritingMode.horizontal||ie===a.WritingMode.horizontalOnly;if(H>0||Y>0){const ve=J($.text);U(t.text,H,ue?le:ve),U(t.text,Y,he?le:ve);const ce=$.text.isHidden();[O.rightJustifiedTextSymbolIndex,O.centerJustifiedTextSymbolIndex,O.leftJustifiedTextSymbolIndex].forEach(Re=>{Re>=0&&(t.text.placedSymbolArray.get(Re).hidden=ce||ue?1:0)}),O.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(O.verticalPlacedTextSymbolIndex).hidden=ce||he?1:0);const Le=this.variableOffsets[O.crossTileID];Le&&this.markUsedJustification(t,Le.anchor,O,ie);const Ie=this.placedOrientations[O.crossTileID];Ie&&(this.markUsedJustification(t,"left",O,Ie),this.markUsedOrientation(t,Ie,O))}if(oe){const ve=J($.icon),ce=!(I&&O.verticalPlacedIconSymbolIndex&&ue);O.placedIconSymbolIndex>=0&&(U(t.icon,O.numIconVertices,ce?ve:le),t.icon.placedSymbolArray.get(O.placedIconSymbolIndex).hidden=$.icon.isHidden()),O.verticalPlacedIconSymbolIndex>=0&&(U(t.icon,O.numVerticalIconVertices,ce?le:ve),t.icon.placedSymbolArray.get(O.verticalPlacedIconSymbolIndex).hidden=$.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ve=t.collisionArrays[F];if(ve){let ce=new a.pointGeometry(0,0);if(ve.textBox||ve.verticalTextBox){let Ie=!0;if(y){const Re=this.variableOffsets[te];Re?(ce=vn(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),v&&ce._rotate(T?this.transform.angle:-this.transform.angle)):Ie=!1}ve.textBox&&b(t.textCollisionBox.collisionVertexArray,$.text.placed,!Ie||ue,ce.x,ce.y),ve.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,$.text.placed,!Ie||he,ce.x,ce.y)}const Le=Boolean(!he&&ve.verticalIconBox);ve.iconBox&&b(t.iconCollisionBox.collisionVertexArray,$.icon.placed,Le,I?ce.x:0,I?ce.y:0),ve.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,$.icon.placed,!Le,I?ce.x:0,I?ce.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const F=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=F.invProjMatrix,t.placementViewportMatrix=F.viewportMatrix,t.collisionCircleArray=F.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,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function b(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const S=Math.pow(2,25),D=Math.pow(2,24),L=Math.pow(2,17),Z=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),j=Math.pow(2,1);function J(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*S+t*D+n*L+t*Z+n*K+t*W+n*j+t}const le=0;class xe{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,u,d){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,d())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,d())return!0;return!1}}class ae{constructor(t,n,s,u,d,f,_,y){this.placement=new B(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=a.exported.now(),d=()=>{const f=a.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new xe(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Oe=512/a.EXTENT/2;class $e{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const d=n.get(u),f=d.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:d.crossTileID,coord:this.getScaledCoordinates(d,t)})}}getScaledCoordinates(t,n){const s=Oe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let d=0;d<t.length;d++){const f=t.get(d);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],d={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),d[_.tileID.key]=_}this.indexes[s]=d}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;d<n.symbolInstances.length;d++)n.symbolInstances.get(d).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const d in this.indexes){const f=this.indexes[d];if(Number(d)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(d)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let d=0;d<n.symbolInstances.length;d++){const f=n.symbolInstances.get(d);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $e(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const d in u)t[u[d].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[d]),delete u[d],n=!0)}return n}}class We{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ze);let d=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(d=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(d=!0),d}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var mt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ke extends a.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new Ir(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),a.ortho(d.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),n[s]=d}else if(u.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(d.posMatrix,0,v,0,v,0,1),a.translate(d.posMatrix,d.posMatrix,[-_*v,-y*v,0]),n[s]=d}else if(t.canonical.isChildOf(u.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=a.EXTENT>>f;a.ortho(d.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(d.posMatrix,d.posMatrix,[_*v,y*v,0]),a.scale(d.posMatrix,d.posMatrix,[1/2**f,1/2**f,0]),n[s]=d}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let d=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!d||!d.dem)&&n)for(;u>=s.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(u--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class tt{constructor(t,n,s){this.style=t,this.sourceCache=new Ke(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=a.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let d=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],T=f.tile.dem.get(v[0],v[1]),I=f.tile.dem.get(v[0],v[1]+1),M=f.tile.dem.get(v[0]+1,v[1]),U=f.tile.dem.get(v[0]+1,v[1]+1);d=a.number(a.number(T,I,y[0]-v[0]),a.number(M,U,y[0]-v[0]),y[1]-v[1])}return d}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=a.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,d=new a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Xe(u,d,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Xe(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Xe(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let d=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?d=t.canonical.z-u:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>d<<d),_=t.canonical.y-(t.canonical.y>>d<<d),y=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<d),1/(a.EXTENT<<d),0]);a.translate(y,y,[f*a.EXTENT,_*a.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Xe(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Xe(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let d=0,f=0;d<this._coordsTextureSize;d++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&d,n[f+2]=_>>8<<4|d>>8,n[f+3]=0;const s=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Xe(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,d=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const T=this._coordsTextureSize,I=(1<<v.tileID.canonical.z)*T;return new a.MercatorCoordinate((v.tileID.canonical.x*T+f)/I,(v.tileID.canonical.y*T+_)/I,this.getElevation(v.tileID,f,_,T))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,d=a.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*d,_*d);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,mt.members),segments:a.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const gt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Ct=a.pick(pt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),ei=a.pick(pt,["setCenter","setZoom","setBearing","setPitch"]),Rt=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class hi extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new lr(mn(),this),this.imageManager=new zt,this.imageManager.setEventedParent(this),this.glyphManager=new Et(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new wo(256,512),this.crossTileSymbolIndex=new We,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=hi.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(d,f)=>{if(a.triggerPluginCompletionEvent(d),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const f=d.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(d,f)=>{this._request=null,d?this.fire(new a.ErrorEvent(d)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Rt,!1)}_load(t,n){if(n&>(this,a.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Nn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new si(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,d){let f,_,y;const v=u>1?"@2x":"";let T=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(U,F)=>{T=null,y||(y=U,f=F,M())}),I=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(U,F)=>{I=null,y||(y=U,_=F,M())});function M(){if(y)d(y);else if(f&&_){const U=a.exported.getImageData(_),F={};for(const O in f){const{width:H,height:Y,x:te,y:$,sdf:oe,pixelRatio:ie,stretchX:ue,stretchY:he,content:ve}=f[O],ce=new a.RGBAImage({width:H,height:Y});a.RGBAImage.copy(U,ce,{x:te,y:$},{x:0,y:0},{width:H,height:Y}),F[O]={data:ce,pixelRatio:ie,sdf:oe,stretchX:ue,stretchY:he,content:ve}}d(null,F)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())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}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(u.length||d.length)&&this._updateWorkerLayers(u,d);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const d=this.sourceCaches[u];s[u]=d.used,d.used=!1}for(const u of this._order){const d=this._layers[u];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const u in s){const d=this.sourceCaches[u];s[u]!==d.used&&d.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new tt(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),gt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Nn(t.layers);const n=function(u,d){if(!u)return[{command:pt.setStyle,args:[d]}];let f=[];try{if(!be(u.version,d.version))return[{command:pt.setStyle,args:[d]}];be(u.center,d.center)||f.push({command:pt.setCenter,args:[d.center]}),be(u.zoom,d.zoom)||f.push({command:pt.setZoom,args:[d.zoom]}),be(u.bearing,d.bearing)||f.push({command:pt.setBearing,args:[d.bearing]}),be(u.pitch,d.pitch)||f.push({command:pt.setPitch,args:[d.pitch]}),be(u.sprite,d.sprite)||f.push({command:pt.setSprite,args:[d.sprite]}),be(u.glyphs,d.glyphs)||f.push({command:pt.setGlyphs,args:[d.glyphs]}),be(u.transition,d.transition)||f.push({command:pt.setTransition,args:[d.transition]}),be(u.light,d.light)||f.push({command:pt.setLight,args:[d.light]});const _={},y=[];(function(T,I,M,U){let F;for(F in I=I||{},T=T||{})Object.prototype.hasOwnProperty.call(T,F)&&(Object.prototype.hasOwnProperty.call(I,F)||zr(F,M,U));for(F in I)Object.prototype.hasOwnProperty.call(I,F)&&(Object.prototype.hasOwnProperty.call(T,F)?be(T[F],I[F])||(T[F].type==="geojson"&&I[F].type==="geojson"&&Gn(T,I,F)?M.push({command:pt.setGeoJSONSourceData,args:[F,I[F].data]}):Pr(F,I,M,U)):er(F,I,M))})(u.sources,d.sources,y,_);const v=[];u.layers&&u.layers.forEach(T=>{_[T.source]?f.push({command:pt.removeLayer,args:[T.id]}):v.push(T)}),f=f.concat(y),function(T,I,M){I=I||[];const U=(T=T||[]).map(fr),F=I.map(fr),O=T.reduce(_n,{}),H=I.reduce(_n,{}),Y=U.slice(),te=Object.create(null);let $,oe,ie,ue,he,ve,ce;for($=0,oe=0;$<U.length;$++)ie=U[$],Object.prototype.hasOwnProperty.call(H,ie)?oe++:(M.push({command:pt.removeLayer,args:[ie]}),Y.splice(Y.indexOf(ie,oe),1));for($=0,oe=0;$<F.length;$++)ie=F[F.length-1-$],Y[Y.length-1-$]!==ie&&(Object.prototype.hasOwnProperty.call(O,ie)?(M.push({command:pt.removeLayer,args:[ie]}),Y.splice(Y.lastIndexOf(ie,Y.length-oe),1)):oe++,ve=Y[Y.length-$],M.push({command:pt.addLayer,args:[H[ie],ve]}),Y.splice(Y.length-$,0,ie),te[ie]=!0);for($=0;$<F.length;$++)if(ie=F[$],ue=O[ie],he=H[ie],!te[ie]&&!be(ue,he))if(be(ue.source,he.source)&&be(ue["source-layer"],he["source-layer"])&&be(ue.type,he.type)){for(ce in pr(ue.layout,he.layout,M,ie,null,pt.setLayoutProperty),pr(ue.paint,he.paint,M,ie,null,pt.setPaintProperty),be(ue.filter,he.filter)||M.push({command:pt.setFilter,args:[ie,he.filter]}),be(ue.minzoom,he.minzoom)&&be(ue.maxzoom,he.maxzoom)||M.push({command:pt.setLayerZoomRange,args:[ie,he.minzoom,he.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?pr(ue[ce],he[ce],M,ie,ce.slice(6),pt.setPaintProperty):be(ue[ce],he[ce])||M.push({command:pt.setLayerProperty,args:[ie,ce,he[ce]]}));for(ce in he)Object.prototype.hasOwnProperty.call(he,ce)&&!Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?pr(ue[ce],he[ce],M,ie,ce.slice(6),pt.setPaintProperty):be(ue[ce],he[ce])||M.push({command:pt.setLayerProperty,args:[ie,ce,he[ce]]}))}else M.push({command:pt.removeLayer,args:[ie]}),ve=Y[Y.lastIndexOf(ie)+1],M.push({command:pt.addLayer,args:[he,ve]})}(v,d.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:pt.setStyle,args:[d]}]}return f}(this.serialize(),t).filter(u=>!(u.command in ei));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in Ct));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new a.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new a.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new vi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let d;if(t.type==="custom"){if(gt(this,a.validateCustomStyleLayer(t)))return;d=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;d=a.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[d.id]=d.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=d,this._removedLayers[u]&&d.source&&d.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!be(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?be(d.getLayoutProperty(n),s)||(d.setLayoutProperty(n,s,u),this._updateLayer(d)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?be(d.getPaintProperty(n),s)||(d.setPaintProperty(n,s,u)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,d=this.sourceCaches[s];if(d===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=d.getSource().type;f==="geojson"&&u?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(u,t.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const d=u.getSource().type,f=d==="vector"?t.sourceLayer:void 0;d!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const T of v)u.push(T)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const d=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;d.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const T of v)d.push(T.feature)}}return d}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const d=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||d.push(pn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&d.push(function(f,_,y,v,T,I,M){const U={},F=I.queryRenderedSymbols(v),O=[];for(const H of Object.keys(F).map(Number))O.push(M[H]);O.sort(Qi);for(const H of O){const Y=H.featureIndex.lookupSymbolFeatures(F[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,T.filter,T.layers,T.availableImages,f);for(const te in Y){const $=U[te]=U[te]||[],oe=Y[te];oe.sort((ie,ue)=>{const he=H.featureSortOrder;if(he){const ve=he.indexOf(ie.featureIndex);return he.indexOf(ue.featureIndex)-ve}return ue.featureIndex-ie.featureIndex});for(const ie of oe)$.push(ie)}}for(const H in U)U[H].forEach(Y=>{const te=Y.feature,$=y[f[H].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=$});return U}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,d){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const T=f[v],I=T.tileID.canonical.key;y[I]||(y[I]=!0,T.querySourceFeatures(_,d))}return _}(s,n):[]}addSourceType(t,n,s){return hi.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(hi.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!be(t[f],s[f])){u=!0;break}if(!u)return;const d={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,s,u,d={}){return(!d||d.validate!==!1)&>(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,d=!1){let f=!1,_=!1;const y={};for(const v of this._order){const T=this._layers[v];if(T.type!=="symbol")continue;if(!y[T.source]){const M=this.sourceCaches[T.source];y[T.source]=M.getRenderableIds(!0).map(U=>M.getTileByID(U)).sort((U,F)=>F.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(F.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);f=f||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new ae(t,this.terrain,this._order,d,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return a.makeRequest(n,s)}}hi.getSourceType=function(l){return hn[l]},hi.setSourceType=function(l,t){hn[l]=t},hi.registerForPluginStateChange=a.registerForPluginStateChange;var bn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const qn={prelude:At(`#ifdef GL_ES
|
|
11
|
+
precision mediump float;
|
|
12
|
+
#else
|
|
13
|
+
#if !defined(lowp)
|
|
14
|
+
#define lowp
|
|
15
|
+
#endif
|
|
16
|
+
#if !defined(mediump)
|
|
17
|
+
#define mediump
|
|
18
|
+
#endif
|
|
19
|
+
#if !defined(highp)
|
|
20
|
+
#define highp
|
|
21
|
+
#endif
|
|
22
|
+
#endif`,`#ifdef GL_ES
|
|
23
|
+
precision highp float;
|
|
24
|
+
#else
|
|
25
|
+
#if !defined(lowp)
|
|
26
|
+
#define lowp
|
|
27
|
+
#endif
|
|
28
|
+
#if !defined(mediump)
|
|
29
|
+
#define mediump
|
|
30
|
+
#endif
|
|
31
|
+
#if !defined(highp)
|
|
32
|
+
#define highp
|
|
33
|
+
#endif
|
|
34
|
+
#endif
|
|
35
|
+
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
36
|
+
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
|
37
|
+
#ifdef TERRAIN3D
|
|
38
|
+
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
39
|
+
#endif
|
|
40
|
+
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|
41
|
+
#ifdef TERRAIN3D
|
|
42
|
+
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
43
|
+
#else
|
|
44
|
+
return 1.0;
|
|
45
|
+
#endif
|
|
46
|
+
}float calculate_visibility(vec4 pos) {
|
|
47
|
+
#ifdef TERRAIN3D
|
|
48
|
+
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|
49
|
+
#else
|
|
50
|
+
return 1.0;
|
|
51
|
+
#endif
|
|
52
|
+
}float ele(vec2 pos) {
|
|
53
|
+
#ifdef TERRAIN3D
|
|
54
|
+
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
55
|
+
#else
|
|
56
|
+
return 0.0;
|
|
57
|
+
#endif
|
|
58
|
+
}float get_elevation(vec2 pos) {
|
|
59
|
+
#ifdef TERRAIN3D
|
|
60
|
+
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;
|
|
61
|
+
#else
|
|
62
|
+
return 0.0;
|
|
63
|
+
#endif
|
|
64
|
+
}`),background:At(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
65
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
66
|
+
gl_FragColor=vec4(1.0);
|
|
67
|
+
#endif
|
|
68
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:At(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
69
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
70
|
+
gl_FragColor=vec4(1.0);
|
|
71
|
+
#endif
|
|
72
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:At(`varying vec3 v_data;varying float v_visibility;
|
|
73
|
+
#pragma mapbox: define highp vec4 color
|
|
74
|
+
#pragma mapbox: define mediump float radius
|
|
75
|
+
#pragma mapbox: define lowp float blur
|
|
76
|
+
#pragma mapbox: define lowp float opacity
|
|
77
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
78
|
+
#pragma mapbox: define mediump float stroke_width
|
|
79
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
80
|
+
void main() {
|
|
81
|
+
#pragma mapbox: initialize highp vec4 color
|
|
82
|
+
#pragma mapbox: initialize mediump float radius
|
|
83
|
+
#pragma mapbox: initialize lowp float blur
|
|
84
|
+
#pragma mapbox: initialize lowp float opacity
|
|
85
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
86
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
87
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
88
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
89
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
90
|
+
gl_FragColor=vec4(1.0);
|
|
91
|
+
#endif
|
|
92
|
+
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
|
93
|
+
#pragma mapbox: define highp vec4 color
|
|
94
|
+
#pragma mapbox: define mediump float radius
|
|
95
|
+
#pragma mapbox: define lowp float blur
|
|
96
|
+
#pragma mapbox: define lowp float opacity
|
|
97
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
98
|
+
#pragma mapbox: define mediump float stroke_width
|
|
99
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
100
|
+
void main(void) {
|
|
101
|
+
#pragma mapbox: initialize highp vec4 color
|
|
102
|
+
#pragma mapbox: initialize mediump float radius
|
|
103
|
+
#pragma mapbox: initialize lowp float blur
|
|
104
|
+
#pragma mapbox: initialize lowp float opacity
|
|
105
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
106
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
107
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
108
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:At("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:At(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
109
|
+
#pragma mapbox: define highp float weight
|
|
110
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
111
|
+
void main() {
|
|
112
|
+
#pragma mapbox: initialize highp float weight
|
|
113
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|
114
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
115
|
+
gl_FragColor=vec4(1.0);
|
|
116
|
+
#endif
|
|
117
|
+
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|
118
|
+
#pragma mapbox: define highp float weight
|
|
119
|
+
#pragma mapbox: define mediump float radius
|
|
120
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
121
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
122
|
+
void main(void) {
|
|
123
|
+
#pragma mapbox: initialize highp float weight
|
|
124
|
+
#pragma mapbox: initialize mediump float radius
|
|
125
|
+
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:At(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
126
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
127
|
+
gl_FragColor=vec4(0.0);
|
|
128
|
+
#endif
|
|
129
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:At("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:At("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:At("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:At(`#pragma mapbox: define highp vec4 color
|
|
130
|
+
#pragma mapbox: define lowp float opacity
|
|
131
|
+
void main() {
|
|
132
|
+
#pragma mapbox: initialize highp vec4 color
|
|
133
|
+
#pragma mapbox: initialize lowp float opacity
|
|
134
|
+
gl_FragColor=color*opacity;
|
|
135
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
136
|
+
gl_FragColor=vec4(1.0);
|
|
137
|
+
#endif
|
|
138
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
139
|
+
#pragma mapbox: define highp vec4 color
|
|
140
|
+
#pragma mapbox: define lowp float opacity
|
|
141
|
+
void main() {
|
|
142
|
+
#pragma mapbox: initialize highp vec4 color
|
|
143
|
+
#pragma mapbox: initialize lowp float opacity
|
|
144
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:At(`varying vec2 v_pos;
|
|
145
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
146
|
+
#pragma mapbox: define lowp float opacity
|
|
147
|
+
void main() {
|
|
148
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
149
|
+
#pragma mapbox: initialize lowp float opacity
|
|
150
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
151
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
152
|
+
gl_FragColor=vec4(1.0);
|
|
153
|
+
#endif
|
|
154
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
155
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
156
|
+
#pragma mapbox: define lowp float opacity
|
|
157
|
+
void main() {
|
|
158
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
159
|
+
#pragma mapbox: initialize lowp float opacity
|
|
160
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:At(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
161
|
+
#pragma mapbox: define lowp float opacity
|
|
162
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
163
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
164
|
+
void main() {
|
|
165
|
+
#pragma mapbox: initialize lowp float opacity
|
|
166
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
167
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
168
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
169
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
170
|
+
gl_FragColor=vec4(1.0);
|
|
171
|
+
#endif
|
|
172
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
173
|
+
#pragma mapbox: define lowp float opacity
|
|
174
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
175
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
176
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
177
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
178
|
+
void main() {
|
|
179
|
+
#pragma mapbox: initialize lowp float opacity
|
|
180
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
181
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
182
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
183
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
184
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:At(`#ifdef GL_ES
|
|
185
|
+
precision highp float;
|
|
186
|
+
#endif
|
|
187
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
188
|
+
#pragma mapbox: define lowp float opacity
|
|
189
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
190
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
191
|
+
void main() {
|
|
192
|
+
#pragma mapbox: initialize lowp float opacity
|
|
193
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
194
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
195
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|
196
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
197
|
+
gl_FragColor=vec4(1.0);
|
|
198
|
+
#endif
|
|
199
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
200
|
+
#pragma mapbox: define lowp float opacity
|
|
201
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
202
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
203
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
204
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
205
|
+
void main() {
|
|
206
|
+
#pragma mapbox: initialize lowp float opacity
|
|
207
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
208
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
209
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
210
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
211
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:At(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
212
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
213
|
+
gl_FragColor=vec4(1.0);
|
|
214
|
+
#endif
|
|
215
|
+
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
216
|
+
#ifdef TERRAIN3D
|
|
217
|
+
attribute vec2 a_centroid;
|
|
218
|
+
#endif
|
|
219
|
+
varying vec4 v_color;
|
|
220
|
+
#pragma mapbox: define highp float base
|
|
221
|
+
#pragma mapbox: define highp float height
|
|
222
|
+
#pragma mapbox: define highp vec4 color
|
|
223
|
+
void main() {
|
|
224
|
+
#pragma mapbox: initialize highp float base
|
|
225
|
+
#pragma mapbox: initialize highp float height
|
|
226
|
+
#pragma mapbox: initialize highp vec4 color
|
|
227
|
+
vec3 normal=a_normal_ed.xyz;
|
|
228
|
+
#ifdef TERRAIN3D
|
|
229
|
+
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
230
|
+
#else
|
|
231
|
+
float baseDelta=0.0;float ele=0.0;
|
|
232
|
+
#endif
|
|
233
|
+
base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:At(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
234
|
+
#pragma mapbox: define lowp float base
|
|
235
|
+
#pragma mapbox: define lowp float height
|
|
236
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
237
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
238
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
239
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
240
|
+
void main() {
|
|
241
|
+
#pragma mapbox: initialize lowp float base
|
|
242
|
+
#pragma mapbox: initialize lowp float height
|
|
243
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
244
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
245
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
246
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
247
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|
248
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
249
|
+
gl_FragColor=vec4(1.0);
|
|
250
|
+
#endif
|
|
251
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
252
|
+
#ifdef TERRAIN3D
|
|
253
|
+
attribute vec2 a_centroid;
|
|
254
|
+
#endif
|
|
255
|
+
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
256
|
+
#pragma mapbox: define lowp float base
|
|
257
|
+
#pragma mapbox: define lowp float height
|
|
258
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
259
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
260
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
261
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
262
|
+
void main() {
|
|
263
|
+
#pragma mapbox: initialize lowp float base
|
|
264
|
+
#pragma mapbox: initialize lowp float height
|
|
265
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
266
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
267
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
268
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
269
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|
270
|
+
#ifdef TERRAIN3D
|
|
271
|
+
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
272
|
+
#else
|
|
273
|
+
float baseDelta=0.0;float ele=0.0;
|
|
274
|
+
#endif
|
|
275
|
+
base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
276
|
+
? a_pos
|
|
277
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:At(`#ifdef GL_ES
|
|
278
|
+
precision highp float;
|
|
279
|
+
#endif
|
|
280
|
+
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
281
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
282
|
+
gl_FragColor=vec4(1.0);
|
|
283
|
+
#endif
|
|
284
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:At(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
285
|
+
#define PI 3.141592653589793
|
|
286
|
+
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
287
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
288
|
+
gl_FragColor=vec4(1.0);
|
|
289
|
+
#endif
|
|
290
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:At(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
291
|
+
#pragma mapbox: define highp vec4 color
|
|
292
|
+
#pragma mapbox: define lowp float blur
|
|
293
|
+
#pragma mapbox: define lowp float opacity
|
|
294
|
+
void main() {
|
|
295
|
+
#pragma mapbox: initialize highp vec4 color
|
|
296
|
+
#pragma mapbox: initialize lowp float blur
|
|
297
|
+
#pragma mapbox: initialize lowp float opacity
|
|
298
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);
|
|
299
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
300
|
+
gl_FragColor=vec4(1.0);
|
|
301
|
+
#endif
|
|
302
|
+
}`,`
|
|
303
|
+
#define scale 0.015873016
|
|
304
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|
305
|
+
#pragma mapbox: define highp vec4 color
|
|
306
|
+
#pragma mapbox: define lowp float blur
|
|
307
|
+
#pragma mapbox: define lowp float opacity
|
|
308
|
+
#pragma mapbox: define mediump float gapwidth
|
|
309
|
+
#pragma mapbox: define lowp float offset
|
|
310
|
+
#pragma mapbox: define mediump float width
|
|
311
|
+
void main() {
|
|
312
|
+
#pragma mapbox: initialize highp vec4 color
|
|
313
|
+
#pragma mapbox: initialize lowp float blur
|
|
314
|
+
#pragma mapbox: initialize lowp float opacity
|
|
315
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
316
|
+
#pragma mapbox: initialize lowp float offset
|
|
317
|
+
#pragma mapbox: initialize mediump float width
|
|
318
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
319
|
+
#ifdef TERRAIN3D
|
|
320
|
+
v_gamma_scale=1.0;
|
|
321
|
+
#else
|
|
322
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
323
|
+
#endif
|
|
324
|
+
v_width2=vec2(outset,inset);}`),lineGradient:At(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
325
|
+
#pragma mapbox: define lowp float blur
|
|
326
|
+
#pragma mapbox: define lowp float opacity
|
|
327
|
+
void main() {
|
|
328
|
+
#pragma mapbox: initialize lowp float blur
|
|
329
|
+
#pragma mapbox: initialize lowp float opacity
|
|
330
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
331
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
332
|
+
gl_FragColor=vec4(1.0);
|
|
333
|
+
#endif
|
|
334
|
+
}`,`
|
|
335
|
+
#define scale 0.015873016
|
|
336
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
337
|
+
#pragma mapbox: define lowp float blur
|
|
338
|
+
#pragma mapbox: define lowp float opacity
|
|
339
|
+
#pragma mapbox: define mediump float gapwidth
|
|
340
|
+
#pragma mapbox: define lowp float offset
|
|
341
|
+
#pragma mapbox: define mediump float width
|
|
342
|
+
void main() {
|
|
343
|
+
#pragma mapbox: initialize lowp float blur
|
|
344
|
+
#pragma mapbox: initialize lowp float opacity
|
|
345
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
346
|
+
#pragma mapbox: initialize lowp float offset
|
|
347
|
+
#pragma mapbox: initialize mediump float width
|
|
348
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
349
|
+
#ifdef TERRAIN3D
|
|
350
|
+
v_gamma_scale=1.0;
|
|
351
|
+
#else
|
|
352
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
353
|
+
#endif
|
|
354
|
+
v_width2=vec2(outset,inset);}`),linePattern:At(`#ifdef GL_ES
|
|
355
|
+
precision highp float;
|
|
356
|
+
#endif
|
|
357
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
358
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
359
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
360
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
361
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
362
|
+
#pragma mapbox: define lowp float blur
|
|
363
|
+
#pragma mapbox: define lowp float opacity
|
|
364
|
+
void main() {
|
|
365
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
366
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
367
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
368
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
369
|
+
#pragma mapbox: initialize lowp float blur
|
|
370
|
+
#pragma mapbox: initialize lowp float opacity
|
|
371
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|
372
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
373
|
+
gl_FragColor=vec4(1.0);
|
|
374
|
+
#endif
|
|
375
|
+
}`,`
|
|
376
|
+
#define scale 0.015873016
|
|
377
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
378
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
379
|
+
#pragma mapbox: define lowp float blur
|
|
380
|
+
#pragma mapbox: define lowp float opacity
|
|
381
|
+
#pragma mapbox: define lowp float offset
|
|
382
|
+
#pragma mapbox: define mediump float gapwidth
|
|
383
|
+
#pragma mapbox: define mediump float width
|
|
384
|
+
#pragma mapbox: define lowp float floorwidth
|
|
385
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
386
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
387
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
388
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
389
|
+
void main() {
|
|
390
|
+
#pragma mapbox: initialize lowp float blur
|
|
391
|
+
#pragma mapbox: initialize lowp float opacity
|
|
392
|
+
#pragma mapbox: initialize lowp float offset
|
|
393
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
394
|
+
#pragma mapbox: initialize mediump float width
|
|
395
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
396
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
397
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
398
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
399
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
400
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
401
|
+
#ifdef TERRAIN3D
|
|
402
|
+
v_gamma_scale=1.0;
|
|
403
|
+
#else
|
|
404
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
405
|
+
#endif
|
|
406
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:At(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
407
|
+
#pragma mapbox: define highp vec4 color
|
|
408
|
+
#pragma mapbox: define lowp float blur
|
|
409
|
+
#pragma mapbox: define lowp float opacity
|
|
410
|
+
#pragma mapbox: define mediump float width
|
|
411
|
+
#pragma mapbox: define lowp float floorwidth
|
|
412
|
+
void main() {
|
|
413
|
+
#pragma mapbox: initialize highp vec4 color
|
|
414
|
+
#pragma mapbox: initialize lowp float blur
|
|
415
|
+
#pragma mapbox: initialize lowp float opacity
|
|
416
|
+
#pragma mapbox: initialize mediump float width
|
|
417
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
418
|
+
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|
419
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
420
|
+
gl_FragColor=vec4(1.0);
|
|
421
|
+
#endif
|
|
422
|
+
}`,`
|
|
423
|
+
#define scale 0.015873016
|
|
424
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
425
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
426
|
+
#pragma mapbox: define highp vec4 color
|
|
427
|
+
#pragma mapbox: define lowp float blur
|
|
428
|
+
#pragma mapbox: define lowp float opacity
|
|
429
|
+
#pragma mapbox: define mediump float gapwidth
|
|
430
|
+
#pragma mapbox: define lowp float offset
|
|
431
|
+
#pragma mapbox: define mediump float width
|
|
432
|
+
#pragma mapbox: define lowp float floorwidth
|
|
433
|
+
void main() {
|
|
434
|
+
#pragma mapbox: initialize highp vec4 color
|
|
435
|
+
#pragma mapbox: initialize lowp float blur
|
|
436
|
+
#pragma mapbox: initialize lowp float opacity
|
|
437
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
438
|
+
#pragma mapbox: initialize lowp float offset
|
|
439
|
+
#pragma mapbox: initialize mediump float width
|
|
440
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
441
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
442
|
+
#ifdef TERRAIN3D
|
|
443
|
+
v_gamma_scale=1.0;
|
|
444
|
+
#else
|
|
445
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
446
|
+
#endif
|
|
447
|
+
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:At(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
448
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
449
|
+
gl_FragColor=vec4(1.0);
|
|
450
|
+
#endif
|
|
451
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:At(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
452
|
+
#pragma mapbox: define lowp float opacity
|
|
453
|
+
void main() {
|
|
454
|
+
#pragma mapbox: initialize lowp float opacity
|
|
455
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
456
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
457
|
+
gl_FragColor=vec4(1.0);
|
|
458
|
+
#endif
|
|
459
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
|
|
460
|
+
#pragma mapbox: define lowp float opacity
|
|
461
|
+
void main() {
|
|
462
|
+
#pragma mapbox: initialize lowp float opacity
|
|
463
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
464
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
465
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:At(`#define SDF_PX 8.0
|
|
466
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
467
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
468
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
469
|
+
#pragma mapbox: define lowp float opacity
|
|
470
|
+
#pragma mapbox: define lowp float halo_width
|
|
471
|
+
#pragma mapbox: define lowp float halo_blur
|
|
472
|
+
void main() {
|
|
473
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
474
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
475
|
+
#pragma mapbox: initialize lowp float opacity
|
|
476
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
477
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
478
|
+
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
479
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
480
|
+
gl_FragColor=vec4(1.0);
|
|
481
|
+
#endif
|
|
482
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
|
|
483
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
484
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
485
|
+
#pragma mapbox: define lowp float opacity
|
|
486
|
+
#pragma mapbox: define lowp float halo_width
|
|
487
|
+
#pragma mapbox: define lowp float halo_blur
|
|
488
|
+
void main() {
|
|
489
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
490
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
491
|
+
#pragma mapbox: initialize lowp float opacity
|
|
492
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
493
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
494
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
495
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
496
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:At(`#define SDF_PX 8.0
|
|
497
|
+
#define SDF 1.0
|
|
498
|
+
#define ICON 0.0
|
|
499
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
500
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
501
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
502
|
+
#pragma mapbox: define lowp float opacity
|
|
503
|
+
#pragma mapbox: define lowp float halo_width
|
|
504
|
+
#pragma mapbox: define lowp float halo_blur
|
|
505
|
+
void main() {
|
|
506
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
507
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
508
|
+
#pragma mapbox: initialize lowp float opacity
|
|
509
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
510
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
511
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|
512
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
513
|
+
gl_FragColor=vec4(1.0);
|
|
514
|
+
#endif
|
|
515
|
+
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
516
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
517
|
+
gl_FragColor=vec4(1.0);
|
|
518
|
+
#endif
|
|
519
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|
520
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
521
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
522
|
+
#pragma mapbox: define lowp float opacity
|
|
523
|
+
#pragma mapbox: define lowp float halo_width
|
|
524
|
+
#pragma mapbox: define lowp float halo_blur
|
|
525
|
+
void main() {
|
|
526
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
527
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
528
|
+
#pragma mapbox: initialize lowp float opacity
|
|
529
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
530
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
531
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
532
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
533
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:At("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",bn),terrainDepth:At("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",bn),terrainCoords:At("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",bn)};function At(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=d?d.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,T,I,M)=>(_[M]=!0,v==="define"?`
|
|
534
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
535
|
+
varying ${T} ${I} ${M};
|
|
536
|
+
#else
|
|
537
|
+
uniform ${T} ${I} u_${M};
|
|
538
|
+
#endif
|
|
539
|
+
`:`
|
|
540
|
+
#ifdef HAS_UNIFORM_u_${M}
|
|
541
|
+
${T} ${I} ${M} = u_${M};
|
|
542
|
+
#endif
|
|
543
|
+
`)),vertexSource:t=t.replace(n,(y,v,T,I,M)=>{const U=I==="float"?"vec2":"vec4",F=M.match(/color/)?"color":U;return _[M]?v==="define"?`
|
|
544
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
545
|
+
uniform lowp float u_${M}_t;
|
|
546
|
+
attribute ${T} ${U} a_${M};
|
|
547
|
+
varying ${T} ${I} ${M};
|
|
548
|
+
#else
|
|
549
|
+
uniform ${T} ${I} u_${M};
|
|
550
|
+
#endif
|
|
551
|
+
`:F==="vec4"?`
|
|
552
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
553
|
+
${M} = a_${M};
|
|
554
|
+
#else
|
|
555
|
+
${T} ${I} ${M} = u_${M};
|
|
556
|
+
#endif
|
|
557
|
+
`:`
|
|
558
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
559
|
+
${M} = unpack_mix_${F}(a_${M}, u_${M}_t);
|
|
560
|
+
#else
|
|
561
|
+
${T} ${I} ${M} = u_${M};
|
|
562
|
+
#endif
|
|
563
|
+
`:v==="define"?`
|
|
564
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
565
|
+
uniform lowp float u_${M}_t;
|
|
566
|
+
attribute ${T} ${U} a_${M};
|
|
567
|
+
#else
|
|
568
|
+
uniform ${T} ${I} u_${M};
|
|
569
|
+
#endif
|
|
570
|
+
`:F==="vec4"?`
|
|
571
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
572
|
+
${T} ${I} ${M} = a_${M};
|
|
573
|
+
#else
|
|
574
|
+
${T} ${I} ${M} = u_${M};
|
|
575
|
+
#endif
|
|
576
|
+
`:`
|
|
577
|
+
#ifndef HAS_UNIFORM_u_${M}
|
|
578
|
+
${T} ${I} ${M} = unpack_mix_${F}(a_${M}, u_${M}_t);
|
|
579
|
+
#else
|
|
580
|
+
${T} ${I} ${M} = u_${M};
|
|
581
|
+
#endif
|
|
582
|
+
`}),staticAttributes:s,staticUniforms:f}}class is{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,d,f,_,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==u.length;for(let I=0;!T&&I<u.length;I++)this.boundPaintVertexBuffers[I]!==u[I]&&(T=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!T&&this.boundIndexBuffer===d&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),d&&d.dynamicDraw&&d.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,d,f,_,y,v)}freshBind(t,n,s,u,d,f,_,y){let v;const T=t.numAttributes,I=this.context,M=I.gl;if(I.extVertexArrayObject)this.vao&&this.destroy(),this.vao=I.extVertexArrayObject.createVertexArrayOES(),I.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=d,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=I.currentNumAttributes||0;for(let U=T;U<v;U++)M.disableVertexAttribArray(U)}n.enableAttributes(M,t);for(const U of s)U.enableAttributes(M,t);f&&f.enableAttributes(M,t),_&&_.enableAttributes(M,t),y&&y.enableAttributes(M,t),n.bind(),n.setVertexAttribPointers(M,t,d);for(const U of s)U.bind(),U.setVertexAttribPointers(M,t,d);f&&(f.bind(),f.setVertexAttribPointers(M,t,d)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(M,t,d)),y&&(y.bind(),y.setVertexAttribPointers(M,t,d)),I.currentNumAttributes=T}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function rs(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class na{constructor(t,n,s,u,d,f,_){const y=t.gl;this.program=y.createProgram();const v=rs(s.staticAttributes),T=u?u.getBinderAttributes():[],I=v.concat(T),M=qn.prelude.staticUniforms?rs(qn.prelude.staticUniforms):[],U=s.staticUniforms?rs(s.staticUniforms):[],F=u?u.getBinderUniforms():[],O=M.concat(U).concat(F),H=[];for(const he of O)H.indexOf(he)<0&&H.push(he);const Y=u?u.defines():[];f&&Y.push("#define OVERDRAW_INSPECTOR;"),_&&Y.push("#define TERRAIN3D;");const te=Y.concat(qn.prelude.fragmentSource,s.fragmentSource).join(`
|
|
583
|
+
`),$=Y.concat(qn.prelude.vertexSource,s.vertexSource).join(`
|
|
584
|
+
`),oe=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(oe,te),y.compileShader(oe),y.attachShader(this.program,oe);const ie=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ie,$),y.compileShader(ie),y.attachShader(this.program,ie),this.attributes={};const ue={};this.numAttributes=I.length;for(let he=0;he<this.numAttributes;he++)I[he]&&(y.bindAttribLocation(this.program,he,I[he]),this.attributes[I[he]]=he);y.linkProgram(this.program),y.deleteShader(ie),y.deleteShader(oe);for(let he=0;he<H.length;he++){const ve=H[he];if(ve&&!ue[ve]){const ce=y.getUniformLocation(this.program,ve);ce&&(ue[ve]=ce)}}this.fixedUniforms=d(t,ue),this.terrainUniforms=((he,ve)=>({u_depth:new a.Uniform1i(he,ve.u_depth),u_terrain:new a.Uniform1i(he,ve.u_terrain),u_terrain_dim:new a.Uniform1f(he,ve.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(he,ve.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(he,ve.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(he,ve.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(he,ve.u_terrain_exaggeration)}))(t,ue),this.binderUniforms=u?u.getUniforms(t,ue):[]}draw(t,n,s,u,d,f,_,y,v,T,I,M,U,F,O,H,Y,te){const $=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(d),t.setCullFace(f),y){t.activeTexture.set($.TEXTURE2),$.bindTexture($.TEXTURE_2D,y.depthTexture),t.activeTexture.set($.TEXTURE3),$.bindTexture($.TEXTURE_2D,y.texture);for(const ie in this.terrainUniforms)this.terrainUniforms[ie].set(y[ie])}for(const ie in this.fixedUniforms)this.fixedUniforms[ie].set(_[ie]);O&&O.setUniforms(t,this.binderUniforms,U,{zoom:F});let oe=0;switch(n){case $.LINES:oe=2;break;case $.TRIANGLES:oe=3;break;case $.LINE_STRIP:oe=1}for(const ie of M.get()){const ue=ie.vaos||(ie.vaos={});(ue[v]||(ue[v]=new is)).bind(t,this,T,O?O.getPaintVertexBuffers():[],I,ie.vertexOffset,H,Y,te),$.drawElements(n,ie.primitiveLength*oe,$.UNSIGNED_SHORT,ie.primitiveOffset*oe*2)}}}function oa(l,t,n){const s=1/jt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=d*(n.tileID.canonical.x+n.tileID.wrap*u),_=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const ns=(l,t,n,s)=>{const u=t.style.light,d=u.properties.get("position"),f=[d.x,d.y,d.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},gl=(l,t,n,s,u,d,f)=>a.extend(ns(l,t,n,s),oa(d,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),To=l=>({u_matrix:l}),os=(l,t,n,s)=>a.extend(To(l),oa(n,t,s)),sa=(l,t)=>({u_matrix:l,u_world:t}),aa=(l,t,n,s,u)=>a.extend(os(l,t,n,s),{u_world:u}),la=(l,t,n,s)=>{const u=l.transform;let d,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=jt(n,1,u.zoom);d=!0,f=[_,_]}else d=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},Hr=(l,t,n)=>{const s=jt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:l,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:d}},Zn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),wn=l=>({u_matrix:l}),Eo=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:jt(t,1,n),u_intensity:s});function So(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const Tn=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Xn(l,t,n,s),u_ratio:1/jt(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},ss=(l,t,n,s,u)=>a.extend(Tn(l,t,n,u),{u_image:0,u_image_height:s}),Io=(l,t,n,s,u)=>{const d=l.transform,f=Bt(t,d);return{u_matrix:Xn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/jt(t,1,d.zoom),u_device_pixel_ratio:l.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},jn=(l,t,n,s,u,d)=>{const f=l.lineAtlas,_=Bt(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),T=f.getDash(s.to,y),I=v.width*u.fromScale,M=T.width*u.toScale;return a.extend(Tn(l,t,n,d),{u_patternscale_a:[_/I,-v.height/2],u_patternscale_b:[_/M,-T.height/2],u_sdfgamma:f.width/(256*Math.min(I,M)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:u.t})};function Bt(l,t){return 1/jt(l,1,t.tileZoom)}function Xn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ca=(l,t,n,s,u)=>{return{u_matrix:l,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(d=u.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:ua(u.paint.get("raster-hue-rotate"))};var d,f};function ua(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const as=(l,t,n,s,u,d,f,_,y,v)=>{const T=u.transform;return{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:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},Co=(l,t,n,s,u,d,f,_,y,v,T)=>{const I=u.transform;return a.extend(as(l,t,n,s,u,d,f,_,y,v),{u_gamma_scale:s?Math.cos(I._pitch)*I.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+T})},ha=(l,t,n,s,u,d,f,_,y,v)=>a.extend(Co(l,t,n,s,u,d,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),_l=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),yl=(l,t,n,s,u,d)=>a.extend(function(f,_,y,v){const T=y.imageManager.getPattern(f.from.toString()),I=y.imageManager.getPattern(f.to.toString()),{width:M,height:U}=y.imageManager.getPixelSize(),F=Math.pow(2,v.tileID.overscaledZ),O=v.tileSize*Math.pow(2,y.transform.tileZoom)/F,H=O*(v.tileID.canonical.x+v.tileID.wrap*F),Y=O*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[M,U],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/jt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Y>>16],u_pixel_coord_lower:[65535&H,65535&Y]}}(s,d,n,u),{u_matrix:l,u_opacity:t}),ls={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class cs{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const us={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class hs{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const d=this.attributes[u],f=n.attributes[d.name];f!==void 0&&t.vertexAttribPointer(f,d.components,t[us[d.type]],!1,this.itemSize,d.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class xt{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 da extends xt{getDefault(){return a.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class xl extends xt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Wn extends xt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hn extends xt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class pa extends xt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class zi extends xt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ds extends xt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Ao extends xt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Mo extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class ps extends xt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class fs extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class zo extends xt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ms extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class gs extends xt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Po extends xt{getDefault(){return a.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class fa extends xt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ma extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class En extends xt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class vl extends xt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class bl extends xt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class wl extends xt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Tl extends xt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class El extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Sl extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class _s extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ko extends xt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ys extends xt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class xs extends xt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class Sn extends xt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ga extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class _a extends xt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Do extends xt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Kr extends Do{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ya extends Do{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class In{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const d=t.gl,f=this.framebuffer=d.createFramebuffer();if(this.colorAttachment=new Kr(t,f),u&&(this.depthAttachment=new ya(t,f)),d.checkFramebufferStatus(d.FRAMEBUFFER)!==d.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class Dt{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Dt.Replace=[1,0],Dt.disabled=new Dt(Dt.Replace,a.Color.transparent,[!1,!1,!1,!1]),Dt.unblended=new Dt(Dt.Replace,a.Color.transparent,[!0,!0,!0,!0]),Dt.alphaBlended=new Dt([1,771],a.Color.transparent,[!0,!0,!0,!0]);class xa{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new da(this),this.clearDepth=new xl(this),this.clearStencil=new Wn(this),this.colorMask=new Hn(this),this.depthMask=new pa(this),this.stencilMask=new zi(this),this.stencilFunc=new ds(this),this.stencilOp=new Ao(this),this.stencilTest=new Mo(this),this.depthRange=new ps(this),this.depthTest=new fs(this),this.depthFunc=new zo(this),this.blend=new ms(this),this.blendFunc=new gs(this),this.blendColor=new Po(this),this.blendEquation=new fa(this),this.cullFace=new ma(this),this.cullFaceSide=new En(this),this.frontFace=new vl(this),this.program=new bl(this),this.activeTexture=new wl(this),this.viewport=new Tl(this),this.bindFramebuffer=new El(this),this.bindRenderbuffer=new Sl(this),this.bindTexture=new _s(this),this.bindVertexBuffer=new ko(this),this.bindElementBuffer=new ys(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new xs(this),this.pixelStoreUnpack=new Sn(this),this.pixelStoreUnpackPremultiplyAlpha=new ga(this),this.pixelStoreUnpackFlipY=new _a(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new cs(this,t,n)}createVertexBuffer(t,n,s){return new hs(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,d=u.createRenderbuffer();return this.bindRenderbuffer.set(d),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),d}createFramebuffer(t,n,s){return new In(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}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){be(t.blendFunction,Dt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class ct{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}ct.ReadOnly=!1,ct.ReadWrite=!0,ct.disabled=new ct(519,ct.ReadOnly,[0,1]);const vt=7680;class Pt{constructor(t,n,s,u,d,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=d,this.pass=f}}Pt.disabled=new Pt({func:519,mask:0},0,0,vt,vt,vt);class Ft{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Kn;function Cn(l,t,n,s,u,d,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),T=[];let I=0,M=0;for(let $=0;$<s.length;$++){const oe=s[$],ie=t.getTile(oe),ue=ie.getBucket(n);if(!ue)continue;let he=oe.posMatrix;u[0]===0&&u[1]===0||(he=l.translatePosMatrix(oe.posMatrix,ie,u,d));const ve=f?ue.textCollisionBox:ue.iconCollisionBox,ce=ue.collisionCircleArray;if(ce.length>0){const Le=a.create(),Ie=he;a.mul(Le,ue.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Le,Le,ue.placementViewportMatrix),T.push({circleArray:ce,circleOffset:M,transform:Ie,invTransform:Le,coord:oe}),I+=ce.length/4,M=I}ve&&v.draw(_,y.LINES,ct.disabled,Pt.disabled,l.colorModeForRenderPass(),Ft.disabled,Hr(he,l.transform,ie),l.style.terrain&&l.style.terrain.getTerrainData(oe),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,l.transform.zoom,null,null,ve.collisionVertexBuffer)}if(!f||!T.length)return;const U=l.useProgram("collisionCircle"),F=new a.CollisionCircleLayoutArray;F.resize(4*I),F._trim();let O=0;for(const $ of T)for(let oe=0;oe<$.circleArray.length/4;oe++){const ie=4*oe,ue=$.circleArray[ie+0],he=$.circleArray[ie+1],ve=$.circleArray[ie+2],ce=$.circleArray[ie+3];F.emplace(O++,ue,he,ve,ce,0),F.emplace(O++,ue,he,ve,ce,1),F.emplace(O++,ue,he,ve,ce,2),F.emplace(O++,ue,he,ve,ce,3)}(!Kn||Kn.length<2*I)&&(Kn=function($){const oe=2*$,ie=new a.QuadTriangleArray;ie.resize(oe),ie._trim();for(let ue=0;ue<oe;ue++){const he=6*ue;ie.uint16[he+0]=4*ue+0,ie.uint16[he+1]=4*ue+1,ie.uint16[he+2]=4*ue+2,ie.uint16[he+3]=4*ue+2,ie.uint16[he+4]=4*ue+3,ie.uint16[he+5]=4*ue+0}return ie}(I));const H=_.createIndexBuffer(Kn,!0),Y=_.createVertexBuffer(F,a.collisionCircleLayout.members,!0);for(const $ of T){const oe={u_matrix:$.transform,u_inv_matrix:$.invTransform,u_camera_to_center_distance:(te=l.transform).cameraToCenterDistance,u_viewport_size:[te.width,te.height]};U.draw(_,y.TRIANGLES,ct.disabled,Pt.disabled,l.colorModeForRenderPass(),Ft.disabled,oe,l.style.terrain&&l.style.terrain.getTerrainData($.coord),n.id,Y,H,a.SegmentVector.simpleSegment(0,2*$.circleOffset,$.circleArray.length,$.circleArray.length/2),null,l.transform.zoom,null,null,null)}var te;Y.destroy(),H.destroy()}Ft.disabled=new Ft(!1,1029,2305),Ft.backCCW=new Ft(!0,1029,2305);const Il=a.identity(new Float32Array(16));function Cl(l,t,n,s,u,d){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,T=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+T[0])*d,(v/u+T[1])*d)}function va(l,t,n,s,u,d,f,_,y,v,T){const I=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,U=l.icon.dynamicLayoutVertexArray,F={};M.clear();for(let O=0;O<I.length;O++){const H=I.get(O),Y=l.allowVerticalPlacement&&!H.placedOrientation,te=H.hidden||!H.crossTileID||Y?null:s[H.crossTileID];if(te){const $=new a.pointGeometry(H.anchorX,H.anchorY),oe=ft($,n?f:d,T),ie=Ui(u.cameraToCenterDistance,oe.signedDistanceFromCamera);let ue=a.evaluateSizeForFeature(l.textSizeData,y,H)*ie/a.ONE_EM;n&&(ue*=l.tilePixelRatio/_);const{width:he,height:ve,anchor:ce,textOffset:Le,textBoxScale:Ie}=te,Re=Cl(ce,he,ve,Le,Ie,ue),Qe=n?ft($.add(Re),d,T).point:oe.point.add(t?Re.rotate(-u.angle):Re),it=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let Ge=0;Ge<H.numGlyphs;Ge++)a.addDynamicAttributes(M,Qe,it);v&&H.associatedIconIndex>=0&&(F[H.associatedIconIndex]={shiftedAnchor:Qe,angle:it})}else Je(H.numGlyphs,M)}if(v){U.clear();const O=l.icon.placedSymbolArray;for(let H=0;H<O.length;H++){const Y=O.get(H);if(Y.hidden)Je(Y.numGlyphs,U);else{const te=F[H];if(te)for(let $=0;$<Y.numGlyphs;$++)a.addDynamicAttributes(U,te.shiftedAnchor,te.angle);else Je(Y.numGlyphs,U)}}l.icon.dynamicLayoutVertexBuffer.updateData(U)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Al(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Lo(l,t,n,s,u,d,f,_,y,v,T,I){const M=l.context,U=M.gl,F=l.transform,O=_==="map",H=y==="map",Y=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",te=O&&!H&&!Y,$=!n.layout.get("symbol-sort-key").isConstant();let oe=!1;const ie=l.depthModeForSublayer(0,ct.ReadOnly),ue=n.layout.get("text-variable-anchor"),he=[];for(const ve of s){const ce=t.getTile(ve),Le=ce.getBucket(n);if(!Le)continue;const Ie=u?Le.text:Le.icon;if(!Ie||!Ie.segments.get().length)continue;const Re=Ie.programConfigurations.get(n.id),Qe=u||Le.sdfIcons,it=u?Le.textSizeData:Le.iconSizeData,Ge=H||F.pitch!==0,wt=l.useProgram(Al(Qe,u,Le),Re),Tt=a.evaluateSizeForZoom(it,F.zoom),dt=l.style.terrain&&l.style.terrain.getTerrainData(ve);let _t,It,ti,nr,Wi=[0,0],or=null;if(u){if(It=ce.glyphAtlasTexture,ti=U.LINEAR,_t=ce.glyphAtlasTexture.size,Le.iconsInText){Wi=ce.imageAtlasTexture.size,or=ce.imageAtlasTexture;const Ni=it.kind==="composite"||it.kind==="camera";nr=Ge||l.options.rotating||l.options.zooming||Ni?U.LINEAR:U.NEAREST}}else{const Ni=n.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;It=ce.imageAtlasTexture,ti=Qe||l.options.rotating||l.options.zooming||Ni||Ge?U.LINEAR:U.NEAREST,_t=ce.imageAtlasTexture.size}const $r=jt(ce,1,l.transform.zoom),Vi=Zr(ve.posMatrix,H,O,l.transform,$r),wi=ji(ve.posMatrix,H,O,l.transform,$r),xr=ue&&Le.hasTextData(),No=n.layout.get("icon-text-fit")!=="none"&&xr&&Le.hasIconData();if(Y){const Ni=l.style.terrain?(Ls,Dn)=>l.style.terrain.getElevation(ve,Ls,Dn):null,en=n.layout.get("text-rotation-alignment")==="map";Mi(Le,ve.posMatrix,l,u,Vi,wi,H,v,en,Ni)}const Kt=l.translatePosMatrix(ve.posMatrix,ce,d,f),st=Y||u&&ue||No?Il:Vi,bt=l.translatePosMatrix(wi,ce,d,f,!0),ii=Qe&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ri;ri=Qe?Le.iconsInText?ha(it.kind,Tt,te,H,l,Kt,st,bt,_t,Wi):Co(it.kind,Tt,te,H,l,Kt,st,bt,u,_t,!0):as(it.kind,Tt,te,H,l,Kt,st,bt,u,_t);const Ut={program:wt,buffers:Ie,uniformValues:ri,atlasTexture:It,atlasTextureIcon:or,atlasInterpolation:ti,atlasInterpolationIcon:nr,isSDF:Qe,hasHalo:ii};if($&&Le.canOverlap){oe=!0;const Ni=Ie.segments.get();for(const en of Ni)he.push({segments:new a.SegmentVector([en]),sortKey:en.sortKey,state:Ut,terrainData:dt})}else he.push({segments:Ie.segments,sortKey:0,state:Ut,terrainData:dt})}oe&&he.sort((ve,ce)=>ve.sortKey-ce.sortKey);for(const ve of he){const ce=ve.state;if(M.activeTexture.set(U.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,U.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(M.activeTexture.set(U.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),ce.isSDF){const Le=ce.uniformValues;ce.hasHalo&&(Le.u_is_halo=1,Jn(ce.buffers,ve.segments,n,l,ce.program,ie,T,I,Le,ve.terrainData)),Le.u_is_halo=0}Jn(ce.buffers,ve.segments,n,l,ce.program,ie,T,I,ce.uniformValues,ve.terrainData)}}function Jn(l,t,n,s,u,d,f,_,y,v){const T=s.context;u.draw(T,T.gl.TRIANGLES,d,f,_,Ft.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function Yn(l,t,n,s,u,d,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),T=n.getCrossfadeParameters();let I,M,U,F,O;f?(M=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",I=_.LINES):(M=v?"fillPattern":"fill",I=_.TRIANGLES);for(const H of s){const Y=t.getTile(H);if(v&&!Y.patternsLoaded())continue;const te=Y.getBucket(n);if(!te)continue;const $=te.programConfigurations.get(n.id),oe=l.useProgram(M,$),ie=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Y.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),$.updatePaintBuffers(T));const ue=y.constantOr(null);if(ue&&Y.imageAtlas){const ce=Y.imageAtlas,Le=ce.patternPositions[ue.to.toString()],Ie=ce.patternPositions[ue.from.toString()];Le&&Ie&&$.setConstantPatternPositions(Le,Ie)}const he=ie?H:null,ve=l.translatePosMatrix(he?he.posMatrix:H.posMatrix,Y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){F=te.indexBuffer2,O=te.segments2;const ce=[_.drawingBufferWidth,_.drawingBufferHeight];U=M==="fillOutlinePattern"&&v?aa(ve,l,T,Y,ce):sa(ve,ce)}else F=te.indexBuffer,O=te.segments,U=v?os(ve,l,T,Y):To(ve);oe.draw(l.context,I,u,l.stencilModeForClipping(H),d,Ft.disabled,U,ie,n.id,te.layoutVertexBuffer,F,O,n.paint,l.transform.zoom,$)}}function Qn(l,t,n,s,u,d,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),T=v.constantOr(1),I=n.getCrossfadeParameters(),M=n.paint.get("fill-extrusion-opacity");for(const U of s){const F=t.getTile(U),O=F.getBucket(n);if(!O)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(U),Y=O.programConfigurations.get(n.id),te=l.useProgram(T?"fillExtrusionPattern":"fillExtrusion",Y);T&&(l.context.activeTexture.set(y.TEXTURE0),F.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Y.updatePaintBuffers(I));const $=v.constantOr(null);if($&&F.imageAtlas){const he=F.imageAtlas,ve=he.patternPositions[$.to.toString()],ce=he.patternPositions[$.from.toString()];ve&&ce&&Y.setConstantPatternPositions(ve,ce)}const oe=l.translatePosMatrix(U.posMatrix,F,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ie=n.paint.get("fill-extrusion-vertical-gradient"),ue=T?gl(oe,l,ie,M,U,I,F):ns(oe,l,ie,M);te.draw(_,_.gl.TRIANGLES,u,d,f,Ft.backCCW,ue,H,n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,n.paint,l.transform.zoom,Y,l.style.terrain&&O.centroidVertexBuffer)}}function vs(l,t,n,s,u,d,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const T=l.useProgram("hillshade"),I=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(_,y.TRIANGLES,u,d,f,Ft.disabled,((M,U,F,O)=>{const H=F.paint.get("hillshade-shadow-color"),Y=F.paint.get("hillshade-highlight-color"),te=F.paint.get("hillshade-accent-color");let $=F.paint.get("hillshade-illumination-direction")*(Math.PI/180);F.paint.get("hillshade-illumination-anchor")==="viewport"&&($-=M.transform.angle);const oe=!M.options.moving;return{u_matrix:O?O.posMatrix:M.transform.calculatePosMatrix(U.tileID.toUnwrapped(),oe),u_image:0,u_latrange:So(0,U.tileID),u_light:[F.paint.get("hillshade-exaggeration"),$],u_shadow:H,u_highlight:Y,u_accent:te}})(l,n,s,I?t:null),I,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function ba(l,t,n,s,u,d){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,I=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(T),t.demTexture){const U=t.demTexture;U.update(I,{premultiply:!1}),U.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Xe(f,I,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let M=t.fbo;if(!M){const U=new Xe(f,{width:v,height:v,data:null},_.RGBA);U.bind(_.LINEAR,_.CLAMP_TO_EDGE),M=t.fbo=f.createFramebuffer(v,v,!0),M.colorAttachment.set(U.texture)}f.bindFramebuffer.set(M.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,d,Ft.disabled,((U,F)=>{const O=F.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[O,O],u_zoom:U.overscaledZ,u_unpack:F.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ro(l,t,n,s,u,d){const f=s.paint.get("raster-fade-duration");if(!d&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,T=n.getSource(),I=u.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),M=!t||Math.abs(t.tileID.overscaledZ-I)>Math.abs(l.tileID.overscaledZ-I),U=M&&l.refreshedUponExpiration?1:a.clamp(M?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const Bo=new a.Color(1,0,0,1),Xi=new a.Color(0,1,0,1),wa=new a.Color(0,0,1,1),bs=new a.Color(1,0,1,1),Ta=new a.Color(0,1,1,1);function Jr(l,t,n,s){An(l,0,t+n/2,l.transform.width,n,s)}function eo(l,t,n,s){An(l,t-n/2,0,n,l.transform.height,s)}function An(l,t,n,s,u,d){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:d}),_.disable(_.SCISSOR_TEST)}function Ml(l,t,n){const s=l.context,u=s.gl,d=n.posMatrix,f=l.useProgram("debug"),_=ct.disabled,y=Pt.disabled,v=l.colorModeForRenderPass(),T="$debug",I=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const M=t.getTileByID(n.key).latestRawTileData,U=Math.floor((M&&M.byteLength||0)/1024),F=t.getTile(n).tileSize,O=512/Math.min(F,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Y,te){Y.initDebugOverlayCanvas();const $=Y.debugOverlayCanvas,oe=Y.context.gl,ie=Y.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,$.width,$.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(te,5,5),ie.strokeText(te,5,5),Y.debugOverlayTexture.update($),Y.debugOverlayTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE)}(l,`${H} ${U}kB`),f.draw(s,u.TRIANGLES,_,y,Dt.alphaBlended,Ft.disabled,Zn(d,a.Color.transparent,O),null,T,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Ft.disabled,Zn(d,a.Color.red),I,T,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Fo(l,t,n){const s=l.context,u=s.gl,d=l.colorModeForRenderPass(),f=new ct(u.LEQUAL,ct.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const T=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Pt.disabled,d,Ft.backCCW,{u_matrix:T,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function Ea(l,t,n,s){const u=l.context,d=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(d)||new Xe(u,{width:d,height:d,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,d,d])}class Sa{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const d of u){const f=n.sourceCache.getTerrainCoords(d);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],d=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const f in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][f]=this._coordsDescendingInv[d][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[u][s.tileID.key];d&&d!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,d=s.currentLayer,f=d+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[d]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(Ea(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let T=0;T<y.length;T++){const I=s.style._layers[y[T]],M=I.source?this._coordsDescendingInv[I.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(I,M),s.renderLayer(s,s.style.sourceCaches[I.source],I,M),I.source&&(v.textureCoords[I.source]=this._coordsDescendingInvStr[I.source][v.tileID.key])}}Fo(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[d]]);for(const v of this._renderableTiles){const T=this._coordsDescendingInv[t.source][v.tileID.key];Ea(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,T),s.renderLayer(s,s.style.sourceCaches[t.source],t,T),Fo(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const to={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const d=Pt.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,T,I,M,U){const F=y.transform,O=I==="map",H=M==="map";for(const Y of _){const te=T.getTile(Y),$=te.getBucket(v);if(!$||!$.text||!$.text.segments.get().length)continue;const oe=a.evaluateSizeForZoom($.textSizeData,F.zoom),ie=jt(te,1,y.transform.zoom),ue=Zr(Y.posMatrix,H,O,y.transform,ie),he=v.layout.get("icon-text-fit")!=="none"&&$.hasIconData();if(oe){const ve=Math.pow(2,F.zoom-te.tileID.overscaledZ);va($,O,H,U,F,ue,Y.posMatrix,ve,oe,he,y.style.terrain?(ce,Le)=>y.style.terrain.getElevation(Y,ce,Le):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Lo(l,t,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),d,f),n.paint.get("text-opacity").constantOr(1)!==0&&Lo(l,t,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),d,f),t.map.showCollisionBoxes&&(Cn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Cn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),d=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(d.constantOr(1)===0||f.constantOr(1)===0))return;const y=l.context,v=y.gl,T=l.depthModeForSublayer(0,ct.ReadOnly),I=Pt.disabled,M=l.colorModeForRenderPass(),U=[];for(let F=0;F<s.length;F++){const O=s[F],H=t.getTile(O),Y=H.getBucket(n);if(!Y)continue;const te=Y.programConfigurations.get(n.id),$=l.useProgram("circle",te),oe=Y.layoutVertexBuffer,ie=Y.indexBuffer,ue=l.style.terrain&&l.style.terrain.getTerrainData(O),he={programConfiguration:te,program:$,layoutVertexBuffer:oe,indexBuffer:ie,uniformValues:la(l,O,H,n),terrainData:ue};if(_){const ve=Y.segments.get();for(const ce of ve)U.push({segments:new a.SegmentVector([ce]),sortKey:ce.sortKey,state:he})}else U.push({segments:Y.segments,sortKey:0,state:he})}_&&U.sort((F,O)=>F.sortKey-O.sortKey);for(const F of U){const{programConfiguration:O,program:H,layoutVertexBuffer:Y,indexBuffer:te,uniformValues:$,terrainData:oe}=F.state;H.draw(y,v.TRIANGLES,T,I,M,Ft.disabled,$,oe,n.id,Y,te,F.segments,n.paint,l.transform.zoom,O)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,d=u.gl,f=Pt.disabled,_=new Dt([d.ONE,d.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,T){const I=y.gl;y.activeTexture.set(I.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let M=T.heatmapFbo;if(M)I.bindTexture(I.TEXTURE_2D,M.colorAttachment.get()),y.bindFramebuffer.set(M.framebuffer);else{const U=I.createTexture();I.bindTexture(I.TEXTURE_2D,U),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MIN_FILTER,I.LINEAR),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MAG_FILTER,I.LINEAR),M=T.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(F,O,H,Y){const te=F.gl;te.texImage2D(te.TEXTURE_2D,0,te.RGBA,O.width/4,O.height/4,0,te.RGBA,F.extRenderToTextureHalfFloat?F.extTextureHalfFloat.HALF_FLOAT_OES:te.UNSIGNED_BYTE,null),Y.colorAttachment.set(H)}(y,v,U,M)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const T=t.getTile(v),I=T.getBucket(n);if(!I)continue;const M=I.programConfigurations.get(n.id),U=l.useProgram("heatmap",M),{zoom:F}=l.transform;U.draw(u,d.TRIANGLES,ct.disabled,f,_,Ft.disabled,Eo(v.posMatrix,T,F,n.paint.get("heatmap-intensity")),null,n.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,n.paint,l.transform.zoom,M)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(u,d){const f=u.context,_=f.gl,y=d.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=d.colorRampTexture;v||(v=d.colorRampTexture=new Xe(f,d.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,ct.disabled,Pt.disabled,u.colorModeForRenderPass(),Ft.disabled,((T,I,M,U)=>{const F=a.create();a.ortho(F,0,T.width,T.height,0,0,1);const O=T.context.gl;return{u_matrix:F,u_world:[O.drawingBufferWidth,O.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}})(u,d),null,d.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,d.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),d=n.paint.get("line-width");if(u.constantOr(1)===0||d.constantOr(1)===0)return;const f=l.depthModeForSublayer(0,ct.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),T=v.constantOr(1),I=n.paint.get("line-gradient"),M=n.getCrossfadeParameters(),U=T?"linePattern":y?"lineSDF":I?"lineGradient":"line",F=l.context,O=F.gl;let H=!0;for(const Y of s){const te=t.getTile(Y);if(T&&!te.patternsLoaded())continue;const $=te.getBucket(n);if(!$)continue;const oe=$.programConfigurations.get(n.id),ie=l.context.program.get(),ue=l.useProgram(U,oe),he=H||ue.program!==ie,ve=l.style.terrain&&l.style.terrain.getTerrainData(Y),ce=v.constantOr(null);if(ce&&te.imageAtlas){const Re=te.imageAtlas,Qe=Re.patternPositions[ce.to.toString()],it=Re.patternPositions[ce.from.toString()];Qe&&it&&oe.setConstantPatternPositions(Qe,it)}const Le=ve?Y:null,Ie=T?Io(l,te,n,M,Le):y?jn(l,te,n,y,M,Le):I?ss(l,te,n,$.lineClipsArray.length,Le):Tn(l,te,n,Le);if(T)F.activeTexture.set(O.TEXTURE0),te.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),oe.updatePaintBuffers(M);else if(y&&(he||l.lineAtlas.dirty))F.activeTexture.set(O.TEXTURE0),l.lineAtlas.bind(F);else if(I){const Re=$.gradients[n.id];let Qe=Re.texture;if(n.gradientVersion!==Re.version){let it=256;if(n.stepInterpolant){const Ge=t.getSource().maxzoom,wt=Y.canonical.z===Ge?Math.ceil(1<<l.transform.maxZoom-Y.canonical.z):1;it=a.clamp(a.nextPowerOfTwo($.maxLineLength/a.EXTENT*1024*wt),256,F.maxTextureSize)}Re.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:it,image:Re.gradient||void 0,clips:$.lineClipsArray}),Re.texture?Re.texture.update(Re.gradient):Re.texture=new Xe(F,Re.gradient,O.RGBA),Re.version=n.gradientVersion,Qe=Re.texture}F.activeTexture.set(O.TEXTURE0),Qe.bind(n.stepInterpolant?O.NEAREST:O.LINEAR,O.CLAMP_TO_EDGE)}ue.draw(F,O.TRIANGLES,f,l.stencilModeForClipping(Y),_,Ft.disabled,Ie,ve,n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,n.paint,l.transform.zoom,oe,$.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),d=n.paint.get("fill-opacity");if(d.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&d.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);Yn(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);Yn(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const d=new ct(l.context.gl.LEQUAL,ct.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))Qn(l,t,n,s,d,Pt.disabled,Dt.disabled),Qn(l,t,n,s,d,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();Qn(l,t,n,s,d,Pt.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,d=l.depthModeForSublayer(0,ct.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const T=t.getTile(v);T.needsHillshadePrepare!==void 0&&T.needsHillshadePrepare&&l.renderPass==="offscreen"?ba(l,T,n,d,Pt.disabled,f):l.renderPass==="translucent"&&vs(l,v,T,n,d,_[v.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,d=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,T]=f instanceof qi?[{},s]:l.stencilConfigForOverlap(s),I=T[T.length-1].overscaledZ,M=!l.options.moving;for(const U of T){const F=l.depthModeForSublayer(U.overscaledZ-I,n.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,d.LESS),O=t.getTile(U);O.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(U,0),Y=Ro(O,H,t,n,l.transform,l.style.terrain);let te,$;const oe=n.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR;u.activeTexture.set(d.TEXTURE0),O.texture.bind(oe,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1),H?(H.texture.bind(oe,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),te=Math.pow(2,H.tileID.overscaledZ-O.tileID.overscaledZ),$=[O.tileID.canonical.x*te%1,O.tileID.canonical.y*te%1]):O.texture.bind(oe,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST);const ie=l.style.terrain&&l.style.terrain.getTerrainData(U),ue=ie?U:null,he=ue?ue.posMatrix:l.transform.calculatePosMatrix(U.toUnwrapped(),M),ve=ca(he,$||[0,0],te||1,Y,n);f instanceof qi?_.draw(u,d.TRIANGLES,F,Pt.disabled,y,Ft.disabled,ve,ie,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,d.TRIANGLES,F,v[U.overscaledZ],y,Ft.disabled,ve,ie,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,T=n.paint.get("background-pattern");if(l.isPatternMissing(T))return;const I=!T&&u.a===1&&d===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==I)return;const M=Pt.disabled,U=l.depthModeForSublayer(0,I==="opaque"?ct.ReadWrite:ct.ReadOnly),F=l.colorModeForRenderPass(),O=l.useProgram(T?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});T&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Y=n.getCrossfadeParameters();for(const te of H){const $=s?te.posMatrix:l.transform.calculatePosMatrix(te.toUnwrapped()),oe=T?yl($,d,l,T,{tileID:te,tileSize:v},Y):_l($,d,u),ie=l.style.terrain&&l.style.terrain.getTerrainData(te);O.draw(f,_.TRIANGLES,U,M,F,Ft.disabled,oe,ie,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Ml(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const d=u.prerender;d&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),d.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Pt.disabled);const d=u.renderingMode==="3d"?new ct(l.context.gl.LEQUAL,ct.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,ct.ReadOnly);s.setDepthMode(d),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class ws{constructor(t,n){this.context=new xa(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=vi.maxUnderzooming+vi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new We,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,mt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,mt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,hr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,mt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Xe(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Pt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ct.disabled,this.stencilClearMode,Dt.disabled,Ft.disabled,wn(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(Dt.disabled),s.setDepthMode(ct.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);d.draw(s,u.TRIANGLES,ct.disabled,new Pt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Dt.disabled,Ft.disabled,wn(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Pt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Pt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,d=s[0].overscaledZ-u+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const f={};for(let _=0;_<d;_++)f[_+u]=new Pt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=d,[f,s]}return[{[u]:Pt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Dt([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Dt.unblended:Dt.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return ct.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ct(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,d=this.style.terrain&&new Sa(this);for(const v in u){const T=u[v];T.used&&T.prepare(this.context)}const f={},_={},y={};for(const v in u){const T=u[v];f[v]=T.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=T.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(d){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(T,I){const M=T.context,U=M.gl,F=Dt.unblended,O=new ct(U.LEQUAL,ct.ReadWrite,[0,1]),H=I.getTerrainMesh(),Y=I.sourceCache.getRenderableTiles(),te=T.useProgram("terrainDepth");M.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),M.clear({color:a.Color.transparent,depth:1});for(const $ of Y){const oe=I.getTerrainData($.tileID),ie=T.transform.calculatePosMatrix($.tileID.toUnwrapped());te.draw(M,U.TRIANGLES,O,Pt.disabled,F,Ft.backCCW,{u_matrix:ie},oe,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain),function(T,I){const M=T.context,U=M.gl,F=Dt.unblended,O=new ct(U.LEQUAL,ct.ReadWrite,[0,1]),H=I.getTerrainMesh(),Y=I.getCoordsTexture(),te=I.sourceCache.getRenderableTiles(),$=T.useProgram("terrainCoords");M.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),M.clear({color:a.Color.transparent,depth:1}),I.coordsIndex=[];for(const oe of te){const ie=I.getTerrainData(oe.tileID);M.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,Y.texture);const ue=T.transform.calculatePosMatrix(oe.tileID.toUnwrapped());$.draw(M,U.TRIANGLES,O,Pt.disabled,F,Ft.backCCW,{u_matrix:ue,u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0},ie,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),I.coordsIndex.push(oe.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const T=this.style._layers[v];if(!T.hasOffscreenPass()||T.isHidden(this.transform.zoom))continue;const I=_[T.source];(T.type==="custom"||I.length)&&this.renderLayer(this,u[T.source],T,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!d)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],T=u[v.source],I=f[v.source];this._renderTileClippingMasks(v,I),this.renderLayer(this,T,v,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],T=u[v.source];if(d&&d.renderLayer(v))continue;const I=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,T,v,I)}if(this.options.showTileBoundaries){let v,T;Object.values(this.style._layers).forEach(I=>{I.source&&!I.isHidden(this.transform.zoom)&&(I.source!==(T&&T.id)&&(T=this.style.sourceCaches[I.source]),(!v||v.getSource().maxzoom<T.getSource().maxzoom)&&(v=T))}),v&&to.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const T=v.transform.padding;Jr(v,v.transform.height-(T.top||0),3,Bo),Jr(v,T.bottom||0,3,Xi),eo(v,T.left||0,3,wa),eo(v,v.transform.width-(T.right||0),3,bs);const I=v.transform.centerPoint;(function(M,U,F,O){An(M,U-1,F-10,2,20,O),An(M,U-10,F-1,20,2,O)})(v,I.x,v.transform.height-I.y,Ta)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),to[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],d=this.context.extTimerQuery,f=d.getQueryObjectEXT(u.query,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,d){if(!s[0]&&!s[1])return t;const f=d?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),T=Math.cos(f);s=[s[0]*T-s[1]*v,s[0]*v+s[1]*T]}const _=[d?s[0]:jt(n,s[0],this.transform.zoom),d?s[1]:jt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new na(this.context,t,qn[t],n,ls[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){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 Xe(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Oo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),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(_=>{const y=1/(_=a.transformMat4([],_,t))[3]/n*u;return a.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=a.sub([],d[_[0]],d[_[1]]),v=a.sub([],d[_[2]],d[_[1]]),T=a.normalize([],a.cross([],y,v)),I=-a.dot(T,d[_[1]]);return T.concat(I)});return new Oo(d,f)}}class io{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.clone$2(this.max);for(let d=0;d<n.length;d++)s[d]=n[d]?this.min[d]:this.center[d],u[d]=n[d]?this.center[d]:this.max[d];return u[2]=this.max[2],new io(s,u)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const d=t.planes[u];let f=0;for(let _=0;_<n.length;_++)a.dot$1(d,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let d=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];d=Math.min(d,y),f=Math.max(f,y)}if(f<0||d>this.max[u]-this.min[u])return 0}return 1}}class Mn{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Mn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ro{constructor(t,n,s,u,d){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Mn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new ro(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,d,f){var _=d[0],y=d[1],v=d[2],T=d[3],I=Math.sin(f),M=Math.cos(f);u[0]=_*M+v*I,u[1]=y*M+T*I,u[2]=_*-I+v*M,u[3]=y*-I+T*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),d=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,d.x,f.x)),y=Math.floor(Math.max(s.x,u.x,d.x,f.x)),v=1;for(let T=_-v;T<=y+v;T++)T!==0&&n.push(new a.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const d=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],T=[y*_.x,y*_.y,0],I=Oo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let M=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(M=u);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,F=$=>({aabb:new io([$*y,0,0],[($+1)*y,y,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),O=[],H=[],Y=u,te=t.reparseOverscaled?d:u;if(this._renderWorldCopies)for(let $=1;$<=3;$++)O.push(F(-$)),O.push(F($));for(O.push(F(0));O.length>0;){const $=O.pop(),oe=$.x,ie=$.y;let ue=$.fullyVisible;if(!ue){const Re=$.aabb.intersects(I);if(Re===0)continue;ue=Re===2}const he=t.terrain?v:T,ve=$.aabb.distanceX(he),ce=$.aabb.distanceY(he),Le=Math.max(Math.abs(ve),Math.abs(ce)),Ie=U+(1<<Y-$.zoom)-2;if($.zoom===Y||Le>Ie&&$.zoom>=M){const Re=Y-$.zoom,Qe=v[0]-.5-(oe<<Re),it=v[1]-.5-(ie<<Re);H.push({tileID:new a.OverscaledTileID($.zoom===Y?te:$.zoom,$.wrap,$.zoom,oe,ie),distanceSq:a.sqrLen([T[0]-.5-oe,T[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Qe*Qe+it*it)})}else for(let Re=0;Re<4;Re++){const Qe=(oe<<1)+Re%2,it=(ie<<1)+(Re>>1),Ge=$.zoom+1;let wt=$.aabb.quadrant(Re);if(t.terrain){const Tt=new a.OverscaledTileID(Ge,$.wrap,Ge,Qe,it),dt=t.terrain.getMinMaxElevation(Tt),_t=(n=dt.minElevation)!==null&&n!==void 0?n:this.elevation,It=(s=dt.maxElevation)!==null&&s!==void 0?s:this.elevation;wt=new io([wt.min[0],wt.min[1],_t],[wt.max[0],wt.max[1],It])}O.push({aabb:wt,zoom:Ge,x:Qe,y:it,wrap:$.wrap,fullyVisible:ue})}}return H.sort(($,oe)=>$.distanceSq-oe.distanceSq).map($=>$.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,d=s.x*u,f=s.y*u,_=Math.floor(d/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,d%a.EXTENT,f%a.EXTENT,a.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),d=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=d.x-f.x,y=d.y-f.y,v=d.z-f.z,T=Math.sqrt(_*_+y*y+v*v),I=this.scaleZoom(this.cameraToCenterDistance/T/this.tileSize);this._elevation=s,this._center=n,this.zoom=I}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),f=new a.MercatorCoordinate(d.x-(s.x-u.x),d.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const M=n.pointCoordinate(t);if(M!=null)return M}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const d=s[3],f=u[3],_=s[1]/d,y=u[1]/f,v=s[2]/d,T=u[2]/f,I=v===T?0:(0-v)/(T-v);return new a.MercatorCoordinate(a.number(s[0]/d,u[0]/f,I)/this.worldSize,a.number(_,y,I)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const d=t.canonical,f=this.worldSize/this.zoomScale(d.z),_=d.x+Math.pow(2,d.z)*t.wrap,y=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,d.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,d=-90,f=90,_=-180,y=180;const v=this.size,T=this._unmodified;if(this.latRange){const U=this.latRange;d=a.mercatorYfromLat(U[1])*this.worldSize,f=a.mercatorYfromLat(U[0])*this.worldSize,t=f-d<v.y?v.y/(f-d):0}if(this.lngRange){const U=this.lngRange;_=a.wrap(a.mercatorXfromLng(U[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(U[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const I=this.point,M=Math.max(n||0,t||0);if(M)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:I.x,t?(f+d)/2:I.y)),this.zoom+=this.scaleZoom(M),this._unmodified=T,void(this._constraining=!1);if(this.latRange){const U=I.y,F=v.y/2;U-F<d&&(u=d+F),U+F>f&&(u=f-F)}if(this.lngRange){const U=(_+y)/2,F=a.wrap(I.x,U-this.worldSize/2,U+this.worldSize/2),O=v.x/2;F-O<_&&(s=_+O),F+O>y&&(s=y-O)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:I.x,u!==void 0?u:I.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const d=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-d-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),T=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-d-v,.01,Math.PI-.01)),I=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,M=Math.cos(Math.PI/2-this._pitch)*T+this.cameraToSeaLevelDistance,U=1.01*Math.min(I,M),F=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,F,U),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const O=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),te=Math.sin(this.angle),$=n-Math.round(n)+Y*O+te*H,oe=s-Math.round(s)+Y*H+te*O,ie=new Float64Array(u);if(a.translate(ie,ie,[$>.5?$-1:$,oe>.5?oe-1:oe,0]),this.alignedProjMatrix=ie,u=a.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,d=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),d=Math.max(d,_.x),f=Math.max(f,_.y);return[new a.pointGeometry(s,u),new a.pointGeometry(d,u),new a.pointGeometry(d,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Ia{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,d=null;const f=()=>{d=null,u&&(n(),d=setTimeout(f,300),u=!1)};return()=>(u=!0,d||f(),d)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,u),f=Math.round(n.lng*d)/d,_=Math.round(n.lat*d)/d,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const I=this._hashName;let M=!1;const U=window.location.hash.slice(1).split("&").map(F=>{const O=F.split("=")[0];return O===I?(M=!0,`${O}=${T}`):F}).filter(F=>F);return M||U.push(`${I}=${T}`),`#${U.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(n){}}}const no={linearity:.3,easing:a.bezier(0,0,.3,1)},Ca=a.extend({deceleration:2500,maxSpeed:1400},no),Aa=a.extend({deceleration:20,maxSpeed:1400},no),Ma=a.extend({deceleration:1e3,maxSpeed:360},no),zn=a.extend({deceleration:1e3,maxSpeed:90},no);class za{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const d=so(n.pan.mag(),s,a.extend({},Ca,t||{}));u.offset=n.pan.mult(d.amount/n.pan.mag()),u.center=this._map.transform.center,oo(u,d)}if(n.zoom){const d=so(n.zoom,s,Aa);u.zoom=this._map.transform.zoom+d.amount,oo(u,d)}if(n.bearing){const d=so(n.bearing,s,Ma);u.bearing=this._map.transform.bearing+a.clamp(d.amount,-179,179),oo(u,d)}if(n.pitch){const d=so(n.pitch,s,zn);u.pitch=this._map.transform.pitch+d.amount,oo(u,d)}if(u.zoom||u.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;u.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),a.extend(u,{noMoveStart:!0})}}function oo(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function so(l,t,n){const{maxSpeed:s,linearity:u,deceleration:d}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(d*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Pi extends a.Event{constructor(t,n,s,u={}){const d=ne.mousePos(n.getCanvasContainer(),s),f=n.unproject(d);super(t,a.extend({point:d,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ao extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,d=ne.touchPos(n.getCanvasContainer(),u),f=d.map(y=>n.unproject(y)),_=d.reduce((y,v,T,I)=>y.add(v.div(I.length)),new a.pointGeometry(0,0));super(t,{points:d,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class ki extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class zl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ki(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Pi(t.type,this._map,t))}mouseup(t){this._map.fire(new Pi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Pi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Pi(t.type,this._map,t))}mouseover(t){this._map.fire(new Pi(t.type,this._map,t))}mouseout(t){this._map.fire(new Pi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ao(t.type,this._map,t))}touchmove(t){this._map.fire(new ao(t.type,this._map,t))}touchend(t){this._map.fire(new ao(t.type,this._map,t))}touchcancel(t){this._map.fire(new ao(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Lr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Pi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Pi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Pi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Pa{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(ne.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=ne.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const d=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);ne.setTransform(this._box,`translate(${d}px,${_}px)`),this._box.style.width=f-d+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),ne.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:d=>d.fitScreenCoordinates(s,u,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(ne.remove(this._box),this._box=null),ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function _r(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class lo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const d=new a.pointGeometry(0,0);for(const f of u)d._add(f);return d.div(u.length)}(n),this.touches=_r(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=_r(s,n);for(const d in this.touches){const f=this.touches[d],_=u[d];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class Ts{constructor(t){this.singleTap=new lo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const d=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(d&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Pl{constructor(){this._zoomIn=new Ts({numTouches:1,numTaps:2}),this._zoomOut=new Ts({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),d=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(d)},{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 kl={0:1,2:2};class Uo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=ne.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,d){const f=kl[d];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&ne.mouseButton(t)===this._eventButton&&(this._moved&&ne.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class co extends Uo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class yr extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Fe extends Uo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class ka{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=_r(s,n),d=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const T=u[v],I=this._touches[v];I&&(d._add(T),f._add(T.sub(I)),_++,u[v]=T)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:d.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Yr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,d]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,d);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,d]=this._firstTwoTouches,f=Rr(s,n,u),_=Rr(s,n,d);f&&_||(this._active&&ne.suppressClick(),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 Rr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Es(l,t){return Math.log(l/t)/Math.LN2}class ze extends Yr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Es(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Es(this._distance,s),pinchAround:n}}}function $o(l,t){return 180*l.angleWith(t)/Math.PI}class Dl extends Yr{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$o(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=$o(t,this._startVector);return Math.abs(s)<n}}function Ss(l){return Math.abs(l.y)>Math.abs(l.x)}class Is extends Yr{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Ss(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,d,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,d=n.mag()>=2;if(!u&&!d)return;if(!u||!d)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return Ss(t)&&Ss(n)&&f}}const Da={panStep:100,bearingStep:15,pitchStep:10};class La{constructor(){const t=Da;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,d=0,f=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ll,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-d*this._panStep,-f*this._panStep],center:_.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 Ll(l){return l*(2-l)}const Ra=4.000244140625;class Cs{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],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")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Ra==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,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 n=ne.mousePos(this._el,t);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Ra?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let d,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);d=a.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else d=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.exported.now()-s.start)/s.duration,d=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(d*d+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class As{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 Ms{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zs{constructor(){this._tap=new Ts({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],d=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(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 bi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Br{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}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 Ba{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,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("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Pn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Ps extends a.Event{}function uo(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Fa{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new za(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,d,f]of this._listeners)ne.addEventListener(u,d,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)ne.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new zl(n,t));const u=n.boxZoom=new Pa(n,t);this._add("boxZoom",u);const d=new Pl,f=new Ms;n.doubleClickZoom=new As(f,d),this._add("tapZoom",d),this._add("clickZoom",f);const _=new zs;this._add("tapDragZoom",_);const y=n.touchPitch=new Is(n);this._add("touchPitch",y);const v=new yr(t),T=new Fe(t);n.dragRotate=new Br(t,v,T),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const I=new co(t),M=new ka(t,n);n.dragPan=new bi(s,I,M),this._add("mousePan",I),this._add("touchPan",M,["touchZoom","touchRotate"]);const U=new Dl,F=new ze;n.touchZoomRotate=new Ba(s,F,U,_),this._add("touchRotate",U,["touchPan","touchZoom"]),this._add("touchZoom",F,["touchPan","touchRotate"]);const O=n.scrollZoom=new Cs(n,this);this._add("scrollZoom",O,["mousePan"]);const H=n.keyboard=new La;this._add("keyboard",H),this._add("blockableMapEvent",new Lr(n));for(const Y of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Y]&&n[Y].enable(t[Y])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}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 Boolean(Pn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},d={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?ne.touchPos(this._el,y):ne.mousePos(this._el,t);for(const{handlerName:M,handler:U,allowed:F}of this._handlers){if(!U.isEnabled())continue;let O;this._blockedByActive(f,F,M)?U.reset():U[n||t.type]&&(O=U[n||t.type](t,v,y),this.mergeHandlerResult(u,d,O,M,s),O&&O.needsRenderFrame&&this._triggerRenderFrame()),(O||U.isActive())&&(f[M]=U)}const T={};for(const M in this._previousActiveHandlers)f[M]||(T[M]=s);this._previousActiveHandlers=f,(Object.keys(T).length||uo(u))&&(this._changes.push([u,d,T]),this._triggerRenderFrame()),(Object.keys(f).length||uo(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=u;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(t,n,s,u,d){if(!s)return;a.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||d};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,d,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new a.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),a.extend(n,d),a.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,d=u.transform,f=u.style&&u.style.terrain;if(!(uo(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:I,pinchAround:M}=t;M!==void 0&&(I=M),u._stop(!0),I=I||u.transform.centerPoint;const U=d.pointLocation(_?I.sub(_):I);v&&(d.bearing+=v),T&&(d.pitch+=T),y&&(d.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:d.centerPoint,lngLat:d.pointLocation(I),point:I,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(d.center=d.pointLocation(d.centerPoint.sub(_))):d.setLocationAtPoint(U,I),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Pn(this._eventsInProgress),d=Pn(t),f={};for(const T in t){const{originalEvent:I}=t[T];this._eventsInProgress[T]||(f[`${T}start`]=I),this._eventsInProgress[T]=t[T]}!u&&d&&this._fireEvent("movestart",d.originalEvent);for(const T in f)this._fireEvent(T,f[T]);d&&this._fireEvent("move",d.originalEvent);for(const T in t){const{originalEvent:I}=t[T];this._fireEvent(T,I)}const _={};let y;for(const T in this._eventsInProgress){const{handlerName:I,originalEvent:M}=this._eventsInProgress[T];this._handlersById[I].isActive()||(delete this._eventsInProgress[T],y=n[I]||M,_[`${T}end`]=y)}for(const T in _)this._fireEvent(T,_[T]);const v=Pn(this._eventsInProgress);if(s&&(u||d)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;T?(I(T.bearing||this._map.getBearing())&&(T.bearing=0),this._map.easeTo(T,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),I(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Ps("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const $i={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Ot extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(a.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=a.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const d={top:0,bottom:0,right:0,left:0};if(typeof(u=a.extend({padding:d,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const ie=u.padding;u.padding={top:ie,bottom:ie,right:ie,left:ie}}u.padding=a.extend(d,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),T=y.rotate(-s*Math.PI/180),I=v.rotate(-s*Math.PI/180),M=new a.pointGeometry(Math.max(T.x,I.x),Math.max(T.y,I.y)),U=new a.pointGeometry(Math.min(T.x,I.x),Math.min(T.y,I.y)),F=M.sub(U),O=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/F.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/F.y;if(H<0||O<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Y=Math.min(f.scaleZoom(f.scale*Math.min(O,H)),u.maxZoom),te=a.pointGeometry.convert(u.offset),$=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),oe=te.add($).mult(f.scale/f.zoomScale(Y));return{center:f.unproject(y.add(v).div(2).sub(oe)),zoom:Y,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,d){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,d)}_fitInternal(t,n,s){return t?(delete(n=a.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,d=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=a.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(d=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),d&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const d=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-d.x,y=f.y-d.y,v=f.z-d.z,T=Math.hypot(_,y,v);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,y),M=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),U=180*Math.atan2(_,-y)/Math.PI;let F=180*Math.acos(I/T)/Math.PI;return F=v<0?90-F:90+F,{center:f.toLngLat(),zoom:M,pitch:F,bearing:U}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,M=a.pointGeometry.convert(t.offset);let U=s.centerPoint.add(M);const F=s.pointLocation(U),O=a.LngLat.convert(t.center||F);this._normalizeCenter(O);const H=s.project(F),Y=s.project(O).sub(H),te=s.zoomScale(y-u);let $,oe;t.around&&($=a.LngLat.convert(t.around),oe=s.locationPoint($));const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||d!==v,this._pitching=this._pitching||T!==f,this._padding=!s.isPaddingEqual(I),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(ue=>{if(this._zooming&&(s.zoom=a.number(u,y,ue)),this._rotating&&(s.bearing=a.number(d,v,ue)),this._pitching&&(s.pitch=a.number(f,T,ue)),this._padding&&(s.interpolatePadding(_,I,ue),U=s.centerPoint.add(M)),$)s.setLocationAtPoint($,oe);else{const he=s.zoomScale(s.zoom-u),ve=y>u?Math.min(2,te):Math.max(.5,te),ce=Math.pow(ve,1-ue),Le=s.unproject(H.add(Y.mult(ue*ce)).mult(he));s.setLocationAtPoint(s.renderWorldCopies?Le.wrap():Le,U)}this._fireMoveEvents(n)},ue=>{this._afterEase(n,ue)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),d&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const Ge=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ge,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,M=s.zoomScale(y-u),U=a.pointGeometry.convert(t.offset);let F=s.centerPoint.add(U);const O=s.pointLocation(F),H=a.LngLat.convert(t.center||O);this._normalizeCenter(H);const Y=s.project(O),te=s.project(H).sub(Y);let $=t.curve;const oe=Math.max(s.width,s.height),ie=oe/M,ue=te.mag();if("minZoom"in t){const Ge=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),wt=oe/s.zoomScale(Ge-u);$=Math.sqrt(wt/ue*2)}const he=$*$;function ve(Ge){const wt=(ie*ie-oe*oe+(Ge?-1:1)*he*he*ue*ue)/(2*(Ge?ie:oe)*he*ue);return Math.log(Math.sqrt(wt*wt+1)-wt)}function ce(Ge){return(Math.exp(Ge)-Math.exp(-Ge))/2}function Le(Ge){return(Math.exp(Ge)+Math.exp(-Ge))/2}const Ie=ve(0);let Re=function(Ge){return Le(Ie)/Le(Ie+$*Ge)},Qe=function(Ge){return oe*((Le(Ie)*(ce(wt=Ie+$*Ge)/Le(wt))-ce(Ie))/he)/ue;var wt},it=(ve(1)-Ie)/$;if(Math.abs(ue)<1e-6||!isFinite(it)){if(Math.abs(oe-ie)<1e-6)return this.easeTo(t,n);const Ge=ie<oe?-1:1;it=Math.abs(Math.log(ie/oe))/$,Qe=function(){return 0},Re=function(wt){return Math.exp(Ge*$*wt)}}return t.duration="duration"in t?+t.duration:1e3*it/("screenSpeed"in t?+t.screenSpeed/$:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==v,this._pitching=T!==f,this._padding=!s.isPaddingEqual(I),this._prepareEase(n,!1),this._ease(Ge=>{const wt=Ge*it,Tt=1/Re(wt);s.zoom=Ge===1?y:u+s.scaleZoom(Tt),this._rotating&&(s.bearing=a.number(d,v,Ge)),this._pitching&&(s.pitch=a.number(f,T,Ge)),this._padding&&(s.interpolatePadding(_,I,Ge),F=s.centerPoint.add(U));const dt=Ge===1?H:s.unproject(Y.add(te.mult(Qe(wt))).mult(Tt));s.setLocationAtPoint(s.renderWorldCopies?dt.wrap():dt,F),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=a.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class ho{constructor(t={}){this.options=t,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=ne.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ne.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ne.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){ne.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const d=n[u];if(d.used||d.usedForTerrain){const f=d.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,d)=>u.length-d.length),t=t.filter((u,d)=>{for(let f=d+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Vo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ne.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=ne.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ne.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Oa{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Ua={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},$a={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Rl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ir{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new yr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Fe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),ne.addEventListener(n,"mousedown",this.mousedown),ne.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ne.addEventListener(n,"touchmove",this.touchmove),ne.addEventListener(n,"touchend",this.touchend),ne.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),ne.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const d=this.mousePitch.mousemoveWindow(t,n);d&&d.pitchDelta&&s.setPitch(s.getPitch()+d.pitchDelta)}}off(){const t=this.element;ne.removeEventListener(t,"mousedown",this.mousedown),ne.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ne.removeEventListener(t,"touchmove",this.touchmove),ne.removeEventListener(t,"touchend",this.touchend),ne.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ne.enableDrag(),ne.removeEventListener(window,"mousemove",this.mousemove),ne.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ne.mousePos(this.element,t)),ne.addEventListener(window,"mousemove",this.mousemove),ne.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,ne.mousePos(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=ne.touchPos(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=ne.touchPos(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 po(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),d=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<d?l=s:n.locationPoint(u).distSqr(t)<d&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const Ve={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function je(l,t,n){const s=l.classList;for(const u in Ve)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class kn extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ne.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ne.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${d}px`),s.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const f=ne.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const _=ne.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=ne.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const te of v){const $=ne.createNS("http://www.w3.org/2000/svg","ellipse");$.setAttributeNS(null,"opacity","0.04"),$.setAttributeNS(null,"cx","10.5"),$.setAttributeNS(null,"cy","5.80029008"),$.setAttributeNS(null,"rx",te.rx),$.setAttributeNS(null,"ry",te.ry),y.appendChild($)}const T=ne.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=ne.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(I);const M=ne.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const U=ne.createNS("http://www.w3.org/2000/svg","path");U.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),M.appendChild(U);const F=ne.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=ne.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ne.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Y=ne.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(Y),_.appendChild(y),_.appendChild(T),_.appendChild(M),_.appendChild(F),_.appendChild(O),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(s),this._offset=a.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),je(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),ne.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const u=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:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),ne.setTransform(this._element,`${Ve[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),d=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*d?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=a.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const ks={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Fr,li=0,Or=!1;const rr={maxWidth:100,unit:"metric"};function Va(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,d=l.unproject([0,u]),f=l.unproject([s,u]),_=d.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Ur(t,s,y/5280,l._getUIString("ScaleControl.Miles")):Ur(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ur(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Ur(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):Ur(t,s,_,l._getUIString("ScaleControl.Meters"))}function Ur(l,t,n,s){const u=function(d){const f=Math.pow(10,`${Math.floor(d)}`.length-1);let _=d/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);l.style.width=t*(u/n)+"px",l.innerHTML=`${u} ${s}`}const Gt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Xt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ds(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return Ds(new a.pointGeometry(0,0))}const Qr={supported:ye,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Ot{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},$a,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(super(new ro(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,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._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new Oa,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Ua,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new ht(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Fa(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Ia(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new ho({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Vo,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_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 a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(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}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<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;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>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;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(l,t,n){if(l==="mouseenter"||l==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const f=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Pi(l,this,d.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new Pi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Pi(l,this,f.originalEvent)))}}}}{const s=u=>{const d=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];d.length&&(u.features=d,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];for(let d=0;d<u.length;d++){const f=u[d];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(d,1),this}}})(),this)}queryRenderedFeatures(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new hi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new hi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:d,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:_,height:y,data:v}=t,T=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0,userImage:T}),T.onAdd&&T.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:d,data:f}=s;if(u===void 0||d===void 0)return this.fire(new a.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(u!==n.data.width||d!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=ne.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=ne.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=ne.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=ne.create("div",`maplibregl-ctrl-${d} mapboxgl-ctrl-${d}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=ne.create("div","maplibregl-cooperative-gesture-screen",l);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
|
|
585
|
+
<div class="maplibregl-desktop-message">${n}</div>
|
|
586
|
+
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
587
|
+
`,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},ye.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new ws(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(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)}_render(l){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=a.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new a.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new a.Event("gpu-timing-layer",{layerTimes:_}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ne.remove(this._canvasContainer),ne.remove(this._controlContainer),this._cooperativeGestures&&ne.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=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,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()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},Rl,l),this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ir(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ne.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(l,t){const n=ne.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},ks,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Fr!==void 0?t(Fr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Fr=n.state!=="denied",t(Fr)}):(Fr=!!window.navigator.geolocation,t(Fr)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ne.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,li=0,Or=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("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_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(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._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&Or)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ne.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ne.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new kn(this._dotElement),this._circleElement=ne.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kn({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("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":li--,Or=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),li++,li>1?(l={maximumAge:6e5,timeout:0},Or=!0):(l=this.options.positionOptions,Or=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ho,LogoControl:Vo,ScaleControl:class{constructor(l){this.options=a.extend({},rr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Va(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ne.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Va(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){ne.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=ne.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=ne.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),ne.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){ne.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Gt),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&ne.remove(this._content),this._container&&(ne.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ne.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ne.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=ne.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=ne.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(d=>this._container.classList.add(d)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=po(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=Ds(this.options.offset);if(!n){const d=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<d/2?_.push("left"):t.x>this._map.transform.width-d/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();ne.setTransform(this._container,`${Ve[n]} translate(${u.x}px,${u.y}px)`),je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Xt);l&&l.focus()}_onClose(){this.remove()}},Marker:kn,Style:hi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:qr,GeoJSONSource:ur,ImageSource:qi,RasterDEMTileSource:He,RasterTileSource:Er,VectorTileSource:un,VideoSource:Zi,prewarm:function(){mn().acquire(dr)},clearPrewarmedResources:function(){const l=Mr;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(dr),Mr=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Ci.workerCount},set workerCount(l){Ci.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return $i.extend(Qr,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),Qr});var fe=G;return fe})})(Eh);const Bm=Eh.exports,Pf={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},kf=()=>{const[C,k]=ge.exports.useState(null),[R,N]=ge.exports.useState(Pf),G=ge.exports.useMemo(()=>new window.ResizeObserver(X=>{if(X[0]){const{x:fe,y:a,width:ye,height:pe,top:Ee,left:be,bottom:ne,right:ht}=X[0].contentRect;N({x:fe,y:a,width:ye,height:pe,top:Ee,left:be,bottom:ne,right:ht})}}),[]);return ge.exports.useLayoutEffect(()=>{if(!!C)return G.observe(C),()=>{G.disconnect()}},[C]),[k,R,C]},Df=ut.memo(({marker:C})=>Oi(Sf,{latitude:C.lat,longitude:C.lng,style:{zIndex:1},children:Oi(Up.Root,{options:{style:C.icon||"house"}})}));Df.displayName="Pin";const Lf={all:()=>["pois"],list:C=>[...Lf.all(),C]},Rf={all:()=>["schools"],list:C=>[...Rf.all(),C]},Bf={all:()=>["scores"],list:C=>[...Bf.all(),C]};function Cc(C,k=[]){let R=[];function N(X,fe){const a=ge.exports.createContext(fe),ye=R.length;R=[...R,fe];function pe(be){const{scope:ne,children:ht,...nt}=be,Xe=(ne==null?void 0:ne[C][ye])||a,ot=ge.exports.useMemo(()=>nt,Object.values(nt));return ge.exports.createElement(Xe.Provider,{value:ot},ht)}function Ee(be,ne){const ht=(ne==null?void 0:ne[C][ye])||a,nt=ge.exports.useContext(ht);if(nt)return nt;if(fe!==void 0)return fe;throw new Error(`\`${be}\` must be used within \`${X}\``)}return pe.displayName=X+"Provider",[pe,Ee]}const G=()=>{const X=R.map(fe=>ge.exports.createContext(fe));return function(a){const ye=(a==null?void 0:a[C])||X;return ge.exports.useMemo(()=>({[`__scope${C}`]:{...a,[C]:ye}}),[a,ye])}};return G.scopeName=C,[N,Ff(G,...k)]}function Ff(...C){const k=C[0];if(C.length===1)return k;const R=()=>{const N=C.map(G=>({useScope:G(),scopeName:G.scopeName}));return function(X){const fe=N.reduce((a,{useScope:ye,scopeName:pe})=>{const be=ye(X)[`__scope${pe}`];return{...a,...be}},{});return ge.exports.useMemo(()=>({[`__scope${k.scopeName}`]:fe}),[fe])}};return R.scopeName=k.scopeName,R}function Of(C,k){typeof C=="function"?C(k):C!=null&&(C.current=k)}function Ih(...C){return k=>C.forEach(R=>Of(R,k))}function ea(...C){return ge.exports.useCallback(Ih(...C),C)}const dl=ge.exports.forwardRef((C,k)=>{const{children:R,...N}=C,G=ge.exports.Children.toArray(R),X=G.find($f);if(X){const fe=X.props.children,a=G.map(ye=>ye===X?ge.exports.Children.count(fe)>1?ge.exports.Children.only(null):ge.exports.isValidElement(fe)?fe.props.children:null:ye);return ge.exports.createElement(Tc,Ii({},N,{ref:k}),ge.exports.isValidElement(fe)?ge.exports.cloneElement(fe,void 0,a):null)}return ge.exports.createElement(Tc,Ii({},N,{ref:k}),R)});dl.displayName="Slot";const Tc=ge.exports.forwardRef((C,k)=>{const{children:R,...N}=C;return ge.exports.isValidElement(R)?ge.exports.cloneElement(R,{...Vf(N,R.props),ref:Ih(k,R.ref)}):ge.exports.Children.count(R)>1?ge.exports.Children.only(null):null});Tc.displayName="SlotClone";const Uf=({children:C})=>ge.exports.createElement(ge.exports.Fragment,null,C);function $f(C){return ge.exports.isValidElement(C)&&C.type===Uf}function Vf(C,k){const R={...k};for(const N in k){const G=C[N],X=k[N];/^on[A-Z]/.test(N)?R[N]=(...a)=>{X==null||X(...a),G==null||G(...a)}:N==="style"?R[N]={...G,...X}:N==="className"&&(R[N]=[G,X].filter(Boolean).join(" "))}return{...C,...R}}function Nf(C){const k=C+"CollectionProvider",[R,N]=Cc(k),[G,X]=R(k,{collectionRef:{current:null},itemMap:new Map}),fe=ht=>{const{scope:nt,children:Xe}=ht,ot=ut.useRef(null),zt=ut.useRef(new Map).current;return ut.createElement(G,{scope:nt,itemMap:zt,collectionRef:ot},Xe)},a=C+"CollectionSlot",ye=ut.forwardRef((ht,nt)=>{const{scope:Xe,children:ot}=ht,zt=X(a,Xe),at=ea(nt,zt.collectionRef);return ut.createElement(dl,{ref:at},ot)}),pe=C+"CollectionItemSlot",Ee="data-radix-collection-item",be=ut.forwardRef((ht,nt)=>{const{scope:Xe,children:ot,...zt}=ht,at=ut.useRef(null),yt=ea(nt,at),Nt=X(pe,Xe);return ut.useEffect(()=>(Nt.itemMap.set(at,{ref:at,...zt}),()=>void Nt.itemMap.delete(at))),ut.createElement(dl,{[Ee]:"",ref:yt},ot)});function ne(ht){const nt=X(C+"CollectionConsumer",ht);return ut.useCallback(()=>{const ot=nt.collectionRef.current;if(!ot)return[];const zt=Array.from(ot.querySelectorAll(`[${Ee}]`));return Array.from(nt.itemMap.values()).sort((Nt,Et)=>zt.indexOf(Nt.ref.current)-zt.indexOf(Et.ref.current))},[nt.collectionRef,nt.itemMap])}return[{Provider:fe,Slot:ye,ItemSlot:be},ne,N]}function Ch(C,k,{checkForDefaultPrevented:R=!0}={}){return function(G){if(C==null||C(G),R===!1||!G.defaultPrevented)return k==null?void 0:k(G)}}function Ah(C){const k=ge.exports.useRef(C);return ge.exports.useEffect(()=>{k.current=C}),ge.exports.useMemo(()=>(...R)=>{var N;return(N=k.current)===null||N===void 0?void 0:N.call(k,...R)},[])}function Ac({prop:C,defaultProp:k,onChange:R=()=>{}}){const[N,G]=Gf({defaultProp:k,onChange:R}),X=C!==void 0,fe=X?C:N,a=Ah(R),ye=ge.exports.useCallback(pe=>{if(X){const be=typeof pe=="function"?pe(C):pe;be!==C&&a(be)}else G(pe)},[X,C,G,a]);return[fe,ye]}function Gf({defaultProp:C,onChange:k}){const R=ge.exports.useState(C),[N]=R,G=ge.exports.useRef(N),X=Ah(k);return ge.exports.useEffect(()=>{G.current!==N&&(X(N),G.current=N)},[N,G,X]),R}const qf=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],ia=qf.reduce((C,k)=>{const R=ge.exports.forwardRef((N,G)=>{const{asChild:X,...fe}=N,a=X?dl:k;return ge.exports.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),ge.exports.createElement(a,Ii({},fe,{ref:G}))});return R.displayName=`Primitive.${k}`,{...C,[k]:R}},{}),pl=Boolean(globalThis==null?void 0:globalThis.document)?ge.exports.useLayoutEffect:()=>{};function Zf(C,k){return ge.exports.useReducer((R,N)=>{const G=k[R][N];return G!=null?G:R},C)}const Mh=C=>{const{present:k,children:R}=C,N=jf(k),G=typeof R=="function"?R({present:N.isPresent}):ge.exports.Children.only(R),X=ea(N.ref,G.ref);return typeof R=="function"||N.isPresent?ge.exports.cloneElement(G,{ref:X}):null};Mh.displayName="Presence";function jf(C){const[k,R]=ge.exports.useState(),N=ge.exports.useRef({}),G=ge.exports.useRef(C),X=ge.exports.useRef("none"),fe=C?"mounted":"unmounted",[a,ye]=Zf(fe,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ge.exports.useEffect(()=>{const pe=hl(N.current);X.current=a==="mounted"?pe:"none"},[a]),pl(()=>{const pe=N.current,Ee=G.current;if(Ee!==C){const ne=X.current,ht=hl(pe);C?ye("MOUNT"):ht==="none"||(pe==null?void 0:pe.display)==="none"?ye("UNMOUNT"):ye(Ee&&ne!==ht?"ANIMATION_OUT":"UNMOUNT"),G.current=C}},[C,ye]),pl(()=>{if(k){const pe=be=>{const ht=hl(N.current).includes(be.animationName);be.target===k&&ht&&Sc.exports.flushSync(()=>ye("ANIMATION_END"))},Ee=be=>{be.target===k&&(X.current=hl(N.current))};return k.addEventListener("animationstart",Ee),k.addEventListener("animationcancel",pe),k.addEventListener("animationend",pe),()=>{k.removeEventListener("animationstart",Ee),k.removeEventListener("animationcancel",pe),k.removeEventListener("animationend",pe)}}else ye("ANIMATION_END")},[k,ye]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:ge.exports.useCallback(pe=>{pe&&(N.current=getComputedStyle(pe)),R(pe)},[])}}function hl(C){return(C==null?void 0:C.animationName)||"none"}const Xf=$p["useId".toString()]||(()=>{});let Wf=0;function zh(C){const[k,R]=ge.exports.useState(Xf());return pl(()=>{C||R(N=>N!=null?N:String(Wf++))},[C]),C||(k?`radix-${k}`:"")}const Ph="Collapsible",[Hf,kh]=Cc(Ph),[Kf,Mc]=Hf(Ph),Jf=ge.exports.forwardRef((C,k)=>{const{__scopeCollapsible:R,open:N,defaultOpen:G,disabled:X,onOpenChange:fe,...a}=C,[ye=!1,pe]=Ac({prop:N,defaultProp:G,onChange:fe});return ge.exports.createElement(Kf,{scope:R,disabled:X,contentId:zh(),open:ye,onOpenToggle:ge.exports.useCallback(()=>pe(Ee=>!Ee),[pe])},ge.exports.createElement(ia.div,Ii({"data-state":zc(ye),"data-disabled":X?"":void 0},a,{ref:k})))}),Yf="CollapsibleTrigger",Qf=ge.exports.forwardRef((C,k)=>{const{__scopeCollapsible:R,...N}=C,G=Mc(Yf,R);return ge.exports.createElement(ia.button,Ii({type:"button","aria-controls":G.contentId,"aria-expanded":G.open||!1,"data-state":zc(G.open),"data-disabled":G.disabled?"":void 0,disabled:G.disabled},N,{ref:k,onClick:Ch(C.onClick,G.onOpenToggle)}))}),Dh="CollapsibleContent",em=ge.exports.forwardRef((C,k)=>{const{forceMount:R,...N}=C,G=Mc(Dh,C.__scopeCollapsible);return ge.exports.createElement(Mh,{present:R||G.open},({present:X})=>ge.exports.createElement(tm,Ii({},N,{ref:k,present:X})))}),tm=ge.exports.forwardRef((C,k)=>{const{__scopeCollapsible:R,present:N,children:G,...X}=C,fe=Mc(Dh,R),[a,ye]=ge.exports.useState(N),pe=ge.exports.useRef(null),Ee=ea(k,pe),be=ge.exports.useRef(0),ne=be.current,ht=ge.exports.useRef(0),nt=ht.current,Xe=fe.open||a,ot=ge.exports.useRef(Xe),zt=ge.exports.useRef();return ge.exports.useEffect(()=>{const at=requestAnimationFrame(()=>ot.current=!1);return()=>cancelAnimationFrame(at)},[]),pl(()=>{const at=pe.current;if(at){zt.current=zt.current||{transitionDuration:at.style.transitionDuration,animationDuration:at.style.animationDuration,animationFillMode:at.style.animationFillMode},at.style.transitionDuration="0s",at.style.animationDuration="0s",at.style.animationFillMode="none";const yt=at.getBoundingClientRect();be.current=yt.height,ht.current=yt.width,ot.current||(at.style.transitionDuration=zt.current.transitionDuration,at.style.animationDuration=zt.current.animationDuration,at.style.animationFillMode=zt.current.animationFillMode),ye(N)}},[fe.open,N]),ge.exports.createElement(ia.div,Ii({"data-state":zc(fe.open),"data-disabled":fe.disabled?"":void 0,id:fe.contentId,hidden:!Xe},X,{ref:Ee,style:{["--radix-collapsible-content-height"]:ne?`${ne}px`:void 0,["--radix-collapsible-content-width"]:nt?`${nt}px`:void 0,...C.style}}),Xe&&G)});function zc(C){return C?"open":"closed"}const im=Jf,rm=Qf,nm=em,ra="Accordion",om=["Home","End","ArrowDown","ArrowUp"],[Pc,sm,am]=Nf(ra),[ml,Fm]=Cc(ra,[am,kh]),kc=kh(),Lh=ut.forwardRef((C,k)=>{const{type:R,...N}=C,G=N,X=N;return ut.createElement(Pc.Provider,{scope:C.__scopeAccordion},R==="multiple"?ut.createElement(hm,Ii({},X,{ref:k})):ut.createElement(um,Ii({},G,{ref:k})))});Lh.propTypes={type(C){const k=C.value||C.defaultValue;return C.type&&!["single","multiple"].includes(C.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):C.type==="multiple"&&typeof k=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):C.type==="single"&&Array.isArray(k)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Rh,lm]=ml(ra),[Bh,cm]=ml(ra,{collapsible:!1}),um=ut.forwardRef((C,k)=>{const{value:R,defaultValue:N,onValueChange:G=()=>{},collapsible:X=!1,...fe}=C,[a,ye]=Ac({prop:R,defaultProp:N,onChange:G});return ut.createElement(Rh,{scope:C.__scopeAccordion,value:a?[a]:[],onItemOpen:ye,onItemClose:ut.useCallback(()=>X&&ye(""),[X,ye])},ut.createElement(Bh,{scope:C.__scopeAccordion,collapsible:X},ut.createElement(Fh,Ii({},fe,{ref:k}))))}),hm=ut.forwardRef((C,k)=>{const{value:R,defaultValue:N,onValueChange:G=()=>{},...X}=C,[fe=[],a]=Ac({prop:R,defaultProp:N,onChange:G}),ye=ut.useCallback(Ee=>a((be=[])=>[...be,Ee]),[a]),pe=ut.useCallback(Ee=>a((be=[])=>be.filter(ne=>ne!==Ee)),[a]);return ut.createElement(Rh,{scope:C.__scopeAccordion,value:fe,onItemOpen:ye,onItemClose:pe},ut.createElement(Bh,{scope:C.__scopeAccordion,collapsible:!0},ut.createElement(Fh,Ii({},X,{ref:k}))))}),[dm,pm]=ml(ra),Fh=ut.forwardRef((C,k)=>{const{__scopeAccordion:R,disabled:N,...G}=C,X=ut.useRef(null),fe=ea(X,k),a=sm(R),ye=Ch(C.onKeyDown,pe=>{var Ee;if(!om.includes(pe.key))return;const be=pe.target,ne=a().filter(zt=>{var at;return!((at=zt.ref.current)!==null&&at!==void 0&&at.disabled)}),ht=ne.findIndex(zt=>zt.ref.current===be),nt=ne.length;if(ht===-1)return;pe.preventDefault();let Xe=ht;switch(pe.key){case"Home":Xe=0;break;case"End":Xe=nt-1;break;case"ArrowDown":Xe=ht+1;break;case"ArrowUp":Xe=ht-1,Xe<0&&(Xe=nt-1);break}const ot=Xe%nt;(Ee=ne[ot].ref.current)===null||Ee===void 0||Ee.focus()});return ut.createElement(dm,{scope:R,disabled:N},ut.createElement(Pc.Slot,{scope:R},ut.createElement(ia.div,Ii({},G,{ref:fe,onKeyDown:N?void 0:ye}))))}),Ec="AccordionItem",[fm,Dc]=ml(Ec),mm=ut.forwardRef((C,k)=>{const{__scopeAccordion:R,value:N,...G}=C,X=pm(Ec,R),fe=lm(Ec,R),a=kc(R),ye=zh(),pe=N&&fe.value.includes(N)||!1,Ee=X.disabled||C.disabled;return ut.createElement(fm,{scope:R,open:pe,disabled:Ee,triggerId:ye},ut.createElement(im,Ii({"data-state":pe?"open":"closed"},a,G,{ref:k,disabled:Ee,open:pe,onOpenChange:be=>{be?fe.onItemOpen(N):fe.onItemClose(N)}})))}),gm="AccordionHeader",_m=ut.forwardRef((C,k)=>{const{__scopeAccordion:R,...N}=C,G=Dc(gm,R);return ut.createElement(ia.h3,Ii({"data-state":bm(G.open),"data-disabled":G.disabled?"":void 0},N,{ref:k}))}),fh="AccordionTrigger",ym=ut.forwardRef((C,k)=>{const{__scopeAccordion:R,...N}=C,G=Dc(fh,R),X=cm(fh,R),fe=kc(R);return ut.createElement(Pc.ItemSlot,{scope:R},ut.createElement(rm,Ii({"aria-disabled":G.open&&!X.collapsible||void 0,id:G.triggerId},fe,N,{ref:k})))}),xm="AccordionContent",vm=ut.forwardRef((C,k)=>{const{__scopeAccordion:R,...N}=C,G=Dc(xm,R),X=kc(R);return ut.createElement(nm,Ii({role:"region","aria-labelledby":G.triggerId},X,N,{ref:k,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...C.style}}))});function bm(C){return C?"open":"closed"}const Om=Lh,Um=mm,$m=_m,Vm=ym,Nm=vm,Gm=C=>ge.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...C},ge.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),wm=ts(mh.div)`
|
|
588
|
+
overflow: hidden;
|
|
589
|
+
`,Tm=({transitionOpacity:C=!0,defaultHeight:k=0,open:R,children:N})=>{const[G,X]=kf(),fe={open:{height:X.height,opacity:1},closed:{height:k,opacity:C?0:1}};return Oi(wm,{variants:fe,initial:R?"open":"closed",animate:R?"open":"closed",transition:{ease:"easeInOut"},children:Oi("div",{ref:G,children:N})})},Em=(C,k,R)=>{ge.exports.useEffect(()=>{const N=G=>{C.current&&!C.current.contains(G.target)&&R()};return window.addEventListener(k,N),()=>window.removeEventListener(k,N)},[C])},Oh={all:()=>["geocodes"],list:C=>[...Oh.all(),C]},Sm="https://geocoder.ls.hereapi.com/6.2/geocode.json?";function Im(C){const k={locationid:C,country:"CAN,USA",apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE"},R=()=>fetch(Sm+new URLSearchParams(k)).then(N=>N.json()).then(N=>N.Response.View[0].Result[0]);return xh(Oh.list(k),R,{enabled:!!C})}const Uh={all:()=>["suggestions"],list:C=>[...Uh.all(),C]},Cm="https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?";function Am(C){const k={query:C,country:"CAN,USA",apiKey:"KDL0aAzsbOcv7p53P2ovno2izfDOe93hyzZRrayktbE"},R=()=>fetch(Cm+new URLSearchParams(k)).then(N=>N.json());return xh(Uh.list(k),R,{enabled:!!C.length})}const Mm=ts.div`
|
|
590
|
+
position: relative;
|
|
591
|
+
`,zm=ts.div`
|
|
592
|
+
position: absolute;
|
|
593
|
+
top: calc(100% + 6px);
|
|
594
|
+
width: 100%;
|
|
595
|
+
box-shadow: 0px 5px 8px -4px rgba(0, 0, 0, 0.5);
|
|
596
|
+
transform: translateY(-3px);
|
|
597
|
+
background-color: ${vo["--ll-color-background"]};
|
|
598
|
+
border-radius: ${vo["--ll-border-radius-small"]};
|
|
599
|
+
z-index: 2;
|
|
600
|
+
|
|
601
|
+
${({renderListBelow:C,renderListBelowPosition:k})=>C&&Vp`
|
|
602
|
+
top: inherit;
|
|
603
|
+
bottom: ${k}px;
|
|
604
|
+
`}
|
|
605
|
+
`,$h=ts.button`
|
|
606
|
+
width: 100%;
|
|
607
|
+
border: none;
|
|
608
|
+
cursor: pointer;
|
|
609
|
+
text-align: left;
|
|
610
|
+
padding: ${vo["--ll-spacing-medium"]} ${vo["--ll-spacing-small"]};
|
|
611
|
+
background-color: var(--color-white);
|
|
612
|
+
margin: 0;
|
|
613
|
+
|
|
614
|
+
&:focus {
|
|
615
|
+
transform: translate3d(0, 0, 0);
|
|
616
|
+
}
|
|
617
|
+
`,Pm=ts.ul`
|
|
618
|
+
list-style-type: none;
|
|
619
|
+
padding: 0;
|
|
620
|
+
margin: 0;
|
|
621
|
+
`,km=ts.li`
|
|
622
|
+
&:last-child {
|
|
623
|
+
${$h} {
|
|
624
|
+
overflow: hidden;
|
|
625
|
+
border-radius: 0 0 ${vo["--ll-border-radius-small"]}
|
|
626
|
+
${vo["--ll-border-radius-small"]};
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
&:hover {
|
|
631
|
+
background-color: ${vo["--ll-color-surface"]};
|
|
632
|
+
}
|
|
633
|
+
`,qm=({label:C,onSearch:k,onSelect:R,placeholder:N,renderListBelow:G=!0,renderListBelowPosition:X=0})=>{const fe=ge.exports.useRef(null),[a,ye]=ge.exports.useState(""),[pe,Ee]=ge.exports.useState(""),{data:be,isLoading:ne}=Im(pe),ht=Np(a,300),[nt,Xe]=ge.exports.useState(!0),{data:ot,isLoading:zt}=Am(ht);Em(fe,"click",()=>Xe(!1)),ge.exports.useEffect(()=>{!be||ne||(k({longitude:be.Location.DisplayPosition.Longitude,latitude:be.Location.DisplayPosition.Latitude}),Xe(!1))},[be]);const at=({locationId:Nt,label:Et})=>{Ee(Nt),ye(Et)},yt=(Nt,Et)=>Nt.split(new RegExp(`(${Et})`,"gi")).map((ui,si)=>ui.toLowerCase()===Et.toLowerCase()?Oi("strong",{children:ui},si):Oi("span",{children:ui},si));return Gp(Mm,{ref:fe,onSelect:R,children:[Oi(qp,{autofocus:!0,value:a,label:C,placeholder:N,onChange:Nt=>{ye(Nt.currentTarget.value),Xe(!0)}}),Oi(zm,{renderListBelow:G,renderListBelowPosition:X,children:Oi(Tm,{open:nt&&!!(ot!=null&&ot.suggestions.length),children:Oi(Pm,{children:ot==null?void 0:ot.suggestions.map((Nt,Et)=>Oi(km,{children:Oi($h,{onClick:()=>at(Nt),children:Oi(mh.div,{animate:{y:[10,0],opacity:[0,1]},transition:{delay:(Et+1)*.03,type:"spring",duration:.4},children:yt(Nt.label,a)})})},Nt.locationId))})})})]})};export{$m as $,Tm as A,fl as M,Rm as N,Df as P,Gm as S,Sf as a,Bf as b,Vm as c,Un as d,Nm as e,Um as f,Om as g,Mm as h,qm as i,kf as j,vh as k,Lm as l,Bm as m,vm as n,Lf as p,Rf as s,xh as u};
|